aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-model/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-model/src/main/java/org')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/Component.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/GroupInstance.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java22
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IElementOperation.java21
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java50
5 files changed, 39 insertions, 58 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 38f2f36ae2..7d4dfa72f4 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
@@ -321,7 +321,7 @@ public abstract class Component implements PropertiesOwner {
return safeGetComponentInstanceDeploymentArtifacts(componentInstanceId)
.values()
.stream()
- .filter(artifact -> ArtifactTypeEnum.HEAT_ENV.name().equals(artifact.getArtifactType()))
+ .filter(artifact -> ArtifactTypeEnum.HEAT_ENV.getType().equals(artifact.getArtifactType()))
.collect(Collectors.toList());
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/GroupInstance.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/GroupInstance.java
index caebf4a275..ca154f3076 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/GroupInstance.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/GroupInstance.java
@@ -116,7 +116,7 @@ public class GroupInstance extends GroupInstanceDataDefinition {
String label = artifactId.substring(artifactId.lastIndexOf('.') + 1);
ArtifactDefinition artifact = deploymentArtifacts.get(label);
log.debug("current artifact id: {}, current artifact definition: {}", artifactId, artifact);
- ArtifactTypeEnum artifactType = ArtifactTypeEnum.findType(artifact.getArtifactType());
+ ArtifactTypeEnum artifactType = ArtifactTypeEnum.parse(artifact.getArtifactType());
if (artifactType != ArtifactTypeEnum.HEAT_ENV){
addArtifactsIdToCollection(artifactUuids, artifact);
}else{
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java
index 50c165f535..3c8e0ee5cf 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsonjanusgraph/operations/ArtifactsOperations.java
@@ -312,7 +312,11 @@ public class ArtifactsOperations extends BaseOperation {
String currentChecksum = updateArtifactData.getArtifactChecksum();
if (isUpdate) {
- ArtifactTypeEnum type = ArtifactTypeEnum.findType(updateArtifactData.getArtifactType());
+ final ArtifactTypeEnum type = ArtifactTypeEnum.parse(updateArtifactData.getArtifactType());
+ if(type == null) {
+ generateUUIDForNonHeatArtifactType(updateArtifactData, oldChecksum, oldVesrion, currentChecksum);
+ return;
+ }
switch (type) {
case HEAT_ENV:
if (edgeLabel == EdgeLabelEnum.INST_DEPLOYMENT_ARTIFACTS) {
@@ -384,17 +388,11 @@ public class ArtifactsOperations extends BaseOperation {
return addArtifactToComponent(artifactHeatEnv, component, parentType, failIfExist, instanceId);
}
- public Either<ArtifactDefinition, StorageOperationStatus> getHeatArtifactByHeatEnvId(String parentId, ArtifactDefinition heatEnv, NodeTypeEnum parentType, String containerId, ComponentTypeEnum componentType) {
- String id = heatEnv.getGeneratedFromId();
- ComponentTypeEnum compType;
- switch (parentType) {
- case ResourceInstance:
- compType = ComponentTypeEnum.RESOURCE_INSTANCE;
- break;
- default:
- compType = componentType;
- }
- return getArtifactById(parentId, id, compType, containerId);
+ public Either<ArtifactDefinition, StorageOperationStatus> getHeatArtifactByHeatEnvId(final String parentId,
+ final ArtifactDefinition heatEnv,
+ final String containerId,
+ final ComponentTypeEnum componentType) {
+ return getArtifactById(parentId, heatEnv.getGeneratedFromId(), componentType, containerId);
}
public Either<ArtifactDefinition, StorageOperationStatus> updateHeatEnvArtifact(Component component, ArtifactDefinition artifactEnvInfo, String artifactId, String newArtifactId, NodeTypeEnum type, String instanceId) {
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IElementOperation.java
index 6ecfc1048b..33877add47 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IElementOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/api/IElementOperation.java
@@ -21,6 +21,8 @@
package org.openecomp.sdc.be.model.operations.api;
import fj.data.Either;
+import java.util.List;
+import java.util.Map;
import org.openecomp.sdc.be.config.Configuration;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
@@ -33,9 +35,6 @@ import org.openecomp.sdc.be.model.category.GroupingDefinition;
import org.openecomp.sdc.be.model.category.SubCategoryDefinition;
import org.openecomp.sdc.be.resources.data.CategoryData;
-import java.util.List;
-import java.util.Map;
-
public interface IElementOperation {
Either<List<CategoryDefinition>, ActionStatus> getAllResourceCategories();
@@ -44,21 +43,19 @@ public interface IElementOperation {
Either<List<CategoryDefinition>, ActionStatus> getAllProductCategories();
- public Either<List<Tag>, ActionStatus> getAllTags();
-
- public Either<List<PropertyScope>, ActionStatus> getAllPropertyScopes();
+ Either<List<Tag>, ActionStatus> getAllTags();
- public Either<List<ArtifactType>, ActionStatus> getAllArtifactTypes();
+ Either<List<PropertyScope>, ActionStatus> getAllPropertyScopes();
- public Either<Map<String, Object>, ActionStatus> getAllDeploymentArtifactTypes();
+ List<ArtifactType> getAllArtifactTypes();
- public Either<Configuration.HeatDeploymentArtifactTimeout, ActionStatus> getDefaultHeatTimeout();
+ Either<Configuration.HeatDeploymentArtifactTimeout, ActionStatus> getDefaultHeatTimeout();
- public <T extends GraphNode> Either<CategoryData, StorageOperationStatus> getCategoryData(String name, NodeTypeEnum type, Class<T> clazz);
+ <T extends GraphNode> Either<CategoryData, StorageOperationStatus> getCategoryData(String name, NodeTypeEnum type, Class<T> clazz);
- public <T extends GraphNode> Either<org.openecomp.sdc.be.resources.data.category.CategoryData, StorageOperationStatus> getNewCategoryData(String name, NodeTypeEnum type, Class<T> clazz);
+ <T extends GraphNode> Either<org.openecomp.sdc.be.resources.data.category.CategoryData, StorageOperationStatus> getNewCategoryData(String name, NodeTypeEnum type, Class<T> clazz);
- public Either<Map<String, String>, ActionStatus> getResourceTypesMap();
+ Either<Map<String, String>, ActionStatus> getResourceTypesMap();
Either<CategoryDefinition, ActionStatus> createCategory(CategoryDefinition category, NodeTypeEnum nodeType);
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java
index 402129b8ba..9d0c7b1075 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/ElementOperation.java
@@ -20,22 +20,29 @@
package org.openecomp.sdc.be.model.operations.impl;
-import org.janusgraph.core.JanusGraph;
-import org.janusgraph.core.JanusGraphVertex;
import fj.data.Either;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.tinkerpop.gremlin.structure.Vertex;
+import org.janusgraph.core.JanusGraph;
+import org.janusgraph.core.JanusGraphVertex;
+import org.openecomp.sdc.be.config.ArtifactConfigManager;
+import org.openecomp.sdc.be.config.ArtifactConfiguration;
import org.openecomp.sdc.be.config.Configuration;
-import org.openecomp.sdc.be.config.Configuration.ArtifactTypeConfig;
import org.openecomp.sdc.be.config.ConfigurationManager;
import org.openecomp.sdc.be.dao.api.ActionStatus;
import org.openecomp.sdc.be.dao.graph.datatype.GraphEdge;
import org.openecomp.sdc.be.dao.graph.datatype.GraphNode;
import org.openecomp.sdc.be.dao.graph.datatype.GraphRelation;
+import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.dao.janusgraph.JanusGraphOperationStatus;
import org.openecomp.sdc.be.dao.neo4j.GraphEdgeLabels;
import org.openecomp.sdc.be.dao.neo4j.GraphPropertiesDictionary;
-import org.openecomp.sdc.be.dao.janusgraph.JanusGraphGenericDao;
import org.openecomp.sdc.be.datatypes.category.CategoryDataDefinition;
import org.openecomp.sdc.be.datatypes.category.GroupingDataDefinition;
import org.openecomp.sdc.be.datatypes.category.SubCategoryDataDefinition;
@@ -58,8 +65,6 @@ import org.openecomp.sdc.common.util.ValidationUtils;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
-import java.util.*;
-
@Component("element-operation")
public class ElementOperation implements IElementOperation {
@@ -781,32 +786,13 @@ public class ElementOperation implements IElementOperation {
}
@Override
- public Either<List<ArtifactType>, ActionStatus> getAllArtifactTypes() {
- List<ArtifactType> artifactTypes = new ArrayList<>();
-
- List<String> artifactTypesList = ConfigurationManager.getConfigurationManager().getConfiguration().getArtifactTypes();
- for (String artifactType : artifactTypesList) {
- ArtifactType artifactT = new ArtifactType();
- artifactT.setName(artifactType);
- artifactTypes.add(artifactT);
- }
- return Either.left(artifactTypes);
- }
-
- @Override
- public Either<Map<String, Object>, ActionStatus> getAllDeploymentArtifactTypes() {
-
- Map<String, Object> artifactTypes = new HashMap<>();
- Map<String, ArtifactTypeConfig> artifactResourceTypes = ConfigurationManager.getConfigurationManager().getConfiguration().getResourceDeploymentArtifacts();
- Map<String, ArtifactTypeConfig> artifactServiceTypes = ConfigurationManager.getConfigurationManager().getConfiguration().getServiceDeploymentArtifacts();
- Map<String, ArtifactTypeConfig> artifactResourceInstanceTypes = ConfigurationManager.getConfigurationManager().getConfiguration().getResourceInstanceDeploymentArtifacts();
-
- artifactTypes.put("resourceDeploymentArtifacts", artifactResourceTypes);
- artifactTypes.put("serviceDeploymentArtifacts", artifactServiceTypes);
- artifactTypes.put("resourceInstanceDeploymentArtifacts", artifactResourceInstanceTypes);
-
- return Either.left(artifactTypes);
-
+ public List<ArtifactType> getAllArtifactTypes() {
+ final List<ArtifactConfiguration> artifactTypesList = ArtifactConfigManager.getInstance().getConfiguration();
+ return artifactTypesList.stream().map(artifactConfiguration -> {
+ final ArtifactType artifactType = new ArtifactType();
+ artifactType.setName(artifactConfiguration.getType());
+ return artifactType;
+ }).collect(Collectors.toList());
}
@Override