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 = "configuration_customization")
49 public class ConfigurationResourceCustomization implements Serializable {
54 private static final long serialVersionUID = 1230671937560638856L;
58 @Column(name = "MODEL_CUSTOMIZATION_UUID")
59 private String modelCustomizationUUID;
61 @Column(name = "MODEL_INSTANCE_NAME")
62 private String modelInstanceName;
64 @Column(name = "CONFIGURATION_FUNCTION")
65 private String nfFunction;
67 @Column(name = "CONFIGURATION_TYPE")
68 private String nfType;
70 @Column(name = "CONFIGURATION_ROLE")
71 private String nfRole;
73 @Column(name = "CREATION_TIMESTAMP", updatable = false)
74 @Temporal(TemporalType.TIMESTAMP)
77 @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
78 @JoinColumn(name = "SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
79 private ServiceProxyResourceCustomization serviceProxyResourceCustomization;
81 @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
82 @JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
83 private ConfigurationResourceCustomization configResourceCustomization;
85 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
86 @JoinColumn(name = "CONFIGURATION_MODEL_UUID")
87 private ConfigurationResource configurationResource;
90 protected void onCreate() {
91 this.created = new Date();
94 public String getModelCustomizationUUID() {
95 return modelCustomizationUUID;
98 public void setModelCustomizationUUID(String modelCustomizationUUID) {
99 this.modelCustomizationUUID = modelCustomizationUUID;
102 public String getModelInstanceName() {
103 return modelInstanceName;
106 public void setModelInstanceName(String modelInstanceName) {
107 this.modelInstanceName = modelInstanceName;
110 public String getNfFunction() {
114 public void setNfFunction(String nfFunction) {
115 this.nfFunction = nfFunction;
118 public String getNfType() {
122 public void setNfType(String nfType) {
123 this.nfType = nfType;
126 public String getNfRole() {
130 public void setNfRole(String nfRole) {
131 this.nfRole = nfRole;
134 public Date getCreated() {
139 public ServiceProxyResourceCustomization getServiceProxyResourceCustomization() {
140 return serviceProxyResourceCustomization;
143 public void setServiceProxyResourceCustomization(
144 ServiceProxyResourceCustomization serviceProxyResourceCustomization) {
145 this.serviceProxyResourceCustomization = serviceProxyResourceCustomization;
149 public ConfigurationResourceCustomization getConfigResourceCustomization() {
150 return configResourceCustomization;
153 public void setConfigResourceCustomization(ConfigurationResourceCustomization configResourceCustomization) {
154 this.configResourceCustomization = configResourceCustomization;
158 public ConfigurationResource getConfigurationResource() {
159 return configurationResource;
162 public void setConfigurationResource(ConfigurationResource configurationResource) {
163 this.configurationResource = configurationResource;
167 public String toString() {
168 return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
169 .append("modelInstanceName", modelInstanceName).append("nfFunction", nfFunction)
170 .append("nfType", nfType).append("nfRole", nfRole).append("created", created)
171 .append("serviceProxyResourceCustomization", serviceProxyResourceCustomization)
172 .append("configResourceCustomization", configResourceCustomization)
173 .append("configurationResource", configurationResource).toString();
177 public boolean equals(final Object other) {
178 if (!(other instanceof ConfigurationResourceCustomization)) {
181 ConfigurationResourceCustomization castOther = (ConfigurationResourceCustomization) other;
182 return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
186 public int hashCode() {
187 return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();