Correct Catalog DB beans
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / ActivitySpecActivitySpecCategories.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 - 2018 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
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.catalog.beans;
22
23 import java.io.Serializable;
24 import javax.persistence.CascadeType;
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.FetchType;
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 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.openpojo.business.annotation.BusinessKey;
38 import uk.co.blackpepper.bowman.annotation.LinkedResource;
39
40 @Entity
41 @Table(name = "activity_spec_to_activity_spec_categories")
42 public class ActivitySpecActivitySpecCategories implements Serializable {
43
44     private static final long serialVersionUID = 6228647901909437418L;
45
46     @Id
47     @Column(name = "ID", nullable = false, updatable = false)
48     @GeneratedValue(strategy = GenerationType.IDENTITY)
49     private Integer ID;
50
51     @BusinessKey
52     @Id
53     @Column(name = "ACTIVITY_SPEC_ID")
54     private Integer activitySpecId;
55
56     @BusinessKey
57     @Id
58     @Column(name = "ACTIVITY_SPEC_CATEGORIES_ID")
59     private Integer activitySpecCategoriesId;
60
61     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
62     @JoinColumn(name = "ACTIVITY_SPEC_ID", updatable = false, insertable = false)
63     private ActivitySpec activitySpec;
64
65     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
66     @JoinColumn(name = "ACTIVITY_SPEC_CATEGORIES_ID", updatable = false, insertable = false)
67     private ActivitySpecCategories activitySpecCategories;
68
69     @Override
70     public String toString() {
71         return new ToStringBuilder(this).append("activitySpecId", activitySpecId)
72                 .append("activitySpecCategoriesId", activitySpecCategoriesId).toString();
73     }
74
75     @Override
76     public boolean equals(final Object other) {
77         if (!(other instanceof ActivitySpecActivitySpecCategories)) {
78             return false;
79         }
80         ActivitySpecActivitySpecCategories castOther = (ActivitySpecActivitySpecCategories) other;
81         return new EqualsBuilder().append(activitySpecId, castOther.activitySpecId)
82                 .append(activitySpecCategoriesId, castOther.activitySpecCategoriesId).isEquals();
83     }
84
85     @Override
86     public int hashCode() {
87         return new HashCodeBuilder().append(activitySpecId).append(activitySpecCategoriesId).toHashCode();
88     }
89
90     public Integer getID() {
91         return ID;
92     }
93
94     public Integer getActivitySpecId() {
95         return activitySpecId;
96     }
97
98     public void setActivitySpecId(Integer activitySpecId) {
99         this.activitySpecId = activitySpecId;
100     }
101
102     public Integer getActivitySpecCategoriesId() {
103         return activitySpecCategoriesId;
104     }
105
106     public void setActivitySpecCategoriesId(Integer activitySpecCategoriesId) {
107         this.activitySpecCategoriesId = activitySpecCategoriesId;
108     }
109
110     public ActivitySpec getActivitySpec() {
111         return activitySpec;
112     }
113
114     public void setActivitySpec(ActivitySpec activitySpec) {
115         this.activitySpec = activitySpec;
116     }
117
118     @LinkedResource
119     public ActivitySpecCategories getActivitySpecCategories() {
120         return activitySpecCategories;
121     }
122
123     public void setActivitySpecCategories(ActivitySpecCategories activitySpecCategories) {
124         this.activitySpecCategories = activitySpecCategories;
125     }
126
127 }