[SO] Release so 1.13.0 image
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / NetworkResourceCustomization.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.so.db.catalog.beans;
22
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.Id;
30 import javax.persistence.JoinColumn;
31 import javax.persistence.ManyToOne;
32 import javax.persistence.PrePersist;
33 import javax.persistence.Table;
34 import javax.persistence.Temporal;
35 import javax.persistence.TemporalType;
36 import org.apache.commons.lang3.builder.EqualsBuilder;
37 import org.apache.commons.lang3.builder.HashCodeBuilder;
38 import org.apache.commons.lang3.builder.ToStringBuilder;
39 import com.openpojo.business.annotation.BusinessKey;
40 import uk.co.blackpepper.bowman.annotation.LinkedResource;
41 import uk.co.blackpepper.bowman.annotation.RemoteResource;
42
43 @Entity
44 @RemoteResource("/networkResourceCustomization")
45 @Table(name = "network_resource_customization")
46 public class NetworkResourceCustomization implements Serializable {
47     public static final long serialVersionUID = -1322322139926390329L;
48
49     @BusinessKey
50     @Id
51     @Column(name = "MODEL_CUSTOMIZATION_UUID")
52     private String modelCustomizationUUID = null;
53
54     @Column(name = "MODEL_INSTANCE_NAME")
55     private String modelInstanceName;
56
57     @Column(name = "CREATION_TIMESTAMP", updatable = false)
58     @Temporal(TemporalType.TIMESTAMP)
59     private Date created;
60
61     @Column(name = "NETWORK_TECHNOLOGY")
62     private String networkTechnology;
63
64     @Column(name = "NETWORK_TYPE")
65     private String networkType = null;
66
67     @Column(name = "NETWORK_SCOPE")
68     private String networkScope;
69
70     @Column(name = "NETWORK_ROLE")
71     private String networkRole;
72
73     @Column(name = "RESOURCE_INPUT")
74     private String resourceInput;
75
76     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
77     @JoinColumn(name = "NETWORK_RESOURCE_MODEL_UUID")
78     private NetworkResource networkResource = null;
79
80     public NetworkResourceCustomization() {
81         super();
82     }
83
84     @PrePersist
85     protected void onCreate() {
86         this.created = new Date();
87     }
88
89     public String getModelCustomizationUUID() {
90         return this.modelCustomizationUUID;
91     }
92
93     public void setModelCustomizationUUID(String modelCustomizationUUID) {
94         this.modelCustomizationUUID = modelCustomizationUUID;
95     }
96
97     public String getModelInstanceName() {
98         return this.modelInstanceName;
99     }
100
101     public void setModelInstanceName(String modelInstanceName) {
102         this.modelInstanceName = modelInstanceName;
103     }
104
105     @LinkedResource
106     public NetworkResource getNetworkResource() {
107         return this.networkResource;
108     }
109
110     public void setNetworkResource(NetworkResource networkResource) {
111         this.networkResource = networkResource;
112     }
113
114     public String getNetworkType() {
115         return this.networkType;
116     }
117
118     public void setNetworkType(String networkType) {
119         this.networkType = networkType;
120     }
121
122     public Date getCreated() {
123         return this.created;
124     }
125
126     public String getNetworkTechnology() {
127         return this.networkTechnology;
128     }
129
130     public void setNetworkTechnology(String networkTechnology) {
131         this.networkTechnology = networkTechnology;
132     }
133
134     public String getNetworkScope() {
135         return this.networkScope;
136     }
137
138     public void setNetworkScope(String networkScope) {
139         this.networkScope = networkScope;
140     }
141
142     public void setNetworkRole(String networkRole) {
143         this.networkRole = networkRole;
144     }
145
146     public String getNetworkRole() {
147         return this.networkRole;
148     }
149
150     public String getResourceInput() {
151         return resourceInput;
152     }
153
154     public void setResourceInput(String resourceInput) {
155         this.resourceInput = resourceInput;
156     }
157
158     @Override
159     public String toString() {
160         return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
161                 .append("modelInstanceName", modelInstanceName).append("created", created)
162                 .append("networkTechnology", networkTechnology).append("networkType", networkType)
163                 .append("networkScope", networkScope).append("networkRole", networkRole)
164                 .append("networkResource", networkResource).toString();
165     }
166
167     @Override
168     public boolean equals(final Object other) {
169         if (!(other instanceof NetworkResourceCustomization)) {
170             return false;
171         }
172         NetworkResourceCustomization castOther = (NetworkResourceCustomization) other;
173         return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
174     }
175
176     @Override
177     public int hashCode() {
178         return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
179     }
180 }