6e2c8d70d336195fef2dbaef55e470a29e91e1d1
[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  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
22  */
23
24 package org.onap.clamp.clds.model;
25
26 import org.onap.clamp.clds.dao.CldsDao;
27
28 import javax.ws.rs.NotFoundException;
29
30 /**
31  * Represent a CLDS Model.
32  */
33 public class CldsTemplate {
34
35     public static final String STATUS_DESIGN = "DESIGN";
36     public static final String STATUS_ACTIVE = "ACTIVE";
37     public static final String STATUS_STOPPED = "STOPPED";
38     public static final String STATUS_DELETING = "DELETING";
39     public static final String STATUS_ERROR = "ERROR"; // manual intervention required
40     public static final String STATUS_UNKNOWN = "UNKNOWN";
41
42     private String id;
43     private String name;
44     private String controlNamePrefix;
45     private String controlNameUuid;
46     private String bpmnId;
47     private String bpmnUserid;
48     private String bpmnText;
49     private String imageId;
50     private String imageUserid;
51     private String imageText;
52     private String propId;
53     private String propUserid;
54     private String propText;
55
56     /**
57      * Save template to DB.
58      *
59      * @param cldsDao
60      * @param userid
61      */
62     public void save(CldsDao cldsDao, String userid) {
63         cldsDao.setTemplate(this, userid);
64     }
65
66     /**
67      * Retrieve from DB.
68      *
69      * @param cldsDao
70      * @param name
71      * @return
72      */
73     public static CldsTemplate retrieve(CldsDao cldsDao, String name, boolean okIfNotFound) {
74         // get from db
75         CldsTemplate template = cldsDao.getTemplate(name);
76         if (template.getId() == null && !okIfNotFound) {
77             throw new NotFoundException();
78         }
79         return template;
80     }
81
82     public String getBpmnUserid() {
83         return bpmnUserid;
84     }
85
86     public void setBpmnUserid(String bpmnUserid) {
87         this.bpmnUserid = bpmnUserid;
88     }
89
90     public String getBpmnText() {
91         return bpmnText;
92     }
93
94     public void setBpmnText(String bpmnText) {
95         this.bpmnText = bpmnText;
96     }
97
98     public String getImageUserid() {
99         return imageUserid;
100     }
101
102     public void setImageUserid(String imageUserid) {
103         this.imageUserid = imageUserid;
104     }
105
106     public String getImageText() {
107         return imageText;
108     }
109
110     public void setImageText(String imageText) {
111         this.imageText = imageText;
112     }
113
114     public String getName() {
115         return name;
116     }
117
118     public void setName(String name) {
119         this.name = name;
120     }
121
122     public String getControlNamePrefix() {
123         return controlNamePrefix;
124     }
125
126     public void setControlNamePrefix(String controlNamePrefix) {
127         this.controlNamePrefix = controlNamePrefix;
128     }
129
130     public String getControlNameUuid() {
131         return controlNameUuid;
132     }
133
134     public void setControlNameUuid(String controlNameUuid) {
135         this.controlNameUuid = controlNameUuid;
136     }
137
138     public String getPropId() {
139         return propId;
140     }
141
142     public void setPropId(String propId) {
143         this.propId = propId;
144     }
145
146     public String getPropUserid() {
147         return propUserid;
148     }
149
150     public void setPropUserid(String propUserid) {
151         this.propUserid = propUserid;
152     }
153
154     public String getPropText() {
155         return propText;
156     }
157
158     public void setPropText(String propText) {
159         this.propText = propText;
160     }
161
162     public String getId() {
163         return id;
164     }
165
166     public void setId(String id) {
167         this.id = id;
168     }
169
170     public String getBpmnId() {
171         return bpmnId;
172     }
173
174     public void setBpmnId(String bpmnId) {
175         this.bpmnId = bpmnId;
176     }
177
178     public String getImageId() {
179         return imageId;
180     }
181
182     public void setImageId(String imageId) {
183         this.imageId = imageId;
184     }
185
186 }