aboutsummaryrefslogtreecommitdiffstats
path: root/catalog-be/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'catalog-be/src/main')
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayload.java42
1 files changed, 41 insertions, 1 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayload.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayload.java
index 0af2bb55ed..0b13ff8609 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayload.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/distribution/engine/VfModuleArtifactPayload.java
@@ -23,35 +23,75 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.stream.Collectors;
import org.openecomp.sdc.be.datatypes.elements.PropertyDataDefinition;
import org.openecomp.sdc.be.model.GroupDefinition;
import org.openecomp.sdc.be.model.GroupInstance;
import org.openecomp.sdc.be.model.GroupInstanceProperty;
+import org.openecomp.sdc.be.model.GroupProperty;
import org.openecomp.sdc.common.api.Constants;
+@SuppressWarnings("unused")
public class VfModuleArtifactPayload {
- private String vfModuleModelName;
+ private String vfModuleModelName;
+ private String vfModuleModelInvariantUUID;
+ private String vfModuleModelVersion;
+ private String vfModuleModelUUID;
+ private String vfModuleModelCustomizationUUID;
+ private String vfModuleModelDescription;
+ private Boolean isBase;
private List<String> artifacts;
private Map<String, Object> properties;
public VfModuleArtifactPayload(GroupDefinition group) {
vfModuleModelName = group.getName();
+ vfModuleModelInvariantUUID = group.getInvariantUUID();
+ vfModuleModelVersion = group.getVersion();
+ vfModuleModelUUID = group.getGroupUUID();
+ vfModuleModelDescription = group.getDescription();
artifacts = group.getArtifactsUuid();
// Base Value is set from properties
+ setBaseValue(group);
}
public VfModuleArtifactPayload(GroupInstance group) {
vfModuleModelName = group.getGroupName();
+ vfModuleModelInvariantUUID = group.getInvariantUUID();
+ vfModuleModelVersion = group.getVersion();
+ vfModuleModelUUID = group.getGroupUUID();
+ vfModuleModelCustomizationUUID = group.getCustomizationUUID();
+ vfModuleModelDescription = group.getDescription();
artifacts = new ArrayList<>(group.getArtifactsUuid() != null ? group.getArtifactsUuid() : new LinkedList<>());
artifacts.addAll(group.getGroupInstanceArtifactsUuid() != null ? group.getGroupInstanceArtifactsUuid() : new LinkedList<>());
// Base Value is set from properties
+ setBaseValue(group);
if (group.convertToGroupInstancesProperties() != null) {
setProperties(group.convertToGroupInstancesProperties());
}
}
+ private void setBaseValue(GroupInstance group) {
+ if (group.convertToGroupInstancesProperties() != null) {
+ Optional<GroupInstanceProperty> findBaseProperty = group.convertToGroupInstancesProperties().stream()
+ .filter(p -> p.getName().equals(Constants.IS_BASE)).findAny();
+ if (findBaseProperty.isPresent()) {
+ isBase = Boolean.valueOf(findBaseProperty.get().getValue());
+ }
+ }
+ }
+
+ private void setBaseValue(GroupDefinition group) {
+ if (group.getProperties() != null) {
+ Optional<GroupProperty> findBaseProperty = group.convertToGroupProperties().stream().filter(p -> p.getName().equals(Constants.IS_BASE))
+ .findAny();
+ if (findBaseProperty.isPresent()) {
+ isBase = Boolean.valueOf(findBaseProperty.get().getValue());
+ }
+ }
+ }
+
public static int compareByGroupName(VfModuleArtifactPayload art1, VfModuleArtifactPayload art2) {
Float thisCounter = Float.parseFloat(art1.vfModuleModelName.split(Constants.MODULE_NAME_DELIMITER)[1].replace(' ', '.'));
Float otherCounter = Float.parseFloat(art2.vfModuleModelName.split(Constants.MODULE_NAME_DELIMITER)[1].replace(' ', '.'));