2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.enrichment.impl;
23 import org.openecomp.core.enrichment.api.EnrichmentManager;
24 import org.openecomp.core.enrichment.types.EntityInfo;
25 import org.openecomp.sdc.logging.api.Logger;
26 import org.openecomp.sdc.logging.api.LoggerFactory;
27 import org.openecomp.sdc.datatypes.error.ErrorMessage;
28 import org.openecomp.sdc.enrichment.EnrichmentInfo;
29 import org.openecomp.sdc.enrichment.factory.EnricherHandlerFactory;
30 import org.openecomp.sdc.enrichment.inter.Enricher;
31 import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
32 import org.openecomp.sdc.versioning.dao.types.Version;
34 import java.util.HashMap;
35 import java.util.List;
38 public class EnrichmentManagerImpl implements EnrichmentManager<ToscaServiceModel> {
40 private static Logger logger = (Logger) LoggerFactory.getLogger(EnrichmentManagerImpl.class);
42 private EnrichmentInfo data = null;
43 private ToscaServiceModel model;
47 public Map<String, List<ErrorMessage>> enrich() {
48 Map<String, List<ErrorMessage>> enrichErrors = new HashMap<>();
49 List<Enricher> enricherList =
50 EnricherHandlerFactory.getInstance().createInterface().getEnrichers();
51 for (Enricher enricher : enricherList) {
52 enricher.setData(data);
53 enricher.setModel(model);
54 enrichErrors.putAll(enricher.enrich());
61 public void addEntityInfo(String entityKey, EntityInfo entityInfo) {
62 this.data.addEntityInfo(entityKey, entityInfo);
67 public void init(String key, Version version) {
68 data = new EnrichmentInfo();
70 data.setVersion(version);
74 public ToscaServiceModel getModel() {
79 public void setModel(ToscaServiceModel model) {