Migrate "ms/controllerblueprints" from ccsdk/apps
[ccsdk/cds.git] / ms / controllerblueprints / modules / service / src / main / java / org / onap / ccsdk / cds / controllerblueprints / service / domain / ModelType.java
1 /*
2  * Copyright © 2017-2018 AT&T Intellectual Property.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.ccsdk.cds.controllerblueprints.service.domain;
18
19 import com.fasterxml.jackson.annotation.JsonFormat;
20 import com.fasterxml.jackson.databind.JsonNode;
21 import io.swagger.annotations.ApiModelProperty;
22 import org.springframework.data.annotation.LastModifiedDate;
23 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
24
25 import javax.persistence.*;
26 import java.io.Serializable;
27 import java.util.Date;
28
29
30 /**
31  * AsdcReference.java Purpose: Provide Configuration Generator AsdcReference Entity
32  *
33  * @author Brinda Santh
34  * @version 1.0
35  */
36 @EntityListeners({AuditingEntityListener.class})
37 @Entity
38 @Table(name = "MODEL_TYPE")
39 public class ModelType implements Serializable {
40     private static final long serialVersionUID = 1L;
41
42     @Id
43     @Column(name = "model_name", nullable = false)
44     @ApiModelProperty(required=true)
45     private String modelName;
46
47     @Column(name = "derived_from", nullable = false)
48     @ApiModelProperty(required=true)
49     private String derivedFrom;
50
51     @Column(name = "definition_type", nullable = false)
52     @ApiModelProperty(required=true)
53     private String definitionType;
54
55     @Lob
56     @Convert(converter  = JpaJsonNodeConverter.class)
57     @Column(name = "definition", nullable = false)
58     @ApiModelProperty(required=true)
59     private JsonNode definition;
60
61     @Lob
62     @Column(name = "description", nullable = false)
63     @ApiModelProperty(required=true)
64     private String description;
65
66     @Column(name = "version", nullable = false)
67     @ApiModelProperty(required=true)
68     private String version;
69
70     @Lob
71     @Column(name = "tags", nullable = false)
72     @ApiModelProperty(required=true)
73     private String tags;
74
75     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
76     @LastModifiedDate
77     @Temporal(TemporalType.TIMESTAMP)
78     @Column(name = "creation_date")
79     private Date creationDate;
80
81     @Column(name = "updated_by", nullable = false)
82     @ApiModelProperty(required=true)
83     private String updatedBy;
84
85     @Override
86     public String toString() {
87         return "[" + "modelName = " + modelName +
88                 ", derivedFrom = " + derivedFrom +
89                 ", definitionType = " + definitionType +
90                 ", description = " + description +
91                 ", creationDate = " + creationDate +
92                 ", version = " + version +
93                 ", updatedBy = " + updatedBy +
94                 ", tags = " + tags +
95                 "]";
96     }
97
98     public String getModelName() {
99         return modelName;
100     }
101
102     public void setModelName(String modelName) {
103         this.modelName = modelName;
104     }
105
106     public String getDerivedFrom() {
107         return derivedFrom;
108     }
109
110     public void setDerivedFrom(String derivedFrom) {
111         this.derivedFrom = derivedFrom;
112     }
113
114     public String getDefinitionType() {
115         return definitionType;
116     }
117
118     public void setDefinitionType(String definitionType) {
119         this.definitionType = definitionType;
120     }
121
122     public JsonNode getDefinition() {
123         return definition;
124     }
125
126     public void setDefinition(JsonNode definition) {
127         this.definition = definition;
128     }
129
130     public String getDescription() {
131         return description;
132     }
133
134     public void setDescription(String description) {
135         this.description = description;
136     }
137
138     public String getVersion() {
139         return version;
140     }
141
142     public void setVersion(String version) {
143         this.version = version;
144     }
145
146     public String getTags() {
147         return tags;
148     }
149
150     public void setTags(String tags) {
151         this.tags = tags;
152     }
153
154     public Date getCreationDate() {
155         return creationDate;
156     }
157
158     public void setCreationDate(Date creationDate) {
159         this.creationDate = creationDate;
160     }
161
162     public String getUpdatedBy() {
163         return updatedBy;
164     }
165
166     public void setUpdatedBy(String updatedBy) {
167         this.updatedBy = updatedBy;
168     }
169
170
171 }