diff options
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java')
-rw-r--r-- | openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java | 59 |
1 files changed, 24 insertions, 35 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java index 938f104b1e..6f1492c163 100644 --- a/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java +++ b/openecomp-be/lib/openecomp-sdc-model-lib/openecomp-sdc-model-impl/src/main/java/org/openecomp/sdc/model/impl/zusammen/EnrichedServiceModelDaoZusammenImpl.java @@ -7,9 +7,9 @@ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -17,9 +17,10 @@ * limitations under the License. * ============LICENSE_END========================================================= */ - package org.openecomp.sdc.model.impl.zusammen; +import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement; + import com.amdocs.zusammen.adaptor.inbound.api.types.item.ZusammenElement; import com.amdocs.zusammen.datatypes.SessionContext; import com.amdocs.zusammen.datatypes.item.Action; @@ -35,41 +36,29 @@ import org.openecomp.sdc.logging.api.Logger; import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; -import static org.openecomp.core.zusammen.api.ZusammenUtil.buildStructuralElement; - public class EnrichedServiceModelDaoZusammenImpl extends ServiceModelDaoZusammenImpl implements EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> { - private static final Logger logger = - LoggerFactory.getLogger(EnrichedServiceModelDaoZusammenImpl.class); - - public EnrichedServiceModelDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) { - super(zusammenAdaptor); - this.elementType = ElementType.EnrichedServiceModel; - } - - @Override - public void storeExternalArtifact(ServiceArtifact serviceArtifact) { - ZusammenElement artifact = buildArtifactElement(serviceArtifact.getName(), - FileUtils.toByteArray(serviceArtifact.getContent()), Action.CREATE); - - ZusammenElement artifacts = buildStructuralElement(ElementType.Artifacts, Action.IGNORE); - artifacts.addSubElement(artifact); - - ZusammenElement enrichedServiceModel = buildStructuralElement(elementType, Action.IGNORE); - enrichedServiceModel.addSubElement(artifacts); - - ZusammenElement vspModel = buildStructuralElement(ElementType.VspModel, Action.IGNORE); - vspModel.addSubElement(enrichedServiceModel); + private static final Logger logger = LoggerFactory.getLogger(EnrichedServiceModelDaoZusammenImpl.class); - SessionContext context = ZusammenUtil.createSessionContext(); - ElementContext elementContext = - new ElementContext(serviceArtifact.getVspId(), serviceArtifact.getVersion().getId()); - zusammenAdaptor - .saveElement(context, elementContext, vspModel, "add service external artifact."); + public EnrichedServiceModelDaoZusammenImpl(ZusammenAdaptor zusammenAdaptor) { + super(zusammenAdaptor); + this.elementType = ElementType.EnrichedServiceModel; + } - logger.info( - "Finished adding artifact to enriched service model for VendorSoftwareProduct id -> {}", - elementContext.getItemId().getValue()); - } + @Override + public void storeExternalArtifact(ServiceArtifact serviceArtifact) { + ZusammenElement artifact = buildArtifactElement(serviceArtifact.getName(), FileUtils.toByteArray(serviceArtifact.getContent()), + Action.CREATE); + ZusammenElement artifacts = buildStructuralElement(ElementType.Artifacts, Action.IGNORE); + artifacts.addSubElement(artifact); + ZusammenElement enrichedServiceModel = buildStructuralElement(elementType, Action.IGNORE); + enrichedServiceModel.addSubElement(artifacts); + ZusammenElement vspModel = buildStructuralElement(ElementType.VspModel, Action.IGNORE); + vspModel.addSubElement(enrichedServiceModel); + SessionContext context = ZusammenUtil.createSessionContext(); + ElementContext elementContext = new ElementContext(serviceArtifact.getVspId(), serviceArtifact.getVersion().getId()); + zusammenAdaptor.saveElement(context, elementContext, vspModel, "add service external artifact."); + logger.info("Finished adding artifact to enriched service model for VendorSoftwareProduct id -> {}", elementContext.getItemId().getValue()); + } } |