Initial commit for AAI-UI(sparky-backend)
[aai/sparky-be.git] / src / main / java / org / openecomp / sparky / viewandinspect / config / VisualizationConfig.java
1 /**
2  * ============LICENSE_START===================================================
3  * SPARKY (AAI UI service)
4  * ============================================================================
5  * Copyright © 2017 AT&T Intellectual Property.
6  * Copyright © 2017 Amdocs
7  * All rights reserved.
8  * ============================================================================
9  * Licensed under the Apache License, Version 2.0 (the "License");
10  * you may not use this file except in compliance with the License.
11  * You may obtain a copy of the License at
12  *
13  *      http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing, software
16  * distributed under the License is distributed on an "AS IS" BASIS,
17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18  * See the License for the specific language governing permissions and
19  * limitations under the License.
20  * ============LICENSE_END=====================================================
21  *
22  * ECOMP and OpenECOMP are trademarks
23  * and service marks of AT&T Intellectual Property.
24  */
25
26 package org.openecomp.sparky.viewandinspect.config;
27
28 import java.util.Properties;
29
30 import org.openecomp.sparky.util.ConfigHelper;
31
32 /**
33  * The Class VisualizationConfig.
34  */
35 public class VisualizationConfig {
36
37   private int maxSelfLinkTraversalDepth;
38
39   private boolean visualizationDebugEnabled;
40
41   private String aaiEntityNodeDescriptors;
42
43   private String generalNodeClassName;
44
45   private String searchNodeClassName;
46
47   private String selectedSearchedNodeClassName;
48
49   private String entityTypesToSummarize;
50   private String vnfEntityTypes;
51
52   private boolean makeAllNeighborsBidirectional;
53
54   private static VisualizationConfig instance;
55
56   public static VisualizationConfig getConfig() {
57
58     if (instance == null) {
59       instance = new VisualizationConfig();
60     }
61
62     return instance;
63
64   }
65
66   /**
67    * Instantiates a new visualization config.
68    */
69   public VisualizationConfig() {
70
71     Properties visualizationProps =
72         ConfigHelper.loadConfigFromExplicitPath(TierSupportUiConstants.STATIC_CONFIG_APP_LOCATION
73             + TierSupportUiConstants.FILESEP + "visualization.properties");
74
75     maxSelfLinkTraversalDepth =
76         Integer.parseInt(visualizationProps.getProperty("maxSelfLinkTraversalDepth", "2"));
77     visualizationDebugEnabled =
78         Boolean.parseBoolean(visualizationProps.getProperty("visualizationDebugEnabled", "false"));
79     aaiEntityNodeDescriptors = visualizationProps.getProperty("aaiEntityNodeDescriptors", null);
80     generalNodeClassName =
81         visualizationProps.getProperty("generalNodeClassName", "unknownClassName");
82     searchNodeClassName =
83         visualizationProps.getProperty("searchedNodeClassName", "unknownClassName");
84     selectedSearchedNodeClassName =
85         visualizationProps.getProperty("selectedSearchedNodeClassName", "unknownClassName");
86
87     entityTypesToSummarize = visualizationProps.getProperty("entityTypesToSummarize",
88         "customer,service-instance,complex,pserver,vserver,vnf");
89
90     vnfEntityTypes = visualizationProps.getProperty("vnfEntityTypes", "generic-vnf,newvce,vce,vpe");
91
92     makeAllNeighborsBidirectional = Boolean
93         .parseBoolean(visualizationProps.getProperty("makeAllNeighborsBidirectional", "false"));
94
95   }
96
97
98
99   /**
100    * Make all neighbors bidirectional.
101    *
102    * @return true, if successful
103    */
104   public boolean makeAllNeighborsBidirectional() {
105     return makeAllNeighborsBidirectional;
106   }
107
108   public void setMakeAllNeighborsBidirectional(boolean makeAllNeighborsBidirectional) {
109     this.makeAllNeighborsBidirectional = makeAllNeighborsBidirectional;
110   }
111
112   public String getSelectedSearchedNodeClassName() {
113     return selectedSearchedNodeClassName;
114   }
115
116   public void setSelectedSearchedNodeClassName(String selectedSearchedNodeClassName) {
117     this.selectedSearchedNodeClassName = selectedSearchedNodeClassName;
118   }
119
120   public String getGeneralNodeClassName() {
121     return generalNodeClassName;
122   }
123
124   public void setGeneralNodeClassName(String generalNodeClassName) {
125     this.generalNodeClassName = generalNodeClassName;
126   }
127
128   public String getSearchNodeClassName() {
129     return searchNodeClassName;
130   }
131
132   public void setSearchNodeClassName(String searchNodeClassName) {
133     this.searchNodeClassName = searchNodeClassName;
134   }
135
136   public String getAaiEntityNodeDescriptors() {
137     return aaiEntityNodeDescriptors;
138   }
139
140   public void setAaiEntityNodeDescriptors(String aaiEntityNodeDescriptors) {
141     this.aaiEntityNodeDescriptors = aaiEntityNodeDescriptors;
142   }
143
144   public boolean isVisualizationDebugEnabled() {
145     return visualizationDebugEnabled;
146   }
147
148   public void setVisualizationDebugEnabled(boolean visualizationDebugEnabled) {
149     this.visualizationDebugEnabled = visualizationDebugEnabled;
150   }
151
152   public void setMaxSelfLinkTraversalDepth(int maxSelfLinkTraversalDepth) {
153     this.maxSelfLinkTraversalDepth = maxSelfLinkTraversalDepth;
154   }
155
156   public int getMaxSelfLinkTraversalDepth() {
157     return maxSelfLinkTraversalDepth;
158   }
159
160   public String getEntityTypesToSummarize() {
161     return entityTypesToSummarize;
162   }
163
164   public void setEntityTypesToSummarize(String entityTypesToSummarize) {
165     this.entityTypesToSummarize = entityTypesToSummarize;
166   }
167
168   public String getVnfEntityTypes() {
169     return vnfEntityTypes;
170   }
171
172   public void setVnfEntityTypes(String vnfEntityTypes) {
173     this.vnfEntityTypes = vnfEntityTypes;
174   }
175
176   @Override
177   public String toString() {
178     return "VisualizationConfig [maxSelfLinkTraversalDepth=" + maxSelfLinkTraversalDepth
179         + ", visualizationDebugEnabled=" + visualizationDebugEnabled + ", "
180         + (aaiEntityNodeDescriptors != null
181             ? "aaiEntityNodeDescriptors=" + aaiEntityNodeDescriptors + ", " : "")
182         + (generalNodeClassName != null ? "generalNodeClassName=" + generalNodeClassName + ", "
183             : "")
184         + (searchNodeClassName != null ? "searchNodeClassName=" + searchNodeClassName + ", " : "")
185         + (selectedSearchedNodeClassName != null
186             ? "selectedSearchedNodeClassName=" + selectedSearchedNodeClassName + ", " : "")
187         + (entityTypesToSummarize != null
188             ? "entityTypesToSummarize=" + entityTypesToSummarize + ", " : "")
189         + (vnfEntityTypes != null ? "vnfEntityTypes=" + vnfEntityTypes + ", " : "")
190         + "makeAllNeighborsBidirectional=" + makeAllNeighborsBidirectional + "]";
191   }
192
193   /* (non-Javadoc)
194    * @see java.lang.Object#toString()
195    */
196
197
198
199 }