| 1 | /** |
| 2 | * Licensed to jclouds, Inc. (jclouds) under one or more |
| 3 | * contributor license agreements. See the NOTICE file |
| 4 | * distributed with this work for additional information |
| 5 | * regarding copyright ownership. jclouds licenses this file |
| 6 | * to you under the Apache License, Version 2.0 (the |
| 7 | * "License"); you may not use this file except in compliance |
| 8 | * with the License. You may obtain a copy of the License at |
| 9 | * |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | * |
| 12 | * Unless required by applicable law or agreed to in writing, |
| 13 | * software distributed under the License is distributed on an |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | * KIND, either express or implied. See the License for the |
| 16 | * specific language governing permissions and limitations |
| 17 | * under the License. |
| 18 | */ |
| 19 | package org.jclouds.vcloud.domain.ovf; |
| 20 | |
| 21 | import java.util.List; |
| 22 | |
| 23 | import org.jclouds.cim.ResourceAllocationSettingData; |
| 24 | import org.jclouds.vcloud.domain.ReferenceType; |
| 25 | |
| 26 | /** |
| 27 | * @author Adrian Cole |
| 28 | * |
| 29 | */ |
| 30 | public class EditableResourceAllocationSettingData extends ResourceAllocationSettingData { |
| 31 | |
| 32 | public static Builder builder() { |
| 33 | return new Builder(); |
| 34 | } |
| 35 | |
| 36 | /** |
| 37 | * {@inheritDoc} |
| 38 | */ |
| 39 | @Override |
| 40 | public Builder toBuilder() { |
| 41 | return builder().fromEditableResourceAllocationSettingData(this); |
| 42 | } |
| 43 | |
| 44 | public static class Builder extends ResourceAllocationSettingData.Builder { |
| 45 | private ReferenceType edit; |
| 46 | |
| 47 | /** |
| 48 | * @see EditableResourceAllocationSettingData#getEdit |
| 49 | */ |
| 50 | public Builder edit(ReferenceType edit) { |
| 51 | this.edit = edit; |
| 52 | return this; |
| 53 | } |
| 54 | |
| 55 | public EditableResourceAllocationSettingData build() { |
| 56 | return new EditableResourceAllocationSettingData(elementName, instanceID, caption, description, address, |
| 57 | addressOnParent, allocationUnits, automaticAllocation, automaticDeallocation, consumerVisibility, limit, |
| 58 | mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, |
| 59 | virtualQuantity, virtualQuantityUnits, weight, connections, hostResources, edit); |
| 60 | } |
| 61 | |
| 62 | public Builder fromEditableResourceAllocationSettingData(EditableResourceAllocationSettingData in) { |
| 63 | return edit(in.getEdit()).fromResourceAllocationSettingData(in); |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * {@inheritDoc} |
| 68 | */ |
| 69 | @Override |
| 70 | public Builder caption(String caption) { |
| 71 | return Builder.class.cast(super.caption(caption)); |
| 72 | } |
| 73 | |
| 74 | /** |
| 75 | * {@inheritDoc} |
| 76 | */ |
| 77 | @Override |
| 78 | public Builder description(String description) { |
| 79 | return Builder.class.cast(super.description(description)); |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * {@inheritDoc} |
| 84 | */ |
| 85 | @Override |
| 86 | public Builder elementName(String elementName) { |
| 87 | return Builder.class.cast(super.elementName(elementName)); |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * {@inheritDoc} |
| 92 | */ |
| 93 | @Override |
| 94 | public Builder instanceID(String instanceID) { |
| 95 | return Builder.class.cast(super.instanceID(instanceID)); |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * {@inheritDoc} |
| 100 | */ |
| 101 | @Override |
| 102 | public Builder address(String address) { |
| 103 | return Builder.class.cast(super.address(address)); |
| 104 | } |
| 105 | |
| 106 | /** |
| 107 | * {@inheritDoc} |
| 108 | */ |
| 109 | @Override |
| 110 | public Builder addressOnParent(String addressOnParent) { |
| 111 | return Builder.class.cast(super.addressOnParent(addressOnParent)); |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * {@inheritDoc} |
| 116 | */ |
| 117 | @Override |
| 118 | public Builder allocationUnits(String allocationUnits) { |
| 119 | return Builder.class.cast(super.allocationUnits(allocationUnits)); |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * {@inheritDoc} |
| 124 | */ |
| 125 | @Override |
| 126 | public Builder automaticAllocation(Boolean automaticAllocation) { |
| 127 | return Builder.class.cast(super.automaticAllocation(automaticAllocation)); |
| 128 | } |
| 129 | |
| 130 | /** |
| 131 | * {@inheritDoc} |
| 132 | */ |
| 133 | @Override |
| 134 | public Builder automaticDeallocation(Boolean automaticDeallocation) { |
| 135 | return Builder.class.cast(super.automaticDeallocation(automaticDeallocation)); |
| 136 | } |
| 137 | |
| 138 | /** |
| 139 | * {@inheritDoc} |
| 140 | */ |
| 141 | @Override |
| 142 | public Builder connection(String connection) { |
| 143 | return Builder.class.cast(super.connection(connection)); |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * {@inheritDoc} |
| 148 | */ |
| 149 | @Override |
| 150 | public Builder connections(List<String> connections) { |
| 151 | return Builder.class.cast(super.connections(connections)); |
| 152 | } |
| 153 | |
| 154 | /** |
| 155 | * {@inheritDoc} |
| 156 | */ |
| 157 | @Override |
| 158 | public Builder consumerVisibility(ConsumerVisibility consumerVisibility) { |
| 159 | return Builder.class.cast(super.consumerVisibility(consumerVisibility)); |
| 160 | } |
| 161 | |
| 162 | /** |
| 163 | * {@inheritDoc} |
| 164 | */ |
| 165 | @Override |
| 166 | public Builder hostResource(String hostResource) { |
| 167 | return Builder.class.cast(super.hostResource(hostResource)); |
| 168 | } |
| 169 | |
| 170 | /** |
| 171 | * {@inheritDoc} |
| 172 | */ |
| 173 | @Override |
| 174 | public Builder hostResources(List<String> hostResources) { |
| 175 | return Builder.class.cast(super.hostResources(hostResources)); |
| 176 | } |
| 177 | |
| 178 | /** |
| 179 | * {@inheritDoc} |
| 180 | */ |
| 181 | @Override |
| 182 | public Builder limit(Long limit) { |
| 183 | return Builder.class.cast(super.limit(limit)); |
| 184 | } |
| 185 | |
| 186 | /** |
| 187 | * {@inheritDoc} |
| 188 | */ |
| 189 | @Override |
| 190 | public Builder mappingBehavior(MappingBehavior mappingBehavior) { |
| 191 | return Builder.class.cast(super.mappingBehavior(mappingBehavior)); |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * {@inheritDoc} |
| 196 | */ |
| 197 | @Override |
| 198 | public Builder otherResourceType(String otherResourceType) { |
| 199 | return Builder.class.cast(super.otherResourceType(otherResourceType)); |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * {@inheritDoc} |
| 204 | */ |
| 205 | @Override |
| 206 | public Builder parent(String parent) { |
| 207 | return Builder.class.cast(super.parent(parent)); |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * {@inheritDoc} |
| 212 | */ |
| 213 | @Override |
| 214 | public Builder poolID(String poolID) { |
| 215 | return Builder.class.cast(super.poolID(poolID)); |
| 216 | } |
| 217 | |
| 218 | /** |
| 219 | * {@inheritDoc} |
| 220 | */ |
| 221 | @Override |
| 222 | public Builder reservation(Long reservation) { |
| 223 | return Builder.class.cast(super.reservation(reservation)); |
| 224 | } |
| 225 | |
| 226 | /** |
| 227 | * {@inheritDoc} |
| 228 | */ |
| 229 | @Override |
| 230 | public Builder resourceSubType(String resourceSubType) { |
| 231 | return Builder.class.cast(super.resourceSubType(resourceSubType)); |
| 232 | } |
| 233 | |
| 234 | /** |
| 235 | * {@inheritDoc} |
| 236 | */ |
| 237 | @Override |
| 238 | public Builder resourceType(org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType) { |
| 239 | return Builder.class.cast(super.resourceType(resourceType)); |
| 240 | } |
| 241 | |
| 242 | /** |
| 243 | * {@inheritDoc} |
| 244 | */ |
| 245 | @Override |
| 246 | public Builder virtualQuantity(Long virtualQuantity) { |
| 247 | return Builder.class.cast(super.virtualQuantity(virtualQuantity)); |
| 248 | } |
| 249 | |
| 250 | /** |
| 251 | * {@inheritDoc} |
| 252 | */ |
| 253 | @Override |
| 254 | public Builder virtualQuantityUnits(String virtualQuantityUnits) { |
| 255 | return Builder.class.cast(super.virtualQuantityUnits(virtualQuantityUnits)); |
| 256 | } |
| 257 | |
| 258 | /** |
| 259 | * {@inheritDoc} |
| 260 | */ |
| 261 | @Override |
| 262 | public Builder weight(Integer weight) { |
| 263 | return Builder.class.cast(super.weight(weight)); |
| 264 | } |
| 265 | |
| 266 | @Override |
| 267 | public Builder fromResourceAllocationSettingData(ResourceAllocationSettingData in) { |
| 268 | return Builder.class.cast(super.fromResourceAllocationSettingData(in)); |
| 269 | } |
| 270 | |
| 271 | } |
| 272 | |
| 273 | private final ReferenceType edit; |
| 274 | |
| 275 | public EditableResourceAllocationSettingData(String elementName, String instanceID, String caption, |
| 276 | String description, String address, String addressOnParent, String allocationUnits, |
| 277 | Boolean automaticAllocation, Boolean automaticDeallocation, ConsumerVisibility consumerVisibility, Long limit, |
| 278 | MappingBehavior mappingBehavior, String otherResourceType, String parent, String poolID, Long reservation, |
| 279 | String resourceSubType, org.jclouds.cim.ResourceAllocationSettingData.ResourceType resourceType, |
| 280 | Long virtualQuantity, String virtualQuantityUnits, Integer weight, List<String> connections, |
| 281 | List<String> hostResources, ReferenceType edit) { |
| 282 | super(elementName, instanceID, caption, description, address, addressOnParent, allocationUnits, |
| 283 | automaticAllocation, automaticDeallocation, consumerVisibility, limit, mappingBehavior, otherResourceType, |
| 284 | parent, poolID, reservation, resourceSubType, resourceType, virtualQuantity, virtualQuantityUnits, weight, |
| 285 | connections, hostResources); |
| 286 | this.edit = edit; |
| 287 | } |
| 288 | |
| 289 | public ReferenceType getEdit() { |
| 290 | return edit; |
| 291 | } |
| 292 | |
| 293 | @Override |
| 294 | public String toString() { |
| 295 | return String |
| 296 | .format( |
| 297 | "[elementName=%s, instanceID=%s, caption=%s, description=%s, address=%s, addressOnParent=%s, allocationUnits=%s, automaticAllocation=%s, automaticDeallocation=%s, connections=%s, consumerVisibility=%s, hostResources=%s, limit=%s, mappingBehavior=%s, otherResourceType=%s, parent=%s, poolID=%s, reservation=%s, resourceSubType=%s, resourceType=%s, virtualQuantity=%s, virtualQuantityUnits=%s, weight=%s, edit=%s]", |
| 298 | elementName, instanceID, caption, description, address, addressOnParent, allocationUnits, |
| 299 | automaticAllocation, automaticDeallocation, connections, consumerVisibility, hostResources, limit, |
| 300 | mappingBehavior, otherResourceType, parent, poolID, reservation, resourceSubType, resourceType, |
| 301 | virtualQuantity, virtualQuantityUnits, weight, edit); |
| 302 | } |
| 303 | |
| 304 | } |