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;
26 import javax.persistence.Column;
27 import javax.persistence.Entity;
28 import javax.persistence.Id;
29 import javax.persistence.PrePersist;
30 import javax.persistence.Table;
31 import javax.persistence.Temporal;
32 import javax.persistence.TemporalType;
33 import java.util.Objects;
34 import org.apache.commons.lang3.builder.ToStringBuilder;
37 @Table(name = "site_status")
38 public class SiteStatus {
40 @Column(name = "STATUS")
41 private boolean status;
43 @Column(name = "SITE_NAME")
44 private String siteName;
45 @Column(name = "CREATION_TIMESTAMP", insertable = false, updatable = false)
46 @Temporal(TemporalType.TIMESTAMP)
49 public SiteStatus() {}
51 public SiteStatus(String siteName) {
52 this.siteName = siteName;
55 public Date getCreated() {
59 public String getSiteName() {
63 public void setSiteName(String siteName) {
64 this.siteName = siteName;
67 public void setStatus(boolean status) {
71 public boolean getStatus() {
76 protected void createdAt() {
77 this.created = new Date();
81 public boolean equals(final Object other) {
85 if (!(other instanceof SiteStatus)) {
88 SiteStatus castOther = (SiteStatus) other;
89 return Objects.equals(getSiteName(), castOther.getSiteName());
93 public int hashCode() {
94 return Objects.hash(getSiteName());
98 public String toString() {
99 return new ToStringBuilder(this).append("status", getStatus()).append("siteName", getSiteName())
100 .append("created", getCreated()).toString();