X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fonap%2Fclamp%2Fclds%2Fsdc%2Fcontroller%2Finstaller%2FCsarInstallerImpl.java;h=57fe7cd472c33f73687f1ca6198bb866b84e73cf;hb=1d40770936891a836fb24e9c03dec78fd115c14b;hp=32f26e994c4d25620f37443cfe4509a2c13c4e71;hpb=27643f6e0e807c25230214df188f88a3cf0ab2a4;p=clamp.git diff --git a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java index 32f26e99..57fe7cd4 100644 --- a/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java +++ b/src/main/java/org/onap/clamp/clds/sdc/controller/installer/CsarInstallerImpl.java @@ -46,6 +46,7 @@ import org.onap.clamp.clds.dao.CldsDao; import org.onap.clamp.clds.exception.sdc.controller.SdcArtifactInstallerException; import org.onap.clamp.clds.model.CldsModel; import org.onap.clamp.clds.model.CldsTemplate; +import org.onap.clamp.clds.model.dcae.DcaeInventoryResponse; import org.onap.clamp.clds.model.properties.ModelProperties; import org.onap.clamp.clds.service.CldsService; import org.onap.clamp.clds.service.CldsTemplateService; @@ -120,7 +121,8 @@ public class CsarInstallerImpl implements CsarInstaller { policyScopePrefix = MODEL_NAME_PREFIX; } return policyScopePrefix + csar.getSdcCsarHelper().getServiceMetadata().getValue("name") + "_v" - + csar.getSdcNotification().getServiceVersion().replace('.', '_') + "_" + resourceInstanceName; + + csar.getSdcNotification().getServiceVersion().replace('.', '_') + "_" + + resourceInstanceName.replaceAll(" ", ""); } @Override @@ -130,9 +132,10 @@ public class CsarInstallerImpl implements CsarInstaller { logger.info("Installing the CSAR " + csar.getFilePath()); for (Entry blueprint : csar.getMapOfBlueprints().entrySet()) { logger.info("Processing blueprint " + blueprint.getValue().getBlueprintArtifactName()); - String serviceTypeId = queryDcaeToGetServiceTypeId(blueprint.getValue()); - createFakeCldsModel(csar, blueprint.getValue(), createFakeCldsTemplate(csar, blueprint.getValue(), - this.searchForRightMapping(blueprint.getValue())), serviceTypeId); + createFakeCldsModel(csar, blueprint.getValue(), + createFakeCldsTemplate(csar, blueprint.getValue(), + this.searchForRightMapping(blueprint.getValue())), + queryDcaeToGetServiceTypeId(blueprint.getValue())); } logger.info("Successfully installed the CSAR " + csar.getFilePath()); } catch (IOException e) { @@ -202,16 +205,16 @@ public class CsarInstallerImpl implements CsarInstaller { * call) * * @param blueprintArtifact - * @return + * @return The DcaeInventoryResponse object containing the dcae values * @throws IOException * @throws ParseException * @throws InterruptedException */ - private String queryDcaeToGetServiceTypeId(BlueprintArtifact blueprintArtifact) + private DcaeInventoryResponse queryDcaeToGetServiceTypeId(BlueprintArtifact blueprintArtifact) throws IOException, ParseException, InterruptedException { return dcaeInventoryService.getDcaeInformation(blueprintArtifact.getBlueprintArtifactName(), blueprintArtifact.getBlueprintInvariantServiceUuid(), - blueprintArtifact.getResourceAttached().getResourceInvariantUUID()).getTypeId(); + blueprintArtifact.getResourceAttached().getResourceInvariantUUID()); } private CldsTemplate createFakeCldsTemplate(CsarHandler csar, BlueprintArtifact blueprintArtifact, @@ -233,7 +236,8 @@ public class CsarInstallerImpl implements CsarInstaller { } private CldsModel createFakeCldsModel(CsarHandler csar, BlueprintArtifact blueprintArtifact, - CldsTemplate cldsTemplate, String serviceTypeId) throws SdcArtifactInstallerException { + CldsTemplate cldsTemplate, DcaeInventoryResponse dcaeInventoryResponse) + throws SdcArtifactInstallerException { try { CldsModel cldsModel = new CldsModel(); cldsModel.setName(buildModelName(csar, blueprintArtifact.getResourceAttached().getResourceInstanceName())); @@ -241,7 +245,8 @@ public class CsarInstallerImpl implements CsarInstaller { cldsModel.setTemplateName(cldsTemplate.getName()); cldsModel.setTemplateId(cldsTemplate.getId()); cldsModel.setBpmnText(cldsTemplate.getBpmnText()); - cldsModel.setTypeId(serviceTypeId); + cldsModel.setTypeId(dcaeInventoryResponse.getTypeId()); + cldsModel.setTypeName(dcaeInventoryResponse.getTypeName()); cldsModel.setControlNamePrefix(CONTROL_NAME_PREFIX); // We must save it otherwise object won't be created in db // and proptext will always be null