2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.onap.so.db.catalog.beans;
23 import java.io.Serializable;
24 import java.util.Date;
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.OneToOne;
34 import javax.persistence.PrePersist;
35 import javax.persistence.Table;
36 import javax.persistence.Temporal;
37 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;
43 import com.openpojo.business.annotation.BusinessKey;
45 import uk.co.blackpepper.bowman.annotation.LinkedResource;
48 @Table(name = "service_proxy_customization")
49 public class ServiceProxyResourceCustomization implements Serializable {
54 private static final long serialVersionUID = -2822457299134903084L;
58 @Column(name = "MODEL_CUSTOMIZATION_UUID")
59 private String modelCustomizationUUID;
61 @Column(name = "MODEL_INSTANCE_NAME")
62 private String modelInstanceName;
64 @Column(name = "TOSCA_NODE_TYPE")
65 private String toscaNodeType;
67 @Column(name = "CREATION_TIMESTAMP", updatable = false)
68 @Temporal(TemporalType.TIMESTAMP)
71 @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
72 @JoinColumn(name = "SOURCE_SERVICE_MODEL_UUID")
73 private Service sourceService;
75 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
76 @JoinColumn(name = "SERVICE_PROXY_MODEL_UUID")
77 private ServiceProxyResource serviceProxyResource;
79 @OneToOne(mappedBy = "serviceProxyResourceCustomization")
80 private ConfigurationResourceCustomization configResourceCustomization;
83 protected void onCreate() {
84 this.created = new Date();
87 public String getModelCustomizationUUID() {
88 return modelCustomizationUUID;
91 public void setModelCustomizationUUID(String modelCustomizationUUID) {
92 this.modelCustomizationUUID = modelCustomizationUUID;
95 public String getModelInstanceName() {
96 return modelInstanceName;
99 public void setModelInstanceName(String modelInstanceName) {
100 this.modelInstanceName = modelInstanceName;
103 public String getToscaNodeType() {
104 return toscaNodeType;
107 public void setToscaNodeType(String toscaNodeType) {
108 this.toscaNodeType = toscaNodeType;
111 public Date getCreated() {
116 public Service getSourceService() {
117 return sourceService;
120 public void setSourceService(Service sourceService) {
121 this.sourceService = sourceService;
125 public ServiceProxyResource getServiceProxyResource() {
126 return serviceProxyResource;
129 public void setServiceProxyResource(ServiceProxyResource serviceProxyResource) {
130 this.serviceProxyResource = serviceProxyResource;
134 public ConfigurationResourceCustomization getConfigResourceCustomization() {
135 return configResourceCustomization;
138 public void setConfigResourceCustomization(ConfigurationResourceCustomization configResourceCustomization) {
139 this.configResourceCustomization = configResourceCustomization;
143 public String toString() {
144 return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
145 .append("modelInstanceName", modelInstanceName).append("toscaNodeType", toscaNodeType)
146 .append("created", created).append("sourceService", sourceService)
147 .append("serviceProxyResource", serviceProxyResource)
148 .append("configResourceCustomization", configResourceCustomization).toString();
152 public boolean equals(final Object other) {
153 if (!(other instanceof ServiceProxyResourceCustomization)) {
156 ServiceProxyResourceCustomization castOther = (ServiceProxyResourceCustomization) other;
157 return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
161 public int hashCode() {
162 return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();