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.request.beans;
24 import java.time.format.DateTimeFormatter;
25 import java.util.Date;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.Id;
30 import javax.persistence.PrePersist;
31 import javax.persistence.Table;
32 import javax.persistence.Temporal;
33 import javax.persistence.TemporalType;
35 import java.util.Objects;
36 import org.apache.commons.lang3.builder.ToStringBuilder;
39 @Table(name = "site_status")
40 public class SiteStatus {
42 @Column(name = "STATUS")
43 private boolean status;
45 @Column(name = "SITE_NAME")
46 private String siteName;
47 @Column(name = "CREATION_TIMESTAMP", insertable = false, updatable = false)
48 @Temporal(TemporalType.TIMESTAMP)
54 public SiteStatus(String siteName) {
55 this.siteName = siteName;
58 public Date getCreated() {
62 public String getSiteName() {
66 public void setSiteName(String siteName) {
67 this.siteName = siteName;
70 public void setStatus(boolean status) {
74 public boolean getStatus() {
79 protected void createdAt() {
80 this.created = new Date();
83 public boolean equals(final Object other) {
87 if (!(other instanceof SiteStatus)) {
90 SiteStatus castOther = (SiteStatus) other;
91 return Objects.equals(getSiteName(), castOther.getSiteName());
95 public int hashCode() {
96 return Objects.hash(getSiteName());
100 public String toString() {
101 return new ToStringBuilder(this).append("status", getStatus()).append("siteName", getSiteName())
102 .append("created", getCreated()).toString();