2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights
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
12 * http://www.apache.org/licenses/LICENSE-2.0
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 * ===================================================================
24 package org.onap.clamp.clds.model;
26 import javax.ws.rs.NotFoundException;
28 import org.onap.clamp.clds.dao.CldsDao;
30 import com.google.gson.annotations.Expose;
33 * Represent a CLDS Model.
35 public class CldsTemplate {
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";
50 private String controlNamePrefix;
52 private String controlNameUuid;
54 private String bpmnId;
56 private String bpmnUserid;
58 private String bpmnText;
60 private String imageId;
62 private String imageUserid;
64 private String imageText;
66 private String propId;
68 private String propUserid;
70 private String propText;
72 private boolean userAuthorizedToUpdate;
75 * Save template to DB.
77 * @param cldsDao The cldsDao
78 * @param userid The user Id
80 public void save(CldsDao cldsDao, String userid) {
81 cldsDao.setTemplate(this, userid);
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
93 public static CldsTemplate retrieve(CldsDao cldsDao, String name, boolean okIfNotFound) {
95 CldsTemplate template = cldsDao.getTemplate(name);
96 if (template.getId() == null && !okIfNotFound) {
97 throw new NotFoundException();
102 public String getBpmnUserid() {
106 public void setBpmnUserid(String bpmnUserid) {
107 this.bpmnUserid = bpmnUserid;
110 public String getBpmnText() {
114 public void setBpmnText(String bpmnText) {
115 this.bpmnText = bpmnText;
118 public String getImageUserid() {
122 public void setImageUserid(String imageUserid) {
123 this.imageUserid = imageUserid;
126 public String getImageText() {
130 public void setImageText(String imageText) {
131 this.imageText = imageText;
134 public String getName() {
138 public void setName(String name) {
142 public String getControlNamePrefix() {
143 return controlNamePrefix;
146 public void setControlNamePrefix(String controlNamePrefix) {
147 this.controlNamePrefix = controlNamePrefix;
150 public String getControlNameUuid() {
151 return controlNameUuid;
154 public void setControlNameUuid(String controlNameUuid) {
155 this.controlNameUuid = controlNameUuid;
158 public String getPropId() {
162 public void setPropId(String propId) {
163 this.propId = propId;
166 public String getPropUserid() {
170 public void setPropUserid(String propUserid) {
171 this.propUserid = propUserid;
174 public String getPropText() {
178 public void setPropText(String propText) {
179 this.propText = propText;
182 public String getId() {
186 public void setId(String id) {
190 public String getBpmnId() {
194 public void setBpmnId(String bpmnId) {
195 this.bpmnId = bpmnId;
198 public String getImageId() {
202 public void setImageId(String imageId) {
203 this.imageId = imageId;
206 public boolean isUserAuthorizedToUpdate() {
207 return userAuthorizedToUpdate;
210 public void setUserAuthorizedToUpdate(boolean userAuthorizedToUpdate) {
211 this.userAuthorizedToUpdate = userAuthorizedToUpdate;