From: Sindhuri.A Date: Tue, 30 Oct 2018 13:37:39 +0000 (+0530) Subject: Code refactoring catalog-model X-Git-Tag: 1.3.2~7 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F59%2F71459%2F2;p=sdc.git Code refactoring catalog-model Code refactor : catalog-model classes Issue-ID: SDC-1880 Change-Id: I75ef87ef25cc9d1da6d59f4ed5d3790a0fbb2c25 Signed-off-by: Sindhuri.A --- 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 metadataProperties = new HashMap<>(toscaElementVertex.getMetadataProperties()); + Map 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 checkinToscaELement(LifecycleStateEnum currState, GraphVertex toscaElementVertex, GraphVertex ownerVertex, GraphVertex modifierVertex, LifecycleStateEnum nextState) { Either 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 vertexProperties = new HashMap<>(); + Map vertexProperties = new EnumMap<>(GraphPropertyEnum.class); vertexProperties.put(GraphPropertyEnum.STATE, nextState); Either 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 edgeProperties = new HashMap<>(); + Map 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) {