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 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;
47 @Table(name = "configuration_customization")
48 public class ConfigurationResourceCustomization implements Serializable {
53 private static final long serialVersionUID = 1230671937560638856L;
57 @Column(name = "MODEL_CUSTOMIZATION_UUID")
58 private String modelCustomizationUUID;
60 @Column(name = "MODEL_INSTANCE_NAME")
61 private String modelInstanceName;
63 @Column(name = "CONFIGURATION_FUNCTION")
64 private String nfFunction;
66 @Column(name = "CONFIGURATION_TYPE")
67 private String nfType;
69 @Column(name = "CONFIGURATION_ROLE")
70 private String nfRole;
72 @Column(name = "CREATION_TIMESTAMP", updatable = false)
73 @Temporal(TemporalType.TIMESTAMP)
76 @Column(name = "SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
77 private String serviceProxyResourceCustomizationUUID;
79 @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
80 @JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
81 private ConfigurationResourceCustomization configResourceCustomization;
83 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
84 @JoinColumn(name = "CONFIGURATION_MODEL_UUID")
85 private ConfigurationResource configurationResource;
88 protected void onCreate() {
89 this.created = new Date();
92 public String getModelCustomizationUUID() {
93 return modelCustomizationUUID;
96 public void setModelCustomizationUUID(String modelCustomizationUUID) {
97 this.modelCustomizationUUID = modelCustomizationUUID;
100 public String getModelInstanceName() {
101 return modelInstanceName;
104 public void setModelInstanceName(String modelInstanceName) {
105 this.modelInstanceName = modelInstanceName;
108 public String getNfFunction() {
112 public void setNfFunction(String nfFunction) {
113 this.nfFunction = nfFunction;
116 public String getNfType() {
120 public void setNfType(String nfType) {
121 this.nfType = nfType;
124 public String getNfRole() {
128 public void setNfRole(String nfRole) {
129 this.nfRole = nfRole;
132 public Date getCreated() {
136 public String getServiceProxyResourceCustomizationUUID() {
137 return serviceProxyResourceCustomizationUUID;
140 public void setServiceProxyResourceCustomizationUUID(String serviceProxyResourceCustomizationUUID) {
141 this.serviceProxyResourceCustomizationUUID = serviceProxyResourceCustomizationUUID;
145 public ConfigurationResourceCustomization getConfigResourceCustomization() {
146 return configResourceCustomization;
149 public void setConfigResourceCustomization(ConfigurationResourceCustomization configResourceCustomization) {
150 this.configResourceCustomization = configResourceCustomization;
154 public ConfigurationResource getConfigurationResource() {
155 return configurationResource;
158 public void setConfigurationResource(ConfigurationResource configurationResource) {
159 this.configurationResource = configurationResource;
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();
173 public boolean equals(final Object other) {
174 if (!(other instanceof ConfigurationResourceCustomization)) {
177 ConfigurationResourceCustomization castOther = (ConfigurationResourceCustomization) other;
178 return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
182 public int hashCode() {
183 return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();