2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017-2019 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=========================================================
22 package org.onap.so.db.request.beans;
24 import java.io.Serializable;
25 import java.util.Date;
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.GeneratedValue;
29 import javax.persistence.GenerationType;
30 import javax.persistence.Id;
31 import javax.persistence.PrePersist;
32 import javax.persistence.Table;
33 import javax.persistence.Temporal;
34 import javax.persistence.TemporalType;
35 import org.apache.commons.lang3.builder.EqualsBuilder;
36 import org.apache.commons.lang3.builder.HashCodeBuilder;
37 import org.apache.commons.lang3.builder.ToStringBuilder;
38 import com.fasterxml.jackson.annotation.JsonIgnore;
39 import com.fasterxml.jackson.annotation.JsonInclude;
40 import com.fasterxml.jackson.annotation.JsonInclude.Include;
41 import com.openpojo.business.annotation.BusinessKey;
45 @JsonInclude(Include.NON_NULL)
46 @Table(name = "cloud_api_requests")
47 public class CloudApiRequests implements Serializable {
53 private static final long serialVersionUID = 4686890103198488984L;
58 @GeneratedValue(strategy = GenerationType.IDENTITY)
63 @Column(name = "SO_REQUEST_ID")
64 private String requestId;
66 public String getRequestId() {
70 public void setRequestId(String requestId) {
71 this.requestId = requestId;
74 @Column(name = "CLOUD_IDENTIFIER")
75 private String cloudIdentifier;
77 @Column(name = "REQUEST_BODY", columnDefinition = "LONGTEXT")
78 private String requestBody;
80 @Column(name = "CREATE_TIME", insertable = false, updatable = false)
81 @Temporal(TemporalType.TIMESTAMP)
82 private Date created = null;
86 public boolean equals(final Object other) {
87 if (!(other instanceof CloudApiRequests)) {
90 CloudApiRequests castOther = (CloudApiRequests) other;
91 return new EqualsBuilder().append(id, castOther.id).isEquals();
95 public int hashCode() {
96 return new HashCodeBuilder().append(id).toHashCode();
100 public String toString() {
101 return new ToStringBuilder(this).append("id", id).append("cloudIdentifier", cloudIdentifier)
102 .append("requestBody", requestBody).append("created", created).toString();
106 protected void createdAt() {
107 this.created = new Date();
110 public Integer getId() {
114 public void setId(Integer id) {
118 public String getCloudIdentifier() {
119 return cloudIdentifier;
122 public void setCloudIdentifier(String cloudIdentifier) {
123 this.cloudIdentifier = cloudIdentifier;
127 public String getRequestBody() {
131 public void setRequestBody(String requestBody) {
132 this.requestBody = requestBody;
135 public Date getCreated() {