Sonar Critical Fix
[dcaegen2/analytics/tca.git] / dcae-analytics-model / src / main / java / org / openecomp / dcae / apod / analytics / model / BaseDynamicPropertiesProvider.java
1 /*\r
2  * ===============================LICENSE_START======================================\r
3  *  dcae-analytics\r
4  * ================================================================================\r
5  *    Copyright © 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  *  Licensed under the Apache License, Version 2.0 (the "License");\r
8  *  you may not use this file except in compliance with the License.\r
9  *   You may obtain a copy of the License at\r
10  *\r
11  *          http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  *  Unless required by applicable law or agreed to in writing, software\r
14  *  distributed under the License is distributed on an "AS IS" BASIS,\r
15  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  *  See the License for the specific language governing permissions and\r
17  *  limitations under the License.\r
18  *  ============================LICENSE_END===========================================\r
19  */\r
20 \r
21 package org.openecomp.dcae.apod.analytics.model;\r
22 \r
23 import lombok.Data;\r
24 \r
25 import java.util.LinkedHashMap;\r
26 import java.util.Map;\r
27 \r
28 /**\r
29  * <p>\r
30  *     Base Dynamic Provider provide functionality so that all the\r
31  *     additional dynamic Properties can be accumalated in a map.\r
32  * </p>\r
33  *\r
34  * @author Rajiv Singla . Creation Date: 11/5/2016.\r
35  */\r
36 @Data\r
37 public abstract class BaseDynamicPropertiesProvider implements DynamicPropertiesProvider {\r
38 \r
39     /**\r
40      * All non-required properties should be captured in additional properties\r
41      *\r
42      * @param dynamicProperties Dynamic properties\r
43      * @return dynamic properties\r
44      */\r
45     private Map<String, Object> dynamicProperties = new LinkedHashMap<>();\r
46 \r
47 \r
48     /**\r
49      * Add a dynamic property to Common Event Format Entity\r
50      *\r
51      * @param propertyName property name\r
52      * @param propertyValue property value\r
53      */\r
54     @Override\r
55     public void addDynamicProperties(String propertyName, Object propertyValue) {\r
56         dynamicProperties.put(propertyName, propertyValue);\r
57     }\r
58 \r
59     /**\r
60      * Determines if dynamic properties are present for the CEF Entity\r
61      *\r
62      * @return return true if Dynamic Properties are present\r
63      */\r
64     public boolean isDynamicPropertiesPresent() {\r
65         return dynamicProperties.size() == 0;\r
66     }\r
67 \r
68 \r
69 }\r