aboutsummaryrefslogtreecommitdiffstats
path: root/ajsc-aai/src/main/java/org/openecomp/aai/domain/model/AAIResource.java
blob: c6efbb3f718fec97a2ce28c0c93251493b9882b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
/*-
 * ============LICENSE_START=======================================================
 * org.openecomp.aai
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

package org.openecomp.aai.domain.model;

import java.util.ArrayList;
import java.util.Map;

import com.google.common.collect.Multimap;


public class AAIResource {
	private AAIResource parent;
	private AAIResources children;
		
	private AAIResourceKeys aaiResourceKeys;
	
	private String namespace; // /Network/Vces/Vce/PortGroups/PortGroup/CvlanTags/CvlanTag -> "Network"

	private String resourceType; // node or container
	private String resourceClassName; // (dynamic entity)
	private String simpleName; // Vce
	private String fullName; // /Network/Vces/Vce/PortGroups/PortGroup/CvlanTags/CvlanTag
	private String uri; // /network/vces/vce/{vnf-id}/port-groups/port-group/{interface-name}/cvlan-tags/cvlan-tag/{cvlan-tag}
	private String apiVersion;
	private String relationshipListClass;
	private String relationshipUtils;
	
	private Map<String, String>      PropertyDataTypeMap; 
	private Multimap<String, String> NodeMapIndexedProps;
	private Multimap<String, String> NodeAltKey1Props;
	private Multimap<String, String> NodeDependencies;
	private Multimap<String, String> NodeKeyProps;
	private Multimap<String, String> NodeReqProps;
	private Multimap<String, String> NodeNameProps;
	private Multimap<String, String> NodeUniqueProps;
	
	// if new dataTypes are added - make sure to update getAllFields() method below
	private ArrayList<String> stringFields;
	private ArrayList<String> stringListFields;
	private ArrayList<String> longFields;
	private ArrayList<String> intFields;
	private ArrayList<String> shortFields;
	private ArrayList<String> booleanFields;
		
	private ArrayList<String> requiredFields;
	private ArrayList<String> orderedFields;
	private AAIResource recurseToResource;
	private boolean allowDirectWrite;
	private boolean allowDirectRead;
	private ArrayList<String> autoGenUuidFields;
	
	/**
	 * Gets the parent.
	 *
	 * @return the parent
	 */
	public AAIResource getParent() {
		return parent;
	}
	
	/**
	 * Sets the parent.
	 *
	 * @param parent the new parent
	 */
	public void setParent(AAIResource parent) {
		this.parent = parent;
	}
	
	/**
	 * Gets the children.
	 *
	 * @return the children
	 */
	public AAIResources getChildren() { 
		if (this.children == null) { 
			this.children = new AAIResources();
		}
		return this.children;
	}
	
	/**
	 * Gets the aai resource keys.
	 *
	 * @return the aai resource keys
	 */
	public AAIResourceKeys getAaiResourceKeys() {
		if (aaiResourceKeys == null) {
			aaiResourceKeys = new AAIResourceKeys();
		}
		return aaiResourceKeys;
	}
	
	/**
	 * Gets the namespace.
	 *
	 * @return the namespace
	 */
	public String getNamespace() {
		return namespace;
	}
	
	/**
	 * Sets the namespace.
	 *
	 * @param namespace the new namespace
	 */
	public void setNamespace(String namespace) {
		this.namespace = namespace;
	}
	
	/**
	 * Gets the resource type.
	 *
	 * @return the resource type
	 */
	public String getResourceType() {
		return resourceType;
	}
	
	/**
	 * Sets the resource type.
	 *
	 * @param resourceType the new resource type
	 */
	public void setResourceType(String resourceType) {
		this.resourceType = resourceType;
	}
	
	/**
	 * Gets the simple name.
	 *
	 * @return the simple name
	 */
	public String getSimpleName() {
		return simpleName;
	}
	
	/**
	 * Sets the simple name.
	 *
	 * @param simpleName the new simple name
	 */
	public void setSimpleName(String simpleName) {
		this.simpleName = simpleName;
	}
	
	/**
	 * Gets the full name.
	 *
	 * @return the full name
	 */
	public String getFullName() {
		return fullName;
	}
	
	/**
	 * Sets the full name.
	 *
	 * @param fullName the new full name
	 */
	public void setFullName(String fullName) {
		this.fullName = fullName;
	}
	
	/**
	 * Gets the uri.
	 *
	 * @return the uri
	 */
	public String getUri() {
		return uri;
	}
	
	/**
	 * Sets the uri.
	 *
	 * @param uri the new uri
	 */
	public void setUri(String uri) {
		this.uri = uri;
	}
	
	/**
	 * Gets the resource class name.
	 *
	 * @return the resource class name
	 */
	public String getResourceClassName() {
		return resourceClassName;
	}
	
	/**
	 * Sets the resource class name.
	 *
	 * @param resourceClassName the new resource class name
	 */
	public void setResourceClassName(String resourceClassName) {
		this.resourceClassName = resourceClassName;
	}

	/**
	 * Gets the property data type map.
	 *
	 * @return the property data type map
	 */
	public Map<String, String> getPropertyDataTypeMap() {
		return PropertyDataTypeMap;
	}
	
	/**
	 * Sets the property data type map.
	 *
	 * @param propertyDataTypeMap the property data type map
	 */
	public void setPropertyDataTypeMap(Map<String, String> propertyDataTypeMap) {
		PropertyDataTypeMap = propertyDataTypeMap;
	}
	
	/**
	 * Gets the node map indexed props.
	 *
	 * @return the node map indexed props
	 */
	public Multimap<String, String> getNodeMapIndexedProps() {
		return NodeMapIndexedProps;
	}
	
	/**
	 * Sets the node map indexed props.
	 *
	 * @param nodeMapIndexedProps the node map indexed props
	 */
	public void setNodeMapIndexedProps(Multimap<String, String> nodeMapIndexedProps) {
		NodeMapIndexedProps = nodeMapIndexedProps;
	}
	
	/**
	 * Gets the node key props.
	 *
	 * @return the node key props
	 */
	public Multimap<String, String> getNodeKeyProps() {	
		return NodeKeyProps;
	}
	
	/**
	 * Sets the node key props.
	 *
	 * @param nodeKeyProps the node key props
	 */
	public void setNodeKeyProps(Multimap<String, String> nodeKeyProps) {
		this.NodeKeyProps = nodeKeyProps;
	}
	
	/**
	 * Gets the node name props.
	 *
	 * @return the node name props
	 */
	public Multimap<String, String> getNodeNameProps() {
		return NodeNameProps;
	}
	
	/**
	 * Sets the node name props.
	 *
	 * @param nodeNameProps the node name props
	 */
	public void setNodeNameProps(Multimap<String, String> nodeNameProps) {
	
		NodeNameProps = nodeNameProps;
	}
	
	/**
	 * Gets the node unique props.
	 *
	 * @return the node unique props
	 */
	public Multimap<String, String> getNodeUniqueProps() {
		return NodeUniqueProps;
	}
	
	/**
	 * Sets the node unique props.
	 *
	 * @param nodeUniqueProps the node unique props
	 */
	public void setNodeUniqueProps(Multimap<String, String> nodeUniqueProps) {
		NodeUniqueProps = nodeUniqueProps;
	}
	
	/**
	 * Gets the node req props.
	 *
	 * @return the node req props
	 */
	public Multimap<String, String> getNodeReqProps() {
		return NodeReqProps;
	}
	
	/**
	 * Sets the node req props.
	 *
	 * @param nodeReqProps the node req props
	 */
	public void setNodeReqProps(Multimap<String, String> nodeReqProps) {
		NodeReqProps = nodeReqProps;
	}
	
	/**
	 * Gets the api version.
	 *
	 * @return the api version
	 */
	public String getApiVersion() {
		return apiVersion;
	}
	
	/**
	 * Sets the api version.
	 *
	 * @param apiVersion the new api version
	 */
	public void setApiVersion(String apiVersion) {
		this.apiVersion = apiVersion;
	}
	
	/**
	 * Gets the relationship list class.
	 *
	 * @return the relationship list class
	 */
	public String getRelationshipListClass() {
		return relationshipListClass;
	}
	
	/**
	 * Sets the relationship list class.
	 *
	 * @param relationshipListClass the new relationship list class
	 */
	public void setRelationshipListClass(String relationshipListClass) {
		this.relationshipListClass = relationshipListClass;
	}
	
	/**
	 * Gets the relationship utils.
	 *
	 * @return the relationship utils
	 */
	public String getRelationshipUtils() {
		return relationshipUtils;
	}
	
	/**
	 * Sets the relationship utils.
	 *
	 * @param relationshipUtils the new relationship utils
	 */
	public void setRelationshipUtils(String relationshipUtils) {
		this.relationshipUtils = relationshipUtils;
	}
	
	/**
	 * Gets the string fields.
	 *
	 * @return the string fields
	 */
	public ArrayList<String> getStringFields() {
		if (this.stringFields == null) {
			this.stringFields = new ArrayList<String>();
		}
		return this.stringFields;
	}
	
	/**
	 * Sets the string fields.
	 *
	 * @param stringFields the new string fields
	 */
	public void setStringFields(ArrayList<String> stringFields) {
		this.stringFields = stringFields;
	}
	
	/**
	 * Gets the string list fields.
	 *
	 * @return the string list fields
	 */
	public ArrayList<String> getStringListFields() {
		if (this.stringListFields == null) {
			this.stringListFields = new ArrayList<String>();
		}
		return this.stringListFields;
	}
	
	/**
	 * Sets the string list fields.
	 *
	 * @param stringListFields the new string list fields
	 */
	public void setStringListFields(ArrayList<String> stringListFields) {
		this.stringListFields = stringListFields;
	}
	
	/**
	 * Gets the long fields.
	 *
	 * @return the long fields
	 */
	public ArrayList<String> getLongFields() {
		if (this.longFields == null) {
			this.longFields = new ArrayList<String>();
		}
		return longFields;
	}
	
	/**
	 * Sets the long fields.
	 *
	 * @param longFields the new long fields
	 */
	public void setLongFields(ArrayList<String> longFields) {
		this.longFields = longFields;
	}
	
	/**
	 * Gets the int fields.
	 *
	 * @return the int fields
	 */
	public ArrayList<String> getIntFields() {
		if (this.intFields == null) {
			this.intFields = new ArrayList<String>();
		}
		return intFields;
	}
	
	/**
	 * Sets the int fields.
	 *
	 * @param intFields the new int fields
	 */
	public void setIntFields(ArrayList<String> intFields) {
		this.intFields = intFields;
	}
	
	/**
	 * Gets the short fields.
	 *
	 * @return the short fields
	 */
	public ArrayList<String> getShortFields() {
		if (this.shortFields == null) {
			this.shortFields = new ArrayList<String>();
		}
		return shortFields;
	}
	
	/**
	 * Sets the short fields.
	 *
	 * @param shortFields the new short fields
	 */
	public void setShortFields(ArrayList<String> shortFields) {
		this.shortFields = shortFields;
	}
	
	/**
	 * Gets the boolean fields.
	 *
	 * @return the boolean fields
	 */
	public ArrayList<String> getBooleanFields() {
		if (this.booleanFields == null) {
			this.booleanFields = new ArrayList<String>();
		}
		return booleanFields;
	}
	
	/**
	 * Sets the boolean fields.
	 *
	 * @param booleanFields the new boolean fields
	 */
	public void setBooleanFields(ArrayList<String> booleanFields) {
		this.booleanFields = booleanFields;
	}
	
	/**
	 * Gets the required fields.
	 *
	 * @return the required fields
	 */
	public ArrayList<String> getRequiredFields() {
		if (this.requiredFields == null) {
			this.requiredFields = new ArrayList<String>();
		}
		return requiredFields;
	}
	
	/**
	 * Sets the required fields.
	 *
	 * @param requiredFields the new required fields
	 */
	public void setRequiredFields(ArrayList<String> requiredFields) {
		this.requiredFields = requiredFields;
	}
	
	/**
	 * Gets the ordered fields.
	 *
	 * @return the ordered fields
	 */
	public ArrayList<String> getOrderedFields() {
		if (this.orderedFields == null) { 
			this.orderedFields = new ArrayList<String>();
		}
		return this.orderedFields;
	}
	
	/**
	 * Gets the all fields.
	 *
	 * @return the all fields
	 */
	public ArrayList<String>  getAllFields() {
		
		ArrayList<String> allFields = new ArrayList<String>();
		allFields.addAll(getBooleanFields());
		allFields.addAll(getStringListFields());
		allFields.addAll(getStringFields());
		allFields.addAll(getIntFields());
		allFields.addAll(getLongFields());
		allFields.addAll(getShortFields());
		
		return allFields;
	}
		
	/**
	 * Gets the plural name.
	 *
	 * @return the plural name
	 */
	public String  getPluralName() {	
		
		if (simpleName.contains("List")  || simpleName.contains("-list") )
			return "";
		String[] fullNameList = getFullName().split("/");		
		return fullNameList[fullNameList.length - 2];
	}
	
	/**
	 * Sets the node alt key 1 props.
	 *
	 * @param _dbRulesNodeAltKey1Props the db rules node alt key 1 props
	 */
	public void setNodeAltKey1Props(Multimap<String, String> _dbRulesNodeAltKey1Props) {
		this.NodeAltKey1Props = _dbRulesNodeAltKey1Props;
	}
	
	/**
	 * Gets the node alt key 1 props.
	 *
	 * @return the node alt key 1 props
	 */
	public Multimap<String,String> getNodeAltKey1Props() {
		return this.NodeAltKey1Props;
	}
	
	/**
	 * Sets the node dependencies.
	 *
	 * @param _dbRulesNodeDependencies the db rules node dependencies
	 */
	public void setNodeDependencies(Multimap<String, String> _dbRulesNodeDependencies) {
		this.NodeDependencies = _dbRulesNodeDependencies;
	}
	
	/**
	 * Gets the node dependencies.
	 *
	 * @return the node dependencies
	 */
	public Multimap<String,String> getNodeDependencies() {
		return this.NodeDependencies;
	}
	
	/**
	 * Gets the recurse to resource.
	 *
	 * @return the recurse to resource
	 */
	public AAIResource getRecurseToResource() { 
		return this.recurseToResource;
	}
	
	/**
	 * Sets the recurse to resource.
	 *
	 * @param ancestor the new recurse to resource
	 */
	public void setRecurseToResource(AAIResource ancestor) {
		this.recurseToResource = ancestor;
		
	}
	
	/**
	 * Sets the allow direct write.
	 *
	 * @param allowDirectWrite the new allow direct write
	 */
	public void setAllowDirectWrite(boolean allowDirectWrite) {
		this.allowDirectWrite = allowDirectWrite;
	}
	
	/**
	 * Checks if is allow direct write.
	 *
	 * @return true, if is allow direct write
	 */
	public boolean isAllowDirectWrite() {
		return this.allowDirectWrite;
	}
	
	/**
	 * Sets the allow direct read.
	 *
	 * @param allowDirectRead the new allow direct read
	 */
	public void setAllowDirectRead(boolean allowDirectRead) {
		this.allowDirectRead = allowDirectRead;
	}
	
	/**
	 * Checks if is allow direct read.
	 *
	 * @return true, if is allow direct read
	 */
	public boolean isAllowDirectRead() {
		return this.allowDirectRead;
	}
	
	/**
	 * Gets the auto gen uuid fields.
	 *
	 * @return the auto gen uuid fields
	 */
	public ArrayList<String> getAutoGenUuidFields() {
		if (this.autoGenUuidFields == null) { 
			this.autoGenUuidFields = new ArrayList<String>();
		}
		return this.autoGenUuidFields;
	}
}