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 org.openecomp.mso.db.catalog.utils.MavenLikeVersioning;
25 import java.io.Serializable;
26 import java.sql.Timestamp;
27 import java.text.DateFormat;
31 public class Service extends MavenLikeVersioning implements Serializable {
33 private static final long serialVersionUID = 768026109321305392L;
35 private String modelName;
36 private String description;
37 private String modelUUID;
38 private String modelInvariantUUID;
39 private Timestamp created;
40 private String toscaCsarArtifactUUID;
41 private String modelVersion;
42 private String category;
43 private String serviceType;
44 private String serviceRole;
45 private Map<String,ServiceRecipe> recipes;
46 private Set<ServiceToResourceCustomization> serviceResourceCustomizations;
50 public String getModelName() {
53 public void setModelName(String modelName) {
54 this.modelName = modelName;
57 public String getDescription() {
60 public void setDescription(String description) {
61 this.description = description;
64 public Map<String, ServiceRecipe> getRecipes() {
67 public void setRecipes(Map<String, ServiceRecipe> recipes) {
68 this.recipes = recipes;
71 public Timestamp getCreated() {
75 public void setCreated(Timestamp created) {
76 this.created = created;
79 public String getModelUUID() {
83 public void setModelUUID(String modelUUID) {
84 this.modelUUID = modelUUID;
87 public String getModelInvariantUUID() {
88 return modelInvariantUUID;
91 public void setModelInvariantUUID(String modelInvariantUUID) {
92 this.modelInvariantUUID = modelInvariantUUID;
95 public String getToscaCsarArtifactUUID() {
96 return toscaCsarArtifactUUID;
99 public void setToscaCsarArtifactUUID(String toscaCsarArtifactUUID) {
100 this.toscaCsarArtifactUUID = toscaCsarArtifactUUID;
103 public Set<ServiceToResourceCustomization> getServiceResourceCustomizations() {
104 return serviceResourceCustomizations;
107 public void setServiceResourceCustomizations(Set<ServiceToResourceCustomization> serviceResourceCustomizations) {
108 this.serviceResourceCustomizations = serviceResourceCustomizations;
111 public String getModelVersion() {
115 public void setModelVersion(String modelVersion) {
116 this.modelVersion = modelVersion;
120 * @return Returns the category.
122 public String getCategory() {
128 * @param category The category to set.
130 public void setCategory(String category) {
131 this.category = category;
134 public String getServiceType() {
138 public void setServiceType(String serviceType) {
139 this.serviceType = serviceType;
142 public String getServiceRole() {
146 public void setServiceRole(String serviceRole) {
147 this.serviceRole = serviceRole;
151 public String toString() {
152 StringBuilder sb = new StringBuilder();
153 sb.append("SERVICE: name=").append(modelName).append(",modelVersion=").append(modelVersion)
154 .append(",description=").append(description).append(",modelInvariantUUID=").append(modelInvariantUUID)
155 .append(",toscaCsarArtifactUUID=").append(toscaCsarArtifactUUID).append(",serviceType=").append(serviceType)
156 .append(",serviceRole=").append(serviceRole);
157 for (String recipeAction : recipes.keySet()) {
158 ServiceRecipe recipe = recipes.get(recipeAction);
159 sb.append("\n").append(recipe.toString());
162 for(ServiceToResourceCustomization serviceResourceCustomization : serviceResourceCustomizations) {
163 sb.append("\n").append(serviceResourceCustomization.toString());
165 if (created != null) {
166 sb.append (",created=");
167 sb.append (DateFormat.getInstance().format(created));
169 return sb.toString();