diff options
author | tragait <rahul.tyagi@est.tech> | 2021-02-24 17:11:42 +0000 |
---|---|---|
committer | Vasyl Razinkov <vasyl.razinkov@est.tech> | 2021-02-26 11:58:55 +0000 |
commit | d673cb77453ba5f8e269d2b919e3a5a1d577bf53 (patch) | |
tree | 59153e383c5527f3a138eb8e32491b1d6e69e636 | |
parent | f2c809515e48d53a2f9ffeab5f0e656f32a65637 (diff) |
set default software version value from properties
In this commit, default software version value is copied from
software versions list[0] property. This input value will being
used in pnfcustomization table.
Signed-off-by: tragait <rahul.tyagi@est.tech>
Issue-ID: SDC-3469
Change-Id: I114b3452e6a2420487029f7e4d04cb72798c61bb
-rw-r--r-- | catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/SoftwareInformationBusinessLogic.java | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/SoftwareInformationBusinessLogic.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/SoftwareInformationBusinessLogic.java index 3605856994..d6b17ca604 100644 --- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/SoftwareInformationBusinessLogic.java +++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/SoftwareInformationBusinessLogic.java @@ -25,6 +25,8 @@ import org.openecomp.sdc.be.components.impl.exceptions.BusinessLogicException; import org.openecomp.sdc.be.csar.pnf.PnfSoftwareInformation; import org.openecomp.sdc.be.csar.pnf.PnfSoftwareVersion; import org.openecomp.sdc.be.csar.pnf.SoftwareInformationArtifactYamlParser; +import org.openecomp.sdc.be.datatypes.enums.ResourceTypeEnum; +import org.openecomp.sdc.be.model.InputDefinition; import org.openecomp.sdc.be.model.PropertyDefinition; import org.openecomp.sdc.be.model.Resource; import org.openecomp.sdc.be.model.tosca.ToscaPropertyType; @@ -42,6 +44,7 @@ public class SoftwareInformationBusinessLogic { private final PropertyBusinessLogic propertyBusinessLogic; private static final String SOFTWARE_VERSION_PROPERTY_NAME = "software_versions"; + private static final String DEFAULT_SOFTWARE_VERSION_PROPERTY_NAME = "default_software_version"; @Autowired public SoftwareInformationBusinessLogic(final PropertyBusinessLogic propertyBusinessLogic) { @@ -84,6 +87,15 @@ public class SoftwareInformationBusinessLogic { final PropertyDefinition updatedPropertyDefinition = propertyBusinessLogic.updateComponentProperty(resource.getUniqueId(), propertyDefinition); + + // set default-software-version as first entry of software version list for resource type pnf + if(resource.getResourceType() == ResourceTypeEnum.PNF && !versionList.isEmpty()){ + final String sw_version = versionList.get(0); + Optional<InputDefinition> default_Sw_Ver_PropertyDefinition = resource.safeGetInputs().stream().filter(s->DEFAULT_SOFTWARE_VERSION_PROPERTY_NAME.equals(s.getName())).findFirst(); + if(default_Sw_Ver_PropertyDefinition.isPresent()) { + default_Sw_Ver_PropertyDefinition.get().setDefaultValue(sw_version); + } + } return Optional.ofNullable(updatedPropertyDefinition); } |