Skip to content

Commit

Permalink
changed error message if schedule already exists in other job (#2325)
Browse files Browse the repository at this point in the history
Signed-off-by: ana.albic.comtrade <Ana.Albic@comtrade.com>
  • Loading branch information
ct-anaalbic authored and Coduz committed Jan 21, 2019
1 parent a8a3ee3 commit d398ab2
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
Expand Up @@ -44,5 +44,6 @@ public enum GwtKapuaErrorCode {
OPERATION_NOT_ALLOWED_ON_ADMIN_USER,
RETRY_AND_CRON_BOTH_SELECTED,
END_BEFORE_START_TIME_ERROR,
SAME_START_AND_DATE
SAME_START_AND_DATE,
SCHEDULE_DUPLICATE_NAME
}
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2011, 2016 Eurotech and/or its affiliates and others
* Copyright (c) 2011, 2019 Eurotech and/or its affiliates and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand Down Expand Up @@ -29,4 +29,8 @@ public class KapuaDuplicateNameException extends KapuaException {
public KapuaDuplicateNameException(String duplicatedName) {
super(KapuaErrorCodes.DUPLICATE_NAME, duplicatedName);
}

public KapuaDuplicateNameException() {
super(KapuaErrorCodes.SCHEDULE_DUPLICATE_NAME);
}
}
Expand Up @@ -110,6 +110,8 @@ public enum KapuaErrorCodes implements KapuaErrorCode {
/**
* retry interval and cron expression both selected
*/
RETRY_AND_CRON_BOTH_SELECTED;
RETRY_AND_CRON_BOTH_SELECTED,

SCHEDULE_DUPLICATE_NAME;

}
Expand Up @@ -12,6 +12,7 @@
###############################################################################
ENTITY_NOT_FOUND=The entity of type {0} with id/name {1} was not found.
DUPLICATE_NAME=An entity with the same name {0} already exists.
SCHEDULE_DUPLICATE_NAME=An entity with the same value for field already exists here or in another job.
ILLEGAL_ACCESS=The current subject is not authorized for {0}.
ILLEGAL_ARGUMENT=An illegal value was provided for the argument {0}: {1}.
ILLEGAL_NULL_ARGUMENT=An illegal null value was provided for the argument {0}.
Expand Down
Expand Up @@ -96,7 +96,7 @@ public Trigger create(TriggerCreator triggerCreator) throws KapuaException {
query.setPredicate(new AttributePredicateImpl<>(TriggerAttributes.NAME, triggerCreator.getName()));

if (count(query) > 0) {
throw new KapuaDuplicateNameException(triggerCreator.getName());
throw new KapuaDuplicateNameException();
}

if (triggerCreator.getRetryInterval() != null && triggerCreator.getCronScheduling() != null) {
Expand Down

0 comments on commit d398ab2

Please sign in to comment.