Replaced all tabs with spaces in java and pom.xml
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / VnfcInstanceGroupCustomization.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 java.util.Date;
25 import javax.persistence.CascadeType;
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.FetchType;
29 import javax.persistence.GeneratedValue;
30 import javax.persistence.GenerationType;
31 import javax.persistence.Id;
32 import javax.persistence.IdClass;
33 import javax.persistence.JoinColumn;
34 import javax.persistence.ManyToOne;
35 import javax.persistence.PrePersist;
36 import javax.persistence.Table;
37 import javax.persistence.Temporal;
38 import javax.persistence.TemporalType;
39 import org.apache.commons.lang3.builder.EqualsBuilder;
40 import org.apache.commons.lang3.builder.HashCodeBuilder;
41 import org.apache.commons.lang3.builder.ToStringBuilder;
42 import com.openpojo.business.annotation.BusinessKey;
43 import uk.co.blackpepper.bowman.annotation.LinkedResource;
44
45 @Entity
46
47 @Table(name = "vnfc_instance_group_customization")
48 public class VnfcInstanceGroupCustomization implements Serializable {
49
50     /**
51      * 
52      */
53     private static final long serialVersionUID = -8288218040186901676L;
54
55     @Id
56     @BusinessKey
57     @Column(name = "ID")
58     @GeneratedValue(strategy = GenerationType.IDENTITY)
59     private Integer id;
60
61     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
62     @JoinColumn(name = "VNF_RESOURCE_CUSTOMIZATION_ID")
63     private VnfResourceCustomization vnfResourceCust;
64
65     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
66     @JoinColumn(name = "INSTANCE_GROUP_MODEL_UUID")
67     private InstanceGroup instanceGroup;
68
69     @Column(name = "FUNCTION")
70     private String function;
71
72     @Column(name = "DESCRIPTION")
73     private String description;
74
75     @Column(name = "CREATION_TIMESTAMP", updatable = false)
76     @Temporal(TemporalType.TIMESTAMP)
77     private Date created;
78
79     @Override
80     public boolean equals(final Object other) {
81         if (!(other instanceof VnfcInstanceGroupCustomization)) {
82             return false;
83         }
84         VnfcInstanceGroupCustomization castOther = (VnfcInstanceGroupCustomization) other;
85         return new EqualsBuilder().append(id, castOther.id).isEquals();
86     }
87
88     @Override
89     public int hashCode() {
90         return new HashCodeBuilder().append(id).toHashCode();
91     }
92
93     @Override
94     public String toString() {
95         return new ToStringBuilder(this).append("function", function).append("description", description)
96                 .append("created", created).toString();
97     }
98
99     public Integer getId() {
100         return id;
101     }
102
103     public void setId(Integer id) {
104         this.id = id;
105     }
106
107     @PrePersist
108     protected void onCreate() {
109         this.created = new Date();
110     }
111
112     public Date getCreated() {
113         return created;
114     }
115
116     public String getFunction() {
117         return function;
118     }
119
120     public void setFunction(String function) {
121         this.function = function;
122     }
123
124     public String getDescription() {
125         return description;
126     }
127
128     public void setDescription(String description) {
129         this.description = description;
130     }
131
132     public void setCreated(Date created) {
133         this.created = created;
134     }
135
136     @LinkedResource
137     public VnfResourceCustomization getVnfResourceCust() {
138         return vnfResourceCust;
139     }
140
141     public void setVnfResourceCust(VnfResourceCustomization vnfResourceCust) {
142         this.vnfResourceCust = vnfResourceCust;
143     }
144
145     @LinkedResource
146     public InstanceGroup getInstanceGroup() {
147         return instanceGroup;
148     }
149
150     public void setInstanceGroup(InstanceGroup instanceGroup) {
151         this.instanceGroup = instanceGroup;
152     }
153 }