org.onap migration
[vid.git] / vid-app-common / src / main / java / org / onap / vid / model / CategoryParameterOption.java
1 package org.onap.vid.model;
2
3 import org.openecomp.portalsdk.core.domain.support.DomainVo;
4
5 import javax.persistence.*;
6 import java.io.Serializable;
7 import java.util.Date;
8 import java.util.Set;
9
10 @Entity
11 @Table(name = "vid_category_parameter_option")
12 public class CategoryParameterOption extends DomainVo {
13
14     private Long id;
15     private String appId;
16     private String name;
17
18     private CategoryParameter categoryParameter;
19
20     public CategoryParameterOption() {
21     }
22
23     public CategoryParameterOption(String appId, String name, CategoryParameter categoryParameter) {
24         setAppId(appId);
25         setName(name);
26         setCategoryParameter(categoryParameter);
27     }
28
29     @Id
30     @GeneratedValue(strategy = GenerationType.IDENTITY)
31     @Column(name = "CATEGORY_OPT_DB_ID")
32     public Long getId() {
33         return id;
34     }
35
36     public void setId(Long id) {
37         this.id = id;
38     }
39
40     @Column(name = "CATEGORY_OPT_APP_ID")
41     public String getAppId() {
42         return appId;
43     }
44
45     public void setAppId(String appId) {
46         this.appId = appId;
47     }
48
49     @Column(name = "NAME")
50     public String getName() {
51         return name;
52     }
53
54     public void setName(String name) {
55         this.name = name;
56     }
57
58     @ManyToOne
59     @JoinColumn(name="CATEGORY_ID", nullable=false)
60     public CategoryParameter getCategoryParameter() {
61         return categoryParameter;
62     }
63
64     public void setCategoryParameter(CategoryParameter categoryParameter) {
65         this.categoryParameter = categoryParameter;
66     }
67
68     @Override
69     @Column(name = "CREATED_DATE")
70     public Date getCreated() {
71         return super.getCreated();
72     }
73
74     @Override
75     @Column(name = "MODIFIED_DATE")
76     public Date getModified() {
77         return super.getModified();
78     }
79
80     @Override
81     @Transient
82     public Long getCreatedId() {
83         return super.getCreatedId();
84     }
85
86     @Override
87     @Transient
88     public Long getModifiedId() {
89         return super.getModifiedId();
90     }
91
92     @Override
93     @Transient
94     public Serializable getAuditUserId() {
95         return super.getAuditUserId();
96     }
97
98     @Override
99     @Transient
100     public Long getRowNum() {
101         return super.getRowNum();
102     }
103
104     @Override
105     @Transient
106     public Set getAuditTrail() {
107         return super.getAuditTrail();
108     }
109
110     @Override
111     public boolean equals(Object o) {
112         if (this == o) return true;
113         if (o == null || getClass() != o.getClass()) return false;
114
115         CategoryParameterOption that = (CategoryParameterOption) o;
116
117         if (getAppId() != null ? !getAppId().equals(that.getAppId()) : that.getAppId() != null) return false;
118         if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) return false;
119         return getCategoryParameter() != null ? getCategoryParameter().equals(that.getCategoryParameter()) : that.getCategoryParameter() == null;
120     }
121
122     @Override
123     public int hashCode() {
124         int result = getAppId() != null ? getAppId().hashCode() : 0;
125         result = 31 * result + (getName() != null ? getName().hashCode() : 0);
126         result = 31 * result + (getCategoryParameter() != null ? getCategoryParameter().hashCode() : 0);
127         return result;
128     }
129
130     @Override
131     public String toString() {
132         return "CategoryParameterOption{" +
133                 "id=" + id +
134                 ", key='" + appId + '\'' +
135                 ", value='" + name + '\'' +
136                 ", categoryParameterId=" + categoryParameter.getId() +
137                 '}';
138     }
139 }