Add Expose annotation
[clamp.git] / src / main / java / org / onap / clamp / clds / model / CldsTemplate.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP CLAMP
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights
6  *                             reserved.
7  * ================================================================================
8  * Licensed under the Apache License, Version 2.0 (the "License");
9  * you may not use this file except in compliance with the License.
10  * You may obtain a copy of the License at
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
14  * Unless required by applicable law or agreed to in writing, software
15  * distributed under the License is distributed on an "AS IS" BASIS,
16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17  * See the License for the specific language governing permissions and
18  * limitations under the License.
19  * ============LICENSE_END============================================
20  * ===================================================================
21  * 
22  */
23
24 package org.onap.clamp.clds.model;
25
26 import javax.ws.rs.NotFoundException;
27
28 import org.onap.clamp.clds.dao.CldsDao;
29
30 import com.google.gson.annotations.Expose;
31
32 /**
33  * Represent a CLDS Model.
34  */
35 public class CldsTemplate {
36
37         public static final String STATUS_DESIGN = "DESIGN";
38         public static final String STATUS_ACTIVE = "ACTIVE";
39         public static final String STATUS_STOPPED = "STOPPED";
40         public static final String STATUS_DELETING = "DELETING";
41         // manual intervention required
42         public static final String STATUS_ERROR = "ERROR";
43         public static final String STATUS_UNKNOWN = "UNKNOWN";
44
45         @Expose
46         private String id;
47         @Expose
48         private String name;
49         @Expose
50         private String controlNamePrefix;
51         @Expose
52         private String controlNameUuid;
53         @Expose
54         private String bpmnId;
55         @Expose
56         private String bpmnUserid;
57         @Expose
58         private String bpmnText;
59         @Expose
60         private String imageId;
61         @Expose
62         private String imageUserid;
63         @Expose
64         private String imageText;
65         @Expose
66         private String propId;
67         @Expose
68         private String propUserid;
69         @Expose
70         private String propText;
71         @Expose
72         private boolean userAuthorizedToUpdate;
73
74         /**
75          * Save template to DB.
76          *
77          * @param cldsDao The cldsDao
78          * @param userid  The user Id
79          */
80         public void save(CldsDao cldsDao, String userid) {
81                 cldsDao.setTemplate(this, userid);
82         }
83
84         /**
85          * Retrieve from DB.
86          *
87          * @param cldsDao      The cldsDao
88          * @param name         The template name to retrieve
89          * @param okIfNotFound The flag indicating whether exception will be returned in
90          *                     case nothing is found
91          * @return Clds template from DB
92          */
93         public static CldsTemplate retrieve(CldsDao cldsDao, String name, boolean okIfNotFound) {
94                 // get from db
95                 CldsTemplate template = cldsDao.getTemplate(name);
96                 if (template.getId() == null && !okIfNotFound) {
97                         throw new NotFoundException();
98                 }
99                 return template;
100         }
101
102         public String getBpmnUserid() {
103                 return bpmnUserid;
104         }
105
106         public void setBpmnUserid(String bpmnUserid) {
107                 this.bpmnUserid = bpmnUserid;
108         }
109
110         public String getBpmnText() {
111                 return bpmnText;
112         }
113
114         public void setBpmnText(String bpmnText) {
115                 this.bpmnText = bpmnText;
116         }
117
118         public String getImageUserid() {
119                 return imageUserid;
120         }
121
122         public void setImageUserid(String imageUserid) {
123                 this.imageUserid = imageUserid;
124         }
125
126         public String getImageText() {
127                 return imageText;
128         }
129
130         public void setImageText(String imageText) {
131                 this.imageText = imageText;
132         }
133
134         public String getName() {
135                 return name;
136         }
137
138         public void setName(String name) {
139                 this.name = name;
140         }
141
142         public String getControlNamePrefix() {
143                 return controlNamePrefix;
144         }
145
146         public void setControlNamePrefix(String controlNamePrefix) {
147                 this.controlNamePrefix = controlNamePrefix;
148         }
149
150         public String getControlNameUuid() {
151                 return controlNameUuid;
152         }
153
154         public void setControlNameUuid(String controlNameUuid) {
155                 this.controlNameUuid = controlNameUuid;
156         }
157
158         public String getPropId() {
159                 return propId;
160         }
161
162         public void setPropId(String propId) {
163                 this.propId = propId;
164         }
165
166         public String getPropUserid() {
167                 return propUserid;
168         }
169
170         public void setPropUserid(String propUserid) {
171                 this.propUserid = propUserid;
172         }
173
174         public String getPropText() {
175                 return propText;
176         }
177
178         public void setPropText(String propText) {
179                 this.propText = propText;
180         }
181
182         public String getId() {
183                 return id;
184         }
185
186         public void setId(String id) {
187                 this.id = id;
188         }
189
190         public String getBpmnId() {
191                 return bpmnId;
192         }
193
194         public void setBpmnId(String bpmnId) {
195                 this.bpmnId = bpmnId;
196         }
197
198         public String getImageId() {
199                 return imageId;
200         }
201
202         public void setImageId(String imageId) {
203                 this.imageId = imageId;
204         }
205
206         public boolean isUserAuthorizedToUpdate() {
207                 return userAuthorizedToUpdate;
208         }
209
210         public void setUserAuthorizedToUpdate(boolean userAuthorizedToUpdate) {
211                 this.userAuthorizedToUpdate = userAuthorizedToUpdate;
212         }
213 }