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;
28 import org.apache.commons.lang3.builder.ToStringBuilder;
29 import org.apache.commons.lang3.builder.ToStringStyle;
30 import org.apache.commons.lang3.builder.HashCodeBuilder;
31 import org.apache.commons.lang3.builder.EqualsBuilder;
33 import javax.persistence.Column;
34 import javax.persistence.Entity;
35 import javax.persistence.Id;
36 import javax.persistence.PrePersist;
37 import javax.persistence.Table;
38 import javax.persistence.Temporal;
39 import javax.persistence.TemporalType;
42 * EntityBean class for a Cloudify Manager. This bean represents a Cloudify
43 * node through which TOSCA-based VNFs may be deployed. Each CloudSite in the
44 * CloudConfig may have a Cloudify Manager for deployments using TOSCA blueprints.
45 * Cloudify Managers may support multiple Cloud Sites, but each site will have
46 * at most one Cloudify Manager.
48 * This does not replace the ability to use the CloudSite directly via Openstack.
53 @Table(name = "cloudify_managers")
54 public class CloudifyManager {
63 @JsonProperty ("cloudify_url")
64 @Column(name = "CLOUDIFY_URL")
65 private String cloudifyUrl;
68 @JsonProperty("username")
69 @Column(name = "USERNAME")
70 private String username;
73 @JsonProperty("password")
74 @Column(name = "PASSWORD")
75 private String password;
78 @JsonProperty("version")
79 @Column(name = "VERSION")
80 private String version;
82 @JsonProperty("last_updated_by")
84 @Column(name = "LAST_UPDATED_BY")
85 private String lastUpdatedBy ;
87 @JsonProperty("creation_timestamp")
89 @Column(name = "CREATION_TIMESTAMP", updatable = false)
90 @Temporal(TemporalType.TIMESTAMP)
93 @JsonProperty("update_timestamp")
95 @Column(name = "UPDATE_TIMESTAMP")
96 @Temporal(TemporalType.TIMESTAMP)
99 public CloudifyManager() {}
102 protected void onCreate() {
103 this.created = new Date();
104 this.updated = new Date();
107 public String getId() {
110 public void setId(String id) {
114 public String getCloudifyUrl() {
118 public void setCloudifyUrl(String cloudifyUrl) {
119 this.cloudifyUrl = cloudifyUrl;
122 public String getUsername() {
126 public void setUsername(String username) {
127 this.username = username;
130 public String getPassword() {
134 public void setPassword(String password) {
135 this.password = password;
138 public String getVersion() {
142 public void setVersion(String version) {
143 this.version = version;
146 public String getLastUpdatedBy() {
147 return lastUpdatedBy;
150 public Date getCreated() {
154 public Date getUpdated() {
158 public void setLastUpdatedBy(String lastUpdatedBy) {
159 this.lastUpdatedBy = lastUpdatedBy;
162 public void setCreated(Date created) {
163 this.created = created;
166 public void setUpdated(Date updated) {
167 this.updated = updated;
171 public CloudifyManager clone() {
172 CloudifyManager cloudifyManagerCopy = new CloudifyManager();
173 cloudifyManagerCopy.id = this.id;
174 cloudifyManagerCopy.cloudifyUrl = this.cloudifyUrl;
175 cloudifyManagerCopy.username = this.username;
176 cloudifyManagerCopy.password = this.password;
177 cloudifyManagerCopy.version = this.version;
178 return cloudifyManagerCopy;
182 public String toString() {
183 return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId())
184 .append("cloudifyUrl", getCloudifyUrl()).append("username", getUsername())
185 .append("password", getPassword()).append("version", getVersion()).toString();
189 public boolean equals(final Object other) {
193 if (!getClass().equals(other.getClass())) {
196 CloudifyManager castOther = (CloudifyManager) other;
197 return new EqualsBuilder().append(getId(), castOther.getId())
198 .append(getCloudifyUrl(), castOther.getCloudifyUrl()).append(getUsername(), castOther.getUsername())
199 .append(getPassword(), castOther.getPassword()).append(getVersion(), castOther.getVersion()).isEquals();
203 public int hashCode() {
204 return new HashCodeBuilder(1, 31).append(getId()).append(getCloudifyUrl()).append(getUsername())
205 .append(getPassword()).append(getVersion()).toHashCode();