remove unused columns infra active requests
[so.git] / mso-api-handlers / mso-requests-db / src / main / java / org / onap / so / db / request / beans / RequestProcessingData.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.db.request.beans;
22
23 import java.io.Serializable;
24 import java.util.Date;
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.GenerationType;
29 import javax.persistence.Id;
30 import javax.persistence.PrePersist;
31 import javax.persistence.Table;
32 import javax.persistence.Temporal;
33 import javax.persistence.TemporalType;
34 import org.apache.commons.lang3.builder.EqualsBuilder;
35 import org.apache.commons.lang3.builder.HashCodeBuilder;
36 import org.apache.commons.lang3.builder.ToStringBuilder;
37 import com.fasterxml.jackson.annotation.JsonInclude;
38 import com.fasterxml.jackson.annotation.JsonInclude.Include;
39 import com.openpojo.business.annotation.BusinessKey;
40
41 /**
42  * persist the request identifiers created when MSO POSTs a request to PINC <br>
43  * <p>
44  * </p>
45  * 
46  * @author
47  * @version
48  */
49
50 @Entity
51
52 @JsonInclude(Include.NON_NULL)
53 @Table(name = "request_processing_data")
54 public class RequestProcessingData implements Serializable {
55
56     /**
57      * 
58      */
59     private static final long serialVersionUID = -3497593687393936143L;
60
61     @Id
62     @GeneratedValue(strategy = GenerationType.IDENTITY)
63     @Column(name = "ID")
64     private Integer id;
65
66     @BusinessKey
67     @Column(name = "SO_REQUEST_ID", length = 50, unique = true)
68     private String soRequestId;
69
70     @BusinessKey
71     @Column(name = "GROUPING_ID", length = 100, unique = true)
72     private String groupingId;
73
74     @BusinessKey
75     @Column(name = "NAME", length = 200)
76     private String name;
77
78     @Column(name = "VALUE", columnDefinition = "LONGTEXT")
79     private String value;
80
81     @BusinessKey
82     @Column(name = "TAG", length = 200)
83     private String tag;
84
85     @Column(name = "CREATE_TIME", insertable = false, updatable = false)
86     @Temporal(TemporalType.TIMESTAMP)
87     private Date created = null;
88
89     @Column(name = "IS_DATA_INTERNAL")
90     private Boolean isDataInternal = true;
91
92     @Override
93     public boolean equals(final Object other) {
94         if (!(other instanceof RequestProcessingData)) {
95             return false;
96         }
97         RequestProcessingData castOther = (RequestProcessingData) other;
98         return new EqualsBuilder().append(soRequestId, castOther.soRequestId).append(groupingId, castOther.groupingId)
99                 .append(name, castOther.name).append(tag, castOther.tag).isEquals();
100     }
101
102     @Override
103     public int hashCode() {
104         return new HashCodeBuilder().append(soRequestId).append(groupingId).append(name).append(tag).toHashCode();
105     }
106
107     @Override
108     public String toString() {
109         return new ToStringBuilder(this).append("id", id).append("soRequestId", soRequestId)
110                 .append("groupingId", groupingId).append("name", name).append("value", value).append("tag", tag)
111                 .append("isDataInternal", isDataInternal).toString();
112     }
113
114     @PrePersist
115     protected void createdAt() {
116         this.created = new Date();
117     }
118
119     public Integer getId() {
120         return id;
121     }
122
123     public void setId(Integer id) {
124         this.id = id;
125     }
126
127     public String getSoRequestId() {
128         return soRequestId;
129     }
130
131     public void setSoRequestId(String soRequestId) {
132         this.soRequestId = soRequestId;
133     }
134
135     public String getGroupingId() {
136         return groupingId;
137     }
138
139     public void setGroupingId(String groupingId) {
140         this.groupingId = groupingId;
141     }
142
143     public String getName() {
144         return name;
145     }
146
147     public void setName(String name) {
148         this.name = name;
149     }
150
151     public String getValue() {
152         return value;
153     }
154
155     public void setValue(String value) {
156         this.value = value;
157     }
158
159     public String getTag() {
160         return tag;
161     }
162
163     public void setTag(String tag) {
164         this.tag = tag;
165     }
166
167     public Date getCreated() {
168         return created;
169     }
170
171     public Boolean getIsDataInternal() {
172         return isDataInternal;
173     }
174
175     public void setIsDataInternal(Boolean isDataInternal) {
176         this.isDataInternal = isDataInternal;
177     }
178 }