Changing the license and trademark
[aai/sparky-be.git] / src / main / java / org / openecomp / sparky / viewandinspect / config / VisualizationConfig.java
1 /**
2  * ============LICENSE_START=======================================================
3  * org.onap.aai
4  * ================================================================================
5  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
6  * Copyright © 2017 Amdocs
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  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23 package org.openecomp.sparky.viewandinspect.config;
24
25 import java.util.Properties;
26
27 import org.openecomp.sparky.util.ConfigHelper;
28
29 /**
30  * The Class VisualizationConfig.
31  */
32 public class VisualizationConfig {
33
34   private int maxSelfLinkTraversalDepth;
35
36   private boolean visualizationDebugEnabled;
37
38   private String aaiEntityNodeDescriptors;
39
40   private String generalNodeClassName;
41
42   private String searchNodeClassName;
43
44   private String selectedSearchedNodeClassName;
45
46   private String entityTypesToSummarize;
47   private String vnfEntityTypes;
48
49   private boolean makeAllNeighborsBidirectional;
50
51   private static VisualizationConfig instance;
52
53   public static VisualizationConfig getConfig() {
54
55     if (instance == null) {
56       instance = new VisualizationConfig();
57     }
58
59     return instance;
60
61   }
62
63   /**
64    * Instantiates a new visualization config.
65    */
66   public VisualizationConfig() {
67
68     Properties visualizationProps =
69         ConfigHelper.loadConfigFromExplicitPath(TierSupportUiConstants.STATIC_CONFIG_APP_LOCATION
70             + TierSupportUiConstants.FILESEP + "visualization.properties");
71
72     maxSelfLinkTraversalDepth =
73         Integer.parseInt(visualizationProps.getProperty("maxSelfLinkTraversalDepth", "2"));
74     visualizationDebugEnabled =
75         Boolean.parseBoolean(visualizationProps.getProperty("visualizationDebugEnabled", "false"));
76     aaiEntityNodeDescriptors = visualizationProps.getProperty("aaiEntityNodeDescriptors", null);
77     generalNodeClassName =
78         visualizationProps.getProperty("generalNodeClassName", "unknownClassName");
79     searchNodeClassName =
80         visualizationProps.getProperty("searchedNodeClassName", "unknownClassName");
81     selectedSearchedNodeClassName =
82         visualizationProps.getProperty("selectedSearchedNodeClassName", "unknownClassName");
83
84     entityTypesToSummarize = visualizationProps.getProperty("entityTypesToSummarize",
85         "customer,service-instance,complex,pserver,vserver,vnf");
86
87     vnfEntityTypes = visualizationProps.getProperty("vnfEntityTypes", "generic-vnf,newvce,vce,vpe");
88
89     makeAllNeighborsBidirectional = Boolean
90         .parseBoolean(visualizationProps.getProperty("makeAllNeighborsBidirectional", "false"));
91
92   }
93
94
95
96   /**
97    * Make all neighbors bidirectional.
98    *
99    * @return true, if successful
100    */
101   public boolean makeAllNeighborsBidirectional() {
102     return makeAllNeighborsBidirectional;
103   }
104
105   public void setMakeAllNeighborsBidirectional(boolean makeAllNeighborsBidirectional) {
106     this.makeAllNeighborsBidirectional = makeAllNeighborsBidirectional;
107   }
108
109   public String getSelectedSearchedNodeClassName() {
110     return selectedSearchedNodeClassName;
111   }
112
113   public void setSelectedSearchedNodeClassName(String selectedSearchedNodeClassName) {
114     this.selectedSearchedNodeClassName = selectedSearchedNodeClassName;
115   }
116
117   public String getGeneralNodeClassName() {
118     return generalNodeClassName;
119   }
120
121   public void setGeneralNodeClassName(String generalNodeClassName) {
122     this.generalNodeClassName = generalNodeClassName;
123   }
124
125   public String getSearchNodeClassName() {
126     return searchNodeClassName;
127   }
128
129   public void setSearchNodeClassName(String searchNodeClassName) {
130     this.searchNodeClassName = searchNodeClassName;
131   }
132
133   public String getAaiEntityNodeDescriptors() {
134     return aaiEntityNodeDescriptors;
135   }
136
137   public void setAaiEntityNodeDescriptors(String aaiEntityNodeDescriptors) {
138     this.aaiEntityNodeDescriptors = aaiEntityNodeDescriptors;
139   }
140
141   public boolean isVisualizationDebugEnabled() {
142     return visualizationDebugEnabled;
143   }
144
145   public void setVisualizationDebugEnabled(boolean visualizationDebugEnabled) {
146     this.visualizationDebugEnabled = visualizationDebugEnabled;
147   }
148
149   public void setMaxSelfLinkTraversalDepth(int maxSelfLinkTraversalDepth) {
150     this.maxSelfLinkTraversalDepth = maxSelfLinkTraversalDepth;
151   }
152
153   public int getMaxSelfLinkTraversalDepth() {
154     return maxSelfLinkTraversalDepth;
155   }
156
157   public String getEntityTypesToSummarize() {
158     return entityTypesToSummarize;
159   }
160
161   public void setEntityTypesToSummarize(String entityTypesToSummarize) {
162     this.entityTypesToSummarize = entityTypesToSummarize;
163   }
164
165   public String getVnfEntityTypes() {
166     return vnfEntityTypes;
167   }
168
169   public void setVnfEntityTypes(String vnfEntityTypes) {
170     this.vnfEntityTypes = vnfEntityTypes;
171   }
172
173   @Override
174   public String toString() {
175     return "VisualizationConfig [maxSelfLinkTraversalDepth=" + maxSelfLinkTraversalDepth
176         + ", visualizationDebugEnabled=" + visualizationDebugEnabled + ", "
177         + (aaiEntityNodeDescriptors != null
178             ? "aaiEntityNodeDescriptors=" + aaiEntityNodeDescriptors + ", " : "")
179         + (generalNodeClassName != null ? "generalNodeClassName=" + generalNodeClassName + ", "
180             : "")
181         + (searchNodeClassName != null ? "searchNodeClassName=" + searchNodeClassName + ", " : "")
182         + (selectedSearchedNodeClassName != null
183             ? "selectedSearchedNodeClassName=" + selectedSearchedNodeClassName + ", " : "")
184         + (entityTypesToSummarize != null
185             ? "entityTypesToSummarize=" + entityTypesToSummarize + ", " : "")
186         + (vnfEntityTypes != null ? "vnfEntityTypes=" + vnfEntityTypes + ", " : "")
187         + "makeAllNeighborsBidirectional=" + makeAllNeighborsBidirectional + "]";
188   }
189
190   /* (non-Javadoc)
191    * @see java.lang.Object#toString()
192    */
193
194
195
196 }