1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.jclouds.trmk.vcloud_0_8.domain.internal;
20
21 import java.net.URI;
22 import java.util.Map;
23
24 import com.google.common.collect.ImmutableMap;
25 import org.jclouds.javax.annotation.Nullable;
26 import org.jclouds.trmk.vcloud_0_8.domain.ReferenceType;
27 import org.jclouds.trmk.vcloud_0_8.domain.VDC;
28
29 import static com.google.common.base.Preconditions.checkNotNull;
30
31
32
33
34
35
36
37 public class VDCImpl extends ReferenceTypeImpl implements VDC {
38
39 @Nullable
40 private final String description;
41 private final ReferenceType catalog;
42 private final ReferenceType publicIps;
43 private final ReferenceType internetServices;
44 private final Map<String, ReferenceType> resourceEntities;
45 private final Map<String, ReferenceType> availableNetworks;
46
47 public VDCImpl(String name, String type, URI href, @Nullable String description, ReferenceType catalog,
48 ReferenceType publicIps, ReferenceType internetServices, Map<String, ReferenceType> resourceEntities,
49 Map<String, ReferenceType> availableNetworks) {
50 super(name, type, href);
51 this.description = description;
52 this.catalog = checkNotNull(catalog, "catalog");
53 this.publicIps = checkNotNull(publicIps, "publicIps");
54 this.internetServices = checkNotNull(internetServices, "internetServices");
55 this.resourceEntities = ImmutableMap.copyOf(checkNotNull(resourceEntities, "resourceEntities"));
56 this.availableNetworks = ImmutableMap.copyOf(checkNotNull(availableNetworks, "availableNetworks"));
57 }
58
59
60
61
62 @Override
63 public String getDescription() {
64 return description;
65 }
66
67
68
69
70 @Override
71 public ReferenceType getCatalog() {
72 return catalog;
73 }
74
75
76
77
78 @Override
79 public ReferenceType getPublicIps() {
80 return publicIps;
81 }
82
83
84
85
86 @Override
87 public ReferenceType getInternetServices() {
88 return internetServices;
89 }
90
91
92
93
94 @Override
95 public Map<String, ReferenceType> getResourceEntities() {
96 return resourceEntities;
97 }
98
99
100
101
102 @Override
103 public Map<String, ReferenceType> getAvailableNetworks() {
104 return availableNetworks;
105 }
106
107 @Override
108 public int hashCode() {
109 final int prime = 31;
110 int result = super.hashCode();
111 result = prime * result + ((availableNetworks == null) ? 0 : availableNetworks.hashCode());
112 result = prime * result + ((catalog == null) ? 0 : catalog.hashCode());
113 result = prime * result + ((description == null) ? 0 : description.hashCode());
114 result = prime * result + ((internetServices == null) ? 0 : internetServices.hashCode());
115 result = prime * result + ((publicIps == null) ? 0 : publicIps.hashCode());
116 result = prime * result + ((resourceEntities == null) ? 0 : resourceEntities.hashCode());
117 return result;
118 }
119
120 @Override
121 public boolean equals(Object obj) {
122 if (this == obj)
123 return true;
124 if (!super.equals(obj))
125 return false;
126 if (getClass() != obj.getClass())
127 return false;
128 VDCImpl other = (VDCImpl) obj;
129 if (availableNetworks == null) {
130 if (other.availableNetworks != null)
131 return false;
132 } else if (!availableNetworks.equals(other.availableNetworks))
133 return false;
134 if (catalog == null) {
135 if (other.catalog != null)
136 return false;
137 } else if (!catalog.equals(other.catalog))
138 return false;
139 if (description == null) {
140 if (other.description != null)
141 return false;
142 } else if (!description.equals(other.description))
143 return false;
144 if (internetServices == null) {
145 if (other.internetServices != null)
146 return false;
147 } else if (!internetServices.equals(other.internetServices))
148 return false;
149 if (publicIps == null) {
150 if (other.publicIps != null)
151 return false;
152 } else if (!publicIps.equals(other.publicIps))
153 return false;
154 if (resourceEntities == null) {
155 if (other.resourceEntities != null)
156 return false;
157 } else if (!resourceEntities.equals(other.resourceEntities))
158 return false;
159 return true;
160 }
161
162 @Override
163 public String toString() {
164 return "[name=" + getName() + ", href=" + getHref() + ", description=" + description + ", catalog=" + catalog
165 + ", publicIps=" + publicIps + ", internetServices=" + internetServices + ", resourceEntities="
166 + resourceEntities + ", availableNetworks=" + availableNetworks + "]";
167 }
168
169 }