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