[SO] Release so 1.13.0 image
[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 javax.persistence.CascadeType;
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.FetchType;
29 import javax.persistence.Id;
30 import javax.persistence.JoinColumn;
31 import javax.persistence.OneToOne;
32 import javax.persistence.PrePersist;
33 import javax.persistence.Table;
34 import javax.persistence.Temporal;
35 import javax.persistence.TemporalType;
36 import org.apache.commons.lang3.builder.EqualsBuilder;
37 import org.apache.commons.lang3.builder.HashCodeBuilder;
38 import org.apache.commons.lang3.builder.ToStringBuilder;
39 import com.openpojo.business.annotation.BusinessKey;
40 import uk.co.blackpepper.bowman.annotation.LinkedResource;
41 import uk.co.blackpepper.bowman.annotation.RemoteResource;
42
43 @Entity
44 @RemoteResource("/serviceProxyResourceCustomization")
45 @Table(name = "service_proxy_customization")
46 public class ServiceProxyResourceCustomization implements Serializable {
47
48     /**
49      * 
50      */
51     private static final long serialVersionUID = -2822457299134903084L;
52
53     @BusinessKey
54     @Id
55     @Column(name = "MODEL_CUSTOMIZATION_UUID")
56     private String modelCustomizationUUID;
57
58     @Column(name = "MODEL_INSTANCE_NAME")
59     private String modelInstanceName;
60
61     @Column(name = "MODEL_UUID")
62     private String modelUUID;
63
64     @Column(name = "MODEL_INVARIANT_UUID")
65     private String modelInvariantUUID;
66
67     @Column(name = "MODEL_VERSION")
68     private String modelVersion;
69
70     @Column(name = "MODEL_NAME")
71     private String modelName;
72
73     @Column(name = "TOSCA_NODE_TYPE")
74     private String toscaNodeType;
75
76     @Column(name = "DESCRIPTION")
77     private String description;
78
79     @Column(name = "CREATION_TIMESTAMP", updatable = false)
80     @Temporal(TemporalType.TIMESTAMP)
81     private Date created;
82
83     @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
84     @JoinColumn(name = "SOURCE_SERVICE_MODEL_UUID")
85     private Service sourceService;
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 getToscaNodeType() {
109         return toscaNodeType;
110     }
111
112     public void setToscaNodeType(String toscaNodeType) {
113         this.toscaNodeType = toscaNodeType;
114     }
115
116     public Date getCreated() {
117         return created;
118     }
119
120     @LinkedResource
121     public Service getSourceService() {
122         return sourceService;
123     }
124
125     public void setSourceService(Service sourceService) {
126         this.sourceService = sourceService;
127     }
128
129     public String getModelUUID() {
130         return modelUUID;
131     }
132
133     public void setModelUUID(String modelUUID) {
134         this.modelUUID = modelUUID;
135     }
136
137     public String getModelInvariantUUID() {
138         return modelInvariantUUID;
139     }
140
141     public void setModelInvariantUUID(String modelInvariantUUID) {
142         this.modelInvariantUUID = modelInvariantUUID;
143     }
144
145     public String getModelVersion() {
146         return modelVersion;
147     }
148
149     public void setModelVersion(String modelVersion) {
150         this.modelVersion = modelVersion;
151     }
152
153     public String getModelName() {
154         return modelName;
155     }
156
157     public void setModelName(String modelName) {
158         this.modelName = modelName;
159     }
160
161     public String getDescription() {
162         return description;
163     }
164
165     public void setDescription(String description) {
166         this.description = description;
167     }
168
169
170     @Override
171     public String toString() {
172         return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
173                 .append("modelInstanceName", modelInstanceName).append("toscaNodeType", toscaNodeType)
174                 .append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID)
175                 .append("modelName", modelName).append("description", description).append("created", created)
176                 .append("sourceService", sourceService).toString();
177     }
178
179     @Override
180     public boolean equals(final Object other) {
181         if (!(other instanceof ServiceProxyResourceCustomization)) {
182             return false;
183         }
184         ServiceProxyResourceCustomization castOther = (ServiceProxyResourceCustomization) other;
185         return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
186     }
187
188     @Override
189     public int hashCode() {
190         return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
191     }
192 }