ae374a7862b4c0e695e569fa18617dfd7a1f80cc
[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         String builder = "[" + "id = " + id +\r
80                 ", name = " + name +\r
81                 ", contentType = " + contentType +\r
82                 "]";\r
83         return builder;\r
84     }\r
85 \r
86     @Override\r
87     public boolean equals(Object o) {\r
88 \r
89         if (o == this) {\r
90             return true;\r
91         }\r
92         if (!(o instanceof ConfigModelContent)) {\r
93             return false;\r
94         }\r
95         ConfigModelContent configModelContent = (ConfigModelContent) o;\r
96         return Objects.equals(id, configModelContent.id) && Objects.equals(name, configModelContent.name)\r
97                 && Objects.equals(contentType, configModelContent.contentType);\r
98     }\r
99 \r
100     @Override\r
101     public int hashCode() {\r
102         return Objects.hash(id, name, contentType);\r
103     }\r
104 \r
105     public Long getId() {\r
106         return id;\r
107     }\r
108 \r
109 \r
110     public void setId(Long id) {\r
111         this.id = id;\r
112     }\r
113 \r
114 \r
115     public String getName() {\r
116         return name;\r
117     }\r
118 \r
119 \r
120     public void setName(String name) {\r
121         this.name = name;\r
122     }\r
123 \r
124 \r
125     public String getContentType() {\r
126         return contentType;\r
127     }\r
128 \r
129 \r
130     public void setContentType(String contentType) {\r
131         this.contentType = contentType;\r
132     }\r
133 \r
134 \r
135     public ConfigModel getConfigModel() {\r
136         return configModel;\r
137     }\r
138 \r
139 \r
140     public void setConfigModel(ConfigModel configModel) {\r
141         this.configModel = configModel;\r
142     }\r
143 \r
144 \r
145     public String getDescription() {\r
146         return description;\r
147     }\r
148 \r
149 \r
150     public void setDescription(String description) {\r
151         this.description = description;\r
152     }\r
153 \r
154 \r
155     public String getContent() {\r
156         return content;\r
157     }\r
158 \r
159 \r
160     public void setContent(String content) {\r
161         this.content = content;\r
162     }\r
163 \r
164 \r
165     public Date getCreationDate() {\r
166         return creationDate;\r
167     }\r
168 \r
169 \r
170     public void setCreationDate(Date creationDate) {\r
171         this.creationDate = creationDate;\r
172     }\r
173 \r
174 }\r