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;
27 import javax.persistence.CascadeType;
28 import javax.persistence.Column;
29 import javax.persistence.Entity;
30 import javax.persistence.Id;
31 import javax.persistence.OneToMany;
32 import javax.persistence.PrePersist;
33 import javax.persistence.Table;
34 import javax.persistence.Temporal;
35 import javax.persistence.TemporalType;
37 import org.apache.commons.lang3.builder.EqualsBuilder;
38 import org.apache.commons.lang3.builder.HashCodeBuilder;
39 import org.apache.commons.lang3.builder.ToStringBuilder;
41 import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
42 import com.openpojo.business.annotation.BusinessKey;
44 import uk.co.blackpepper.bowman.annotation.LinkedResource;
46 @JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
48 @Table(name = "service_proxy")
49 public class ServiceProxyResource implements Serializable {
54 private static final long serialVersionUID = 8113564204017394906L;
58 @Column(name = "MODEL_UUID")
59 private String modelUUID;
61 @Column(name = "MODEL_INVARIANT_UUID")
62 private String modelInvariantUUID;
64 @Column(name = "MODEL_VERSION")
65 private String modelVersion;
67 @Column(name = "MODEL_NAME")
68 private String modelName;
70 @Column(name = "DESCRIPTION")
71 private String description;
73 @Column(name = "CREATION_TIMESTAMP", updatable = false)
74 @Temporal(TemporalType.TIMESTAMP)
77 @OneToMany(cascade = CascadeType.ALL, mappedBy = "serviceProxyResource")
78 private Set<ServiceProxyResourceCustomization> serviceProxyCustomization;
81 protected void onCreate() {
82 this.created = new Date();
85 public String getModelUUID() {
89 public void setModelUUID(String modelUUID) {
90 this.modelUUID = modelUUID;
93 public String getModelInvariantUUID() {
94 return modelInvariantUUID;
97 public void setModelInvariantUUID(String modelInvariantUUID) {
98 this.modelInvariantUUID = modelInvariantUUID;
101 public String getModelVersion() {
105 public void setModelVersion(String modelVersion) {
106 this.modelVersion = modelVersion;
109 public String getModelName() {
113 public void setModelName(String modelName) {
114 this.modelName = modelName;
117 public String getDescription() {
121 public void setDescription(String description) {
122 this.description = description;
125 public Date getCreated() {
130 public Set<ServiceProxyResourceCustomization> getServiceProxyCustomization() {
131 return serviceProxyCustomization;
134 public void setServiceProxyCustomization(Set<ServiceProxyResourceCustomization> serviceProxyCustomization) {
135 this.serviceProxyCustomization = serviceProxyCustomization;
139 public String toString() {
140 return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID)
141 .append("modelVersion", modelVersion).append("modelName", modelName).append("description", description)
142 .append("created", created).append("serviceProxyCustomization", serviceProxyCustomization).toString();
146 public boolean equals(final Object other) {
147 if (!(other instanceof ServiceProxyResource)) {
150 ServiceProxyResource castOther = (ServiceProxyResource) other;
151 return new EqualsBuilder().append(modelUUID, castOther.modelUUID).isEquals();
155 public int hashCode() {
156 return new HashCodeBuilder().append(modelUUID).toHashCode();