2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 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=========================================================
21 package org.openecomp.aai.domain.model;
23 import java.util.ArrayList;
26 import com.google.common.collect.Multimap;
29 public class AAIResource {
30 private AAIResource parent;
31 private AAIResources children;
33 private AAIResourceKeys aaiResourceKeys;
35 private String namespace; // /Network/Vces/Vce/PortGroups/PortGroup/CvlanTags/CvlanTag -> "Network"
37 private String resourceType; // node or container
38 private String resourceClassName;
39 private String simpleName; // Vce
40 private String fullName; // /Network/Vces/Vce/PortGroups/PortGroup/CvlanTags/CvlanTag
41 private String uri; // /network/vces/vce/{vnf-id}/port-groups/port-group/{interface-name}/cvlan-tags/cvlan-tag/{cvlan-tag}
42 private String apiVersion;
43 private String relationshipListClass;
44 private String relationshipUtils;
46 private Map<String, String> PropertyDataTypeMap;
47 private Multimap<String, String> NodeMapIndexedProps;
48 private Multimap<String, String> NodeAltKey1Props;
49 private Multimap<String, String> NodeDependencies;
50 private Multimap<String, String> NodeKeyProps;
51 private Multimap<String, String> NodeReqProps;
52 private Multimap<String, String> NodeNameProps;
53 private Multimap<String, String> NodeUniqueProps;
55 // if new dataTypes are added - make sure to update getAllFields() method below
56 private ArrayList<String> stringFields;
57 private ArrayList<String> stringListFields;
58 private ArrayList<String> longFields;
59 private ArrayList<String> intFields;
60 private ArrayList<String> shortFields;
61 private ArrayList<String> booleanFields;
63 private ArrayList<String> requiredFields;
64 private ArrayList<String> orderedFields;
65 private AAIResource recurseToResource;
66 private boolean allowDirectWrite;
67 private boolean allowDirectRead;
68 private ArrayList<String> autoGenUuidFields;
75 public AAIResource getParent() {
82 * @param parent the new parent
84 public void setParent(AAIResource parent) {
91 * @return the children
93 public AAIResources getChildren() {
94 if (this.children == null) {
95 this.children = new AAIResources();
101 * Gets the aai resource keys.
103 * @return the aai resource keys
105 public AAIResourceKeys getAaiResourceKeys() {
106 if (aaiResourceKeys == null) {
107 aaiResourceKeys = new AAIResourceKeys();
109 return aaiResourceKeys;
113 * Gets the namespace.
115 * @return the namespace
117 public String getNamespace() {
122 * Sets the namespace.
124 * @param namespace the new namespace
126 public void setNamespace(String namespace) {
127 this.namespace = namespace;
131 * Gets the resource type.
133 * @return the resource type
135 public String getResourceType() {
140 * Sets the resource type.
142 * @param resourceType the new resource type
144 public void setResourceType(String resourceType) {
145 this.resourceType = resourceType;
149 * Gets the simple name.
151 * @return the simple name
153 public String getSimpleName() {
158 * Sets the simple name.
160 * @param simpleName the new simple name
162 public void setSimpleName(String simpleName) {
163 this.simpleName = simpleName;
167 * Gets the full name.
169 * @return the full name
171 public String getFullName() {
176 * Sets the full name.
178 * @param fullName the new full name
180 public void setFullName(String fullName) {
181 this.fullName = fullName;
189 public String getUri() {
196 * @param uri the new uri
198 public void setUri(String uri) {
203 * Gets the resource class name.
205 * @return the resource class name
207 public String getResourceClassName() {
208 return resourceClassName;
212 * Sets the resource class name.
214 * @param resourceClassName the new resource class name
216 public void setResourceClassName(String resourceClassName) {
217 this.resourceClassName = resourceClassName;
221 * Gets the property data type map.
223 * @return the property data type map
225 public Map<String, String> getPropertyDataTypeMap() {
226 return PropertyDataTypeMap;
230 * Sets the property data type map.
232 * @param propertyDataTypeMap the property data type map
234 public void setPropertyDataTypeMap(Map<String, String> propertyDataTypeMap) {
235 PropertyDataTypeMap = propertyDataTypeMap;
239 * Gets the node map indexed props.
241 * @return the node map indexed props
243 public Multimap<String, String> getNodeMapIndexedProps() {
244 return NodeMapIndexedProps;
248 * Sets the node map indexed props.
250 * @param nodeMapIndexedProps the node map indexed props
252 public void setNodeMapIndexedProps(Multimap<String, String> nodeMapIndexedProps) {
253 NodeMapIndexedProps = nodeMapIndexedProps;
257 * Gets the node key props.
259 * @return the node key props
261 public Multimap<String, String> getNodeKeyProps() {
266 * Sets the node key props.
268 * @param nodeKeyProps the node key props
270 public void setNodeKeyProps(Multimap<String, String> nodeKeyProps) {
271 this.NodeKeyProps = nodeKeyProps;
275 * Gets the node name props.
277 * @return the node name props
279 public Multimap<String, String> getNodeNameProps() {
280 return NodeNameProps;
284 * Sets the node name props.
286 * @param nodeNameProps the node name props
288 public void setNodeNameProps(Multimap<String, String> nodeNameProps) {
290 NodeNameProps = nodeNameProps;
294 * Gets the node unique props.
296 * @return the node unique props
298 public Multimap<String, String> getNodeUniqueProps() {
299 return NodeUniqueProps;
303 * Sets the node unique props.
305 * @param nodeUniqueProps the node unique props
307 public void setNodeUniqueProps(Multimap<String, String> nodeUniqueProps) {
308 NodeUniqueProps = nodeUniqueProps;
312 * Gets the node req props.
314 * @return the node req props
316 public Multimap<String, String> getNodeReqProps() {
321 * Sets the node req props.
323 * @param nodeReqProps the node req props
325 public void setNodeReqProps(Multimap<String, String> nodeReqProps) {
326 NodeReqProps = nodeReqProps;
330 * Gets the api version.
332 * @return the api version
334 public String getApiVersion() {
339 * Sets the api version.
341 * @param apiVersion the new api version
343 public void setApiVersion(String apiVersion) {
344 this.apiVersion = apiVersion;
348 * Gets the relationship list class.
350 * @return the relationship list class
352 public String getRelationshipListClass() {
353 return relationshipListClass;
357 * Sets the relationship list class.
359 * @param relationshipListClass the new relationship list class
361 public void setRelationshipListClass(String relationshipListClass) {
362 this.relationshipListClass = relationshipListClass;
366 * Gets the relationship utils.
368 * @return the relationship utils
370 public String getRelationshipUtils() {
371 return relationshipUtils;
375 * Sets the relationship utils.
377 * @param relationshipUtils the new relationship utils
379 public void setRelationshipUtils(String relationshipUtils) {
380 this.relationshipUtils = relationshipUtils;
384 * Gets the string fields.
386 * @return the string fields
388 public ArrayList<String> getStringFields() {
389 if (this.stringFields == null) {
390 this.stringFields = new ArrayList<String>();
392 return this.stringFields;
396 * Sets the string fields.
398 * @param stringFields the new string fields
400 public void setStringFields(ArrayList<String> stringFields) {
401 this.stringFields = stringFields;
405 * Gets the string list fields.
407 * @return the string list fields
409 public ArrayList<String> getStringListFields() {
410 if (this.stringListFields == null) {
411 this.stringListFields = new ArrayList<String>();
413 return this.stringListFields;
417 * Sets the string list fields.
419 * @param stringListFields the new string list fields
421 public void setStringListFields(ArrayList<String> stringListFields) {
422 this.stringListFields = stringListFields;
426 * Gets the long fields.
428 * @return the long fields
430 public ArrayList<String> getLongFields() {
431 if (this.longFields == null) {
432 this.longFields = new ArrayList<String>();
438 * Sets the long fields.
440 * @param longFields the new long fields
442 public void setLongFields(ArrayList<String> longFields) {
443 this.longFields = longFields;
447 * Gets the int fields.
449 * @return the int fields
451 public ArrayList<String> getIntFields() {
452 if (this.intFields == null) {
453 this.intFields = new ArrayList<String>();
459 * Sets the int fields.
461 * @param intFields the new int fields
463 public void setIntFields(ArrayList<String> intFields) {
464 this.intFields = intFields;
468 * Gets the short fields.
470 * @return the short fields
472 public ArrayList<String> getShortFields() {
473 if (this.shortFields == null) {
474 this.shortFields = new ArrayList<String>();
480 * Sets the short fields.
482 * @param shortFields the new short fields
484 public void setShortFields(ArrayList<String> shortFields) {
485 this.shortFields = shortFields;
489 * Gets the boolean fields.
491 * @return the boolean fields
493 public ArrayList<String> getBooleanFields() {
494 if (this.booleanFields == null) {
495 this.booleanFields = new ArrayList<String>();
497 return booleanFields;
501 * Sets the boolean fields.
503 * @param booleanFields the new boolean fields
505 public void setBooleanFields(ArrayList<String> booleanFields) {
506 this.booleanFields = booleanFields;
510 * Gets the required fields.
512 * @return the required fields
514 public ArrayList<String> getRequiredFields() {
515 if (this.requiredFields == null) {
516 this.requiredFields = new ArrayList<String>();
518 return requiredFields;
522 * Sets the required fields.
524 * @param requiredFields the new required fields
526 public void setRequiredFields(ArrayList<String> requiredFields) {
527 this.requiredFields = requiredFields;
531 * Gets the ordered fields.
533 * @return the ordered fields
535 public ArrayList<String> getOrderedFields() {
536 if (this.orderedFields == null) {
537 this.orderedFields = new ArrayList<String>();
539 return this.orderedFields;
543 * Gets the all fields.
545 * @return the all fields
547 public ArrayList<String> getAllFields() {
549 ArrayList<String> allFields = new ArrayList<String>();
550 allFields.addAll(getBooleanFields());
551 allFields.addAll(getStringListFields());
552 allFields.addAll(getStringFields());
553 allFields.addAll(getIntFields());
554 allFields.addAll(getLongFields());
555 allFields.addAll(getShortFields());
561 * Gets the plural name.
563 * @return the plural name
565 public String getPluralName() {
567 if (simpleName.contains("List") || simpleName.contains("-list") )
569 String[] fullNameList = getFullName().split("/");
570 return fullNameList[fullNameList.length - 2];
574 * Sets the node alt key 1 props.
576 * @param _dbRulesNodeAltKey1Props the db rules node alt key 1 props
578 public void setNodeAltKey1Props(Multimap<String, String> _dbRulesNodeAltKey1Props) {
579 this.NodeAltKey1Props = _dbRulesNodeAltKey1Props;
583 * Gets the node alt key 1 props.
585 * @return the node alt key 1 props
587 public Multimap<String,String> getNodeAltKey1Props() {
588 return this.NodeAltKey1Props;
592 * Sets the node dependencies.
594 * @param _dbRulesNodeDependencies the db rules node dependencies
596 public void setNodeDependencies(Multimap<String, String> _dbRulesNodeDependencies) {
597 this.NodeDependencies = _dbRulesNodeDependencies;
601 * Gets the node dependencies.
603 * @return the node dependencies
605 public Multimap<String,String> getNodeDependencies() {
606 return this.NodeDependencies;
610 * Gets the recurse to resource.
612 * @return the recurse to resource
614 public AAIResource getRecurseToResource() {
615 return this.recurseToResource;
619 * Sets the recurse to resource.
621 * @param ancestor the new recurse to resource
623 public void setRecurseToResource(AAIResource ancestor) {
624 this.recurseToResource = ancestor;
629 * Sets the allow direct write.
631 * @param allowDirectWrite the new allow direct write
633 public void setAllowDirectWrite(boolean allowDirectWrite) {
634 this.allowDirectWrite = allowDirectWrite;
638 * Checks if is allow direct write.
640 * @return true, if is allow direct write
642 public boolean isAllowDirectWrite() {
643 return this.allowDirectWrite;
647 * Sets the allow direct read.
649 * @param allowDirectRead the new allow direct read
651 public void setAllowDirectRead(boolean allowDirectRead) {
652 this.allowDirectRead = allowDirectRead;
656 * Checks if is allow direct read.
658 * @return true, if is allow direct read
660 public boolean isAllowDirectRead() {
661 return this.allowDirectRead;
665 * Gets the auto gen uuid fields.
667 * @return the auto gen uuid fields
669 public ArrayList<String> getAutoGenUuidFields() {
670 if (this.autoGenUuidFields == null) {
671 this.autoGenUuidFields = new ArrayList<String>();
673 return this.autoGenUuidFields;