2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2019 AT&T Intellectual Property. 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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.vid.model;
23 import java.io.Serializable;
24 import java.util.Date;
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.GeneratedValue;
29 import javax.persistence.GenerationType;
30 import javax.persistence.Id;
31 import javax.persistence.JoinColumn;
32 import javax.persistence.ManyToOne;
33 import javax.persistence.Table;
34 import javax.persistence.Transient;
35 import org.onap.portalsdk.core.domain.support.DomainVo;
38 @Table(name = "vid_category_parameter_option")
39 public class CategoryParameterOption extends DomainVo {
44 private CategoryParameter categoryParameter;
46 public CategoryParameterOption() {
49 public CategoryParameterOption(String appId, String name, CategoryParameter categoryParameter) {
52 setCategoryParameter(categoryParameter);
56 @GeneratedValue(strategy = GenerationType.IDENTITY)
57 @Column(name = "CATEGORY_OPT_DB_ID")
62 @Column(name = "CATEGORY_OPT_APP_ID")
63 public String getAppId() {
67 public void setAppId(String appId) {
71 @Column(name = "NAME")
72 public String getName() {
76 public void setName(String name) {
81 @JoinColumn(name="CATEGORY_ID", nullable=false)
82 public CategoryParameter getCategoryParameter() {
83 return categoryParameter;
86 public void setCategoryParameter(CategoryParameter categoryParameter) {
87 this.categoryParameter = categoryParameter;
91 @Column(name = "CREATED_DATE")
92 public Date getCreated() {
93 return super.getCreated();
97 @Column(name = "MODIFIED_DATE")
98 public Date getModified() {
99 return super.getModified();
104 public Long getCreatedId() {
105 return super.getCreatedId();
110 public Long getModifiedId() {
111 return super.getModifiedId();
116 public Serializable getAuditUserId() {
117 return super.getAuditUserId();
122 public Long getRowNum() {
123 return super.getRowNum();
128 public Set getAuditTrail() {
129 return super.getAuditTrail();
133 public boolean equals(Object o) {
137 if (o == null || getClass() != o.getClass()) {
141 CategoryParameterOption that = (CategoryParameterOption) o;
143 if (getAppId() != null ? !getAppId().equals(that.getAppId()) : that.getAppId() != null) {
146 if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) {
149 return getCategoryParameter() != null ? getCategoryParameter().equals(that.getCategoryParameter())
150 : that.getCategoryParameter() == null;
154 public int hashCode() {
155 int result = getAppId() != null ? getAppId().hashCode() : 0;
156 result = 31 * result + (getName() != null ? getName().hashCode() : 0);
157 result = 31 * result + hashCodeOfParentCategoryParameter();
161 private int hashCodeOfParentCategoryParameter() {
162 // Don't use getCategoryParameter's hashCode, as it might loop back to self's hasCode
163 return (getCategoryParameter() == null || getCategoryParameter().getId() == null)
164 ? 0 : getCategoryParameter().getId().hashCode();
168 public String toString() {
169 return "CategoryParameterOption{" +
171 ", key='" + appId + '\'' +
172 ", value='" + name + '\'' +
173 ", categoryParameterId=" + categoryParameter.getId() +