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")
63 @Column(name = "CATEGORY_OPT_APP_ID")
64 public String getAppId() {
68 public void setAppId(String appId) {
72 @Column(name = "NAME")
73 public String getName() {
77 public void setName(String name) {
82 @JoinColumn(name="CATEGORY_ID", nullable=false)
83 public CategoryParameter getCategoryParameter() {
84 return categoryParameter;
87 public void setCategoryParameter(CategoryParameter categoryParameter) {
88 this.categoryParameter = categoryParameter;
92 @Column(name = "CREATED_DATE")
93 public Date getCreated() {
94 return super.getCreated();
98 @Column(name = "MODIFIED_DATE")
99 public Date getModified() {
100 return super.getModified();
105 public Long getCreatedId() {
106 return super.getCreatedId();
111 public Long getModifiedId() {
112 return super.getModifiedId();
117 public Serializable getAuditUserId() {
118 return super.getAuditUserId();
123 public Long getRowNum() {
124 return super.getRowNum();
129 public Set getAuditTrail() {
130 return super.getAuditTrail();
134 public boolean equals(Object o) {
138 if (o == null || getClass() != o.getClass()) {
142 CategoryParameterOption that = (CategoryParameterOption) o;
144 if (getAppId() != null ? !getAppId().equals(that.getAppId()) : that.getAppId() != null) {
147 if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) {
150 return getCategoryParameter() != null ? getCategoryParameter().equals(that.getCategoryParameter())
151 : that.getCategoryParameter() == null;
155 public int hashCode() {
156 int result = getAppId() != null ? getAppId().hashCode() : 0;
157 result = 31 * result + (getName() != null ? getName().hashCode() : 0);
158 result = 31 * result + hashCodeOfParentCategoryParameter();
162 private int hashCodeOfParentCategoryParameter() {
163 // Don't use getCategoryParameter's hashCode, as it might loop back to self's hasCode
164 return (getCategoryParameter() == null || getCategoryParameter().getId() == null)
165 ? 0 : getCategoryParameter().getId().hashCode();
169 public String toString() {
170 return "CategoryParameterOption{" +
172 ", key='" + appId + '\'' +
173 ", value='" + name + '\'' +
174 ", categoryParameterId=" + categoryParameter.getId() +