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;
37 import uk.co.blackpepper.bowman.annotation.RemoteResource;
40 * EntityBean class for a Cloudify Manager. This bean represents a Cloudify node through which TOSCA-based VNFs may be
41 * deployed. Each CloudSite in the CloudConfig may have a Cloudify Manager for deployments using TOSCA blueprints.
42 * Cloudify Managers may support multiple Cloud Sites, but each site will have at most one Cloudify Manager.
44 * This does not replace the ability to use the CloudSite directly via Openstack.
49 @RemoteResource("/cloudifyManager")
50 @Table(name = "cloudify_managers")
51 public class CloudifyManager {
60 @JsonProperty("cloudify_url")
61 @Column(name = "CLOUDIFY_URL")
62 private String cloudifyUrl;
65 @JsonProperty("username")
66 @Column(name = "USERNAME")
67 private String username;
70 @JsonProperty("password")
71 @Column(name = "PASSWORD")
72 private String password;
75 @JsonProperty("version")
76 @Column(name = "VERSION")
77 private String version;
79 @JsonProperty("last_updated_by")
81 @Column(name = "LAST_UPDATED_BY")
82 private String lastUpdatedBy;
84 @JsonProperty("creation_timestamp")
86 @Column(name = "CREATION_TIMESTAMP", updatable = false)
87 @Temporal(TemporalType.TIMESTAMP)
90 @JsonProperty("update_timestamp")
92 @Column(name = "UPDATE_TIMESTAMP")
93 @Temporal(TemporalType.TIMESTAMP)
96 public CloudifyManager() {}
99 protected void onCreate() {
100 this.created = new Date();
101 this.updated = new Date();
104 public String getId() {
108 public void setId(String id) {
112 public String getCloudifyUrl() {
116 public void setCloudifyUrl(String cloudifyUrl) {
117 this.cloudifyUrl = cloudifyUrl;
120 public String getUsername() {
124 public void setUsername(String username) {
125 this.username = username;
128 public String getPassword() {
132 public void setPassword(String password) {
133 this.password = password;
136 public String getVersion() {
140 public void setVersion(String version) {
141 this.version = version;
144 public String getLastUpdatedBy() {
145 return lastUpdatedBy;
148 public Date getCreated() {
152 public Date getUpdated() {
156 public void setLastUpdatedBy(String lastUpdatedBy) {
157 this.lastUpdatedBy = lastUpdatedBy;
160 public void setCreated(Date created) {
161 this.created = created;
164 public void setUpdated(Date updated) {
165 this.updated = updated;
169 public CloudifyManager clone() {
170 CloudifyManager cloudifyManagerCopy = new CloudifyManager();
171 cloudifyManagerCopy.id = this.id;
172 cloudifyManagerCopy.cloudifyUrl = this.cloudifyUrl;
173 cloudifyManagerCopy.username = this.username;
174 cloudifyManagerCopy.password = this.password;
175 cloudifyManagerCopy.version = this.version;
176 return cloudifyManagerCopy;
180 public String toString() {
181 return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE).append("id", getId())
182 .append("cloudifyUrl", getCloudifyUrl()).append("username", getUsername())
183 .append("password", getPassword()).append("version", getVersion()).toString();
187 public boolean equals(final Object other) {
191 if (!getClass().equals(other.getClass())) {
194 CloudifyManager castOther = (CloudifyManager) other;
195 return new EqualsBuilder().append(getId(), castOther.getId())
196 .append(getCloudifyUrl(), castOther.getCloudifyUrl()).append(getUsername(), castOther.getUsername())
197 .append(getPassword(), castOther.getPassword()).append(getVersion(), castOther.getVersion()).isEquals();
201 public int hashCode() {
202 return new HashCodeBuilder(1, 31).append(getId()).append(getCloudifyUrl()).append(getUsername())
203 .append(getPassword()).append(getVersion()).toHashCode();