2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
20 package org.onap.aai.domain.model;
22 import com.google.common.collect.Multimap;
24 import java.util.ArrayList;
28 public class AAIResource {
29 private AAIResource parent;
30 private AAIResources children;
32 private AAIResourceKeys aaiResourceKeys;
34 private String namespace; // /Network/Vces/Vce/PortGroups/PortGroup/CvlanTags/CvlanTag -> "Network"
36 private String resourceType; // node or container
37 private String resourceClassName;
38 private String simpleName; // Vce
39 private String fullName; // /Network/Vces/Vce/PortGroups/PortGroup/CvlanTags/CvlanTag
40 private String uri; // /network/vces/vce/{vnf-id}/port-groups/port-group/{interface-name}/cvlan-tags/cvlan-tag/{cvlan-tag}
41 private String apiVersion;
42 private String relationshipListClass;
43 private String relationshipUtils;
45 private Map<String, String> PropertyDataTypeMap;
46 private Multimap<String, String> NodeMapIndexedProps;
47 private Multimap<String, String> NodeAltKey1Props;
48 private Multimap<String, String> NodeDependencies;
49 private Multimap<String, String> NodeKeyProps;
50 private Multimap<String, String> NodeReqProps;
51 private Multimap<String, String> NodeNameProps;
52 private Multimap<String, String> NodeUniqueProps;
54 // if new dataTypes are added - make sure to update getAllFields() method below
55 private ArrayList<String> stringFields;
56 private ArrayList<String> stringListFields;
57 private ArrayList<String> longFields;
58 private ArrayList<String> intFields;
59 private ArrayList<String> shortFields;
60 private ArrayList<String> booleanFields;
62 private ArrayList<String> requiredFields;
63 private ArrayList<String> orderedFields;
64 private AAIResource recurseToResource;
65 private boolean allowDirectWrite;
66 private boolean allowDirectRead;
67 private ArrayList<String> autoGenUuidFields;
74 public AAIResource getParent() {
81 * @param parent the new parent
83 public void setParent(AAIResource parent) {
90 * @return the children
92 public AAIResources getChildren() {
93 if (this.children == null) {
94 this.children = new AAIResources();
100 * Gets the aai resource keys.
102 * @return the aai resource keys
104 public AAIResourceKeys getAaiResourceKeys() {
105 if (aaiResourceKeys == null) {
106 aaiResourceKeys = new AAIResourceKeys();
108 return aaiResourceKeys;
112 * Gets the namespace.
114 * @return the namespace
116 public String getNamespace() {
121 * Sets the namespace.
123 * @param namespace the new namespace
125 public void setNamespace(String namespace) {
126 this.namespace = namespace;
130 * Gets the resource type.
132 * @return the resource type
134 public String getResourceType() {
139 * Sets the resource type.
141 * @param resourceType the new resource type
143 public void setResourceType(String resourceType) {
144 this.resourceType = resourceType;
148 * Gets the simple name.
150 * @return the simple name
152 public String getSimpleName() {
157 * Sets the simple name.
159 * @param simpleName the new simple name
161 public void setSimpleName(String simpleName) {
162 this.simpleName = simpleName;
166 * Gets the full name.
168 * @return the full name
170 public String getFullName() {
175 * Sets the full name.
177 * @param fullName the new full name
179 public void setFullName(String fullName) {
180 this.fullName = fullName;
188 public String getUri() {
195 * @param uri the new uri
197 public void setUri(String uri) {
202 * Gets the resource class name.
204 * @return the resource class name
206 public String getResourceClassName() {
207 return resourceClassName;
211 * Sets the resource class name.
213 * @param resourceClassName the new resource class name
215 public void setResourceClassName(String resourceClassName) {
216 this.resourceClassName = resourceClassName;
220 * Gets the property data type map.
222 * @return the property data type map
224 public Map<String, String> getPropertyDataTypeMap() {
225 return PropertyDataTypeMap;
229 * Sets the property data type map.
231 * @param propertyDataTypeMap the property data type map
233 public void setPropertyDataTypeMap(Map<String, String> propertyDataTypeMap) {
234 PropertyDataTypeMap = propertyDataTypeMap;
238 * Gets the node map indexed props.
240 * @return the node map indexed props
242 public Multimap<String, String> getNodeMapIndexedProps() {
243 return NodeMapIndexedProps;
247 * Sets the node map indexed props.
249 * @param nodeMapIndexedProps the node map indexed props
251 public void setNodeMapIndexedProps(Multimap<String, String> nodeMapIndexedProps) {
252 NodeMapIndexedProps = nodeMapIndexedProps;
256 * Gets the node key props.
258 * @return the node key props
260 public Multimap<String, String> getNodeKeyProps() {
265 * Sets the node key props.
267 * @param nodeKeyProps the node key props
269 public void setNodeKeyProps(Multimap<String, String> nodeKeyProps) {
270 this.NodeKeyProps = nodeKeyProps;
274 * Gets the node name props.
276 * @return the node name props
278 public Multimap<String, String> getNodeNameProps() {
279 return NodeNameProps;
283 * Sets the node name props.
285 * @param nodeNameProps the node name props
287 public void setNodeNameProps(Multimap<String, String> nodeNameProps) {
289 NodeNameProps = nodeNameProps;
293 * Gets the node unique props.
295 * @return the node unique props
297 public Multimap<String, String> getNodeUniqueProps() {
298 return NodeUniqueProps;
302 * Sets the node unique props.
304 * @param nodeUniqueProps the node unique props
306 public void setNodeUniqueProps(Multimap<String, String> nodeUniqueProps) {
307 NodeUniqueProps = nodeUniqueProps;
311 * Gets the node req props.
313 * @return the node req props
315 public Multimap<String, String> getNodeReqProps() {
320 * Sets the node req props.
322 * @param nodeReqProps the node req props
324 public void setNodeReqProps(Multimap<String, String> nodeReqProps) {
325 NodeReqProps = nodeReqProps;
329 * Gets the api version.
331 * @return the api version
333 public String getApiVersion() {
338 * Sets the api version.
340 * @param apiVersion the new api version
342 public void setApiVersion(String apiVersion) {
343 this.apiVersion = apiVersion;
347 * Gets the relationship list class.
349 * @return the relationship list class
351 public String getRelationshipListClass() {
352 return relationshipListClass;
356 * Sets the relationship list class.
358 * @param relationshipListClass the new relationship list class
360 public void setRelationshipListClass(String relationshipListClass) {
361 this.relationshipListClass = relationshipListClass;
365 * Gets the relationship utils.
367 * @return the relationship utils
369 public String getRelationshipUtils() {
370 return relationshipUtils;
374 * Sets the relationship utils.
376 * @param relationshipUtils the new relationship utils
378 public void setRelationshipUtils(String relationshipUtils) {
379 this.relationshipUtils = relationshipUtils;
383 * Gets the string fields.
385 * @return the string fields
387 public ArrayList<String> getStringFields() {
388 if (this.stringFields == null) {
389 this.stringFields = new ArrayList<String>();
391 return this.stringFields;
395 * Sets the string fields.
397 * @param stringFields the new string fields
399 public void setStringFields(ArrayList<String> stringFields) {
400 this.stringFields = stringFields;
404 * Gets the string list fields.
406 * @return the string list fields
408 public ArrayList<String> getStringListFields() {
409 if (this.stringListFields == null) {
410 this.stringListFields = new ArrayList<String>();
412 return this.stringListFields;
416 * Sets the string list fields.
418 * @param stringListFields the new string list fields
420 public void setStringListFields(ArrayList<String> stringListFields) {
421 this.stringListFields = stringListFields;
425 * Gets the long fields.
427 * @return the long fields
429 public ArrayList<String> getLongFields() {
430 if (this.longFields == null) {
431 this.longFields = new ArrayList<String>();
437 * Sets the long fields.
439 * @param longFields the new long fields
441 public void setLongFields(ArrayList<String> longFields) {
442 this.longFields = longFields;
446 * Gets the int fields.
448 * @return the int fields
450 public ArrayList<String> getIntFields() {
451 if (this.intFields == null) {
452 this.intFields = new ArrayList<String>();
458 * Sets the int fields.
460 * @param intFields the new int fields
462 public void setIntFields(ArrayList<String> intFields) {
463 this.intFields = intFields;
467 * Gets the short fields.
469 * @return the short fields
471 public ArrayList<String> getShortFields() {
472 if (this.shortFields == null) {
473 this.shortFields = new ArrayList<String>();
479 * Sets the short fields.
481 * @param shortFields the new short fields
483 public void setShortFields(ArrayList<String> shortFields) {
484 this.shortFields = shortFields;
488 * Gets the boolean fields.
490 * @return the boolean fields
492 public ArrayList<String> getBooleanFields() {
493 if (this.booleanFields == null) {
494 this.booleanFields = new ArrayList<String>();
496 return booleanFields;
500 * Sets the boolean fields.
502 * @param booleanFields the new boolean fields
504 public void setBooleanFields(ArrayList<String> booleanFields) {
505 this.booleanFields = booleanFields;
509 * Gets the required fields.
511 * @return the required fields
513 public ArrayList<String> getRequiredFields() {
514 if (this.requiredFields == null) {
515 this.requiredFields = new ArrayList<String>();
517 return requiredFields;
521 * Sets the required fields.
523 * @param requiredFields the new required fields
525 public void setRequiredFields(ArrayList<String> requiredFields) {
526 this.requiredFields = requiredFields;
530 * Gets the ordered fields.
532 * @return the ordered fields
534 public ArrayList<String> getOrderedFields() {
535 if (this.orderedFields == null) {
536 this.orderedFields = new ArrayList<String>();
538 return this.orderedFields;
542 * Gets the all fields.
544 * @return the all fields
546 public ArrayList<String> getAllFields() {
548 ArrayList<String> allFields = new ArrayList<String>();
549 allFields.addAll(getBooleanFields());
550 allFields.addAll(getStringListFields());
551 allFields.addAll(getStringFields());
552 allFields.addAll(getIntFields());
553 allFields.addAll(getLongFields());
554 allFields.addAll(getShortFields());
560 * Gets the plural name.
562 * @return the plural name
564 public String getPluralName() {
566 if (simpleName.contains("List") || simpleName.contains("-list") )
568 String[] fullNameList = getFullName().split("/");
569 return fullNameList[fullNameList.length - 2];
573 * Sets the node alt key 1 props.
575 * @param _dbRulesNodeAltKey1Props the db rules node alt key 1 props
577 public void setNodeAltKey1Props(Multimap<String, String> _dbRulesNodeAltKey1Props) {
578 this.NodeAltKey1Props = _dbRulesNodeAltKey1Props;
582 * Gets the node alt key 1 props.
584 * @return the node alt key 1 props
586 public Multimap<String,String> getNodeAltKey1Props() {
587 return this.NodeAltKey1Props;
591 * Sets the node dependencies.
593 * @param _dbRulesNodeDependencies the db rules node dependencies
595 public void setNodeDependencies(Multimap<String, String> _dbRulesNodeDependencies) {
596 this.NodeDependencies = _dbRulesNodeDependencies;
600 * Gets the node dependencies.
602 * @return the node dependencies
604 public Multimap<String,String> getNodeDependencies() {
605 return this.NodeDependencies;
609 * Gets the recurse to resource.
611 * @return the recurse to resource
613 public AAIResource getRecurseToResource() {
614 return this.recurseToResource;
618 * Sets the recurse to resource.
620 * @param ancestor the new recurse to resource
622 public void setRecurseToResource(AAIResource ancestor) {
623 this.recurseToResource = ancestor;
628 * Sets the allow direct write.
630 * @param allowDirectWrite the new allow direct write
632 public void setAllowDirectWrite(boolean allowDirectWrite) {
633 this.allowDirectWrite = allowDirectWrite;
637 * Checks if is allow direct write.
639 * @return true, if is allow direct write
641 public boolean isAllowDirectWrite() {
642 return this.allowDirectWrite;
646 * Sets the allow direct read.
648 * @param allowDirectRead the new allow direct read
650 public void setAllowDirectRead(boolean allowDirectRead) {
651 this.allowDirectRead = allowDirectRead;
655 * Checks if is allow direct read.
657 * @return true, if is allow direct read
659 public boolean isAllowDirectRead() {
660 return this.allowDirectRead;
664 * Gets the auto gen uuid fields.
666 * @return the auto gen uuid fields
668 public ArrayList<String> getAutoGenUuidFields() {
669 if (this.autoGenUuidFields == null) {
670 this.autoGenUuidFields = new ArrayList<String>();
672 return this.autoGenUuidFields;