0c05ef95970c6f35f457779d0dc2e4cc7820e2a9
[ccsdk/cds.git] /
1 /*\r
2  * Copyright © 2017-2018 AT&T Intellectual Property.\r
3  *\r
4  * Licensed under the Apache License, Version 2.0 (the "License");\r
5  * you may not use this file except in compliance with the License.\r
6  * You may obtain a copy of the License at\r
7  *\r
8  *     http://www.apache.org/licenses/LICENSE-2.0\r
9  *\r
10  * Unless required by applicable law or agreed to in writing, software\r
11  * distributed under the License is distributed on an "AS IS" BASIS,\r
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
13  * See the License for the specific language governing permissions and\r
14  * limitations under the License.\r
15  */\r
16 \r
17 package org.onap.ccsdk.apps.controllerblueprints.service.domain;\r
18 \r
19 import com.fasterxml.jackson.annotation.JsonBackReference;\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 javax.validation.constraints.NotNull;\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 ConfigModelContent {\r
40 \r
41     private static final long serialVersionUID = 1L;\r
42 \r
43     @Id\r
44     @GeneratedValue(strategy = GenerationType.IDENTITY)\r
45     @Column(name = "config_model_content_id")\r
46     private Long id;\r
47 \r
48     @NotNull\r
49     @Column(name = "name")\r
50     @ApiModelProperty(required=true)\r
51     private String name;\r
52 \r
53     @NotNull\r
54     @Column(name = "content_type")\r
55     @ApiModelProperty(required=true)\r
56     private String contentType;\r
57 \r
58 \r
59     @ManyToOne\r
60     @JoinColumn(name = "config_model_id")\r
61     @JsonBackReference\r
62     private ConfigModel configModel;\r
63 \r
64     @Lob\r
65     @Column(name = "description")\r
66     private String description;\r
67 \r
68     @NotNull\r
69     @Lob\r
70     @Column(name = "content")\r
71     @ApiModelProperty(required=true)\r
72     private String content;\r
73 \r
74 \r
75     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")\r
76     @LastModifiedDate\r
77     @Temporal(TemporalType.TIMESTAMP)\r
78     @Column(name = "updated_date")\r
79     private Date creationDate;\r
80 \r
81     @Override\r
82     public String toString() {\r
83         StringBuilder builder = new StringBuilder("[");\r
84         builder.append("id = " + id);\r
85         builder.append(", name = " + name);\r
86         builder.append(", contentType = " + contentType);\r
87         builder.append("]");\r
88         return builder.toString();\r
89     }\r
90 \r
91     @Override\r
92     public boolean equals(Object o) {\r
93 \r
94         if (o == this) {\r
95             return true;\r
96         }\r
97         if (!(o instanceof ConfigModelContent)) {\r
98             return false;\r
99         }\r
100         ConfigModelContent configModelContent = (ConfigModelContent) o;\r
101         return Objects.equals(id, configModelContent.id) && Objects.equals(name, configModelContent.name)\r
102                 && Objects.equals(contentType, configModelContent.contentType);\r
103     }\r
104 \r
105     @Override\r
106     public int hashCode() {\r
107         return Objects.hash(id, name, contentType);\r
108     }\r
109 \r
110     public Long getId() {\r
111         return id;\r
112     }\r
113 \r
114 \r
115     public void setId(Long id) {\r
116         this.id = id;\r
117     }\r
118 \r
119 \r
120     public String getName() {\r
121         return name;\r
122     }\r
123 \r
124 \r
125     public void setName(String name) {\r
126         this.name = name;\r
127     }\r
128 \r
129 \r
130     public String getContentType() {\r
131         return contentType;\r
132     }\r
133 \r
134 \r
135     public void setContentType(String contentType) {\r
136         this.contentType = contentType;\r
137     }\r
138 \r
139 \r
140     public ConfigModel getConfigModel() {\r
141         return configModel;\r
142     }\r
143 \r
144 \r
145     public void setConfigModel(ConfigModel configModel) {\r
146         this.configModel = configModel;\r
147     }\r
148 \r
149 \r
150     public String getDescription() {\r
151         return description;\r
152     }\r
153 \r
154 \r
155     public void setDescription(String description) {\r
156         this.description = description;\r
157     }\r
158 \r
159 \r
160     public String getContent() {\r
161         return content;\r
162     }\r
163 \r
164 \r
165     public void setContent(String content) {\r
166         this.content = content;\r
167     }\r
168 \r
169 \r
170     public Date getCreationDate() {\r
171         return creationDate;\r
172     }\r
173 \r
174 \r
175     public void setCreationDate(Date creationDate) {\r
176         this.creationDate = creationDate;\r
177     }\r
178 \r
179 }\r