diff options
Diffstat (limited to 'workflow-designer-be')
5 files changed, 12 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", diff --git a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImplTest.java b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImplTest.java index 38ab8a4f..be6fe04e 100644 --- a/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImplTest.java +++ b/workflow-designer-be/src/test/java/org/onap/sdc/workflow/services/impl/WorkflowVersionManagerImplTest.java @@ -219,6 +219,9 @@ public class WorkflowVersionManagerImplTest { public void shouldUploadArtifact() { Version version = new Version(VERSION1_ID); version.setStatus(VersionStatus.Draft); + VersionState versionState = new VersionState(); + versionState.setDirty(false); + version.setState(versionState); doReturn(version).when(versioningManagerMock).get(eq(ITEM1_ID), eqVersion(VERSION1_ID)); doReturn(DRAFT).when(versionStateMapperMock).versionStatusToWorkflowVersionState(version.getStatus()); |