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 org.onap.so.logger.MsoLogger;
36 import java.util.Objects;
37 import org.apache.commons.lang3.builder.ToStringBuilder;
40 @Table(name = "site_status")
41 public class SiteStatus {
43 @Column(name = "STATUS")
44 private boolean status;
46 @Column(name = "SITE_NAME")
47 private String siteName;
48 @Column(name = "CREATION_TIMESTAMP", insertable = false, updatable = false)
49 @Temporal(TemporalType.TIMESTAMP)
55 public SiteStatus(String siteName) {
56 this.siteName = siteName;
59 public Date getCreated() {
63 public String getSiteName() {
67 public void setSiteName(String siteName) {
68 this.siteName = siteName;
71 public void setStatus(boolean status) {
75 public boolean getStatus() {
80 protected void createdAt() {
81 this.created = new Date();
84 public boolean equals(final Object other) {
88 if (!(other instanceof SiteStatus)) {
91 SiteStatus castOther = (SiteStatus) other;
92 return Objects.equals(getSiteName(), castOther.getSiteName());
96 public int hashCode() {
97 return Objects.hash(getSiteName());
101 public String toString() {
102 return new ToStringBuilder(this).append("status", getStatus()).append("siteName", getSiteName())
103 .append("created", getCreated()).toString();