Replaced all tabs with spaces in java and pom.xml
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / ServiceProxyResourceCustomization.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 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 java.util.List;
26 import javax.persistence.CascadeType;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.FetchType;
30 import javax.persistence.GeneratedValue;
31 import javax.persistence.GenerationType;
32 import javax.persistence.Id;
33 import javax.persistence.JoinColumn;
34 import javax.persistence.JoinTable;
35 import javax.persistence.ManyToOne;
36 import javax.persistence.OneToMany;
37 import javax.persistence.OneToOne;
38 import javax.persistence.PrePersist;
39 import javax.persistence.Table;
40 import javax.persistence.Temporal;
41 import javax.persistence.TemporalType;
42 import org.apache.commons.lang3.builder.EqualsBuilder;
43 import org.apache.commons.lang3.builder.HashCodeBuilder;
44 import org.apache.commons.lang3.builder.ToStringBuilder;
45 import com.openpojo.business.annotation.BusinessKey;
46 import uk.co.blackpepper.bowman.annotation.LinkedResource;
47
48 @Entity
49 @Table(name = "service_proxy_customization")
50 public class ServiceProxyResourceCustomization implements Serializable {
51
52     /**
53      * 
54      */
55     private static final long serialVersionUID = -2822457299134903084L;
56
57     @BusinessKey
58     @Id
59     @Column(name = "MODEL_CUSTOMIZATION_UUID")
60     private String modelCustomizationUUID;
61
62     @Column(name = "MODEL_INSTANCE_NAME")
63     private String modelInstanceName;
64
65     @Column(name = "MODEL_UUID")
66     private String modelUUID;
67
68     @Column(name = "MODEL_INVARIANT_UUID")
69     private String modelInvariantUUID;
70
71     @Column(name = "MODEL_VERSION")
72     private String modelVersion;
73
74     @Column(name = "MODEL_NAME")
75     private String modelName;
76
77     @Column(name = "TOSCA_NODE_TYPE")
78     private String toscaNodeType;
79
80     @Column(name = "DESCRIPTION")
81     private String description;
82
83     @Column(name = "CREATION_TIMESTAMP", updatable = false)
84     @Temporal(TemporalType.TIMESTAMP)
85     private Date created;
86
87     @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
88     @JoinColumn(name = "SOURCE_SERVICE_MODEL_UUID")
89     private Service sourceService;
90
91     @PrePersist
92     protected void onCreate() {
93         this.created = new Date();
94     }
95
96     public String getModelCustomizationUUID() {
97         return modelCustomizationUUID;
98     }
99
100     public void setModelCustomizationUUID(String modelCustomizationUUID) {
101         this.modelCustomizationUUID = modelCustomizationUUID;
102     }
103
104     public String getModelInstanceName() {
105         return modelInstanceName;
106     }
107
108     public void setModelInstanceName(String modelInstanceName) {
109         this.modelInstanceName = modelInstanceName;
110     }
111
112     public String getToscaNodeType() {
113         return toscaNodeType;
114     }
115
116     public void setToscaNodeType(String toscaNodeType) {
117         this.toscaNodeType = toscaNodeType;
118     }
119
120     public Date getCreated() {
121         return created;
122     }
123
124     @LinkedResource
125     public Service getSourceService() {
126         return sourceService;
127     }
128
129     public void setSourceService(Service sourceService) {
130         this.sourceService = sourceService;
131     }
132
133     public String getModelUUID() {
134         return modelUUID;
135     }
136
137     public void setModelUUID(String modelUUID) {
138         this.modelUUID = modelUUID;
139     }
140
141     public String getModelInvariantUUID() {
142         return modelInvariantUUID;
143     }
144
145     public void setModelInvariantUUID(String modelInvariantUUID) {
146         this.modelInvariantUUID = modelInvariantUUID;
147     }
148
149     public String getModelVersion() {
150         return modelVersion;
151     }
152
153     public void setModelVersion(String modelVersion) {
154         this.modelVersion = modelVersion;
155     }
156
157     public String getModelName() {
158         return modelName;
159     }
160
161     public void setModelName(String modelName) {
162         this.modelName = modelName;
163     }
164
165     public String getDescription() {
166         return description;
167     }
168
169     public void setDescription(String description) {
170         this.description = description;
171     }
172
173
174     @Override
175     public String toString() {
176         return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
177                 .append("modelInstanceName", modelInstanceName).append("toscaNodeType", toscaNodeType)
178                 .append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID)
179                 .append("modelName", modelName).append("description", description).append("created", created)
180                 .append("sourceService", sourceService).toString();
181     }
182
183     @Override
184     public boolean equals(final Object other) {
185         if (!(other instanceof ServiceProxyResourceCustomization)) {
186             return false;
187         }
188         ServiceProxyResourceCustomization castOther = (ServiceProxyResourceCustomization) other;
189         return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
190     }
191
192     @Override
193     public int hashCode() {
194         return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
195     }
196 }