diff options
author | ayalaben <ayala.benzvi@amdocs.com> | 2018-08-20 11:05:16 +0300 |
---|---|---|
committer | ayalaben <ayala.benzvi@amdocs.com> | 2018-08-20 11:53:48 +0300 |
commit | e7228e5ceefb44c291c32b84fddfc68fb4328efc (patch) | |
tree | 0b97a447c6ef914b515551128aff8aa54be14e49 /workflow-designer-be/src/main | |
parent | b7cac6170407b0eea7014ff4991f15a477886b07 (diff) |
Workflow name validation test
Change-Id: Ib1601649fdea065b8a3d43b39342fa6c01c58f91
Issue-ID: SDC-1654
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'workflow-designer-be/src/main')
2 files changed, 13 insertions, 3 deletions
diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/types/Workflow.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/types/Workflow.java index f312f7b4..f7df4474 100644 --- a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/types/Workflow.java +++ b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/types/Workflow.java @@ -17,6 +17,9 @@ package org.onap.sdc.workflow.services.types; +import static org.onap.sdc.workflow.services.types.WorkflowValidationConstants.MAX_LENGTH; +import static org.onap.sdc.workflow.services.types.WorkflowValidationConstants.MIN_LENGTH; + import java.util.Collection; import java.util.Set; import javax.validation.constraints.NotBlank; @@ -29,9 +32,9 @@ import lombok.Data; public class Workflow { private String id; - @NotBlank(message = "Workflow name may not be blank") - @Size(max = 80, message = "Workflow name must be less than 80 characters") - @Pattern(regexp = "[A-Za-z0-9_ ]+", message = "Workflow name must contain only letters, digits and underscores") + @NotBlank(message = "Workflow name may not be blank.") + @Size(min = MIN_LENGTH, max = MAX_LENGTH, message = "Workflow name must be at least " + MIN_LENGTH + " characters, and no more than " + MAX_LENGTH +" characters.") + @Pattern(regexp = "[A-Za-z0-9_ ]+", message = "Workflow name must contain only letters, digits and underscores.") private String name; private String description; private Set<WorkflowVersionState> versionStates; diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/types/WorkflowValidationConstants.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/types/WorkflowValidationConstants.java new file mode 100644 index 00000000..c88f36c6 --- /dev/null +++ b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/types/WorkflowValidationConstants.java @@ -0,0 +1,7 @@ +package org.onap.sdc.workflow.services.types; + +public class WorkflowValidationConstants { + + public static final int MAX_LENGTH = 80; + public static final int MIN_LENGTH = 6; +} |