Aharoni, Pavel (pa0916) | ca3cb01 | 2018-10-22 15:29:57 +0300 | [diff] [blame] | 1 | /*-
|
| 2 | * ============LICENSE_START=======================================================
|
| 3 | * OSAM
|
| 4 | * ================================================================================
|
| 5 | * Copyright (C) 2018 AT&T
|
| 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 |
|
| 22 |
|
| 23 | package org.onap.osam.model;
|
| 24 |
|
| 25 | import org.onap.portalsdk.core.domain.support.DomainVo;
|
| 26 |
|
| 27 | import javax.persistence.*;
|
| 28 | import java.io.Serializable;
|
| 29 | import java.util.Date;
|
| 30 | import java.util.Set;
|
| 31 |
|
| 32 | @Entity
|
| 33 | @Table(name = "vid_category_parameter_option")
|
| 34 | public class CategoryParameterOption extends DomainVo {
|
| 35 |
|
| 36 | private String appId;
|
| 37 | private String name;
|
| 38 |
|
| 39 | private CategoryParameter categoryParameter;
|
| 40 |
|
| 41 | public CategoryParameterOption() {
|
| 42 | }
|
| 43 |
|
| 44 | public CategoryParameterOption(String appId, String name, CategoryParameter categoryParameter) {
|
| 45 | setAppId(appId);
|
| 46 | setName(name);
|
| 47 | setCategoryParameter(categoryParameter);
|
| 48 | }
|
| 49 |
|
| 50 | @Id
|
| 51 | @GeneratedValue(strategy = GenerationType.IDENTITY)
|
| 52 | @Column(name = "CATEGORY_OPT_DB_ID")
|
| 53 | public Long getId() {
|
| 54 | return id;
|
| 55 | }
|
| 56 |
|
| 57 | @Column(name = "CATEGORY_OPT_APP_ID")
|
| 58 | public String getAppId() {
|
| 59 | return appId;
|
| 60 | }
|
| 61 |
|
| 62 | public void setAppId(String appId) {
|
| 63 | this.appId = appId;
|
| 64 | }
|
| 65 |
|
| 66 | @Column(name = "NAME")
|
| 67 | public String getName() {
|
| 68 | return name;
|
| 69 | }
|
| 70 |
|
| 71 | public void setName(String name) {
|
| 72 | this.name = name;
|
| 73 | }
|
| 74 |
|
| 75 | @ManyToOne
|
| 76 | @JoinColumn(name="CATEGORY_ID", nullable=false)
|
| 77 | public CategoryParameter getCategoryParameter() {
|
| 78 | return categoryParameter;
|
| 79 | }
|
| 80 |
|
| 81 | public void setCategoryParameter(CategoryParameter categoryParameter) {
|
| 82 | this.categoryParameter = categoryParameter;
|
| 83 | }
|
| 84 |
|
| 85 | @Override
|
| 86 | @Column(name = "CREATED_DATE")
|
| 87 | public Date getCreated() {
|
| 88 | return super.getCreated();
|
| 89 | }
|
| 90 |
|
| 91 | @Override
|
| 92 | @Column(name = "MODIFIED_DATE")
|
| 93 | public Date getModified() {
|
| 94 | return super.getModified();
|
| 95 | }
|
| 96 |
|
| 97 | @Override
|
| 98 | @Transient
|
| 99 | public Long getCreatedId() {
|
| 100 | return super.getCreatedId();
|
| 101 | }
|
| 102 |
|
| 103 | @Override
|
| 104 | @Transient
|
| 105 | public Long getModifiedId() {
|
| 106 | return super.getModifiedId();
|
| 107 | }
|
| 108 |
|
| 109 | @Override
|
| 110 | @Transient
|
| 111 | public Serializable getAuditUserId() {
|
| 112 | return super.getAuditUserId();
|
| 113 | }
|
| 114 |
|
| 115 | @Override
|
| 116 | @Transient
|
| 117 | public Long getRowNum() {
|
| 118 | return super.getRowNum();
|
| 119 | }
|
| 120 |
|
| 121 | @Override
|
| 122 | @Transient
|
| 123 | public Set getAuditTrail() {
|
| 124 | return super.getAuditTrail();
|
| 125 | }
|
| 126 |
|
| 127 | @Override
|
| 128 | public boolean equals(Object o) {
|
| 129 | if (this == o) return true;
|
| 130 | if (o == null || getClass() != o.getClass()) return false;
|
| 131 |
|
| 132 | CategoryParameterOption that = (CategoryParameterOption) o;
|
| 133 |
|
| 134 | if (getAppId() != null ? !getAppId().equals(that.getAppId()) : that.getAppId() != null) return false;
|
| 135 | if (getName() != null ? !getName().equals(that.getName()) : that.getName() != null) return false;
|
| 136 | return getCategoryParameter() != null ? getCategoryParameter().equals(that.getCategoryParameter()) : that.getCategoryParameter() == null;
|
| 137 | }
|
| 138 |
|
| 139 | @Override
|
| 140 | public int hashCode() {
|
| 141 | int result = getAppId() != null ? getAppId().hashCode() : 0;
|
| 142 | result = 31 * result + (getName() != null ? getName().hashCode() : 0);
|
| 143 | result = 31 * result + (getCategoryParameter() != null ? getCategoryParameter().hashCode() : 0);
|
| 144 | return result;
|
| 145 | }
|
| 146 |
|
| 147 | @Override
|
| 148 | public String toString() {
|
| 149 | return "CategoryParameterOption{" +
|
| 150 | "id=" + id +
|
| 151 | ", key='" + appId + '\'' +
|
| 152 | ", value='" + name + '\'' +
|
| 153 | ", categoryParameterId=" + categoryParameter.getId() +
|
| 154 | '}';
|
| 155 | }
|
| 156 | }
|