2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.mso.db.catalog.beans;
23 import java.io.Serializable;
24 import java.sql.Timestamp;
25 import java.text.DateFormat;
26 import java.util.HashMap;
27 import java.util.HashSet;
31 import org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
33 public class Service extends MavenLikeVersioning implements Serializable {
35 private static final long serialVersionUID = 768026109321305392L;
37 private String modelName = null;
38 private String description = null;
39 private String modelUUID = null;
40 private String modelInvariantUUID = null;
41 private Timestamp created = null;
42 private String toscaCsarArtifactUUID = null;
43 private String modelVersion = null;
44 private String category = null;
45 private String serviceType = null;
46 private String serviceRole = null;
47 private String environmentContext = null;
48 private String workloadContext = null;
49 private Map<String,ServiceRecipe> recipes = new HashMap<>();
50 private Set<ServiceToResourceCustomization> serviceResourceCustomizations = new HashSet<>();
54 public String getModelName() {
57 public void setModelName(String modelName) {
58 this.modelName = modelName;
61 public String getDescription() {
64 public void setDescription(String description) {
65 this.description = description;
68 public Map<String, ServiceRecipe> getRecipes() {
71 public void setRecipes(Map<String, ServiceRecipe> recipes) {
72 this.recipes = recipes;
75 public Timestamp getCreated() {
79 public void setCreated(Timestamp created) {
80 this.created = created;
83 public String getModelUUID() {
87 public void setModelUUID(String modelUUID) {
88 this.modelUUID = modelUUID;
91 public String getModelInvariantUUID() {
92 return modelInvariantUUID;
95 public void setModelInvariantUUID(String modelInvariantUUID) {
96 this.modelInvariantUUID = modelInvariantUUID;
99 public String getToscaCsarArtifactUUID() {
100 return toscaCsarArtifactUUID;
103 public void setToscaCsarArtifactUUID(String toscaCsarArtifactUUID) {
104 this.toscaCsarArtifactUUID = toscaCsarArtifactUUID;
107 public Set<ServiceToResourceCustomization> getServiceResourceCustomizations() {
108 return serviceResourceCustomizations;
111 public void setServiceResourceCustomizations(Set<ServiceToResourceCustomization> serviceResourceCustomizations) {
112 this.serviceResourceCustomizations = serviceResourceCustomizations;
115 public String getModelVersion() {
119 public void setModelVersion(String modelVersion) {
120 this.modelVersion = modelVersion;
124 * @return Returns the category.
126 public String getCategory() {
132 * @param category The category to set.
134 public void setCategory(String category) {
135 this.category = category;
138 public String getServiceType() {
142 public void setServiceType(String serviceType) {
143 this.serviceType = serviceType;
146 public String getServiceRole() {
150 public void setServiceRole(String serviceRole) {
151 this.serviceRole = serviceRole;
153 public String getEnvironmentContext() {
154 return this.environmentContext;
156 public void setEnvironmentContext(String environmentContext) {
157 this.environmentContext = environmentContext;
160 public String getWorkloadContext() {
161 return this.workloadContext;
163 public void setWorkloadContext(String workloadContext) {
164 this.workloadContext = workloadContext;
168 public String toString() {
169 StringBuilder sb = new StringBuilder();
170 sb.append("SERVICE: name=").append(modelName).append(",modelVersion=").append(modelVersion)
171 .append(",description=").append(description).append(",modelInvariantUUID=").append(modelInvariantUUID)
173 .append(",toscaCsarArtifactUUID=").append(toscaCsarArtifactUUID).append(",serviceType=").append(serviceType)
174 .append(",serviceRole=").append(serviceRole).append(",envtContext=").append(this.environmentContext)
175 .append(",workloadContext=").append(this.workloadContext);
176 for (String recipeAction : recipes.keySet()) {
177 ServiceRecipe recipe = recipes.get(recipeAction);
178 sb.append("\n").append(recipe.toString());
181 for(ServiceToResourceCustomization serviceResourceCustomization : serviceResourceCustomizations) {
182 sb.append("\n").append(serviceResourceCustomization.toString());
184 if (created != null) {
185 sb.append (",created=");
186 sb.append (DateFormat.getInstance().format(created));
188 return sb.toString();