-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathVmwareDatacenterVO.java
More file actions
166 lines (132 loc) · 4.12 KB
/
VmwareDatacenterVO.java
File metadata and controls
166 lines (132 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.dc;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.db.Encrypt;
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
/**
* VmwareDatacenterVO contains information of Vmware Datacenter associated with a CloudStack zone.
*/
@Entity
@Table(name = "vmware_data_center")
public class VmwareDatacenterVO implements VmwareDatacenter {
private static final long serialVersionUID = -9114941929893819232L;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private long id;
@Column(name = "guid")
private String guid;
@Column(name = "name")
private String vmwareDatacenterName;
@Column(name = "vcenter_host")
private String vcenterHost;
@Column(name = "uuid")
private String uuid;
@Column(name = "username")
private String user;
@Encrypt
@Column(name = "password")
private String password;
@Override
public String getUuid() {
return uuid;
}
@Override
public long getId() {
return id;
}
@Override
public String getVmwareDatacenterName() {
return vmwareDatacenterName;
}
@Override
public String getGuid() {
return guid;
}
@Override
public String getUser() {
return user;
}
@Override
public String getPassword() {
return password;
}
@Override
public String getVcenterHost() {
return vcenterHost;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public void setGuid(String guid) {
this.guid = guid;
}
public void setVmwareDatacenterName(String name) {
vmwareDatacenterName = name;
}
public void setVcenterHost(String vCenterHost) {
vcenterHost = vCenterHost;
}
public void setUser(String user) {
this.user = user;
;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return String.format("VmwareDatacenter %s",
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
this, "id", "uuid", "guid"));
}
@Override
public int hashCode() {
return NumbersUtil.hash(id);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof VmwareDatacenterVO) {
return ((VmwareDatacenterVO)obj).getId() == getId();
} else {
return false;
}
}
public VmwareDatacenterVO(String guid, String name, String vCenterHost, String user, String password) {
uuid = UUID.randomUUID().toString();
vmwareDatacenterName = name;
this.guid = guid;
vcenterHost = vCenterHost;
this.user = user;
this.password = password;
}
public VmwareDatacenterVO(long id, String guid, String name, String vCenterHost, String user, String password) {
this(guid, name, vCenterHost, user, password);
this.id = id;
}
public VmwareDatacenterVO() {
uuid = UUID.randomUUID().toString();
}
}