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;
24 import com.fasterxml.jackson.annotation.JsonProperty;
25 import com.openpojo.business.annotation.BusinessKey;
26 import org.apache.commons.lang3.builder.ToStringBuilder;
27 import org.apache.commons.lang3.builder.ToStringStyle;
28 import org.apache.commons.lang3.builder.HashCodeBuilder;
29 import org.apache.commons.lang3.builder.EqualsBuilder;
30 import javax.persistence.Column;
31 import javax.persistence.Entity;
32 import javax.persistence.Id;
33 import javax.persistence.PrePersist;
34 import javax.persistence.Table;
35 import javax.persistence.Temporal;
36 import javax.persistence.TemporalType;
39 * EntityBean class for a Cloudify Manager. This bean represents a Cloudify node through which TOSCA-based VNFs may be
40 * deployed. Each CloudSite in the CloudConfig may have a Cloudify Manager for deployments using TOSCA blueprints.
41 * Cloudify Managers may support multiple Cloud Sites, but each site will have at most one Cloudify Manager.
43 * This does not replace the ability to use the CloudSite directly via Openstack.
48 @Table(name = "cloudify_managers")
49 public class CloudifyManager {
58 @JsonProperty("cloudify_url")
59 @Column(name = "CLOUDIFY_URL")
60 private String cloudifyUrl;
63 @JsonProperty("username")
64 @Column(name = "USERNAME")
65 private String username;
68 @JsonProperty("password")
69 @Column(name = "PASSWORD")
70 private String password;
73 @JsonProperty("version")
74 @Column(name = "VERSION")
75 private String version;
77 @JsonProperty("last_updated_by")
79 @Column(name = "LAST_UPDATED_BY")
80 private String lastUpdatedBy;
82 @JsonProperty("creation_timestamp")
84 @Column(name = "CREATION_TIMESTAMP", updatable = false)
85 @Temporal(TemporalType.TIMESTAMP)
88 @JsonProperty("update_timestamp")
90 @Column(name = "UPDATE_TIMESTAMP")
91 @Temporal(TemporalType.TIMESTAMP)
94 public CloudifyManager() {}
97 protected void onCreate() {
98 this.created = new Date();
99 this.updated = new Date();
102 public String getId() {
106 public void setId(String id) {
110 public String getCloudifyUrl() {
114 public void setCloudifyUrl(String cloudifyUrl) {
115 this.cloudifyUrl = cloudifyUrl;
118 public String getUsername() {
122 public void setUsername(String username) {
123 this.username = username;
126 public String getPassword() {
130 public void setPassword(String password) {
131 this.password = password;
134 public String getVersion() {
138 public void setVersion(String version) {
139 this.version = version;
142 public String getLastUpdatedBy() {
143 return lastUpdatedBy;
146 public Date getCreated() {
150 public Date getUpdated() {
154 public void setLastUpdatedBy(String lastUpdatedBy) {
155 this.lastUpdatedBy = lastUpdatedBy;
158 public void setCreated(Date created) {
159 this.created = created;
162 public void setUpdated(Date updated) {
163 this.updated = updated;
167 public CloudifyManager clone() {
168 CloudifyManager cloudifyManagerCopy = new CloudifyManager();
169 cloudifyManagerCopy.id = this.id;
170 cloudifyManagerCopy.cloudifyUrl = this.cloudifyUrl;
171 cloudifyManagerCopy.username = this.username;
172 cloudifyManagerCopy.password = this.password;
173 cloudifyManagerCopy.version = this.version;
174 return cloudifyManagerCopy;
178 public String toString() {
179 return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId())
180 .append("cloudifyUrl", getCloudifyUrl()).append("username", getUsername())
181 .append("password", getPassword()).append("version", getVersion()).toString();
185 public boolean equals(final Object other) {
189 if (!getClass().equals(other.getClass())) {
192 CloudifyManager castOther = (CloudifyManager) other;
193 return new EqualsBuilder().append(getId(), castOther.getId())
194 .append(getCloudifyUrl(), castOther.getCloudifyUrl()).append(getUsername(), castOther.getUsername())
195 .append(getPassword(), castOther.getPassword()).append(getVersion(), castOther.getVersion()).isEquals();
199 public int hashCode() {
200 return new HashCodeBuilder(1, 31).append(getId()).append(getCloudifyUrl()).append(getUsername())
201 .append(getPassword()).append(getVersion()).toHashCode();