summaryrefslogtreecommitdiffstats
path: root/catalog-model/src/main/java/org
diff options
context:
space:
mode:
authorTal Gitelman <tg851x@intl.att.com>2018-04-30 16:12:59 +0300
committerTal Gitelman <tg851x@intl.att.com>2018-04-30 15:58:25 +0000
commit3dc177d73b079e83ae476879b24636f01dc8873e (patch)
tree339782b7598cb951fb102ac2b22cd737f3f58835 /catalog-model/src/main/java/org
parent7fc8f3181561ca04b5db3dfbd0aaf63e954bbdcb (diff)
Remove dead code catalog-model
Change-Id: Ife2589a10d529c830195bb978a2314dd316342b1 Issue-ID: SDC-1270 Signed-off-by: Tal Gitelman <tg851x@intl.att.com>
Diffstat (limited to 'catalog-model/src/main/java/org')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java4
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java1
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java1
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperations.java15
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/BaseOperation.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java1
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaOperationFacade.java32
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IComponentInstanceOperation.java14
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperation.java14
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperation.java5
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CsarOperation.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GraphLockOperation.java121
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupInstanceOperation.java25
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperation.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java20
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java202
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java18
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/ListValidator.java13
19 files changed, 5 insertions, 489 deletions
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
index d3bdfede42..956a94048a 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java
@@ -22,14 +22,10 @@ package org.openecomp.sdc.be.model;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.openecomp.sdc.be.config.ConfigurationManager;
-import org.openecomp.sdc.be.dao.utils.MapUtil;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.model.category.CategoryDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
-import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
-import org.openecomp.sdc.common.api.ArtifactTypeEnum;
-import java.util.stream.Collectors;
import static java.util.Collections.emptyList;
import org.openecomp.sdc.be.dao.utils.MapUtil;
import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java
index dc742cb163..681fc4e33b 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/PolicyDefinition.java
@@ -5,7 +5,6 @@ import org.openecomp.sdc.be.datatypes.elements.PropertiesOwner;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import java.io.Serializable;
-import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java
index bb36595578..8912efdca9 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/datamodel/TopologyTemplate.java
@@ -24,7 +24,6 @@ import org.apache.commons.collections.MapUtils;
import org.openecomp.sdc.be.datatypes.elements.*;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
import org.openecomp.sdc.be.model.jsontitan.enums.JsonConstantKeysEnum;
-import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import java.util.HashMap;
import java.util.Map;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperations.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperations.java
index 4782851e26..872a16041c 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperations.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ArtifactsOperations.java
@@ -686,21 +686,6 @@ public class ArtifactsOperations extends BaseOperation {
artifactData.setArtifactVersion(String.valueOf(newVersion));
}
- private boolean validateParentType(NodeTypeEnum type) {
- boolean isValid = false;
- switch (type) {
- case Resource:
- case InterfaceOperation:
- case Service:
- case ResourceInstance:
- isValid = true;
- break;
- default:
- log.debug("Not supported node type for artifact relation : {} ", type);
- }
- return isValid;
- }
-
public Either<ArtifactDataDefinition, StorageOperationStatus> removeArtifactOnGraph(ArtifactDefinition artifactFromGraph, String componentId, String instanceId, NodeTypeEnum type, boolean deleteMandatoryArtifact) {
Triple<EdgeLabelEnum, Boolean, VertexTypeEnum> triple = getEdgeLabelEnumFromArtifactGroupType(artifactFromGraph.getArtifactGroupType(), type);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/BaseOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/BaseOperation.java
index 3b64a6b208..ee1a8a0339 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/BaseOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/BaseOperation.java
@@ -55,8 +55,6 @@ import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.GraphPropertyEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
import org.openecomp.sdc.be.datatypes.tosca.ToscaDataDefinition;
-import org.openecomp.sdc.be.model.Component;
-import org.openecomp.sdc.be.model.PolicyDefinition;
import org.openecomp.sdc.be.model.User;
import org.openecomp.sdc.be.model.jsontitan.datamodel.ToscaElementTypeEnum;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java
index 59f4745537..d46743cfa9 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTypeOperation.java
@@ -41,7 +41,6 @@ import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.elements.AdditionalInfoParameterDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListCapabilityDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ListRequirementDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.MapPropertiesDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
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 647234d892..b1b886bc62 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
@@ -448,11 +448,6 @@ public class ToscaOperationFacade {
}
- private List<InputDefinition> getNewInputsByResourceType(Resource component) {
- return component.getResourceType().equals(ResourceTypeEnum.CVFC) ?
- component.getInputs() : null;
- }
-
// region - Component Update
/**
*
@@ -1185,33 +1180,6 @@ public class ToscaOperationFacade {
return Either.left(instProperties);
}
- public StorageOperationStatus deleteComponentInstanceInputsToComponent(Map<String, List<ComponentInstanceInput>> instProperties, String componentId) {
-
- Either<GraphVertex, TitanOperationStatus> getVertexEither = titanDao.getVertexById(componentId, JsonParseFlagEnum.NoParse);
- if (getVertexEither.isRight()) {
- log.debug("Couldn't fetch component with and unique id {}, error: {}", componentId, getVertexEither.right().value());
- return DaoStatusConverter.convertTitanStatusToStorageStatus(getVertexEither.right().value());
-
- }
-
- GraphVertex vertex = getVertexEither.left().value();
- Map<String, MapPropertiesDataDefinition> instPropsMap = new HashMap<>();
- if (instProperties != null) {
-
- MapPropertiesDataDefinition propertiesMap;
- for (Entry<String, List<ComponentInstanceInput>> entry : instProperties.entrySet()) {
- propertiesMap = new MapPropertiesDataDefinition();
-
- propertiesMap.setMapToscaDataDefinition(entry.getValue().stream().map(e -> new PropertyDataDefinition(e)).collect(Collectors.toMap(e -> e.getName(), e -> e)));
-
- instPropsMap.put(entry.getKey(), propertiesMap);
- }
- }
-
- return topologyTemplateOperation.deleteInstInputsToComponent(vertex, instPropsMap);
-
- }
-
public Either<Map<String, List<ComponentInstanceProperty>>, StorageOperationStatus> addComponentInstancePropertiesToComponent(Component containerComponent, Map<String, List<ComponentInstanceProperty>> instProperties, String componentId) {
if (instProperties != null) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java
index 023d3fe2bd..9fecbe7fba 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/utils/ModelConverter.java
@@ -40,7 +40,6 @@ import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CapabilityDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.CompositionDataDefinition;
-import org.openecomp.sdc.be.datatypes.elements.ForwardingPathDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.InterfaceDataDefinition;
@@ -58,7 +57,6 @@ import org.openecomp.sdc.be.datatypes.elements.RelationshipInstDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.RequirementDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.ComponentTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFields;
-import org.openecomp.sdc.be.datatypes.enums.OriginTypeEnum;
import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum;
import org.openecomp.sdc.be.model.AdditionalInformationDefinition;
import org.openecomp.sdc.be.model.ArtifactDefinition;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IComponentInstanceOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IComponentInstanceOperation.java
index d4e5939173..90e01c3980 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IComponentInstanceOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IComponentInstanceOperation.java
@@ -20,26 +20,12 @@
package org.openecomp.sdc.be.model.operations.api;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.lang3.tuple.ImmutablePair;
-import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
-import org.openecomp.sdc.be.model.ArtifactDefinition;
import org.openecomp.sdc.be.model.ComponentInstance;
import org.openecomp.sdc.be.model.ComponentInstanceInput;
import org.openecomp.sdc.be.model.ComponentInstanceProperty;
-import org.openecomp.sdc.be.model.RelationshipInfo;
-import org.openecomp.sdc.be.model.RequirementCapabilityRelDef;
-import org.openecomp.sdc.be.model.User;
-import org.openecomp.sdc.be.resources.data.AttributeValueData;
-import org.openecomp.sdc.be.resources.data.CapabilityData;
import org.openecomp.sdc.be.resources.data.ComponentInstanceData;
-import org.openecomp.sdc.be.resources.data.RequirementData;
-import org.openecomp.sdc.exception.ResponseFormat;
import fj.data.Either;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperation.java
index 24e4b48793..65abcd4d4f 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/AdditionalInformationOperation.java
@@ -47,7 +47,6 @@ import org.openecomp.sdc.be.resources.data.AdditionalInfoParameterData;
import org.openecomp.sdc.be.resources.data.ResourceMetadataData;
import org.openecomp.sdc.be.resources.data.ServiceMetadataData;
import org.openecomp.sdc.be.resources.data.UniqueIdData;
-import org.openecomp.sdc.common.config.EcompErrorName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -729,19 +728,6 @@ public class AdditionalInformationOperation implements IAdditionalInformationOpe
}
}
- private void commitOrRollbackTx(TitanTransaction tx, boolean inTransaction, Either<? extends Object, StorageOperationStatus> result) {
-
- if (false == inTransaction) {
- if (result == null || result.isRight()) {
- log.error("Going to execute rollback on graph.");
- tx.rollback();
- } else {
- log.debug("Going to execute commit on graph.");
- tx.commit();
- }
- }
- }
-
@Override
public Either<AdditionalInfoParameterInfo, StorageOperationStatus> getAdditionalInformationParameter(NodeTypeEnum nodeType, String resourceId, String id, boolean inTransaction) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperation.java
index 10cd30cbe5..0c8abdaa39 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ArtifactOperation.java
@@ -53,17 +53,12 @@ import org.openecomp.sdc.be.resources.data.HeatParameterData;
import org.openecomp.sdc.be.resources.data.HeatParameterValueData;
import org.openecomp.sdc.be.resources.data.UniqueIdData;
import org.openecomp.sdc.common.api.ArtifactTypeEnum;
-import org.openecomp.sdc.common.config.EcompErrorName;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.stereotype.Component;
import com.thinkaurelius.titan.core.TitanGraph;
-//import com.tinkerpop.blueprints.Direction;
-//import com.tinkerpop.blueprints.Edge;
-//import com.tinkerpop.blueprints.Vertex;
-//import com.tinkerpop.blueprints.util.ElementHelper;
import com.thinkaurelius.titan.core.TitanVertex;
import fj.data.Either;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CsarOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CsarOperation.java
index e81264ab59..5b9af033ea 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CsarOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/CsarOperation.java
@@ -25,7 +25,6 @@ import java.io.FileFilter;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Map;
-import java.util.Map.Entry;
import javax.annotation.PostConstruct;
import org.apache.commons.io.filefilter.WildcardFileFilter;
@@ -38,7 +37,6 @@ import org.slf4j.LoggerFactory;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
-import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import fj.data.Either;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GraphLockOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GraphLockOperation.java
index a47f7cfdef..776012ac43 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GraphLockOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GraphLockOperation.java
@@ -22,34 +22,19 @@ package org.openecomp.sdc.be.model.operations.impl;
import org.openecomp.sdc.be.dao.titan.TitanGenericDao;
import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
-import org.openecomp.sdc.be.datatypes.components.ResourceMetadataDataDefinition;
import org.openecomp.sdc.be.datatypes.enums.NodeTypeEnum;
-import org.openecomp.sdc.be.model.Resource;
-import org.openecomp.sdc.be.model.jsontitan.operations.ToscaOperationFacade;
-import org.openecomp.sdc.be.model.operations.api.ICacheMangerOperation;
import org.openecomp.sdc.be.model.operations.api.IGraphLockOperation;
import org.openecomp.sdc.be.model.operations.api.StorageOperationStatus;
-import org.openecomp.sdc.be.resources.data.ComponentMetadataData;
-import org.openecomp.sdc.be.resources.data.ResourceMetadataData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import fj.data.Either;
-
@Component("graph-lock-operation")
public class GraphLockOperation implements IGraphLockOperation {
private static Logger log = LoggerFactory.getLogger(GraphLockOperation.class.getName());
@javax.annotation.Resource
private TitanGenericDao titanGenericDao;
-
- @Autowired
- ToscaOperationFacade toscaOperationFacade;
-
- @javax.annotation.Resource
- private ICacheMangerOperation cacheManagerOperation;
public GraphLockOperation() {
super();
@@ -66,18 +51,6 @@ public class GraphLockOperation implements IGraphLockOperation {
TitanOperationStatus lockElementStatus = null;
try {
- // SET LAST UPDATE DATE OF THE COMPONENT.
- // In this way we mark the component as updated one (and component
- // won't be fetched from cache since the component in cache has
- // different timestamp)
-// Either<ComponentMetadataData, TitanOperationStatus> updateTime = updateModificationTimeOfComponent(componentId, nodeType);
-// if (updateTime.isRight()) {
-// TitanOperationStatus operationStatus = updateTime.right().value();
-// if (operationStatus != TitanOperationStatus.OK) {
-// return DaoStatusConverter.convertTitanStatusToStorageStatus(operationStatus);
-// }
-// }
-
lockElementStatus = titanGenericDao.lockElement(componentId, nodeType);
} catch (Exception e) {
@@ -89,33 +62,6 @@ public class GraphLockOperation implements IGraphLockOperation {
}
- /**
- * update the last update date of the component
- *
- * @param componentId
- * @param nodeType
- * @return
- */
- private Either<ComponentMetadataData, TitanOperationStatus> updateModificationTimeOfComponent(String componentId, NodeTypeEnum nodeType) {
-
- if (nodeType == NodeTypeEnum.Resource || nodeType == NodeTypeEnum.Service || nodeType == NodeTypeEnum.Product) {
- // We fetch all node since update only timestamp make problems since
- // there is default resource type (VFC) which changes component
- // resource type when we update only timestamp(ResourceMetadataData
- // contains default value VFC on resourceType field).
- Either<ComponentMetadataData, TitanOperationStatus> findComp = titanGenericDao.getNode(UniqueIdBuilder.getKeyByNodeType(nodeType), componentId, ComponentMetadataData.class);
-
- if (findComp.isRight()) {
- return Either.right(findComp.right().value());
- }
- ComponentMetadataData componentMetadataData = findComp.left().value();
- componentMetadataData.getMetadataDataDefinition().setLastUpdateDate(System.currentTimeMillis());
- Either<ComponentMetadataData, TitanOperationStatus> updateNode = titanGenericDao.updateNode(componentMetadataData, ComponentMetadataData.class);
- return updateNode;
- }
- return Either.right(TitanOperationStatus.OK);
- }
-
/*
* (non-Javadoc)
*
@@ -124,84 +70,17 @@ public class GraphLockOperation implements IGraphLockOperation {
@Override
public StorageOperationStatus unlockComponent(String componentId, NodeTypeEnum nodeType) {
-// Either<Long, StorageOperationStatus> addComponentToCachePart1 = addComponentToCachePart1WithoutCommit(componentId, nodeType);
-
TitanOperationStatus lockElementStatus = titanGenericDao.releaseElement(componentId, nodeType);
-// if (addComponentToCachePart1.isLeft()) {
-// Long lastUpdateDate = addComponentToCachePart1.left().value();
-// addComponentToCachePart2(componentId, lastUpdateDate, nodeType);
-// }
-//
return DaoStatusConverter.convertTitanStatusToStorageStatus(lockElementStatus);
}
- private ResourceMetadataData getResourceMetaDataFromResource(Resource resource) {
- ResourceMetadataData resourceData = new ResourceMetadataData((ResourceMetadataDataDefinition) resource.getComponentMetadataDefinition().getMetadataDataDefinition());
- return resourceData;
- }
-
@Override
public StorageOperationStatus unlockComponentByName(String name, String componentId, NodeTypeEnum nodeType) {
-
-// Either<Long, StorageOperationStatus> addComponentToCachePart1 = addComponentToCachePart1WithoutCommit(componentId, nodeType);
-
TitanOperationStatus lockElementStatus = titanGenericDao.releaseElement(name, nodeType);
-//
-// if (addComponentToCachePart1.isLeft()) {
-// Long lastUpdateDate = addComponentToCachePart1.left().value();
-// addComponentToCachePart2(componentId, lastUpdateDate, nodeType);
-// }
-
return DaoStatusConverter.convertTitanStatusToStorageStatus(lockElementStatus);
}
- /**
- * We fetch the last update date of the component
- *
- * @param componentId
- * @param nodeType
- * @return
- */
- private Either<Long, StorageOperationStatus> addComponentToCachePart1WithoutCommit(String componentId, NodeTypeEnum nodeType) {
- if (componentId != null) { // In case of error, the componentId might be
- // empty.
- if (nodeType == NodeTypeEnum.Resource || nodeType == NodeTypeEnum.Service || nodeType == NodeTypeEnum.Product) {
- Long lastUpdateDate = null;
- Either<ComponentMetadataData, StorageOperationStatus> resResult = toscaOperationFacade.getComponentMetadata(componentId);
- if (resResult.isLeft()) {
- ComponentMetadataData resourceMetadataData = resResult.left().value();
- lastUpdateDate = resourceMetadataData.getMetadataDataDefinition().getLastUpdateDate();
-
- return Either.left(lastUpdateDate);
- } else {
- return Either.right(resResult.right().value());
- }
- }
- }
- return Either.right(StorageOperationStatus.OPERATION_NOT_SUPPORTED);
- }
-
- /**
- * add the component to the cache
- *
- * @param componentId
- * @param lastUpdateDate
- * @param nodeType
- * @return
- */
- private Either<Long, StorageOperationStatus> addComponentToCachePart2(String componentId, Long lastUpdateDate, NodeTypeEnum nodeType) {
- if (componentId != null) { // In case of error, the componentId might be
- // empty.
- if (nodeType == NodeTypeEnum.Resource || nodeType == NodeTypeEnum.Service || nodeType == NodeTypeEnum.Product) {
- // add task to Q
- log.debug("Going to add component {} of type {} to cache", componentId, nodeType.name().toLowerCase());
- cacheManagerOperation.updateComponentInCache(componentId, lastUpdateDate, nodeType);
- }
- }
- return Either.right(StorageOperationStatus.OPERATION_NOT_SUPPORTED);
- }
-
@Override
public StorageOperationStatus lockComponentByName(String name, NodeTypeEnum nodeType) {
log.info("lock resource with name {}", name);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupInstanceOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupInstanceOperation.java
index c4a5c5c586..662e2ecf70 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupInstanceOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/GroupInstanceOperation.java
@@ -433,31 +433,6 @@ public class GroupInstanceOperation extends AbstractOperation implements IGroupI
}
-
- private GroupInstanceData buildGroupInstanceData(GroupInstance groupInstance, String componentInstanceId, String logicalName) {
- String ciOriginComponentUid = groupInstance.getGroupUid();
-
- GroupInstanceDataDefinition dataDefinition = new GroupInstanceDataDefinition(groupInstance);
-
- Long creationDate = groupInstance.getCreationTime();
- if (creationDate == null) {
- creationDate = System.currentTimeMillis();
- }
- dataDefinition.setCreationTime(creationDate);
- dataDefinition.setModificationTime(creationDate);
- // dataDefinition.setResourceUid(resourceUid);
- // String replacmentlogicalName = logicalName.replaceAll(" ",
- // "_").toLowerCase();
- dataDefinition.setName(logicalName);
- if (dataDefinition.getNormalizedName() == null)
- dataDefinition.setNormalizedName(ValidationUtils.normalizeComponentInstanceName(logicalName));
- dataDefinition.setUniqueId(UniqueIdBuilder.buildResourceInstanceUniuqeId(componentInstanceId, ciOriginComponentUid, dataDefinition.getNormalizedName()));
-
- GroupInstanceData resourceInstanceData = new GroupInstanceData(dataDefinition);
-
- return resourceInstanceData;
- }
-
/**
* update value of attribute on resource instance
*
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperation.java
index 0a150ae7c3..c6abe8a849 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/HeatParametersOperation.java
@@ -61,8 +61,6 @@ public class HeatParametersOperation implements IHeatParametersOperation {
@javax.annotation.Resource
private TitanGenericDao titanGenericDao;
- private Gson gson = new Gson();
-
public TitanGenericDao getTitanGenericDao() {
return titanGenericDao;
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java
index b78ad02452..4e9506f8db 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/InterfaceLifecycleOperation.java
@@ -172,26 +172,6 @@ public class InterfaceLifecycleOperation implements IInterfaceLifecycleOperation
return Either.left(createNodeResult.left().value());
}
- private Either<TitanVertex, TitanOperationStatus> createInterfaceNodeAndRelation(String interfaceName, String resourceId, InterfaceData interfaceData, TitanVertex metadataVertex) {
- log.debug("Before adding interface to graph {}", interfaceData);
- Either<TitanVertex, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(interfaceData);
-
- if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
- log.error("Failed to add interface {} to graph. status is {}", interfaceName, operationStatus);
- return Either.right(operationStatus);
- }
-
- Map<String, Object> props = new HashMap<String, Object>();
- props.put(GraphPropertiesDictionary.NAME.getProperty(), interfaceName);
- TitanVertex interfaceVertex = createNodeResult.left().value();
- TitanOperationStatus createRelResult = titanGenericDao.createEdge(metadataVertex, interfaceVertex, GraphEdgeLabels.INTERFACE, props);
- if (!createRelResult.equals(TitanOperationStatus.OK)) {
- log.error("Failed to associate resource {} to property {} in graph. status is {}", resourceId, interfaceName, createRelResult);
- }
- return Either.left(interfaceVertex);
- }
-
private Either<OperationData, TitanOperationStatus> createOperationNodeAndRelation(String operationName, OperationData operationData, InterfaceData interfaceData) {
log.debug("Before adding operation to graph {}", operationData);
Either<OperationData, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(operationData, OperationData.class);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java
index 99e95e6653..a2996ac152 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java
@@ -70,7 +70,6 @@ import org.openecomp.sdc.be.model.tosca.constraints.LessThanConstraint;
import org.openecomp.sdc.be.model.tosca.constraints.MinLengthConstraint;
import org.openecomp.sdc.be.model.tosca.constraints.ValidValuesConstraint;
import org.openecomp.sdc.be.model.tosca.converters.PropertyValueConverter;
-import org.openecomp.sdc.be.model.tosca.validators.PropertyTypeValidator;
import org.openecomp.sdc.be.resources.data.ComponentInstanceData;
import org.openecomp.sdc.be.resources.data.DataTypeData;
import org.openecomp.sdc.be.resources.data.PropertyData;
@@ -154,66 +153,6 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe
return functionPatterns;
}
- /*
- * (non-Javadoc)
- *
- * @see org.openecomp.sdc.be.model.operations.api.IPropertyOperation# addPropertyToResource(java.lang.String, org.openecomp.sdc.be.model.PropertyDefinition, org.openecomp.sdc.be.dao.neo4j.datatype.NodeTypeEnum, java.lang.String)
- */
- /*
- * @Override public Either<PropertyDefinition, StorageOperationStatus> addPropertyToResource( String propertyName, PropertyDefinition propertyDefinition, NodeTypeEnum nodeType, String resourceId) {
- *
- * StorageOperationStatus isValidProperty = isTypeExistsAndValid(propertyDefinition); if (isValidProperty != StorageOperationStatus.OK) { return Either.right(isValidProperty); }
- *
- * Either<PropertyData, TitanOperationStatus> status = addPropertyToGraph(propertyName, propertyDefinition, resourceId);
- *
- * if (status.isRight()) { titanGenericDao.rollback();
- * log.error("Failed to add property {} to resource {}, propertyName, resourceId);
- * return Either.right(DaoStatusConverter.convertTitanStatusToStorageStatus(status. right().value())); } else
- * { titanGenericDao.commit(); PropertyData propertyData = status.left().value();
- *
- * PropertyDefinition propertyDefResult = convertPropertyDataToPropertyDefinition(propertyData, propertyName, resourceId); log.debug("The returned PropertyDefintion is " + propertyDefinition); return Either.left(propertyDefResult); }
- *
- *
- * }
- */
- private StorageOperationStatus isTypeExistsAndValid(PropertyDefinition propertyDefinition) {
-
- ToscaPropertyType type = ToscaPropertyType.isValidType(propertyDefinition.getType());
-
- if (type == null) {
- return StorageOperationStatus.INVALID_TYPE;
- }
-
- String propertyType = propertyDefinition.getType();
- String innerType = null;
- String value = propertyDefinition.getDefaultValue();
-
- if (propertyType.equals(ToscaPropertyType.LIST) || propertyType.equals(ToscaPropertyType.MAP)) {
- SchemaDefinition schema;
- if ((schema = propertyDefinition.getSchema()) != null) {
- PropertyDataDefinition property;
- if ((property = schema.getProperty()) != null) {
- innerType = property.getType();
-
- }
- }
- }
-
- PropertyTypeValidator validator = type.getValidator();
-
- if (value == null || (EMPTY_VALUE != null && EMPTY_VALUE.equals(propertyDefinition.getDefaultValue()))) {
- return StorageOperationStatus.OK;
- } else {
- boolean isValid = validator.isValid(value, innerType, null);
- if (true == isValid) {
- return StorageOperationStatus.OK;
- } else {
- return StorageOperationStatus.INVALID_VALUE;
- }
- }
-
- }
-
public PropertyDefinition convertPropertyDataToPropertyDefinition(PropertyData propertyDataResult, String propertyName, String resourceId) {
log.debug("The object returned after create property is {}", propertyDataResult);
@@ -501,48 +440,6 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe
return StorageOperationStatus.OK;
}
- /*
- * public Either<Object, Boolean> validateAndUpdatePropertyValue(String propertyType, String value, String innerType) {
- *
- * log. trace("Going to validate property value and its type. type = {}, value = {}" ,propertyType, value);
- *
- * ToscaPropertyType type = getType(propertyType);
- *
- * if (type == null) {
- *
- * Either<DataTypeDefinition, TitanOperationStatus> externalDataType = getExternalDataType(propertyType); if (externalDataType.isRight()) { TitanOperationStatus status = externalDataType.right().value(); log.debug("The type " + propertyType +
- * " of property cannot be found. Status is " + status); if (status != TitanOperationStatus.NOT_FOUND) { BeEcompErrorManager.getInstance(). logBeInvalidTypeError("validate property type", propertyType, "property"); } return Either.right(false); }
- *
- * DataTypeDefinition dataTypeDefinition = externalDataType.left().value();
- *
- * Either<Map<String, DataTypeDefinition>, TitanOperationStatus> allDataTypesRes = getAllDataTypes(); if (allDataTypesRes.isRight()) { TitanOperationStatus status = allDataTypesRes.right().value(); return Either.right(false); }
- *
- * Map<String, DataTypeDefinition> allDataTypes = allDataTypesRes.left().value();
- *
- * ImmutablePair<JsonElement, Boolean> validateResult = dataTypeValidatorConverter.validateAndUpdate(value, dataTypeDefinition, allDataTypes);
- *
- * if (validateResult.right.booleanValue() == false) {
- * log.debug("The value {} of property from type {} is invalid", value, propertyType);
- * return Either.right(false); }
- *
- * JsonElement jsonElement = validateResult.left;
- *
- * String valueFromJsonElement = getValueFromJsonElement(jsonElement);
- *
- * return Either.left(valueFromJsonElement);
- *
- * }
- *
- * log.trace("After validating property type {}", propertyType);
- *
- * boolean isValidProperty = isValidValue(type, value, innerType); if (false == isValidProperty) { log.debug("The value " + value + " of property from type " + type + " is invalid"); return Either.right(false); }
- *
- *
- * Object convertedValue = value; if (false == isEmptyValue(value)) { PropertyValueConverter converter = type.getConverter(); convertedValue = converter.convert(value, null); }
- *
- * return Either.left(convertedValue); }
- */
-
public Either<PropertyData, TitanOperationStatus> addPropertyToGraph(String propertyName, PropertyDefinition propertyDefinition, String resourceId) {
ResourceMetadataData resourceData = new ResourceMetadataData();
@@ -729,37 +626,6 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe
}
- public TitanOperationStatus addPropertyToNodeType(TitanVertex elementVertex, String propertyName, PropertyDefinition propertyDefinition, NodeTypeEnum nodeType, String uniqueId) {
-
- List<PropertyConstraint> constraints = propertyDefinition.getConstraints();
-
- propertyDefinition.setUniqueId(UniqueIdBuilder.buildPropertyUniqueId(uniqueId, propertyName));
- PropertyData propertyData = new PropertyData(propertyDefinition, convertConstraintsToString(constraints));
-
- if (log.isDebugEnabled())
- log.debug("Before adding property to graph {}", propertyData);
- Either<TitanVertex, TitanOperationStatus> createNodeResult = titanGenericDao.createNode(propertyData);
- if (log.isDebugEnabled())
- log.debug("After adding property to graph {}", propertyData);
- if (createNodeResult.isRight()) {
- TitanOperationStatus operationStatus = createNodeResult.right().value();
- log.error("Failed to add property {} to graph. status is {} ", propertyName, operationStatus);
- return operationStatus;
- }
-
- Map<String, Object> props = new HashMap<String, Object>();
- props.put(GraphPropertiesDictionary.NAME.getProperty(), propertyName);
-
- TitanOperationStatus createRelResult = titanGenericDao.createEdge(elementVertex, propertyData, GraphEdgeLabels.PROPERTY, props);
- if (!createRelResult.equals(TitanOperationStatus.OK)) {
- log.error("Failed to associate resource {} to property {} in graph. status is {}", uniqueId, propertyName, createRelResult);
- return createRelResult;
- }
-
- return createRelResult;
-
- }
-
public Either<Map<String, PropertyDefinition>, TitanOperationStatus> findPropertiesOfNode(NodeTypeEnum nodeType, String uniqueId) {
Map<String, PropertyDefinition> resourceProps = new HashMap<String, PropertyDefinition>();
@@ -1744,41 +1610,6 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe
}
- public void updatePropertiesByPropertyValues(Map<String, List<ComponentInstanceProperty>> resourceInstancesProperties, Map<String, Map<String, ComponentInstanceProperty>> values) {
-
- if (resourceInstancesProperties == null) {
- return;
- }
-
- List<ComponentInstanceProperty> allProperties = new ArrayList<>();
- Collection<List<ComponentInstanceProperty>> properties = resourceInstancesProperties.values();
- if (properties != null) {
- Iterator<List<ComponentInstanceProperty>> iterator = properties.iterator();
- while (iterator.hasNext()) {
- List<ComponentInstanceProperty> compInstancePropertyList = iterator.next();
- allProperties.addAll(compInstancePropertyList);
- }
- }
-
- // Go over each property and check whether there is a rule which updates
- // it
- for (ComponentInstanceProperty instanceProperty : allProperties) {
-
- String propertyUniqueId = instanceProperty.getUniqueId();
-
- // get the changes per componentInstanceId.
- Map<String, ComponentInstanceProperty> instanceIdToValue = values.get(propertyUniqueId);
-
- if (instanceIdToValue == null) {
- continue;
- }
-
- this.updatePropertyByBestMatch(propertyUniqueId, instanceProperty, instanceIdToValue);
-
- }
-
- }
-
/**
*
* Add data type to graph.
@@ -2187,19 +2018,6 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe
}
- private Either<DataTypeDefinition, TitanOperationStatus> getExternalDataType(String propertyType) {
-
- String dataTypeUid = UniqueIdBuilder.buildDataTypeUid(propertyType);
- Either<DataTypeDefinition, TitanOperationStatus> dataTypeByUid = getDataTypeByUid(dataTypeUid);
- if (dataTypeByUid.isRight()) {
- TitanOperationStatus status = dataTypeByUid.right().value();
- return Either.right(status);
- }
-
- return Either.left(dataTypeByUid.left().value());
-
- }
-
public Either<Map<String, DataTypeDefinition>, TitanOperationStatus> getAllDataTypes() {
Map<String, DataTypeDefinition> dataTypes = new HashMap<>();
@@ -2483,26 +2301,6 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe
}
- protected TitanOperationStatus addPropertiesToElementType(String uniqueId, NodeTypeEnum nodeType, Map<String, PropertyDefinition> propertiesMap, TitanVertex elementVertex) {
-
- if (propertiesMap != null) {
-
- for (Entry<String, PropertyDefinition> propertyDefinitionEntry : propertiesMap.entrySet()) {
- String propertyName = propertyDefinitionEntry.getKey();
-
- TitanOperationStatus operationStatus = this.addPropertyToNodeType(elementVertex, propertyName, propertyDefinitionEntry.getValue(), nodeType, uniqueId);
-
- if (!operationStatus.equals(TitanOperationStatus.OK)) {
- log.error("Failed to associate {} {} to property {} in graph. status is {}", nodeType.getName(), uniqueId, propertyName, operationStatus);
- return operationStatus;
- }
- }
- }
-
- return TitanOperationStatus.OK;
-
- }
-
public Either<Map<String, PropertyData>, TitanOperationStatus> addPropertiesToElementType(String uniqueId, NodeTypeEnum elementType, List<PropertyDefinition> properties) {
Map<String, PropertyDefinition> propMap;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java
index 1466980156..31cec74f0d 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/DataTypeValidatorConverter.java
@@ -58,8 +58,6 @@ public class DataTypeValidatorConverter {
JsonParser jsonParser = new JsonParser();
- Gson gson = new Gson();
-
ImmutablePair<JsonElement, Boolean> falseResult = new ImmutablePair<JsonElement, Boolean>(null, false);
ImmutablePair<JsonElement, Boolean> trueEmptyResult = new ImmutablePair<JsonElement, Boolean>(null, true);
@@ -287,22 +285,6 @@ public class DataTypeValidatorConverter {
return allParentsProps;
}
- private String getValueFromJsonElement(JsonElement jsonElement) {
- String value = null;
-
- if (jsonElement == null || jsonElement.isJsonNull()) {
- value = PropertyOperation.EMPTY_VALUE;
- } else {
- if (jsonElement.toString().isEmpty()) {
- value = "";
- } else {
- value = jsonElement.toString();
- }
- }
-
- return value;
- }
-
public boolean isValid(String value, DataTypeDefinition dataTypeDefinition, Map<String, DataTypeDefinition> allDataTypes) {
boolean result = false;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/ListValidator.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/ListValidator.java
index 177dcb60ea..d4331937c8 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/ListValidator.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/tosca/validators/ListValidator.java
@@ -20,8 +20,10 @@
package org.openecomp.sdc.be.model.tosca.validators;
-import java.util.Map;
-
+import com.google.gson.JsonArray;
+import com.google.gson.JsonElement;
+import com.google.gson.JsonParser;
+import com.google.gson.JsonSyntaxException;
import org.openecomp.sdc.be.config.BeEcompErrorManager;
import org.openecomp.sdc.be.model.DataTypeDefinition;
import org.openecomp.sdc.be.model.tosca.ToscaPropertyType;
@@ -29,18 +31,13 @@ import org.openecomp.sdc.common.util.JsonUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.gson.Gson;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonElement;
-import com.google.gson.JsonParser;
-import com.google.gson.JsonSyntaxException;
+import java.util.Map;
public class ListValidator implements PropertyTypeValidator {
private static ListValidator listValidator = new ListValidator();
private static Logger log = LoggerFactory.getLogger(ListValidator.class.getName());
- Gson gson = new Gson();
private static JsonParser jsonParser = new JsonParser();