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