Initial OpenECOMP policy/engine commit
[policy/engine.git] / ECOMP-REST / src / main / java / org / openecomp / policy / rest / util / ModelObject.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ECOMP-REST
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  
20
21 package org.openecomp.policy.rest.util;
22
23 import java.util.ArrayList;
24 import java.util.HashMap;
25 import java.util.LinkedList;
26 import java.util.List;
27 import java.util.Map;
28
29 import com.vaadin.ui.TextField;
30 import com.vaadin.ui.VerticalLayout;
31
32 public class ModelObject {
33         private String name;
34         private String parent;
35         private List<String> attibutes = new ArrayList<String>();
36         private List<String> arrays = new ArrayList<String>();
37         private List<Integer> integers = new ArrayList<Integer>();
38         private List<ModelObject> subObjects = new ArrayList<ModelObject>();
39         private HashMap<String, LinkedList<ModelObject>> subObjectList = new HashMap<String, LinkedList<ModelObject>>();
40         private HashMap<String, TextField> attribute = new HashMap<String, TextField>();
41         private Map<String, LinkedList<TextField>> arrayTextList =  new HashMap<String, LinkedList<TextField>>();
42         private Map<String,  VerticalLayout> textFieldLayout = new HashMap<String, VerticalLayout>();
43
44         private boolean many = false;
45         
46         public Map<String, LinkedList<TextField>> getArrayTextList() {
47                 return arrayTextList;
48         }
49         public void setArrayTextList(Map<String, LinkedList<TextField>> arrayTextList) {
50                 this.arrayTextList = arrayTextList;
51         }
52         public void addArrayTextList(String name, TextField textField ){
53                 LinkedList<TextField> list = new LinkedList<TextField>();
54                 if (getArrayTextList().get(name) != null){
55                         list = getArrayTextList().get(name); 
56                 }
57
58                 list.push(textField);
59                 this.arrayTextList.put(name, list);
60         }
61         public void removeLastTextList(String name){
62                 LinkedList<TextField> list = getArrayTextList().get(name); 
63                 
64                 list.pop();
65                 this.arrayTextList.put(name, list);
66         }
67         public HashMap<String, TextField> getAttribute() {
68                 return attribute;
69         }
70         public void setAttribute(HashMap<String, TextField> attribute) {
71                 this.attribute = attribute;
72         }
73     public void addAttribute(String name, TextField textField){
74         this.attribute.put(name, textField);
75     }
76         public List<String> getAttibutes() {
77                 return attibutes;
78         }
79         public void setAttibutes(List<String> attibutes) {
80                 this.attibutes = attibutes;
81         }
82         public List<String> getArrays() {
83                 return arrays;
84         }
85         public void setArrays(List<String> arrays) {
86                 this.arrays = arrays;
87         }
88         public List<Integer> getIntegers() {
89                 return integers;
90         }
91         public void setIntegers(List<Integer> integers) {
92                 this.integers = integers;
93         }
94         public List<ModelObject> getSubObjects() {
95                 return subObjects;
96         }
97         public void setSubObjects(List<ModelObject> subObjects) {
98                 this.subObjects = subObjects;
99         }
100         public void addSubObject(ModelObject subObjects ){
101                 this.subObjects.add(subObjects);
102         }
103         public void addAttributes(String attibutes){
104                 this.attibutes.add(attibutes);
105         }
106         public void addArrays(String arrays){
107                 this.arrays.add(arrays);
108         }
109         public void addIntegers(Integer integers){
110                 this.integers.add(integers);
111         }
112         public String getName() {
113                 return name;
114         }
115         public void setName(String name) {
116                 this.name = name;
117         }
118         public boolean isMany() {
119                 return many;
120         }
121         public void setMany(boolean many) {
122                 this.many = many;
123         }
124         public String getParent() {
125                 return parent;
126         }
127         public void setParent(String parent) {
128                 this.parent = parent;
129         }
130         public HashMap<String, LinkedList<ModelObject>> getSubObjectList() {
131                 return subObjectList;
132         }
133         public void setSubObjectList(HashMap<String, LinkedList<ModelObject>> subObjectList) {
134                 this.subObjectList = subObjectList;
135         }
136         public void addSubObjectList(String name, ModelObject object) {
137                 LinkedList<ModelObject> list = new LinkedList<ModelObject>();
138                 if (subObjectList.get(name) != null){
139                         list = subObjectList.get(name); 
140                 }
141
142                 list.push(object);
143
144                 this.subObjectList.put(name, list);
145         }
146         public Map<String,  VerticalLayout> getTextFieldLayout() {
147                 return textFieldLayout;
148         }
149         public void setTextFieldLayout(Map<String,  VerticalLayout> textFieldLayout) {
150                 this.textFieldLayout = textFieldLayout;
151         }
152         public void addTextFieldLayout(String name, VerticalLayout vLayout){
153                 this.textFieldLayout.put(name, vLayout);
154         }
155
156 }
157 */