diff options
author | 2018-08-01 15:21:03 +0300 | |
---|---|---|
committer | 2018-08-01 15:21:03 +0300 | |
commit | 87257b6054147f3c40999d03cdda936e194dccca (patch) | |
tree | 94847d1560c94c9e6d04db31f5aad30234fad6a7 /workflow-designer-be/src/main/java/org | |
parent | 41727d042ca0f0a0a1bb8407aa3b1a1d33f0d257 (diff) |
Validation additions
Change-Id: I0e80789930b067dfe0c79d4cfb9d045509fb94f6
Issue-ID: SDC-1518
Signed-off-by: ayalaben <ayala.benzvi@amdocs.com>
Diffstat (limited to 'workflow-designer-be/src/main/java/org')
4 files changed, 9 insertions, 5 deletions
diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/persistence/types/ParameterEntity.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/persistence/types/ParameterEntity.java index 7c957d85..5bf30773 100644 --- a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/persistence/types/ParameterEntity.java +++ b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/persistence/types/ParameterEntity.java @@ -25,7 +25,7 @@ public class ParameterEntity { private String id; @NotNull(message = "Parameter name may not be null") - @Pattern(regexp = "[A-Za-z0-9_]*", message = "The field must contain only letters, digits and underscores") + @Pattern(regexp = "[A-Za-z0-9_ ]*", message = "Parameter name must contain only letters, digits and underscores") private String name; @NotNull private ParameterType type; diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/persistence/types/Workflow.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/persistence/types/Workflow.java index b2fc6f59..4b9f3449 100644 --- a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/persistence/types/Workflow.java +++ b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/persistence/types/Workflow.java @@ -31,7 +31,7 @@ public class Workflow { private String id; @NotNull(message = "Workflow name may not be null") @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") + @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/persistence/types/WorkflowVersion.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/persistence/types/WorkflowVersion.java index 17f95ae1..e3bbd646 100644 --- a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/persistence/types/WorkflowVersion.java +++ b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/persistence/types/WorkflowVersion.java @@ -19,6 +19,7 @@ package org.onap.sdc.workflow.persistence.types; import java.util.Collection; import java.util.Collections; import java.util.Date; +import javax.validation.Valid; import lombok.Data; @@ -31,7 +32,9 @@ public class WorkflowVersion { private String baseId; private WorkflowVersionState state; private boolean hasArtifact; + @Valid private Collection<ParameterEntity> inputs = Collections.emptyList(); + @Valid private Collection<ParameterEntity> outputs = Collections.emptyList(); private Date creationTime; private Date modificationTime; diff --git a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImpl.java b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImpl.java index 56ba7ac9..14e28744 100644 --- a/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImpl.java +++ b/workflow-designer-be/src/main/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImpl.java @@ -18,7 +18,6 @@ package org.onap.sdc.workflow.services.impl; import static org.onap.sdc.workflow.persistence.types.WorkflowVersionState.CERTIFIED; -import com.amdocs.zusammen.datatypes.response.ErrorCode; import java.io.IOException; import java.io.InputStream; import java.util.Collection; @@ -45,7 +44,6 @@ import org.onap.sdc.workflow.services.exceptions.VersionModificationException; import org.onap.sdc.workflow.services.exceptions.VersionStateModificationException; import org.onap.sdc.workflow.services.impl.mappers.VersionMapper; import org.onap.sdc.workflow.services.impl.mappers.VersionStateMapper; -import org.openecomp.sdc.common.errors.SdcRuntimeException; import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.versioning.VersioningManager; @@ -186,7 +184,10 @@ public class WorkflowVersionManagerImpl implements WorkflowVersionManager { ArtifactEntity artifactEntity = new ArtifactEntity(StringUtils.cleanPath(artifact.getOriginalFilename()), artifactData); artifactRepository.update(workflowId, versionId, artifactEntity); - versioningManager.publish(workflowId, new Version(versionId), "Update Artifact"); + Version updatedVersion = versioningManager.get(workflowId, new Version(versionId)); + if(updatedVersion.getState().isDirty()) { + versioningManager.publish(workflowId, updatedVersion, "Update artifact"); + } } catch (IOException e) { LOGGER.error(String.format("Upload Artifact failed for workflow id %s and version id %s", |