Initial commit for AAI-UI(sparky-backend)
[aai/sparky-be.git] / src / main / java / org / openecomp / sparky / config / oxm / OxmEntityDescriptor.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.config.oxm;
27
28 import java.util.List;
29
30 import org.openecomp.sparky.synchronizer.entity.SuggestionSearchEntity;
31
32 /**
33  * The Class OxmEntityDescriptor.
34  */
35 public class OxmEntityDescriptor {
36
37   private String entityName;
38
39   private List<String> primaryKeyAttributeName;
40
41   private List<String> searchableAttributes;
42
43   private CrossEntityReference crossEntityReference;
44
45   private String geoLatName;
46
47   private String geoLongName;
48   
49   private SuggestionSearchEntity suggestionSearchEntity;
50
51   public String getEntityName() {
52     return entityName;
53   }
54
55   public void setEntityName(String entityName) {
56     this.entityName = entityName;
57   }
58
59   public List<String> getPrimaryKeyAttributeName() {
60     return primaryKeyAttributeName;
61   }
62
63   public void setPrimaryKeyAttributeName(List<String> primaryKeyAttributeName) {
64     this.primaryKeyAttributeName = primaryKeyAttributeName;
65   }
66
67   public List<String> getSearchableAttributes() {
68     return searchableAttributes;
69   }
70
71   public void setSearchableAttributes(List<String> searchableAttributes) {
72     this.searchableAttributes = searchableAttributes;
73   }
74
75   /**
76    * Checks for searchable attributes.
77    *
78    * @return true, if successful
79    */
80   public boolean hasSearchableAttributes() {
81
82     if (this.searchableAttributes == null) {
83       return false;
84     }
85
86     if (this.searchableAttributes.size() > 0) {
87       return true;
88     }
89
90     return false;
91
92   }
93
94   public CrossEntityReference getCrossEntityReference() {
95     return crossEntityReference;
96   }
97
98   public void setCrossEntityReference(CrossEntityReference crossEntityReference) {
99     this.crossEntityReference = crossEntityReference;
100   }
101
102   /**
103    * Checks for cross entity references.
104    *
105    * @return true, if successful
106    */
107   public boolean hasCrossEntityReferences() {
108     if (this.crossEntityReference == null) {
109       return false;
110     }
111     if (!this.crossEntityReference.getReferenceAttributes().isEmpty()) {
112       return true;
113     }
114     return false;
115   }
116
117   public String getGeoLatName() {
118     return geoLatName;
119   }
120
121   public void setGeoLatName(String geoLatName) {
122     this.geoLatName = geoLatName;
123   }
124
125   public String getGeoLongName() {
126     return geoLongName;
127   }
128
129   public void setGeoLongName(String geoLongName) {
130     this.geoLongName = geoLongName;
131   }
132
133   /**
134    * Checks for geo entity.
135    *
136    * @return true, if successful
137    */
138   public boolean hasGeoEntity() {
139
140     if (this.geoLongName != null && this.geoLatName != null) {
141       return true;
142     }
143
144     return false;
145
146   }
147   
148   public SuggestionSearchEntity getSuggestionSearchEntity() {
149     return this.suggestionSearchEntity;
150   }
151   
152   public void setSuggestionSearchEntity(SuggestionSearchEntity suggestionSearchEntity) {
153     this.suggestionSearchEntity = suggestionSearchEntity;
154   }
155   
156   /**
157    * Checks for non-null, populated SuggestionSearchEntity.
158    *
159    * @return true, if successful
160    */
161   public boolean hasSuggestionSearchEntity() {
162     if (this.suggestionSearchEntity == null) {
163       return false;
164     }
165     if (!this.suggestionSearchEntity.getSuggestionConnectorWords().isEmpty()) {
166       return true;
167     }
168     return false;
169   }
170   
171   @Override
172   public String toString() {
173     return "OxmEntityDescriptor [entityName=" + entityName + ", primaryKeyAttributeName="
174         + primaryKeyAttributeName + ", searchableAttributes=" + searchableAttributes
175         + ", crossEntityReference=" + crossEntityReference + ", geoLatName=" + geoLatName
176         + ", geoLongName=" + geoLongName + ", suggestionSearchEntity=" + suggestionSearchEntity
177         + "]";
178   }
179 }