diff options
author | talig <talig@amdocs.com> | 2018-05-30 16:15:50 +0300 |
---|---|---|
committer | Avi Gaffa <avi.gaffa@amdocs.com> | 2018-06-03 06:45:43 +0000 |
commit | 4d0dbee1a1ac7c58c665cdd0e8576bfa9edd1e0e (patch) | |
tree | d5785cc2d65afb78630ce2d83479bdf4622e2da1 /openecomp-be/backend | |
parent | c3322117d0aba0a00feaf9126a579f233318d013 (diff) |
Add minimum to number questionnaire fields
In case of compute validation error - display its name (same as other entities)
Change-Id: Ie3f0190a3b30d1ed6210f50958f61d8a883d5bef
Issue-ID: SDC-1387
Signed-off-by: talig <talig@amdocs.com>
Diffstat (limited to 'openecomp-be/backend')
-rw-r--r-- | openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java index faa53862ef..db6a63a2ba 100644 --- a/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java +++ b/openecomp-be/backend/openecomp-sdc-vendor-software-product-manager/src/main/java/org/openecomp/sdc/vendorsoftwareproduct/impl/CompositionEntityDataManagerImpl.java @@ -66,6 +66,7 @@ import org.openecomp.sdc.versioning.dao.types.Version; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.EnumMap; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -85,7 +86,8 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa private static final Logger logger = LoggerFactory.getLogger(CompositionEntityDataManagerImpl.class); private Map<CompositionEntityId, CompositionEntityData> entities = new HashMap<>(); - private Map<CompositionEntityType, String> nonDynamicSchemas = new HashMap<>(); + private Map<CompositionEntityType, String> nonDynamicSchemas = + new EnumMap<>(CompositionEntityType.class); private List<CompositionEntityValidationData> roots = new ArrayList<>(); private VendorSoftwareProductInfoDao vspInfoDao; @@ -175,10 +177,10 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa @Override public Map<CompositionEntityId, Collection<String>> validateEntitiesQuestionnaire() { Map<CompositionEntityId, Collection<String>> errorsByEntityId = new HashMap<>(); - entities.entrySet().forEach(entry -> { - Collection<String> errors = validateQuestionnaire(entry.getValue()); + entities.forEach((key, value) -> { + Collection<String> errors = validateQuestionnaire(value); if (errors != null) { - errorsByEntityId.put(entry.getKey(), errors); + errorsByEntityId.put(key, errors); } }); return errorsByEntityId; @@ -191,9 +193,8 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa public void buildTrees() { Map<CompositionEntityId, CompositionEntityValidationData> entitiesValidationData = new HashMap<>(); - entities.entrySet().forEach( - entry -> addValidationDataEntity(entitiesValidationData, entry.getKey(), - entry.getValue().entity)); + entities.forEach((key, value) -> addValidationDataEntity(entitiesValidationData, key, + value.entity)); } public Collection<CompositionEntityValidationData> getTrees() { @@ -225,7 +226,7 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa return entitiesWithErrors; } - return null; + return new HashSet<>(); } private boolean isThereErrorsInSubTree(CompositionEntityValidationData entity) { @@ -445,6 +446,10 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa Image image = JsonUtil.json2Object(compositionData, Image.class); return image.getFileName(); + case compute: + ComputeData compute = JsonUtil.json2Object(compositionData, ComputeData.class); + return compute.getName(); + case vsp: CompositionEntityData vspEntity = getCompositionEntityDataById(entity); if (Objects.isNull(vspEntity)) { @@ -455,9 +460,9 @@ public class CompositionEntityDataManagerImpl implements CompositionEntityDataMa vspInfoDao.get(new VspDetails(vspQuestionnaireEntity.getId(), vspQuestionnaireEntity.getVersion())); return vspDetails.getName(); + default: + return null; } - - return null; } private void removeNodesWithoutErrors(CompositionEntityValidationData node, |