Replaced all tabs with spaces in java and pom.xml
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / ConfigurationResourceCustomization.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.Id;
31 import javax.persistence.JoinColumn;
32 import javax.persistence.ManyToOne;
33 import javax.persistence.MapsId;
34 import javax.persistence.OneToMany;
35 import javax.persistence.OneToOne;
36 import javax.persistence.PrePersist;
37 import javax.persistence.Table;
38 import javax.persistence.Temporal;
39 import javax.persistence.TemporalType;
40 import org.apache.commons.lang3.builder.EqualsBuilder;
41 import org.apache.commons.lang3.builder.HashCodeBuilder;
42 import org.apache.commons.lang3.builder.ToStringBuilder;
43 import com.openpojo.business.annotation.BusinessKey;
44 import uk.co.blackpepper.bowman.annotation.LinkedResource;
45
46 @Entity
47 @Table(name = "configuration_customization")
48 public class ConfigurationResourceCustomization implements Serializable {
49
50     /**
51      * 
52      */
53     private static final long serialVersionUID = 1230671937560638856L;
54
55     @BusinessKey
56     @Id
57     @Column(name = "MODEL_CUSTOMIZATION_UUID")
58     private String modelCustomizationUUID;
59
60     @Column(name = "MODEL_INSTANCE_NAME")
61     private String modelInstanceName;
62
63     @Column(name = "CONFIGURATION_FUNCTION")
64     private String nfFunction;
65
66     @Column(name = "CONFIGURATION_TYPE")
67     private String nfType;
68
69     @Column(name = "CONFIGURATION_ROLE")
70     private String nfRole;
71
72     @Column(name = "CREATION_TIMESTAMP", updatable = false)
73     @Temporal(TemporalType.TIMESTAMP)
74     private Date created;
75
76     @Column(name = "SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
77     private String serviceProxyResourceCustomizationUUID;
78
79     @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
80     @JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
81     private ConfigurationResourceCustomization configResourceCustomization;
82
83     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
84     @JoinColumn(name = "CONFIGURATION_MODEL_UUID")
85     private ConfigurationResource configurationResource;
86
87     @PrePersist
88     protected void onCreate() {
89         this.created = new Date();
90     }
91
92     public String getModelCustomizationUUID() {
93         return modelCustomizationUUID;
94     }
95
96     public void setModelCustomizationUUID(String modelCustomizationUUID) {
97         this.modelCustomizationUUID = modelCustomizationUUID;
98     }
99
100     public String getModelInstanceName() {
101         return modelInstanceName;
102     }
103
104     public void setModelInstanceName(String modelInstanceName) {
105         this.modelInstanceName = modelInstanceName;
106     }
107
108     public String getNfFunction() {
109         return nfFunction;
110     }
111
112     public void setNfFunction(String nfFunction) {
113         this.nfFunction = nfFunction;
114     }
115
116     public String getNfType() {
117         return nfType;
118     }
119
120     public void setNfType(String nfType) {
121         this.nfType = nfType;
122     }
123
124     public String getNfRole() {
125         return nfRole;
126     }
127
128     public void setNfRole(String nfRole) {
129         this.nfRole = nfRole;
130     }
131
132     public Date getCreated() {
133         return created;
134     }
135
136     public String getServiceProxyResourceCustomizationUUID() {
137         return serviceProxyResourceCustomizationUUID;
138     }
139
140     public void setServiceProxyResourceCustomizationUUID(String serviceProxyResourceCustomizationUUID) {
141         this.serviceProxyResourceCustomizationUUID = serviceProxyResourceCustomizationUUID;
142     }
143
144     @LinkedResource
145     public ConfigurationResourceCustomization getConfigResourceCustomization() {
146         return configResourceCustomization;
147     }
148
149     public void setConfigResourceCustomization(ConfigurationResourceCustomization configResourceCustomization) {
150         this.configResourceCustomization = configResourceCustomization;
151     }
152
153     @LinkedResource
154     public ConfigurationResource getConfigurationResource() {
155         return configurationResource;
156     }
157
158     public void setConfigurationResource(ConfigurationResource configurationResource) {
159         this.configurationResource = configurationResource;
160     }
161
162     @Override
163     public String toString() {
164         return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
165                 .append("modelInstanceName", modelInstanceName).append("nfFunction", nfFunction)
166                 .append("nfType", nfType).append("nfRole", nfRole).append("created", created)
167                 // .append("serviceProxyResourceCustomization", serviceProxyResourceCustomization)
168                 .append("configResourceCustomization", configResourceCustomization)
169                 .append("configurationResource", configurationResource).toString();
170     }
171
172     @Override
173     public boolean equals(final Object other) {
174         if (!(other instanceof ConfigurationResourceCustomization)) {
175             return false;
176         }
177         ConfigurationResourceCustomization castOther = (ConfigurationResourceCustomization) other;
178         return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
179     }
180
181     @Override
182     public int hashCode() {
183         return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
184     }
185
186 }