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;
28 import javax.persistence.Column;
29 import javax.persistence.Entity;
30 import javax.persistence.Id;
31 import javax.persistence.IdClass;
32 import javax.persistence.PrePersist;
33 import javax.persistence.Table;
34 import javax.persistence.Temporal;
35 import javax.persistence.TemporalType;
37 import org.apache.commons.lang3.builder.ToStringBuilder;
39 @IdClass(WatchdogServiceModVerIdLookupId.class)
41 @Table(name = "watchdog_service_mod_ver_id_lookup")
42 public class WatchdogServiceModVerIdLookup implements Serializable {
47 private static final long serialVersionUID = 7783869906430250355L;
50 @Column(name = "DISTRIBUTION_ID", length=45)
51 private String distributionId;
53 @Column(name = "SERVICE_MODEL_VERSION_ID", length=45)
54 private String serviceModelVersionId;
55 @Column(name = "DISTRIBUTION_NOTIFICATION")
56 private String distributionNotification;
57 @Column(name = "CONSUMER_ID", length=200)
58 private String consumerId;
59 @Column(name = "CREATE_TIME", updatable=false)
60 @Temporal(TemporalType.TIMESTAMP)
61 private Date createTime;
63 public WatchdogServiceModVerIdLookup() {
68 * @param distributionId - Distribution ID
69 * @param serviceModelVersionId -- service UUID
70 * @param distributionNotification -- Notification content from ASDC
71 * @param consumerId -- Consumer ID associated with subscription.
73 public WatchdogServiceModVerIdLookup(String distributionId, String serviceModelVersionId,
74 Optional<String> distributionNotification, String consumerId) {
75 this.distributionId = distributionId;
76 this.serviceModelVersionId = serviceModelVersionId;
77 this.distributionNotification= distributionNotification.orElse(null);
78 this.consumerId = consumerId;
81 public String getDistributionId() {
82 return distributionId;
85 public void setDistributionId(String distributionId) {
86 this.distributionId = distributionId;
89 public String getServiceModelVersionId() {
90 return serviceModelVersionId;
93 public void setServiceModelVersionId(String serviceModelVersionId) {
94 this.serviceModelVersionId = serviceModelVersionId;
97 public Date getCreateTime() {
102 protected void onCreate() {
103 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());
118 public int hashCode() {
119 return Objects.hash(getDistributionId(), getServiceModelVersionId());
122 public String toString() {
123 return new ToStringBuilder(this)
124 .append("distributionId", getDistributionId())
125 .append("serviceModelVersionId", getServiceModelVersionId())
126 .append("createTime", getCreateTime())
127 .append("distributionNotification", getDistributionNotification())
128 .append("consumerId", getConsumerId())
131 public String getDistributionNotification() {
132 return distributionNotification;
134 public void setDistributionNotification(String distributionNotification) {
135 this.distributionNotification = distributionNotification;
137 public String getConsumerId() {
140 public void setConsumerId(String consumerId) {
141 this.consumerId = consumerId;