diff options
author | priyanshu <pagarwal@amdocs.com> | 2018-08-07 19:22:05 +0530 |
---|---|---|
committer | priyanshu <pagarwal@amdocs.com> | 2018-08-07 19:22:05 +0530 |
commit | f0811d5711a03c3b4b3e02ecdce4a2cd0f7f7a35 (patch) | |
tree | 540bf154b3cd3a33297ed8d64a2617023f31b770 /catalog-model | |
parent | b5246d5d62885a84c3e5b29048ad3c468945d3ba (diff) |
Interface operations Bug Fix
modify operation bug fix
Change-Id: I510b19013a050b02bf3b1c959a1340a1ce1b3566
Issue-ID: SDC-1535
Signed-off-by: priyanshu <pagarwal@amdocs.com>
Diffstat (limited to 'catalog-model')
-rw-r--r-- | catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java index 04562534a8..3b1b6e506c 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/InterfaceOperation.java @@ -30,6 +30,7 @@ import org.openecomp.sdc.be.dao.jsongraph.types.EdgeLabelEnum; import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum; import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum; import org.openecomp.sdc.be.dao.titan.TitanOperationStatus; +import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition; import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields; import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition; import org.openecomp.sdc.be.model.ArtifactDefinition; @@ -115,9 +116,10 @@ public class InterfaceOperation extends BaseOperation { return Either.right(statusRes); } GraphVertex interfaceVertex = getToscaElementInt.left().value(); - if (!isUpdateAction) { + if (!isUpdateAction) initNewOperation(operation); - } + else + operation.setImplementation(getArtifactImplFromOperation(operation, interfaceDef)); statusRes = performUpdateToscaAction(isUpdateAction, interfaceVertex, Arrays.asList(operation), EdgeLabelEnum.INTERFACE_OPERATION, VertexTypeEnum.INTERFACE_OPERATION); @@ -214,15 +216,24 @@ public class InterfaceOperation extends BaseOperation { } } - private void initNewOperation(Operation operation){ + private ArtifactDefinition createNewArtifactDefForOperation(){ ArtifactDefinition artifactDefinition = new ArtifactDefinition(); String artifactUUID = UUID.randomUUID().toString(); artifactDefinition.setArtifactUUID(artifactUUID); artifactDefinition.setUniqueId(artifactUUID); artifactDefinition.setArtifactType(ArtifactTypeEnum.PLAN.getType()); artifactDefinition.setArtifactGroupType(ArtifactGroupTypeEnum.LIFE_CYCLE); - operation.setImplementation(artifactDefinition); + return artifactDefinition; + } + + private ArtifactDataDefinition getArtifactImplFromOperation(Operation operation, InterfaceDefinition interfaceDef){ + Either<Operation, StorageOperationStatus> operationData = getInterfaceOperation(interfaceDef, operation.getUniqueId()); + return operationData.isLeft()? operationData.left().value().getImplementation() : createNewArtifactDefForOperation(); + } + + private void initNewOperation(Operation operation){ operation.setUniqueId(UUID.randomUUID().toString()); + operation.setImplementation(createNewArtifactDefForOperation()); } private InterfaceDefinition getUpdatedInterfaceDef(InterfaceDefinition interfaceDef, Operation operation, String operationId){ |