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;
31 * Represent a CLDS Model.
33 public class CldsTemplate {
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 // manual intervention required
40 public static final String STATUS_ERROR = "ERROR";
41 public static final String STATUS_UNKNOWN = "UNKNOWN";
45 private String controlNamePrefix;
46 private String controlNameUuid;
47 private String bpmnId;
48 private String bpmnUserid;
49 private String bpmnText;
50 private String imageId;
51 private String imageUserid;
52 private String imageText;
53 private String propId;
54 private String propUserid;
55 private String propText;
57 private boolean userAuthorizedToUpdate;
60 * Save template to DB.
62 * @param cldsDao The cldsDao
63 * @param userid The user Id
65 public void save(CldsDao cldsDao, String userid) {
66 cldsDao.setTemplate(this, userid);
72 * @param cldsDao The cldsDao
73 * @param name The template name to retrieve
75 * The flag indicating whether exception will be returned in case nothing is found
78 public static CldsTemplate retrieve(CldsDao cldsDao, String name, boolean okIfNotFound) {
80 CldsTemplate template = cldsDao.getTemplate(name);
81 if (template.getId() == null && !okIfNotFound) {
82 throw new NotFoundException();
87 public String getBpmnUserid() {
91 public void setBpmnUserid(String bpmnUserid) {
92 this.bpmnUserid = bpmnUserid;
95 public String getBpmnText() {
99 public void setBpmnText(String bpmnText) {
100 this.bpmnText = bpmnText;
103 public String getImageUserid() {
107 public void setImageUserid(String imageUserid) {
108 this.imageUserid = imageUserid;
111 public String getImageText() {
115 public void setImageText(String imageText) {
116 this.imageText = imageText;
119 public String getName() {
123 public void setName(String name) {
127 public String getControlNamePrefix() {
128 return controlNamePrefix;
131 public void setControlNamePrefix(String controlNamePrefix) {
132 this.controlNamePrefix = controlNamePrefix;
135 public String getControlNameUuid() {
136 return controlNameUuid;
139 public void setControlNameUuid(String controlNameUuid) {
140 this.controlNameUuid = controlNameUuid;
143 public String getPropId() {
147 public void setPropId(String propId) {
148 this.propId = propId;
151 public String getPropUserid() {
155 public void setPropUserid(String propUserid) {
156 this.propUserid = propUserid;
159 public String getPropText() {
163 public void setPropText(String propText) {
164 this.propText = propText;
167 public String getId() {
171 public void setId(String id) {
175 public String getBpmnId() {
179 public void setBpmnId(String bpmnId) {
180 this.bpmnId = bpmnId;
183 public String getImageId() {
187 public void setImageId(String imageId) {
188 this.imageId = imageId;
191 public boolean isUserAuthorizedToUpdate() {
192 return userAuthorizedToUpdate;
195 public void setUserAuthorizedToUpdate(boolean userAuthorizedToUpdate) {
196 this.userAuthorizedToUpdate = userAuthorizedToUpdate;