[SO] Release so 1.13.0 image
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / VnfResourceWorkflow.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 - 2018 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 javax.persistence.CascadeType;
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.FetchType;
28 import javax.persistence.GeneratedValue;
29 import javax.persistence.GenerationType;
30 import javax.persistence.Id;
31 import javax.persistence.JoinColumn;
32 import javax.persistence.ManyToOne;
33 import javax.persistence.Table;
34 import org.apache.commons.lang3.builder.EqualsBuilder;
35 import org.apache.commons.lang3.builder.HashCodeBuilder;
36 import org.apache.commons.lang3.builder.ToStringBuilder;
37 import com.openpojo.business.annotation.BusinessKey;
38 import uk.co.blackpepper.bowman.annotation.LinkedResource;
39 import uk.co.blackpepper.bowman.annotation.RemoteResource;
40
41 @Entity
42 @RemoteResource("/vnfResourceWorkflow")
43 @Table(name = "vnf_resource_to_workflow")
44 public class VnfResourceWorkflow implements Serializable {
45
46     private static final long serialVersionUID = -1326433350241927676L;
47
48     @Id
49     @Column(name = "ID", nullable = false, updatable = false)
50     @GeneratedValue(strategy = GenerationType.IDENTITY)
51     private Integer ID;
52
53     @BusinessKey
54     @Column(name = "VNF_RESOURCE_MODEL_UUID")
55     private String vnfResourceModelUUID;
56
57     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
58     @JoinColumn(name = "VNF_RESOURCE_MODEL_UUID", updatable = false, insertable = false)
59     private VnfResource vnfResource;
60
61     @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
62     @JoinColumn(name = "WORKFLOW_ID")
63     private Workflow workflow;
64
65     @Override
66     public String toString() {
67         return new ToStringBuilder(this).append("vnfResourceModelUUID", vnfResourceModelUUID).toString();
68     }
69
70     @Override
71     public boolean equals(final Object other) {
72         if (!(other instanceof VnfResourceWorkflow)) {
73             return false;
74         }
75         VnfResourceWorkflow castOther = (VnfResourceWorkflow) other;
76         return new EqualsBuilder().append(vnfResourceModelUUID, castOther.vnfResourceModelUUID).isEquals();
77     }
78
79     @Override
80     public int hashCode() {
81         return new HashCodeBuilder().append(vnfResourceModelUUID).toHashCode();
82     }
83
84     public Integer getID() {
85         return ID;
86     }
87
88     public String getVnfResourceModelUUID() {
89         return vnfResourceModelUUID;
90     }
91
92     public void setVnfResourceModelUUID(String vnfResourceModelUUID) {
93         this.vnfResourceModelUUID = vnfResourceModelUUID;
94     }
95
96     @LinkedResource
97     public VnfResource getVnfResource() {
98         return vnfResource;
99     }
100
101     public void setVnfResource(VnfResource vnfResource) {
102         this.vnfResource = vnfResource;
103     }
104
105     @LinkedResource
106     public Workflow getWorkflow() {
107         return workflow;
108     }
109
110     public void setWorkflow(Workflow workflow) {
111         this.workflow = workflow;
112     }
113
114 }