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;
23 import java.io.Serializable;
24 import java.util.Date;
25 import java.util.Objects;
26 import java.util.Optional;
27 import javax.persistence.Column;
28 import javax.persistence.Entity;
29 import javax.persistence.Id;
30 import javax.persistence.IdClass;
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.ToStringBuilder;
37 @IdClass(WatchdogServiceModVerIdLookupId.class)
39 @Table(name = "watchdog_service_mod_ver_id_lookup")
40 public class WatchdogServiceModVerIdLookup implements Serializable {
45 private static final long serialVersionUID = 7783869906430250355L;
48 @Column(name = "DISTRIBUTION_ID", length = 45)
49 private String distributionId;
51 @Column(name = "SERVICE_MODEL_VERSION_ID", length = 45)
52 private String serviceModelVersionId;
53 @Column(name = "DISTRIBUTION_NOTIFICATION")
54 private String distributionNotification;
55 @Column(name = "CONSUMER_ID", length = 200)
56 private String consumerId;
57 @Column(name = "CREATE_TIME", updatable = false)
58 @Temporal(TemporalType.TIMESTAMP)
59 private Date createTime;
61 public WatchdogServiceModVerIdLookup() {
67 * @param distributionId - Distribution ID
68 * @param serviceModelVersionId -- service UUID
69 * @param distributionNotification -- Notification content from ASDC
70 * @param consumerId -- Consumer ID associated with subscription.
72 public WatchdogServiceModVerIdLookup(String distributionId, String serviceModelVersionId,
73 Optional<String> distributionNotification, String consumerId) {
74 this.distributionId = distributionId;
75 this.serviceModelVersionId = serviceModelVersionId;
76 this.distributionNotification = distributionNotification.orElse(null);
77 this.consumerId = consumerId;
80 public String getDistributionId() {
81 return distributionId;
84 public void setDistributionId(String distributionId) {
85 this.distributionId = distributionId;
88 public String getServiceModelVersionId() {
89 return serviceModelVersionId;
92 public void setServiceModelVersionId(String serviceModelVersionId) {
93 this.serviceModelVersionId = serviceModelVersionId;
96 public Date getCreateTime() {
101 protected void onCreate() {
102 this.createTime = new Date();
106 public boolean equals(final Object other) {
110 if (!(other instanceof WatchdogServiceModVerIdLookup)) {
113 WatchdogServiceModVerIdLookup castOther = (WatchdogServiceModVerIdLookup) other;
114 return Objects.equals(getDistributionId(), castOther.getDistributionId())
115 && Objects.equals(getServiceModelVersionId(), castOther.getServiceModelVersionId());
119 public int hashCode() {
120 return Objects.hash(getDistributionId(), getServiceModelVersionId());
124 public String toString() {
125 return new ToStringBuilder(this).append("distributionId", getDistributionId())
126 .append("serviceModelVersionId", getServiceModelVersionId()).append("createTime", getCreateTime())
127 .append("distributionNotification", getDistributionNotification()).append("consumerId", getConsumerId())
131 public String getDistributionNotification() {
132 return distributionNotification;
135 public void setDistributionNotification(String distributionNotification) {
136 this.distributionNotification = distributionNotification;
139 public String getConsumerId() {
143 public void setConsumerId(String consumerId) {
144 this.consumerId = consumerId;