Fix check style issues
[clamp.git] / src / main / java / org / onap / clamp / clds / model / properties / AbstractModelElement.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2017-2018 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  * ===================================================================
21  *
22  */
23
24 package org.onap.clamp.clds.model.properties;
25
26 import com.att.eelf.configuration.EELFLogger;
27 import com.att.eelf.configuration.EELFManager;
28 import com.google.gson.JsonElement;
29 import com.google.gson.JsonObject;
30
31 /**
32  * Provide base ModelElement functionality. Perform base parsing of properties for a ModelElement (such as,
33  * VesCollector, Policy, Tca, Holmes, ...)
34  */
35 public abstract class AbstractModelElement {
36
37     protected static final EELFLogger logger = EELFManager.getInstance().getLogger(AbstractModelElement.class);
38     protected static final EELFLogger auditLogger = EELFManager.getInstance().getAuditLogger();
39     private final String type;
40     private final ModelBpmn modelBpmn;
41     private final String id;
42     protected String topicPublishes;
43     protected final JsonElement modelElementJsonNode;
44     private boolean isFound;
45     private final ModelProperties modelProp;
46
47     /**
48      * Perform base parsing of properties for a ModelElement (such as, VesCollector, Policy and Tca).
49      */
50     protected AbstractModelElement(String type, ModelProperties modelProp, ModelBpmn modelBpmn, JsonObject modelJson) {
51         this.type = type;
52         this.modelProp = modelProp;
53         this.modelBpmn = modelBpmn;
54         this.id = modelBpmn.getId(type);
55         this.modelElementJsonNode = modelJson.get(id);
56         this.isFound = modelBpmn.isModelElementTypeInList(type);
57     }
58
59     /**
60      * Get the topic publishes.
61      * @return the topicPublishes
62      */
63     public String getTopicPublishes() {
64         return topicPublishes;
65     }
66
67
68     /**
69      * Get the id.
70      * @return the id
71      */
72     public String getId() {
73         return id;
74     }
75
76     /**
77      * Get the isFound flag.
78      * @return the isFound
79      */
80     public boolean isFound() {
81         return isFound;
82     }
83 }