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.util.Date;
24 import javax.persistence.Column;
25 import javax.persistence.Entity;
26 import javax.persistence.GeneratedValue;
27 import javax.persistence.GenerationType;
28 import javax.persistence.Id;
29 import javax.persistence.Lob;
30 import javax.persistence.PrePersist;
31 import javax.persistence.Table;
32 import javax.persistence.Temporal;
33 import javax.persistence.TemporalType;
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 org.apache.commons.lang3.builder.ToStringStyle;
38 import org.hibernate.annotations.UpdateTimestamp;
39 import com.fasterxml.jackson.annotation.JsonAutoDetect;
40 import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility;
41 import com.fasterxml.jackson.annotation.JsonProperty;
42 import com.openpojo.business.annotation.BusinessKey;
43 import uk.co.blackpepper.bowman.annotation.RemoteResource;
47 * EntityBean class for ProcessingFlags. This bean represents a set of flags governing request processing.
50 @RemoteResource("/processingFlags")
52 @Table(name = "processing_flags")
53 @JsonAutoDetect(fieldVisibility = Visibility.ANY)
54 public class ProcessingFlags {
57 @Column(name = "ID", nullable = false, updatable = false)
58 @GeneratedValue(strategy = GenerationType.IDENTITY)
63 @Column(name = "FLAG")
66 @JsonProperty("value")
68 @Column(name = "VALUE")
71 @JsonProperty("endpoint")
73 @Column(name = "ENDPOINT")
74 private String endpoint;
76 @JsonProperty("description")
78 @Column(name = "DESCRIPTION", columnDefinition = "LONGTEXT")
79 private String description = null;
81 @JsonProperty("creation_timestamp")
83 @Column(name = "CREATION_TIMESTAMP", updatable = false)
84 @Temporal(TemporalType.TIMESTAMP)
87 @JsonProperty("update_timestamp")
89 @Column(name = "UPDATE_TIMESTAMP")
90 @Temporal(TemporalType.TIMESTAMP)
94 public ProcessingFlags() {
99 protected void onCreate() {
100 this.created = new Date();
101 // this.updated = new Date();
104 public ProcessingFlags(ProcessingFlags flags) {
105 this.flag = flags.getFlag();
106 this.value = flags.getValue();
107 this.endpoint = flags.getEndpoint();
108 this.description = flags.getDescription();
111 public Integer getId() {
115 public String getFlag() {
119 public void setFlag(String flag) {
123 public String getValue() {
127 public void setValue(String value) {
131 public String getEndpoint() {
135 public void setEndpoint(String endpoint) {
136 this.endpoint = endpoint;
139 public String getDescription() {
143 public void setDescription(String description) {
144 this.description = description;
147 public Date getCreated() {
151 public void setCreated(Date created) {
152 this.created = created;
155 public Date getUpdated() {
159 public void setUpdated(Date updated) {
160 this.updated = updated;
164 public String toString() {
165 return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("flag", getFlag())
166 .append("value", getValue()).append("endpoint", getEndpoint()).append("description", getDescription())
171 public boolean equals(final Object other) {
175 if (!getClass().equals(other.getClass())) {
178 ProcessingFlags castOther = (ProcessingFlags) other;
179 return new EqualsBuilder().append(getFlag(), castOther.getFlag()).append(getValue(), castOther.getValue())
184 public int hashCode() {
185 return new HashCodeBuilder(1, 31).append(getFlag()).append(getValue()).append(getEndpoint()).toHashCode();