Replaced all tabs with spaces in java and pom.xml
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / NetworkRecipe.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.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.Id;
28 import javax.persistence.PrePersist;
29 import javax.persistence.Table;
30 import javax.persistence.Temporal;
31 import javax.persistence.TemporalType;
32 import org.apache.commons.lang3.builder.EqualsBuilder;
33 import org.apache.commons.lang3.builder.HashCodeBuilder;
34 import com.openpojo.business.annotation.BusinessKey;
35
36 @Entity
37 @Table(name = "network_recipe")
38 public class NetworkRecipe implements Serializable, Recipe {
39     private static final long serialVersionUID = 768026109321305392L;
40
41     @Id
42     @Column(name = "id")
43     private Integer id;
44
45     @BusinessKey
46     @Column(name = "ACTION")
47     protected String action;
48
49     @Column(name = "DESCRIPTION")
50     private String description;
51
52     @BusinessKey
53     @Column(name = "ORCHESTRATION_URI")
54     protected String orchestrationUri;
55
56     @Column(name = "RECIPE_TIMEOUT")
57     private Integer recipeTimeout;
58
59     @Column(name = "VERSION_STR")
60     private String versionStr;
61
62     @BusinessKey
63     @Column(name = "SERVICE_TYPE")
64     private String serviceType;
65
66     @BusinessKey
67     @Column(name = "MODEL_NAME")
68     private String modelName;
69
70     @Column(name = "NETWORK_PARAM_XSD")
71     private String paramXsd;
72
73     @Column(name = "CREATION_TIMESTAMP", updatable = false)
74     @Temporal(TemporalType.TIMESTAMP)
75     private Date created;
76
77     @PrePersist
78     protected void onCreate() {
79         this.created = new Date();
80     }
81
82     @Override
83     public boolean equals(final Object other) {
84         if (!(other instanceof NetworkRecipe)) {
85             return false;
86         }
87         NetworkRecipe castOther = (NetworkRecipe) other;
88         return new EqualsBuilder().append(action, castOther.action).append(orchestrationUri, castOther.orchestrationUri)
89                 .append(serviceType, castOther.serviceType).append(modelName, castOther.modelName).isEquals();
90     }
91
92     @Override
93     public int hashCode() {
94         return new HashCodeBuilder().append(action).append(orchestrationUri).append(serviceType).append(modelName)
95                 .toHashCode();
96     }
97
98     public Integer getId() {
99         return id;
100     }
101
102     public void setId(Integer id) {
103         this.id = id;
104     }
105
106     public String getAction() {
107         return action;
108     }
109
110     public void setAction(String action) {
111         this.action = action;
112     }
113
114     public String getDescription() {
115         return description;
116     }
117
118     public void setDescription(String description) {
119         this.description = description;
120     }
121
122     public String getOrchestrationUri() {
123         return orchestrationUri;
124     }
125
126     public void setOrchestrationUri(String orchestrationUri) {
127         this.orchestrationUri = orchestrationUri;
128     }
129
130     public Integer getRecipeTimeout() {
131         return recipeTimeout;
132     }
133
134     public void setRecipeTimeout(Integer recipeTimeout) {
135         this.recipeTimeout = recipeTimeout;
136     }
137
138     public String getServiceType() {
139         return serviceType;
140     }
141
142     public void setServiceType(String serviceType) {
143         this.serviceType = serviceType;
144     }
145
146     public Date getCreated() {
147         return created;
148     }
149
150     public String getModelName() {
151         return modelName;
152     }
153
154     public void setModelName(String modelName) {
155         this.modelName = modelName;
156     }
157
158     public String getParamXsd() {
159         return paramXsd;
160     }
161
162     public void setParamXsd(String paramXsd) {
163         this.paramXsd = paramXsd;
164     }
165
166     @Override
167     public String toString() {
168         StringBuilder sb = new StringBuilder();
169         sb.append(super.toString());
170         sb.append(",modelName=" + modelName);
171         sb.append(",networkParamXSD=" + paramXsd);
172         return sb.toString();
173     }
174
175     public String getVersionStr() {
176         return versionStr;
177     }
178
179     public void setVersionStr(String versionStr) {
180         this.versionStr = versionStr;
181     }
182 }