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;
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.JoinColumn;
33 import javax.persistence.ManyToOne;
34 import javax.persistence.OneToOne;
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 import uk.co.blackpepper.bowman.annotation.RemoteResource;
47 @RemoteResource("/configurationResourceCustomization")
48 @Table(name = "configuration_customization")
49 public class ConfigurationResourceCustomization implements Serializable {
54 private static final long serialVersionUID = 1230671937560638856L;
59 @GeneratedValue(strategy = GenerationType.IDENTITY)
62 @Column(name = "MODEL_CUSTOMIZATION_UUID")
63 private String modelCustomizationUUID;
65 @Column(name = "MODEL_INSTANCE_NAME")
66 private String modelInstanceName;
68 @Column(name = "CONFIGURATION_FUNCTION")
69 private String function;
71 @Column(name = "CONFIGURATION_TYPE")
74 @Column(name = "CONFIGURATION_ROLE")
77 @Column(name = "CREATION_TIMESTAMP", updatable = false)
78 @Temporal(TemporalType.TIMESTAMP)
81 @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
82 @JoinColumn(name = "SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
83 private ServiceProxyResourceCustomization serviceProxyResourceCustomization;
85 @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
86 @JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_ID")
87 private ConfigurationResourceCustomization configResourceCustomization;
89 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
90 @JoinColumn(name = "CONFIGURATION_MODEL_UUID")
91 private ConfigurationResource configurationResource;
93 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
94 @JoinColumn(name = "SERVICE_MODEL_UUID")
95 private Service service;
98 protected void onCreate() {
99 this.created = new Date();
102 public Integer getId() {
106 public void setId(Integer id) {
110 public String getModelCustomizationUUID() {
111 return modelCustomizationUUID;
114 public void setModelCustomizationUUID(String modelCustomizationUUID) {
115 this.modelCustomizationUUID = modelCustomizationUUID;
118 public String getModelInstanceName() {
119 return modelInstanceName;
122 public void setModelInstanceName(String modelInstanceName) {
123 this.modelInstanceName = modelInstanceName;
126 public String getFunction() {
130 public void setFunction(String function) {
131 this.function = function;
134 public String getType() {
138 public void setType(String type) {
142 public String getRole() {
146 public void setRole(String role) {
150 public Date getCreated() {
155 public ServiceProxyResourceCustomization getServiceProxyResourceCustomization() {
156 return serviceProxyResourceCustomization;
159 public void setServiceProxyResourceCustomization(
160 ServiceProxyResourceCustomization serviceProxyResourceCustomization) {
161 this.serviceProxyResourceCustomization = serviceProxyResourceCustomization;
166 public ConfigurationResourceCustomization getConfigResourceCustomization() {
167 return configResourceCustomization;
170 public void setConfigResourceCustomization(ConfigurationResourceCustomization configResourceCustomization) {
171 this.configResourceCustomization = configResourceCustomization;
175 public ConfigurationResource getConfigurationResource() {
176 return configurationResource;
179 public void setConfigurationResource(ConfigurationResource configurationResource) {
180 this.configurationResource = configurationResource;
183 public Service getService() {
187 public void setService(Service service) {
188 this.service = service;
192 public String toString() {
193 return new ToStringBuilder(this).append("id", id).append("modelCustomizationUUID", modelCustomizationUUID)
194 .append("modelInstanceName", modelInstanceName).append("function", function).append("type", type)
195 .append("role", role).append("created", created)
196 // .append("serviceProxyResourceCustomization", serviceProxyResourceCustomization)
197 .append("configResourceCustomization", configResourceCustomization)
198 .append("configurationResource", configurationResource).append("service", service).toString();
202 public boolean equals(final Object other) {
203 if (!(other instanceof ConfigurationResourceCustomization)) {
206 ConfigurationResourceCustomization castOther = (ConfigurationResourceCustomization) other;
207 return new EqualsBuilder().append(id, castOther.id).isEquals();
211 public int hashCode() {
212 return new HashCodeBuilder().append(id).toHashCode();