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;
27 import javax.persistence.CascadeType;
28 import javax.persistence.Column;
29 import javax.persistence.Entity;
30 import javax.persistence.FetchType;
31 import javax.persistence.Id;
32 import javax.persistence.JoinColumn;
33 import javax.persistence.ManyToOne;
34 import javax.persistence.MapsId;
35 import javax.persistence.OneToMany;
36 import javax.persistence.OneToOne;
37 import javax.persistence.PrePersist;
38 import javax.persistence.Table;
39 import javax.persistence.Temporal;
40 import javax.persistence.TemporalType;
42 import org.apache.commons.lang3.builder.EqualsBuilder;
43 import org.apache.commons.lang3.builder.HashCodeBuilder;
44 import org.apache.commons.lang3.builder.ToStringBuilder;
46 import com.openpojo.business.annotation.BusinessKey;
48 import uk.co.blackpepper.bowman.annotation.LinkedResource;
51 @Table(name = "configuration_customization")
52 public class ConfigurationResourceCustomization implements Serializable {
57 private static final long serialVersionUID = 1230671937560638856L;
61 @Column(name = "MODEL_CUSTOMIZATION_UUID")
62 private String modelCustomizationUUID;
64 @Column(name = "MODEL_INSTANCE_NAME")
65 private String modelInstanceName;
67 @Column(name = "CONFIGURATION_FUNCTION")
68 private String nfFunction;
70 @Column(name = "CONFIGURATION_TYPE")
71 private String nfType;
73 @Column(name = "CONFIGURATION_ROLE")
74 private String nfRole;
76 @Column(name = "CREATION_TIMESTAMP", updatable = false)
77 @Temporal(TemporalType.TIMESTAMP)
80 @Column(name = "SERVICE_PROXY_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
81 private String serviceProxyResourceCustomizationUUID;
83 @OneToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
84 @JoinColumn(name = "CONFIGURATION_CUSTOMIZATION_MODEL_CUSTOMIZATION_UUID")
85 private ConfigurationResourceCustomization configResourceCustomization;
87 @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
88 @JoinColumn(name = "CONFIGURATION_MODEL_UUID")
89 private ConfigurationResource configurationResource;
92 protected void onCreate() {
93 this.created = new Date();
96 public String getModelCustomizationUUID() {
97 return modelCustomizationUUID;
100 public void setModelCustomizationUUID(String modelCustomizationUUID) {
101 this.modelCustomizationUUID = modelCustomizationUUID;
104 public String getModelInstanceName() {
105 return modelInstanceName;
108 public void setModelInstanceName(String modelInstanceName) {
109 this.modelInstanceName = modelInstanceName;
112 public String getNfFunction() {
116 public void setNfFunction(String nfFunction) {
117 this.nfFunction = nfFunction;
120 public String getNfType() {
124 public void setNfType(String nfType) {
125 this.nfType = nfType;
128 public String getNfRole() {
132 public void setNfRole(String nfRole) {
133 this.nfRole = nfRole;
136 public Date getCreated() {
140 public String getServiceProxyResourceCustomizationUUID() {
141 return serviceProxyResourceCustomizationUUID;
144 public void setServiceProxyResourceCustomizationUUID(String serviceProxyResourceCustomizationUUID) {
145 this.serviceProxyResourceCustomizationUUID = serviceProxyResourceCustomizationUUID;
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();