summaryrefslogtreecommitdiffstats
path: root/catalog-model
diff options
context:
space:
mode:
authorYuli Shlosberg <ys9693@att.com>2017-10-25 11:52:17 +0300
committerYuli Shlosberg <ys9693@att.com>2017-10-25 11:52:17 +0300
commitfa9d07d3ed584cadbb44de89c886d92591eae23f (patch)
tree36f8261be8d23c14490becdbb7cda0bdaa8a0afc /catalog-model
parent85dbef53f19b4504ace0ab170af8904b5749279c (diff)
merge 1710 to 1.1.0
Change-Id: I75bec14b00e780b2e1c819237139b02453c4a359 Issue-Id: SDC-522 Signed-off-by: Yuli Shlosberg <ys9693@att.com>
Diffstat (limited to 'catalog-model')
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/BaseOperation.java71
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java2
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/ToscaElementLifecycleOperation.java2
3 files changed, 47 insertions, 28 deletions
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 1726c397ad..79360f6e10 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
@@ -25,6 +25,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
@@ -44,6 +45,7 @@ import org.openecomp.sdc.be.dao.jsongraph.types.JsonParseFlagEnum;
import org.openecomp.sdc.be.dao.jsongraph.types.VertexTypeEnum;
import org.openecomp.sdc.be.dao.jsongraph.utils.IdBuilderUtils;
import org.openecomp.sdc.be.dao.titan.TitanOperationStatus;
+import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.ComponentInstanceDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GroupDataDefinition;
import org.openecomp.sdc.be.datatypes.elements.GroupInstanceDataDefinition;
@@ -1338,32 +1340,49 @@ public abstract class BaseOperation {
// return StorageOperationStatus.OK;
// }
- protected GroupInstanceDataDefinition buildGroupInstanceDataDefinition(GroupDataDefinition group, ComponentInstanceDataDefinition componentInstance) {
-
- String componentInstanceName = componentInstance.getName();
- Long creationDate = System.currentTimeMillis();
- GroupInstanceDataDefinition groupInstance = new GroupInstanceDataDefinition();
- String groupUid = group.getUniqueId();
-
- groupInstance.setGroupUid(groupUid);
- groupInstance.setType(group.getType());
- groupInstance.setCustomizationUUID(generateCustomizationUUID());
- groupInstance.setCreationTime(creationDate);
- groupInstance.setModificationTime(creationDate);
- groupInstance.setName(buildGroupInstanceName(componentInstanceName, group.getName()));
- groupInstance.setGroupName(group.getName());
- groupInstance.setNormalizedName(ValidationUtils.normalizeComponentInstanceName(groupInstance.getName()));
- groupInstance.setUniqueId(UniqueIdBuilder.buildResourceInstanceUniuqeId(componentInstance.getUniqueId(), groupUid, groupInstance.getNormalizedName()));
- groupInstance.setArtifacts(group.getArtifacts());
- groupInstance.setArtifactsUuid(group.getArtifactsUuid());
- groupInstance.setProperties(group.getProperties());
- convertPropertiesToInstanceProperties(groupInstance.getProperties());
- groupInstance.setInvariantUUID(group.getInvariantUUID());
- groupInstance.setGroupUUID(group.getGroupUUID());
- groupInstance.setVersion(group.getVersion());
-
- return groupInstance;
- }
+ protected GroupInstanceDataDefinition buildGroupInstanceDataDefinition(GroupDataDefinition group, ComponentInstanceDataDefinition componentInstance, Map<String, ArtifactDataDefinition> instDeplArtifMap) {
+
+ String componentInstanceName = componentInstance.getName();
+ Long creationDate = System.currentTimeMillis();
+ GroupInstanceDataDefinition groupInstance = new GroupInstanceDataDefinition();
+ String groupUid = group.getUniqueId();
+
+ groupInstance.setGroupUid(groupUid);
+ groupInstance.setType(group.getType());
+ groupInstance.setCustomizationUUID(generateCustomizationUUID());
+ groupInstance.setCreationTime(creationDate);
+ groupInstance.setModificationTime(creationDate);
+ groupInstance.setName(buildGroupInstanceName(componentInstanceName, group.getName()));
+ groupInstance.setGroupName(group.getName());
+ groupInstance.setNormalizedName(ValidationUtils.normalizeComponentInstanceName(groupInstance.getName()));
+ groupInstance.setUniqueId(UniqueIdBuilder.buildResourceInstanceUniuqeId(componentInstance.getUniqueId(), groupUid, groupInstance.getNormalizedName()));
+ groupInstance.setArtifacts(group.getArtifacts());
+
+// List<String> fixedArtifactsUuid;
+// List<String> artifactsUuid = group.getArtifactsUuid();
+// if (instDeplArtifMap != null) {
+// fixedArtifactsUuid = new ArrayList<>();
+// artifactsUuid.forEach(u -> {
+// Optional<ArtifactDataDefinition> findFirst = instDeplArtifMap.values().stream().filter(a -> u.equals(a.getUniqueId())).findFirst();
+// if (findFirst.isPresent()) {
+// fixedArtifactsUuid.add(findFirst.get().getArtifactUUID());
+// } else {
+// fixedArtifactsUuid.add(u);
+// }
+// });
+// } else {
+// fixedArtifactsUuid = artifactsUuid;
+// }
+ groupInstance.setArtifactsUuid(group.getArtifactsUuid());
+ groupInstance.setProperties(group.getProperties());
+ convertPropertiesToInstanceProperties(groupInstance.getProperties());
+ groupInstance.setInvariantUUID(group.getInvariantUUID());
+ groupInstance.setGroupUUID(group.getGroupUUID());
+ groupInstance.setVersion(group.getVersion());
+
+ return groupInstance;
+ }
+
protected String buildGroupInstanceName(String instanceName, String groupName) {
return ValidationUtils.normalizeComponentInstanceName(instanceName) + ".." + groupName;
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java
index b642410548..7ff42ae42e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/jsontitan/operations/NodeTemplateOperation.java
@@ -793,7 +793,7 @@ public class NodeTemplateOperation extends BaseOperation {
for (Map.Entry<String, List<ArtifactDefinition>> groupArtifacts : groupInstancesArtifacts.entrySet()) {
Optional<GroupDefinition> groupOptional = groups.stream().filter(g -> g.getUniqueId().equals(groupArtifacts.getKey())).findFirst();
if (groupOptional.isPresent()) {
- GroupInstanceDataDefinition groupInstance = buildGroupInstanceDataDefinition((GroupDataDefinition)groupOptional.get(), (ComponentInstanceDataDefinition)componentInstance);
+ GroupInstanceDataDefinition groupInstance = buildGroupInstanceDataDefinition((GroupDataDefinition) groupOptional.get(), (ComponentInstanceDataDefinition) componentInstance, null);
groupInstance.setGroupInstanceArtifacts(groupArtifacts.getValue().stream().map(a -> a.getUniqueId()).collect(Collectors.toList()));
groupInstance.setGroupInstanceArtifactsUuid(groupArtifacts.getValue().stream().map(a -> a.getArtifactUUID()).collect(Collectors.toList()));
groupInstanceToCreate.put(groupInstance.getName(), groupInstance);
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 51d122524c..f34975b073 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
@@ -1120,7 +1120,7 @@ public class ToscaElementLifecycleOperation extends BaseOperation {
Map<String, GroupInstanceDataDefinition> groupInstanceToCreate = new HashMap<>();
for(GroupDataDefinition group:filteredGroups){
CommonUtility.addRecordToLog(logger, LogLevelEnum.DEBUG, "create new groupInstance {} ", group.getName());
- GroupInstanceDataDefinition groupInstance = buildGroupInstanceDataDefinition(group, vfInst);
+ GroupInstanceDataDefinition groupInstance = buildGroupInstanceDataDefinition(group, vfInst, instDeplArtifMap);
List<String> artifactsUid = new ArrayList<>();
List<String> artifactsId = new ArrayList<>();
for (ArtifactDataDefinition artifact : instDeplArtifMap.values()) {