diff options
author | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
---|---|---|
committer | AviZi <avi.ziv@amdocs.com> | 2017-06-09 02:39:56 +0300 |
commit | 280f8015d06af1f41a3ef12e8300801c7a5e0d54 (patch) | |
tree | 9c1d3978c04cd28068f02073038c936bb49ca9e0 /openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java | |
parent | fd3821dad11780d33c5373d74c957c442489945e (diff) |
[SDC-29] Amdocs OnBoard 1707 initial commit.
Change-Id: Ie4d12a3f574008b792899b368a0902a8b46b5370
Signed-off-by: AviZi <avi.ziv@amdocs.com>
Diffstat (limited to 'openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java')
3 files changed, 19 insertions, 114 deletions
diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/EnrichmentArtifactsServiceFactoryImpl.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/EnrichmentArtifactsServiceFactoryImpl.java deleted file mode 100644 index 1075b07a49..0000000000 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/EnrichmentArtifactsServiceFactoryImpl.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.enrichment; - -import org.openecomp.core.enrichment.EnrichmentArtifactsServiceFactory; -import org.openecomp.core.enrichment.enrichmentartifacts.EnrichmentArtifactsService; -import org.openecomp.sdc.enrichment.enrichmentartifacts.EnrichmentArtifactsServiceImpl; - -public class EnrichmentArtifactsServiceFactoryImpl extends EnrichmentArtifactsServiceFactory { - private static EnrichmentArtifactsService INSTANCE = new EnrichmentArtifactsServiceImpl(); - - @Override - public EnrichmentArtifactsService createInterface() { - return INSTANCE; - } -} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/enrichmentartifacts/EnrichmentArtifactsServiceImpl.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/enrichmentartifacts/EnrichmentArtifactsServiceImpl.java deleted file mode 100644 index 2b7fef1e6b..0000000000 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/enrichmentartifacts/EnrichmentArtifactsServiceImpl.java +++ /dev/null @@ -1,61 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * SDC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * 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. - * See the License for the specific language governing permissions and - * limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.openecomp.sdc.enrichment.enrichmentartifacts; - -import org.openecomp.core.enrichment.enrichmentartifacts.EnrichmentArtifactsService; -import org.openecomp.core.model.dao.EnrichedServiceModelDao; -import org.openecomp.core.model.dao.EnrichedServiceModelDaoFactory; -import org.openecomp.core.model.types.ServiceArtifact; -import org.openecomp.core.model.types.ServiceElement; -import org.openecomp.core.utilities.file.FileContentHandler; -import org.openecomp.sdc.common.utils.AsdcCommon; -import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; -import org.openecomp.sdc.versioning.dao.types.Version; - -import java.util.List; - -public class EnrichmentArtifactsServiceImpl implements EnrichmentArtifactsService { - EnrichedServiceModelDao<ToscaServiceModel, ServiceElement> enrichedServiceModelDao = - EnrichedServiceModelDaoFactory.getInstance().createInterface(); - - @Override - public FileContentHandler addMibs(String vspId, Version version) { - FileContentHandler externalArtifacts = new FileContentHandler(); - List<ServiceArtifact> mibsList = enrichedServiceModelDao.getExternalArtifacts(vspId, version); - addMibsToFileContentHandler(mibsList, externalArtifacts); - - return externalArtifacts; - } - - - private void addMibsToFileContentHandler(List<ServiceArtifact> mibsList, - FileContentHandler externalArtifacts) { - for (ServiceArtifact serviceArtifact : mibsList) { - String filename = serviceArtifact.getName(); - externalArtifacts.addFile(filename, serviceArtifact.getContent()); - } - } - - - private boolean isFileArtifact(String filename) { - return !filename.contains(AsdcCommon.HEAT_META) && !filename.contains(AsdcCommon.MANIFEST_NAME); - } -} diff --git a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImpl.java b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImpl.java index ef29108402..06b157b92c 100644 --- a/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImpl.java +++ b/openecomp-be/lib/openecomp-sdc-enrichment-lib/openecomp-sdc-enrichment-core/src/main/java/org/openecomp/sdc/enrichment/impl/EnrichmentManagerImpl.java @@ -22,62 +22,62 @@ package org.openecomp.sdc.enrichment.impl; import org.openecomp.core.enrichment.api.EnrichmentManager; import org.openecomp.core.enrichment.types.EntityInfo; +import org.openecomp.sdc.logging.api.Logger; +import org.openecomp.sdc.logging.api.LoggerFactory; import org.openecomp.sdc.datatypes.error.ErrorMessage; import org.openecomp.sdc.enrichment.EnrichmentInfo; import org.openecomp.sdc.enrichment.factory.EnricherHandlerFactory; import org.openecomp.sdc.enrichment.inter.Enricher; import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel; import org.openecomp.sdc.versioning.dao.types.Version; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import java.util.HashMap; import java.util.List; import java.util.Map; public class EnrichmentManagerImpl implements EnrichmentManager<ToscaServiceModel> { - private static Logger logger = LoggerFactory.getLogger(EnrichmentManagerImpl.class); + private static Logger logger = (Logger) LoggerFactory.getLogger(EnrichmentManagerImpl.class); - private EnrichmentInfo input = null; + private EnrichmentInfo data = null; private ToscaServiceModel model; @Override public Map<String, List<ErrorMessage>> enrich() { + Map<String, List<ErrorMessage>> enrichErrors = new HashMap<>(); List<Enricher> enricherList = EnricherHandlerFactory.getInstance().createInterface().getEnrichers(); for (Enricher enricher : enricherList) { - enricher.setInput(input); + enricher.setData(data); enricher.setModel(model); - enricher.enrich(); + enrichErrors.putAll(enricher.enrich()); } - return null; + return enrichErrors; } @Override - public void addEntityInput(String type, EntityInfo info) { - this.input.addEntityInfo(type, info); + public void addEntityInfo(String entityKey, EntityInfo entityInfo) { + this.data.addEntityInfo(entityKey, entityInfo); } @Override - public void initInput(String key, Version version) { - input = new EnrichmentInfo(); - input.setKey(key); - input.setVersion(version); + public void init(String key, Version version) { + data = new EnrichmentInfo(); + data.setKey(key); + data.setVersion(version); } @Override - public void addModel(ToscaServiceModel model) { - - this.model = model; + public ToscaServiceModel getModel() { + return this.model; } - @Override - public ToscaServiceModel getModel() { - return this.model; + public void setModel(ToscaServiceModel model) { + this.model = model; } |