diff options
author | Sindhuri.A <arcot.sindhuri@huawei.com> | 2018-10-30 17:43:59 +0530 |
---|---|---|
committer | Tal Gitelman <tal.gitelman@att.com> | 2018-11-01 10:27:06 +0000 |
commit | 63b4f6532cd9cadef8d6c53a210f66142158d601 (patch) | |
tree | db29894c20fe260dda600fe52048fc8245fe0900 | |
parent | 2f79edf2a5af5cfbccc10521508ead1460db435a (diff) |
Refactor Code catalog-model
Code refactor : catalog-model classes
Issue-ID: SDC-1880
Change-Id: I8f9e0f87eed6f9db8885572dce159eedc7845173
Signed-off-by: Sindhuri.A <arcot.sindhuri@huawei.com>
2 files changed, 13 insertions, 13 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperation.java index f0dee3016b..f700c2eb69 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperation.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementOperation.java @@ -84,16 +84,17 @@ public abstract class ToscaElementOperation extends BaseOperation { private static final Gson gson = new Gson(); + @Autowired + protected CategoryOperation categoryOperation; + protected Gson getGson() { return gson; } - @Autowired - protected CategoryOperation categoryOperation; protected Either<GraphVertex, StorageOperationStatus> getComponentByLabelAndId(String uniqueId, ToscaElementTypeEnum nodeType, JsonParseFlagEnum parseFlag) { - Map<GraphPropertyEnum, Object> propertiesToMatch = new HashMap<>(); + Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); propertiesToMatch.put(GraphPropertyEnum.UNIQUE_ID, uniqueId); VertexTypeEnum vertexType = ToscaElementTypeEnum.getVertexTypeByToscaType(nodeType); @@ -330,7 +331,7 @@ public abstract class ToscaElementOperation extends BaseOperation { updaterVertex = findUser.left().value(); } } - Map<EdgePropertyEnum, Object> props = new HashMap<>(); + Map<EdgePropertyEnum, Object> props = new EnumMap<>(EdgePropertyEnum.class); props.put(EdgePropertyEnum.STATE, (String) toscaElement.getMetadataValue(JsonPresentationFields.LIFECYCLE_STATE)); TitanOperationStatus result = titanDao.createEdge(updaterVertex, nodeTypeVertex, EdgeLabelEnum.STATE, props); @@ -672,7 +673,7 @@ public abstract class ToscaElementOperation extends BaseOperation { Map<GraphPropertyEnum, Object> props = null; if (userId != null) { - props = new HashMap<>(); + props = new EnumMap<>(GraphPropertyEnum.class); // for Designer retrieve specific user props.put(GraphPropertyEnum.USERID, userId); } @@ -1235,8 +1236,8 @@ public abstract class ToscaElementOperation extends BaseOperation { public Either<List<GraphVertex>, TitanOperationStatus> getListOfHighestComponents(ComponentTypeEnum componentType, List<ResourceTypeEnum> excludeTypes, JsonParseFlagEnum parseFlag) { - Map<GraphPropertyEnum, Object> propertiesToMatch = new HashMap<>(); - Map<GraphPropertyEnum, Object> propertiesHasNotToMatch = new HashMap<>(); + Map<GraphPropertyEnum, Object> propertiesToMatch = new EnumMap<>(GraphPropertyEnum.class); + Map<GraphPropertyEnum, Object> propertiesHasNotToMatch = new EnumMap<>(GraphPropertyEnum.class); propertiesToMatch.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); propertiesToMatch.put(GraphPropertyEnum.IS_HIGHEST_VERSION, true); @@ -1256,8 +1257,8 @@ public abstract class ToscaElementOperation extends BaseOperation { long startFetchAllStates = System.currentTimeMillis(); Either<List<GraphVertex>, TitanOperationStatus> highestNodes = getListOfHighestComponents(componentType, excludeTypes, JsonParseFlagEnum.ParseMetadata); - Map<GraphPropertyEnum, Object> propertiesToMatchCertified = new HashMap<>(); - Map<GraphPropertyEnum, Object> propertiesHasNotToMatchCertified = new HashMap<>(); + Map<GraphPropertyEnum, Object> propertiesToMatchCertified = new EnumMap<>(GraphPropertyEnum.class); + Map<GraphPropertyEnum, Object> propertiesHasNotToMatchCertified = new EnumMap<>(GraphPropertyEnum.class); propertiesToMatchCertified.put(GraphPropertyEnum.STATE, LifecycleStateEnum.CERTIFIED.name()); propertiesToMatchCertified.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); if (componentType == ComponentTypeEnum.RESOURCE) { @@ -1293,7 +1294,7 @@ public abstract class ToscaElementOperation extends BaseOperation { componentType) { // get all components marked for delete - Map<GraphPropertyEnum, Object> props = new HashMap<>(); + Map<GraphPropertyEnum, Object> props = new EnumMap<>(GraphPropertyEnum.class); props.put(GraphPropertyEnum.IS_DELETED, true); props.put(GraphPropertyEnum.COMPONENT_TYPE, componentType.name()); diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java index a1d08a6eed..5c06e97bf3 100644 --- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java +++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java @@ -25,7 +25,6 @@ import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; -import org.apache.tinkerpop.gremlin.structure.Direction; import org.apache.tinkerpop.gremlin.structure.Edge; import org.openecomp.sdc.be.dao.jsongraph.GraphVertex; import org.openecomp.sdc.be.dao.jsongraph.TitanDao; @@ -1270,10 +1269,10 @@ public class ToscaOperationFacade { ComponentInstanceDataDefinition componentInstance = new ComponentInstanceDataDefinition(entry.getKey()); MapListCapabilityDataDefinition capMap = nodeTemplateOperation.prepareCalculatedCapabiltyForNodeType(mapToscaDataDefinition, componentInstance); - MapCapabilityProperty MapCapabilityProperty = ModelConverter.convertToMapOfMapCapabiltyProperties(caps, componentInstance.getUniqueId(), true); + MapCapabilityProperty mapCapabilityProperty = ModelConverter.convertToMapOfMapCapabiltyProperties(caps, componentInstance.getUniqueId(), true); calcCapabilty.put(entry.getKey().getUniqueId(), capMap); - calculatedCapabilitiesProperties.put(entry.getKey().getUniqueId(), MapCapabilityProperty); + calculatedCapabilitiesProperties.put(entry.getKey().getUniqueId(), mapCapabilityProperty); } } |