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.catalog.beans;
23 import java.util.Date;
25 import com.fasterxml.jackson.annotation.JsonProperty;
26 import com.openpojo.business.annotation.BusinessKey;
27 import org.onap.so.logger.MsoLogger;
29 import org.apache.commons.lang3.builder.ToStringBuilder;
30 import org.apache.commons.lang3.builder.ToStringStyle;
31 import org.apache.commons.lang3.builder.HashCodeBuilder;
32 import org.apache.commons.lang3.builder.EqualsBuilder;
34 import javax.persistence.Column;
35 import javax.persistence.Entity;
36 import javax.persistence.Id;
37 import javax.persistence.PrePersist;
38 import javax.persistence.Table;
39 import javax.persistence.Temporal;
40 import javax.persistence.TemporalType;
43 * EntityBean class for a Cloudify Manager. This bean represents a Cloudify
44 * node through which TOSCA-based VNFs may be deployed. Each CloudSite in the
45 * CloudConfig may have a Cloudify Manager for deployments using TOSCA blueprints.
46 * Cloudify Managers may support multiple Cloud Sites, but each site will have
47 * at most one Cloudify Manager.
49 * This does not replace the ability to use the CloudSite directly via Openstack.
54 @Table(name = "cloudify_managers")
55 public class CloudifyManager {
64 @JsonProperty ("cloudify_url")
65 @Column(name = "CLOUDIFY_URL")
66 private String cloudifyUrl;
69 @JsonProperty("username")
70 @Column(name = "USERNAME")
71 private String username;
74 @JsonProperty("password")
75 @Column(name = "PASSWORD")
76 private String password;
79 @JsonProperty("version")
80 @Column(name = "VERSION")
81 private String version;
83 @JsonProperty("last_updated_by")
85 @Column(name = "LAST_UPDATED_BY")
86 private String lastUpdatedBy ;
88 @JsonProperty("creation_timestamp")
90 @Column(name = "CREATION_TIMESTAMP", updatable = false)
91 @Temporal(TemporalType.TIMESTAMP)
94 @JsonProperty("update_timestamp")
96 @Column(name = "UPDATE_TIMESTAMP")
97 @Temporal(TemporalType.TIMESTAMP)
100 public CloudifyManager() {}
103 protected void onCreate() {
104 this.created = new Date();
105 this.updated = new Date();
108 public String getId() {
111 public void setId(String id) {
115 public String getCloudifyUrl() {
119 public void setCloudifyUrl(String cloudifyUrl) {
120 this.cloudifyUrl = cloudifyUrl;
123 public String getUsername() {
127 public void setUsername(String username) {
128 this.username = username;
131 public String getPassword() {
135 public void setPassword(String password) {
136 this.password = password;
139 public String getVersion() {
143 public void setVersion(String version) {
144 this.version = version;
147 public String getLastUpdatedBy() {
148 return lastUpdatedBy;
151 public Date getCreated() {
155 public Date getUpdated() {
159 public void setLastUpdatedBy(String lastUpdatedBy) {
160 this.lastUpdatedBy = lastUpdatedBy;
163 public void setCreated(Date created) {
164 this.created = created;
167 public void setUpdated(Date updated) {
168 this.updated = updated;
172 public CloudifyManager clone() {
173 CloudifyManager cloudifyManagerCopy = new CloudifyManager();
174 cloudifyManagerCopy.id = this.id;
175 cloudifyManagerCopy.cloudifyUrl = this.cloudifyUrl;
176 cloudifyManagerCopy.username = this.username;
177 cloudifyManagerCopy.password = this.password;
178 cloudifyManagerCopy.version = this.version;
179 return cloudifyManagerCopy;
183 public String toString() {
184 return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId())
185 .append("cloudifyUrl", getCloudifyUrl()).append("username", getUsername())
186 .append("password", getPassword()).append("version", getVersion()).toString();
190 public boolean equals(final Object other) {
194 if (!getClass().equals(other.getClass())) {
197 CloudifyManager castOther = (CloudifyManager) other;
198 return new EqualsBuilder().append(getId(), castOther.getId())
199 .append(getCloudifyUrl(), castOther.getCloudifyUrl()).append(getUsername(), castOther.getUsername())
200 .append(getPassword(), castOther.getPassword()).append(getVersion(), castOther.getVersion()).isEquals();
204 public int hashCode() {
205 return new HashCodeBuilder(1, 31).append(getId()).append(getCloudifyUrl()).append(getUsername())
206 .append(getPassword()).append(getVersion()).toHashCode();