diff options
author | Sindhuri.A <arcot.sindhuri@huawei.com> | 2018-10-30 19:07:39 +0530 |
---|---|---|
committer | Tal Gitelman <tal.gitelman@att.com> | 2018-11-01 10:25:40 +0000 |
commit | 2f79edf2a5af5cfbccc10521508ead1460db435a (patch) | |
tree | e5b688974c73dc99ac1b599e2551bb1f84931c2e /catalog-model/src | |
parent | 5378abb698d527fa2003fced27e67d00f7cb2673 (diff) |
Code refactoring catalog-model
Code refactor : catalog-model classes
Issue-ID: SDC-1880
Change-Id: I75ef87ef25cc9d1da6d59f4ed5d3790a0fbb2c25
Signed-off-by: Sindhuri.A <arcot.sindhuri@huawei.com>
Diffstat (limited to 'catalog-model/src')
-rw-r--r-- | catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java index d7ff072ba8..afad869bb1 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java @@ -247,7 +247,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation { private boolean hasPreviousVersion(GraphVertex toscaElementVertex) { boolean hasPreviousVersion = true; String version = (String) toscaElementVertex.getMetadataProperty(GraphPropertyEnum.VERSION); - if (StringUtils.isEmpty(version) || version.equals("0.1")) + if (StringUtils.isEmpty(version) || "0.1".equals(version)) hasPreviousVersion = false; return hasPreviousVersion; } @@ -1293,7 +1293,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation { GraphVertex nextVersionToscaElementVertex = new GraphVertex(); String uniqueId = IdBuilderUtils.generateUniqueId(); - Map<GraphPropertyEnum, Object> metadataProperties = new HashMap<>(toscaElementVertex.getMetadataProperties()); + Map<GraphPropertyEnum, Object> metadataProperties = new EnumMap<>(toscaElementVertex.getMetadataProperties()); nextVersionToscaElementVertex.setMetadataProperties(metadataProperties); nextVersionToscaElementVertex.setUniqueId(uniqueId); nextVersionToscaElementVertex.setLabel(toscaElementVertex.getLabel()); @@ -1322,12 +1322,6 @@ public class ToscaElementLifecycleOperation extends BaseOperation { return nextVersionToscaElementVertex; } - private ComponentParametersView buildComponentParametersViewAfterCheckin() { - ComponentParametersView componentParametersView = new ComponentParametersView(); - componentParametersView.disableAll(); - componentParametersView.setIgnoreUsers(false); - return componentParametersView; - } private Either<GraphVertex, StorageOperationStatus> checkinToscaELement(LifecycleStateEnum currState, GraphVertex toscaElementVertex, GraphVertex ownerVertex, GraphVertex modifierVertex, LifecycleStateEnum nextState) { Either<GraphVertex, StorageOperationStatus> updateRelationsRes; @@ -1368,7 +1362,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation { if (currState == LifecycleStateEnum.READY_FOR_CERTIFICATION) { // In case of cancel "ready for certification" remove last state edge with "STATE" property equals to "NOT_CERTIFIED_CHECKIN" - Map<GraphPropertyEnum, Object> vertexProperties = new HashMap<>(); + Map<GraphPropertyEnum, Object> vertexProperties = new EnumMap<>(GraphPropertyEnum.class); vertexProperties.put(GraphPropertyEnum.STATE, nextState); Either<Edge, TitanOperationStatus> deleteResult = titanDao.deleteBelongingEdgeByCriteria(toscaElementVertex, EdgeLabelEnum.LAST_STATE, vertexProperties); if (deleteResult.isRight()) { @@ -1387,7 +1381,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation { } if (result == null) { // Create CHECKIN relation - Map<EdgePropertyEnum, Object> edgeProperties = new HashMap<>(); + Map<EdgePropertyEnum, Object> edgeProperties = new EnumMap<>(EdgePropertyEnum.class); edgeProperties.put(EdgePropertyEnum.STATE, nextState); TitanOperationStatus createEdgeRes = titanDao.createEdge(modifierVertex.getVertex(), toscaElementVertex.getVertex(), EdgeLabelEnum.STATE, edgeProperties); if (createEdgeRes != TitanOperationStatus.OK) { |