60b3ed6b03ecdc32b14bb380fa0117451d47fe4e
[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 java.util.Date;\r
27 import java.util.Objects;\r
28 \r
29 /**\r
30  * DataDictionary.java Purpose: Provide Configuration Generator DataDictionary Entity\r
31  *\r
32  * @author Brinda Santh\r
33  * @version 1.0\r
34  */\r
35 @EntityListeners({AuditingEntityListener.class})\r
36 @Entity\r
37 @Table(name = "CONFIG_MODEL_CONTENT")\r
38 public class ConfigModelContent {\r
39 \r
40     private static final long serialVersionUID = 1L;\r
41 \r
42     @Id\r
43     @GeneratedValue(strategy = GenerationType.IDENTITY)\r
44     @Column(name = "config_model_content_id")\r
45     private Long 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 \r
56     @ManyToOne\r
57     @JoinColumn(name = "config_model_id")\r
58     @JsonBackReference\r
59     private ConfigModel configModel;\r
60 \r
61     @Lob\r
62     @Column(name = "description")\r
63     private String description;\r
64 \r
65     @Lob\r
66     @Column(name = "content", nullable = false)\r
67     @ApiModelProperty(required=true)\r
68     private String content;\r
69 \r
70 \r
71     @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")\r
72     @LastModifiedDate\r
73     @Temporal(TemporalType.TIMESTAMP)\r
74     @Column(name = "updated_date")\r
75     private Date creationDate;\r
76 \r
77     @Override\r
78     public String toString() {\r
79         StringBuilder builder = new StringBuilder("[");\r
80         builder.append("id = " + id);\r
81         builder.append(", name = " + name);\r
82         builder.append(", contentType = " + contentType);\r
83         builder.append("]");\r
84         return builder.toString();\r
85     }\r
86 \r
87     @Override\r
88     public boolean equals(Object o) {\r
89 \r
90         if (o == this) {\r
91             return true;\r
92         }\r
93         if (!(o instanceof ConfigModelContent)) {\r
94             return false;\r
95         }\r
96         ConfigModelContent configModelContent = (ConfigModelContent) o;\r
97         return Objects.equals(id, configModelContent.id) && Objects.equals(name, configModelContent.name)\r
98                 && Objects.equals(contentType, configModelContent.contentType);\r
99     }\r
100 \r
101     @Override\r
102     public int hashCode() {\r
103         return Objects.hash(id, name, contentType);\r
104     }\r
105 \r
106     public Long getId() {\r
107         return id;\r
108     }\r
109 \r
110 \r
111     public void setId(Long id) {\r
112         this.id = id;\r
113     }\r
114 \r
115 \r
116     public String getName() {\r
117         return name;\r
118     }\r
119 \r
120 \r
121     public void setName(String name) {\r
122         this.name = name;\r
123     }\r
124 \r
125 \r
126     public String getContentType() {\r
127         return contentType;\r
128     }\r
129 \r
130 \r
131     public void setContentType(String contentType) {\r
132         this.contentType = contentType;\r
133     }\r
134 \r
135 \r
136     public ConfigModel getConfigModel() {\r
137         return configModel;\r
138     }\r
139 \r
140 \r
141     public void setConfigModel(ConfigModel configModel) {\r
142         this.configModel = configModel;\r
143     }\r
144 \r
145 \r
146     public String getDescription() {\r
147         return description;\r
148     }\r
149 \r
150 \r
151     public void setDescription(String description) {\r
152         this.description = description;\r
153     }\r
154 \r
155 \r
156     public String getContent() {\r
157         return content;\r
158     }\r
159 \r
160 \r
161     public void setContent(String content) {\r
162         this.content = content;\r
163     }\r
164 \r
165 \r
166     public Date getCreationDate() {\r
167         return creationDate;\r
168     }\r
169 \r
170 \r
171     public void setCreationDate(Date creationDate) {\r
172         this.creationDate = creationDate;\r
173     }\r
174 \r
175 }\r