push addional code
[sdc.git] / openecomp-be / lib / openecomp-sdc-enrichment-lib / openecomp-sdc-enrichment-core / src / main / java / org / openecomp / sdc / enrichment / impl / EnrichmentManagerImpl.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.openecomp.sdc.enrichment.impl;
22
23 import org.openecomp.core.enrichment.api.EnrichmentManager;
24 import org.openecomp.core.enrichment.types.EntityInfo;
25 import org.openecomp.sdc.datatypes.error.ErrorMessage;
26 import org.openecomp.sdc.enrichment.EnrichmentInfo;
27 import org.openecomp.sdc.enrichment.factory.EnricherHandlerFactory;
28 import org.openecomp.sdc.enrichment.inter.Enricher;
29 import org.openecomp.sdc.tosca.datatypes.ToscaServiceModel;
30 import org.openecomp.sdc.versioning.dao.types.Version;
31 import org.slf4j.Logger;
32 import org.slf4j.LoggerFactory;
33
34 import java.util.List;
35 import java.util.Map;
36
37 public class EnrichmentManagerImpl implements EnrichmentManager<ToscaServiceModel> {
38
39   private static Logger logger = LoggerFactory.getLogger(EnrichmentManagerImpl.class);
40
41   private EnrichmentInfo input = null;
42   private ToscaServiceModel model;
43
44
45   @Override
46   public Map<String, List<ErrorMessage>> enrich() {
47     List<Enricher> enricherList =
48         EnricherHandlerFactory.getInstance().createInterface().getEnrichers();
49     for (Enricher enricher : enricherList) {
50       enricher.setInput(input);
51       enricher.setModel(model);
52       enricher.enrich();
53     }
54
55     return null;
56   }
57
58   @Override
59   public void addEntityInput(String type, EntityInfo info) {
60     this.input.addEntityInfo(type, info);
61   }
62
63
64   @Override
65   public void initInput(String key, Version version) {
66     input = new EnrichmentInfo();
67     input.setKey(key);
68     input.setVersion(version);
69   }
70
71   @Override
72   public void addModel(ToscaServiceModel model) {
73
74     this.model = model;
75   }
76
77
78   @Override
79   public ToscaServiceModel getModel() {
80     return this.model;
81   }
82
83
84 }