VCloud Director 1.5: making domain objects immutable and fixing a number of de/serialization problems

This commit is contained in:
Adam Lowe 2012-03-01 23:08:06 +00:00
parent 8cd642af6b
commit cc4a27072b
99 changed files with 3089 additions and 5737 deletions

View File

@ -22,26 +22,23 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import java.util.List; import java.util.Collection;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.Lists; import com.google.common.collect.Sets;
/** /**
*
* Represents a list of references to available networks. * Represents a list of references to available networks.
* * <p/>
* * <p/>
* <p>Java class for AvailableNetworks complex type. * <p>Java class for AvailableNetworks complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="AvailableNetworks"> * &lt;complexType name="AvailableNetworks">
* &lt;complexContent> * &lt;complexContent>
@ -54,10 +51,7 @@ import com.google.common.collect.Lists;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "AvailableNetworks", propOrder = { @XmlType(name = "AvailableNetworks", propOrder = {
"networks" "networks"
}) })
@ -71,14 +65,13 @@ public class AvailableNetworks {
} }
public static class Builder { public static class Builder {
private Set<Reference> networks = Sets.newLinkedHashSet();
private List<Reference> networks = Lists.newArrayList();
/** /**
* @see AvailableNetworks#getNetworks() * @see AvailableNetworks#getNetworks()
*/ */
public Builder networks(List<Reference> networks) { public Builder networks(Collection<Reference> networks) {
this.networks = Lists.newArrayList(checkNotNull(networks, "networks")); this.networks = Sets.newLinkedHashSet(checkNotNull(networks, "networks"));
return this; return this;
} }
@ -101,44 +94,21 @@ public class AvailableNetworks {
} }
} }
private AvailableNetworks() { @XmlElement(name = "Network")
// For JAXB and builder use protected Set<Reference> networks = Sets.newLinkedHashSet();
}
private AvailableNetworks(List<Reference> networks) { private AvailableNetworks(Set<Reference> networks) {
this.networks = networks; this.networks = networks;
} }
private AvailableNetworks() {
@XmlElement(name = "Network") // For JAXB
protected List<Reference> networks; }
/** /**
* Gets the value of the network property. * Gets the value of the network property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the network property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getNetwork().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ReferenceType }
*
*
*/ */
public List<Reference> getNetworks() { public Set<Reference> getNetworks() {
if (networks == null) {
networks = Lists.newArrayList();
}
return this.networks; return this.networks;
} }

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -30,14 +28,13 @@ import com.google.common.base.Objects;
/** /**
*
* Collection of supported hardware capabilities. * Collection of supported hardware capabilities.
* * <p/>
* * <p/>
* <p>Java class for Capabilities complex type. * <p>Java class for Capabilities complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="Capabilities"> * &lt;complexType name="Capabilities">
* &lt;complexContent> * &lt;complexContent>
@ -50,10 +47,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Capabilities", propOrder = { @XmlType(name = "Capabilities", propOrder = {
"supportedHardwareVersions" "supportedHardwareVersions"
}) })
@ -80,9 +74,7 @@ public class Capabilities {
public Capabilities build() { public Capabilities build() {
Capabilities capabilities = new Capabilities(); return new Capabilities(supportedHardwareVersions);
capabilities.setSupportedHardwareVersions(supportedHardwareVersions);
return capabilities;
} }
@ -91,10 +83,13 @@ public class Capabilities {
} }
} }
private Capabilities() { private Capabilities(SupportedHardwareVersions supportedHardwareVersions) {
// For JAXB and builder use this.supportedHardwareVersions = supportedHardwareVersions;
} }
private Capabilities() {
// For JAXB
}
@XmlElement(name = "SupportedHardwareVersions") @XmlElement(name = "SupportedHardwareVersions")
@ -103,27 +98,13 @@ public class Capabilities {
/** /**
* Gets the value of the supportedHardwareVersions property. * Gets the value of the supportedHardwareVersions property.
* *
* @return * @return possible object is
* possible object is
* {@link SupportedHardwareVersions } * {@link SupportedHardwareVersions }
*
*/ */
public SupportedHardwareVersions getSupportedHardwareVersions() { public SupportedHardwareVersions getSupportedHardwareVersions() {
return supportedHardwareVersions; return supportedHardwareVersions;
} }
/**
* Sets the value of the supportedHardwareVersions property.
*
* @param value
* allowed object is
* {@link SupportedHardwareVersions }
*
*/
public void setSupportedHardwareVersions(SupportedHardwareVersions value) {
this.supportedHardwareVersions = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -31,14 +29,13 @@ import com.google.common.base.Objects;
/** /**
*
* Represents a capacity of a given resource. * Represents a capacity of a given resource.
* * <p/>
* * <p/>
* <p>Java class for Capacity complex type. * <p>Java class for Capacity complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="Capacity"> * &lt;complexType name="Capacity">
* &lt;complexContent> * &lt;complexContent>
@ -53,17 +50,14 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Capacity", propOrder = { @XmlType(name = "Capacity", propOrder = {
"units", "units",
"allocated", "allocated",
"limit" "limit"
}) })
@XmlSeeAlso({ @XmlSeeAlso({
// CapacityWithUsageType.class CapacityWithUsage.class
}) })
public class CapacityType<T extends CapacityType<T>> { public class CapacityType<T extends CapacityType<T>> {
@ -107,11 +101,7 @@ public class CapacityType<T extends CapacityType<T>> {
public CapacityType<T> build() { public CapacityType<T> build() {
CapacityType<T> capacity = new CapacityType<T>(); return new CapacityType<T>(units, allocated, limit);
capacity.setUnits(units);
capacity.setAllocated(allocated);
capacity.setLimit(limit);
return capacity;
} }
@ -122,16 +112,16 @@ public class CapacityType<T extends CapacityType<T>> {
} }
} }
protected CapacityType(String units, Long allocated, Long limit) {
this.units = units;
this.allocated = allocated;
this.limit = limit;
}
protected CapacityType() { protected CapacityType() {
// For JAXB and builder use // For JAXB and builder use
} }
protected CapacityType(String units) {
this.units = units;
}
@XmlElement(name = "Units", required = true) @XmlElement(name = "Units", required = true)
protected String units; protected String units;
@XmlElement(name = "Allocated") @XmlElement(name = "Allocated")
@ -142,67 +132,30 @@ public class CapacityType<T extends CapacityType<T>> {
/** /**
* Gets the value of the units property. * Gets the value of the units property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getUnits() { public String getUnits() {
return units; return units;
} }
/**
* Sets the value of the units property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setUnits(String value) {
this.units = value;
}
/** /**
* Gets the value of the allocated property. * Gets the value of the allocated property.
* *
* @return * @return possible object is
* possible object is
* {@link Long } * {@link Long }
*
*/ */
public Long getAllocated() { public Long getAllocated() {
return allocated; return allocated;
} }
/**
* Sets the value of the allocated property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setAllocated(Long value) {
this.allocated = value;
}
/** /**
* Gets the value of the limit property. * Gets the value of the limit property.
*
*/ */
public Long getLimit() { public Long getLimit() {
return limit; return limit;
} }
/**
* Sets the value of the limit property.
*
*/
public void setLimit(Long value) {
this.limit = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -30,14 +28,13 @@ import com.google.common.base.Objects;
/** /**
*
* Represents a capacity and usage of a given resource. * Represents a capacity and usage of a given resource.
* * <p/>
* * <p/>
* <p>Java class for CapacityWithUsage complex type. * <p>Java class for CapacityWithUsage complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="CapacityWithUsage"> * &lt;complexType name="CapacityWithUsage">
* &lt;complexContent> * &lt;complexContent>
@ -51,10 +48,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CapacityWithUsage", propOrder = { @XmlType(name = "CapacityWithUsage", propOrder = {
"used", "used",
"overhead" "overhead"
@ -94,12 +88,7 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
public CapacityWithUsage build() { public CapacityWithUsage build() {
CapacityWithUsage capacityWithUsage = new CapacityWithUsage(units); return new CapacityWithUsage(units, allocated, limit, used, overhead);
capacityWithUsage.setUsed(used);
capacityWithUsage.setOverhead(overhead);
capacityWithUsage.setAllocated(allocated);
capacityWithUsage.setLimit(limit);
return capacityWithUsage;
} }
/** /**
@ -131,6 +120,7 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
public Builder fromCapacityType(CapacityType<CapacityWithUsage> in) { public Builder fromCapacityType(CapacityType<CapacityWithUsage> in) {
return Builder.class.cast(super.fromCapacityType(in)); return Builder.class.cast(super.fromCapacityType(in));
} }
public Builder fromCapacityWithUsage(CapacityWithUsage in) { public Builder fromCapacityWithUsage(CapacityWithUsage in) {
return fromCapacityType(in) return fromCapacityType(in)
.used(in.getUsed()) .used(in.getUsed())
@ -138,15 +128,16 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
} }
} }
protected CapacityWithUsage() { private CapacityWithUsage(String units, Long allocated, Long limit, Long used, Long overhead) {
super(units, allocated, limit);
this.used = used;
this.overhead = overhead;
}
private CapacityWithUsage() {
// For JAXB and builder use // For JAXB and builder use
} }
public CapacityWithUsage(String units) {
super(units);
}
@XmlElement(name = "Used") @XmlElement(name = "Used")
protected Long used; protected Long used;
@XmlElement(name = "Overhead") @XmlElement(name = "Overhead")
@ -155,51 +146,23 @@ public class CapacityWithUsage extends CapacityType<CapacityWithUsage>
/** /**
* Gets the value of the used property. * Gets the value of the used property.
* *
* @return * @return possible object is
* possible object is
* {@link Long } * {@link Long }
*
*/ */
public Long getUsed() { public Long getUsed() {
return used; return used;
} }
/**
* Sets the value of the used property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setUsed(Long value) {
this.used = value;
}
/** /**
* Gets the value of the overhead property. * Gets the value of the overhead property.
* *
* @return * @return possible object is
* possible object is
* {@link Long } * {@link Long }
*
*/ */
public Long getOverhead() { public Long getOverhead() {
return overhead; return overhead;
} }
/**
* Sets the value of the overhead property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setOverhead(Long value) {
this.overhead = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,13 +20,10 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.ArrayList; import java.util.Set;
import java.util.List;
import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -40,17 +37,18 @@ import org.jclouds.ovf.VirtualHardwareSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection; import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/** /**
*
* Represents the parameters for capturing a vApp to a vApp template. * Represents the parameters for capturing a vApp to a vApp template.
* * <p/>
* * <p/>
* <p>Java class for CaptureVAppParams complex type. * <p>Java class for CaptureVAppParams complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="CaptureVAppParams"> * &lt;complexType name="CaptureVAppParams">
* &lt;complexContent> * &lt;complexContent>
@ -64,10 +62,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CaptureVAppParams", propOrder = { @XmlType(name = "CaptureVAppParams", propOrder = {
"source", "source",
"section" "section"
@ -88,7 +83,7 @@ public class CaptureVAppParams
public static class Builder extends ParamsType.Builder<CaptureVAppParams> { public static class Builder extends ParamsType.Builder<CaptureVAppParams> {
private Reference source; private Reference source;
private List<JAXBElement<? extends Section<?>>> sections; private Set<? extends Section<?>> sections = ImmutableSet.of();
/** /**
* @see CaptureVAppParams#getSource() * @see CaptureVAppParams#getSource()
@ -101,16 +96,14 @@ public class CaptureVAppParams
/** /**
* @see CaptureVAppParams#getSections() * @see CaptureVAppParams#getSections()
*/ */
public Builder sections(List<JAXBElement<? extends Section<?>>> sections) { public Builder sections(Set<? extends Section<?>> sections) {
this.sections = sections; this.sections = checkNotNull(sections, "sections");
return this; return this;
} }
public CaptureVAppParams build() { public CaptureVAppParams build() {
CaptureVAppParams captureVAppParams = new CaptureVAppParams(sections); return new CaptureVAppParams(description, name, source, sections);
captureVAppParams.setSource(source);
return captureVAppParams;
} }
@ -118,6 +111,7 @@ public class CaptureVAppParams
public Builder fromParamsType(ParamsType<CaptureVAppParams> in) { public Builder fromParamsType(ParamsType<CaptureVAppParams> in) {
return Builder.class.cast(super.fromParamsType(in)); return Builder.class.cast(super.fromParamsType(in));
} }
public Builder fromCaptureVAppParams(CaptureVAppParams in) { public Builder fromCaptureVAppParams(CaptureVAppParams in) {
return fromParamsType(in) return fromParamsType(in)
.source(in.getSource()) .source(in.getSource())
@ -125,63 +119,54 @@ public class CaptureVAppParams
} }
} }
private CaptureVAppParams(String description, String name, Reference source, Set<? extends Section<?>> sections) {
super(description, name);
this.source = source;
this.sections = sections;
}
private CaptureVAppParams() { private CaptureVAppParams() {
// For JAXB and builder use // For JAXB and builder use
} }
private CaptureVAppParams(List<JAXBElement<? extends Section<?>>> sections) { private CaptureVAppParams(Set<? extends Section<?>> sections) {
this.sections = sections; this.sections = ImmutableSet.copyOf(sections);
} }
@XmlElement(name = "Source", required = true) @XmlElement(name = "Source", required = true)
protected Reference source; protected Reference source;
@XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class) @XmlElementRef
protected List<JAXBElement<? extends Section<?>>> sections; protected Set<? extends Section<?>> sections = Sets.newLinkedHashSet();
/** /**
* Gets the value of the source property. * Gets the value of the source property.
* *
* @return * @return possible object is
* possible object is
* {@link Reference } * {@link Reference }
*
*/ */
public Reference getSource() { public Reference getSource() {
return source; return source;
} }
/** /**
* Sets the value of the source property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setSource(Reference value) {
this.source = value;
}
/**
*
* An ovf:Section to configure the captured vAppTemplate. * An ovf:Section to configure the captured vAppTemplate.
* Gets the value of the section property. * Gets the value of the section property.
* * <p/>
* <p> * <p/>
* This accessor method returns a reference to the live list, * This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the * not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object. * returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the section property. * This is why there is not a <CODE>set</CODE> method for the section property.
* * <p/>
* <p> * <p/>
* For example, to add a new item, do as follows: * For example, to add a new item, do as follows:
* <pre> * <pre>
* getSection().add(newItem); * getSection().add(newItem);
* </pre> * </pre>
* * <p/>
* * <p/>
* <p> * <p/>
* Objects of the following type(s) are allowed in the list * Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link Section> }{@code >} * {@link JAXBElement }{@code <}{@link Section> }{@code >}
* {@link JAXBElement }{@code <}{@link VirtualHardwareSection > }{@code >} * {@link JAXBElement }{@code <}{@link VirtualHardwareSection > }{@code >}
@ -201,13 +186,8 @@ public class CaptureVAppParams
* {@link JAXBElement }{@code <}{@link NetworkSection > }{@code >} * {@link JAXBElement }{@code <}{@link NetworkSection > }{@code >}
* {@link JAXBElement }{@code <}{@link DiskSection > }{@code >} * {@link JAXBElement }{@code <}{@link DiskSection > }{@code >}
* {@link JAXBElement }{@code <}{@link InstallSection> }{@code >} * {@link JAXBElement }{@code <}{@link InstallSection> }{@code >}
*
*
*/ */
public List<JAXBElement<? extends Section<?>>> getSections() { public Set<? extends Section<?>> getSections() {
if (sections == null) {
sections = new ArrayList<JAXBElement<? extends Section<?>>>();
}
return this.sections; return this.sections;
} }

View File

@ -19,11 +19,9 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -33,14 +31,14 @@ import com.google.common.collect.Sets;
/** /**
* Container for references to VappTemplate and Media objects. * Container for references to VappTemplate and Media objects.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="CatalogType" /&gt; * &lt;complexType name="CatalogType" /&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Catalog") @XmlRootElement(name = "Catalog")
public class Catalog extends EntityType<Catalog> { public class Catalog extends EntityType<Catalog> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG; public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG;
@ -95,16 +93,7 @@ public class Catalog extends EntityType<Catalog> {
@Override @Override
public Catalog build() { public Catalog build() {
Catalog catalog = new Catalog(href, name); return new Catalog(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, isPublished);
catalog.setOwner(owner);
catalog.setCatalogItems(catalogItems);
catalog.setIsPublished(isPublished);
catalog.setDescription(description);
catalog.setId(id);
catalog.setType(type);
catalog.setLinks(links);
catalog.setTasksInProgress(tasksInProgress);
return catalog;
} }
/** /**
@ -162,7 +151,7 @@ public class Catalog extends EntityType<Catalog> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder links(Set<Link> links) { public Builder links(Set<Link> links) {
@ -171,7 +160,7 @@ public class Catalog extends EntityType<Catalog> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder link(Link link) { public Builder link(Link link) {
@ -189,12 +178,16 @@ public class Catalog extends EntityType<Catalog> {
} }
} }
private Catalog() { public Catalog(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
// For JAXB and builder use String name, Entity owner, CatalogItems catalogItems, Boolean published) {
super(href, type, links, description, tasksInProgress, id, name);
this.owner = owner;
this.catalogItems = catalogItems;
this.isPublished = published;
} }
private Catalog(URI href, String name) { private Catalog() {
super(href, name); // For JAXB and builder use
} }
@XmlElement(name = "Owner") @XmlElement(name = "Owner")
@ -211,10 +204,6 @@ public class Catalog extends EntityType<Catalog> {
return owner; return owner;
} }
public void setOwner(Entity value) {
this.owner = value;
}
/** /**
* Gets the value of the catalogItems property. * Gets the value of the catalogItems property.
*/ */
@ -222,10 +211,6 @@ public class Catalog extends EntityType<Catalog> {
return catalogItems; return catalogItems;
} }
public void setCatalogItems(CatalogItems value) {
this.catalogItems = value;
}
/** /**
* Gets the value of the isPublished property. * Gets the value of the isPublished property.
*/ */
@ -233,7 +218,4 @@ public class Catalog extends EntityType<Catalog> {
return isPublished; return isPublished;
} }
public void setIsPublished(Boolean value) {
this.isPublished = value;
}
} }

View File

@ -19,31 +19,27 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.List; import java.util.Collections;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
/** /**
*
* Contains a reference to a VappTemplate or Media object and related metadata. * Contains a reference to a VappTemplate or Media object and related metadata.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="CatalogItemType" /&gt; * &lt;complexType name="CatalogItemType" /&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogItem") @XmlRootElement(name = "CatalogItem")
public class CatalogItem extends EntityType<CatalogItem> { public class CatalogItem extends EntityType<CatalogItem> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEM; public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEM;
@ -61,7 +57,7 @@ public class CatalogItem extends EntityType<CatalogItem> {
public static class Builder extends EntityType.Builder<CatalogItem> { public static class Builder extends EntityType.Builder<CatalogItem> {
private Reference entity; private Reference entity;
private List<Property> properties = Lists.newArrayList(); private Set<Property> properties = Sets.newLinkedHashSet();
/** /**
* @see CatalogItem#getEntity() * @see CatalogItem#getEntity()
@ -74,8 +70,8 @@ public class CatalogItem extends EntityType<CatalogItem> {
/** /**
* @see CatalogItem#getProperties() * @see CatalogItem#getProperties()
*/ */
public Builder properties(List<Property> properties) { public Builder properties(Set<Property> properties) {
this.properties = Lists.newArrayList(checkNotNull(properties, "properties")); this.properties = Sets.newLinkedHashSet(checkNotNull(properties, "properties"));
return this; return this;
} }
@ -89,14 +85,7 @@ public class CatalogItem extends EntityType<CatalogItem> {
@Override @Override
public CatalogItem build() { public CatalogItem build() {
CatalogItem catalog = new CatalogItem(href, name, entity); return new CatalogItem(href, type, links, description, tasksInProgress, id, name, entity, properties);
catalog.setProperties(properties);
catalog.setDescription(description);
catalog.setId(id);
catalog.setType(type);
catalog.setLinks(links);
catalog.setTasksInProgress(tasksInProgress);
return catalog;
} }
/** /**
@ -154,7 +143,7 @@ public class CatalogItem extends EntityType<CatalogItem> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder links(Set<Link> links) { public Builder links(Set<Link> links) {
@ -163,7 +152,7 @@ public class CatalogItem extends EntityType<CatalogItem> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder link(Link link) { public Builder link(Link link) {
@ -181,20 +170,20 @@ public class CatalogItem extends EntityType<CatalogItem> {
} }
} }
private CatalogItem() { private CatalogItem(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, Reference entity, Set<Property> properties) {
// For JAXB and builder use super(href, type, links, description, tasksInProgress, id, name);
this.entity = entity;
this.properties = properties;
} }
private CatalogItem(URI href, String name, Reference entity) { private CatalogItem() {
super(href, name); // For JAXB and builder use
this.entity = entity;
this.setProperties(properties);
} }
@XmlElement(name = "Entity", required = true) @XmlElement(name = "Entity", required = true)
private Reference entity; private Reference entity;
@XmlElement(name = "Property") @XmlElement(name = "Property")
private List<Property> properties = Lists.newArrayList(); private Set<Property> properties = Sets.newLinkedHashSet();
/** /**
* A reference to a VappTemplate or Media object. * A reference to a VappTemplate or Media object.
@ -205,18 +194,10 @@ public class CatalogItem extends EntityType<CatalogItem> {
/** /**
* User-specified key/value pair. * User-specified key/value pair.
* * <p/>
* This element has been superseded by the {@link Metadata} element, which is the preferred way to specify key/value pairs for objects. * This element has been superseded by the {@link Metadata} element, which is the preferred way to specify key/value pairs for objects.
*/ */
public List<Property> getProperties() { public Set<Property> getProperties() {
return this.properties; return Collections.unmodifiableSet(this.properties);
}
public void setProperties(List<Property> properties) {
this.properties = Lists.newArrayList(checkNotNull(properties, "properties"));
}
public void addProperty(Property property) {
this.properties.add(checkNotNull(property, "property"));
} }
} }

View File

@ -19,31 +19,27 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import com.google.common.collect.Lists; import com.google.common.collect.Sets;
/** /**
* Represents a list of catalog item references. * Represents a list of catalog item references.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="CatalogItemsType" /&gt; * &lt;complexType name="CatalogItemsType" /&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "CatalogItems")
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogItems")
public class CatalogItems { public class CatalogItems {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEMS; public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEMS;
@ -58,13 +54,13 @@ public class CatalogItems {
public static class Builder { public static class Builder {
private List<Reference> catalogItems = Lists.newArrayList(); private Set<Reference> catalogItems = Sets.newLinkedHashSet();
/** /**
* @see CatalogItems#getCatalogItems() * @see CatalogItems#getCatalogItems()
*/ */
public Builder items(List<Reference> catalogItems) { public Builder items(Collection<Reference> catalogItems) {
this.catalogItems = Lists.newArrayList(checkNotNull(catalogItems, "catalogItems")); this.catalogItems = Sets.newLinkedHashSet(checkNotNull(catalogItems, "catalogItems"));
return this; return this;
} }
@ -90,24 +86,16 @@ public class CatalogItems {
} }
private CatalogItems(Collection<Reference> tasks) { private CatalogItems(Collection<Reference> tasks) {
this.catalogItems = Lists.newArrayList(checkNotNull(catalogItems, "catalogItems")); this.catalogItems = catalogItems;
} }
@XmlElement(name = "CatalogItem") @XmlElement(name = "CatalogItem")
private List<Reference> catalogItems = Lists.newArrayList(); private Set<Reference> catalogItems = Sets.newLinkedHashSet();
/** /**
* Gets the value of the catalogItems property. * Gets the value of the catalogItems property.
*/ */
public List<Reference> getCatalogItems() { public Set<Reference> getCatalogItems() {
return this.catalogItems; return Collections.unmodifiableSet(this.catalogItems);
}
public void setCatalogItems(List<Reference> catalogItems) {
this.catalogItems = Lists.newArrayList(checkNotNull(catalogItems, "catalogItems"));
}
public void addCatalogItem(Reference catalogItem) {
this.catalogItems.add(checkNotNull(catalogItem, "catalogItem"));
} }
} }

View File

@ -1,12 +1,9 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogReference") @XmlRootElement(name = "CatalogReference")
public class CatalogReference extends ReferenceType<CatalogReference> { public class CatalogReference extends ReferenceType<CatalogReference> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -23,11 +20,7 @@ public class CatalogReference extends ReferenceType<CatalogReference> {
@Override @Override
public CatalogReference build() { public CatalogReference build() {
CatalogReference reference = new CatalogReference(href); return new CatalogReference(href, id, name, type);
reference.setId(id);
reference.setName(name);
reference.setType(type);
return reference;
} }
/** /**
@ -76,8 +69,8 @@ public class CatalogReference extends ReferenceType<CatalogReference> {
} }
} }
protected CatalogReference(URI href) { public CatalogReference(URI href, String id, String name, String type) {
super(href); super(href, id, name, type);
} }
protected CatalogReference() { protected CatalogReference() {

View File

@ -19,31 +19,27 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import com.google.common.collect.Lists; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/** /**
* Container for ReferenceType elements that reference catalogs. * Container for ReferenceType elements that reference catalogs.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="CatalogsListType" /&gt; * &lt;complexType name="CatalogsListType" /&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "CatalogsList")
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogsList")
public class CatalogsList { public class CatalogsList {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEMS; public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEMS;
@ -58,13 +54,13 @@ public class CatalogsList {
public static class Builder { public static class Builder {
private List<Reference> catalogReferences = Lists.newArrayList(); private Set<Reference> catalogReferences = Sets.newLinkedHashSet();
/** /**
* @see CatalogsList#getCatalogItems() * @see CatalogsList#getCatalogItems()
*/ */
public Builder catalogs(List<Reference> catalogReferences) { public Builder catalogs(Collection<Reference> catalogReferences) {
this.catalogReferences = Lists.newArrayList(checkNotNull(catalogReferences, "catalogReferences")); this.catalogReferences = Sets.newLinkedHashSet(checkNotNull(catalogReferences, "catalogReferences"));
return this; return this;
} }
@ -81,7 +77,7 @@ public class CatalogsList {
} }
public Builder fromCatalogsList(CatalogsList in) { public Builder fromCatalogsList(CatalogsList in) {
return catalogs(in.getCatalogsList()); return catalogs(in.getCatalogItems());
} }
} }
@ -89,25 +85,18 @@ public class CatalogsList {
// For JAXB and builder use // For JAXB and builder use
} }
private CatalogsList(Collection<Reference> tasks) { private CatalogsList(Set<Reference> tasks) {
this.catalogReferences = Lists.newArrayList(checkNotNull(catalogReferences, "catalogReferences")); this.catalogReferences = ImmutableSet.copyOf(checkNotNull(catalogReferences, "catalogReferences"));
} }
@XmlElement(name = "CatalogReference") @XmlElement(name = "CatalogReference")
private List<Reference> catalogReferences = Lists.newArrayList(); private Set<Reference> catalogReferences = Sets.newLinkedHashSet();
/** /**
* Gets the value of the catalogReferences property. * Gets the value of the catalogReferences property.
*/ */
public List<Reference> getCatalogsList() { public Set<Reference> getCatalogItems() {
return this.catalogReferences; return this.catalogReferences;
} }
public void setCatalogsList(List<Reference> catalogReferences) {
this.catalogReferences = Lists.newArrayList(checkNotNull(catalogReferences, "catalogReferences"));
}
public void addCatalog(Reference catalog) {
this.catalogReferences.add(checkNotNull(catalog, "catalog"));
}
} }

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -30,15 +28,14 @@ import com.google.common.base.Objects;
/** /**
*
* Represents parameters for copying a media resource and optionally * Represents parameters for copying a media resource and optionally
* deleting the source. * deleting the source.
* * <p/>
* * <p/>
* <p>Java class for CloneMediaParams complex type. * <p>Java class for CloneMediaParams complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="CloneMediaParams"> * &lt;complexType name="CloneMediaParams">
* &lt;complexContent> * &lt;complexContent>
@ -52,10 +49,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CloneMediaParams", propOrder = { @XmlType(name = "CloneMediaParams", propOrder = {
"source", "source",
"isSourceDelete" "isSourceDelete"
@ -87,26 +81,22 @@ public class CloneMediaParams
} }
/** /**
* @see CloneMediaParams#getIsSourceDelete() * @see CloneMediaParams#isSourceDelete()
*/ */
public Builder isSourceDelete(Boolean isSourceDelete) { public Builder isSourceDelete(Boolean isSourceDelete) {
this.isSourceDelete = isSourceDelete; this.isSourceDelete = isSourceDelete;
return this; return this;
} }
public CloneMediaParams build() { public CloneMediaParams build() {
CloneMediaParams cloneMediaParams = new CloneMediaParams(); return new CloneMediaParams(description, name, source, isSourceDelete);
cloneMediaParams.setSource(source);
cloneMediaParams.setIsSourceDelete(isSourceDelete);
return cloneMediaParams;
} }
@Override @Override
public Builder fromParamsType(ParamsType<CloneMediaParams> in) { public Builder fromParamsType(ParamsType<CloneMediaParams> in) {
return Builder.class.cast(super.fromParamsType(in)); return Builder.class.cast(super.fromParamsType(in));
} }
public Builder fromCloneMediaParams(CloneMediaParams in) { public Builder fromCloneMediaParams(CloneMediaParams in) {
return fromParamsType(in) return fromParamsType(in)
.source(in.getSource()) .source(in.getSource())
@ -114,12 +104,17 @@ public class CloneMediaParams
} }
} }
private CloneMediaParams(String description, String name, Reference source, Boolean sourceDelete) {
super(description, name);
this.source = source;
isSourceDelete = sourceDelete;
}
private CloneMediaParams() { private CloneMediaParams() {
// For JAXB and builder use // For JAXB and builder use
} }
@XmlElement(name = "Source", required = true) @XmlElement(name = "Source", required = true)
protected Reference source; protected Reference source;
@XmlElement(name = "IsSourceDelete") @XmlElement(name = "IsSourceDelete")
@ -128,51 +123,23 @@ public class CloneMediaParams
/** /**
* Gets the value of the source property. * Gets the value of the source property.
* *
* @return * @return possible object is
* possible object is
* {@link Reference } * {@link Reference }
*
*/ */
public Reference getSource() { public Reference getSource() {
return source; return source;
} }
/**
* Sets the value of the source property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setSource(Reference value) {
this.source = value;
}
/** /**
* Gets the value of the isSourceDelete property. * Gets the value of the isSourceDelete property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isSourceDelete() { public Boolean isSourceDelete() {
return isSourceDelete; return isSourceDelete;
} }
/**
* Sets the value of the isSourceDelete property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsSourceDelete(Boolean value) {
this.isSourceDelete = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -19,22 +19,19 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
/** /**
*
* Represents parameters for copying a vApp and optionally deleting the source. * Represents parameters for copying a vApp and optionally deleting the source.
* * <p/>
* * <p/>
* <p>Java class for CloneVAppParams complex type. * <p>Java class for CloneVAppParams complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="CloneVAppParams"> * &lt;complexType name="CloneVAppParams">
* &lt;complexContent> * &lt;complexContent>
@ -44,10 +41,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CloneVAppParams") @XmlType(name = "CloneVAppParams")
public class CloneVAppParams public class CloneVAppParams
extends InstantiateVAppParamsType<CloneVAppParams> extends InstantiateVAppParamsType<CloneVAppParams>
@ -146,6 +140,7 @@ public class CloneVAppParams
public Builder fromInstantiateVAppParamsType(InstantiateVAppParamsType<CloneVAppParams> in) { public Builder fromInstantiateVAppParamsType(InstantiateVAppParamsType<CloneVAppParams> in) {
return Builder.class.cast(super.fromInstantiateVAppParamsType(in)); return Builder.class.cast(super.fromInstantiateVAppParamsType(in));
} }
public Builder fromCloneVAppParams(CloneVAppParams in) { public Builder fromCloneVAppParams(CloneVAppParams in) {
return fromInstantiateVAppParamsType(in); return fromInstantiateVAppParamsType(in);
} }

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -30,15 +28,14 @@ import com.google.common.base.Objects;
/** /**
*
* Represents parameters for copying a vApp template and optionally * Represents parameters for copying a vApp template and optionally
* deleting the source. * deleting the source.
* * <p/>
* * <p/>
* <p>Java class for CloneVAppTemplateParams complex type. * <p>Java class for CloneVAppTemplateParams complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="CloneVAppTemplateParams"> * &lt;complexType name="CloneVAppTemplateParams">
* &lt;complexContent> * &lt;complexContent>
@ -52,10 +49,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "CloneVAppTemplateParams", propOrder = { @XmlType(name = "CloneVAppTemplateParams", propOrder = {
"source", "source",
"isSourceDelete" "isSourceDelete"
@ -87,26 +81,22 @@ public class CloneVAppTemplateParams
} }
/** /**
* @see CloneVAppTemplateParams#getIsSourceDelete() * @see CloneVAppTemplateParams#isSourceDelete()
*/ */
public Builder isSourceDelete(Boolean isSourceDelete) { public Builder isSourceDelete(Boolean isSourceDelete) {
this.isSourceDelete = isSourceDelete; this.isSourceDelete = isSourceDelete;
return this; return this;
} }
public CloneVAppTemplateParams build() { public CloneVAppTemplateParams build() {
CloneVAppTemplateParams cloneVAppTemplateParams = new CloneVAppTemplateParams(); return new CloneVAppTemplateParams(description, name, source, isSourceDelete);
cloneVAppTemplateParams.setSource(source);
cloneVAppTemplateParams.setIsSourceDelete(isSourceDelete);
return cloneVAppTemplateParams;
} }
@Override @Override
public Builder fromParamsType(ParamsType<CloneVAppTemplateParams> in) { public Builder fromParamsType(ParamsType<CloneVAppTemplateParams> in) {
return Builder.class.cast(super.fromParamsType(in)); return Builder.class.cast(super.fromParamsType(in));
} }
public Builder fromCloneVAppTemplateParams(CloneVAppTemplateParams in) { public Builder fromCloneVAppTemplateParams(CloneVAppTemplateParams in) {
return fromParamsType(in) return fromParamsType(in)
.source(in.getSource()) .source(in.getSource())
@ -114,12 +104,17 @@ public class CloneVAppTemplateParams
} }
} }
public CloneVAppTemplateParams(String description, String name, Reference source, Boolean sourceDelete) {
super(description, name);
this.source = source;
isSourceDelete = sourceDelete;
}
private CloneVAppTemplateParams() { private CloneVAppTemplateParams() {
// For JAXB and builder use // For JAXB and builder use
} }
@XmlElement(name = "Source", required = true) @XmlElement(name = "Source", required = true)
protected Reference source; protected Reference source;
@XmlElement(name = "IsSourceDelete") @XmlElement(name = "IsSourceDelete")
@ -128,51 +123,23 @@ public class CloneVAppTemplateParams
/** /**
* Gets the value of the source property. * Gets the value of the source property.
* *
* @return * @return possible object is
* possible object is
* {@link Reference } * {@link Reference }
*
*/ */
public Reference getSource() { public Reference getSource() {
return source; return source;
} }
/**
* Sets the value of the source property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setSource(Reference value) {
this.source = value;
}
/** /**
* Gets the value of the isSourceDelete property. * Gets the value of the isSourceDelete property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isSourceDelete() { public Boolean isSourceDelete() {
return isSourceDelete; return isSourceDelete;
} }
/**
* Sets the value of the isSourceDelete property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsSourceDelete(Boolean value) {
this.isSourceDelete = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,29 +20,27 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.ArrayList; import java.util.Set;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/** /**
*
* Represents vApp composition parameters. * Represents vApp composition parameters.
* * <p/>
* * <p/>
* <p>Java class for ComposeVAppParams complex type. * <p>Java class for ComposeVAppParams complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="ComposeVAppParams"> * &lt;complexType name="ComposeVAppParams">
* &lt;complexContent> * &lt;complexContent>
@ -57,10 +55,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ComposeVAppParams", propOrder = { @XmlType(name = "ComposeVAppParams", propOrder = {
"sourcedItem", "sourcedItem",
"allEULAsAccepted" "allEULAsAccepted"
@ -83,20 +78,20 @@ public class ComposeVAppParams
public static class Builder extends VAppCreationParamsType.Builder<ComposeVAppParams> { public static class Builder extends VAppCreationParamsType.Builder<ComposeVAppParams> {
private List<SourcedCompositionItemParam> sourcedItem; private Set<SourcedCompositionItemParam> sourcedItem = Sets.newLinkedHashSet();
private Boolean allEULAsAccepted; private Boolean allEULAsAccepted;
private Boolean linkedClone; private Boolean linkedClone;
/** /**
* @see ComposeVAppParams#getSourcedItem() * @see ComposeVAppParams#getSourcedItem()
*/ */
public Builder sourcedItem(List<SourcedCompositionItemParam> sourcedItem) { public Builder sourcedItem(Set<SourcedCompositionItemParam> sourcedItem) {
this.sourcedItem = sourcedItem; this.sourcedItem = checkNotNull(sourcedItem, "sourcedItem");
return this; return this;
} }
/** /**
* @see ComposeVAppParams#getAllEULAsAccepted() * @see ComposeVAppParams#isAllEULAsAccepted()
*/ */
public Builder allEULAsAccepted(Boolean allEULAsAccepted) { public Builder allEULAsAccepted(Boolean allEULAsAccepted) {
this.allEULAsAccepted = allEULAsAccepted; this.allEULAsAccepted = allEULAsAccepted;
@ -104,7 +99,7 @@ public class ComposeVAppParams
} }
/** /**
* @see ComposeVAppParams#getLinkedClone() * @see ComposeVAppParams#isLinkedClone() ()
*/ */
public Builder linkedClone(Boolean linkedClone) { public Builder linkedClone(Boolean linkedClone) {
this.linkedClone = linkedClone; this.linkedClone = linkedClone;
@ -113,10 +108,8 @@ public class ComposeVAppParams
public ComposeVAppParams build() { public ComposeVAppParams build() {
ComposeVAppParams composeVAppParams = new ComposeVAppParams(sourcedItem); return new ComposeVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn,
composeVAppParams.setAllEULAsAccepted(allEULAsAccepted); sourcedItem, allEULAsAccepted, linkedClone);
composeVAppParams.setLinkedClone(linkedClone);
return composeVAppParams;
} }
@ -124,6 +117,7 @@ public class ComposeVAppParams
public Builder fromVAppCreationParamsType(VAppCreationParamsType<ComposeVAppParams> in) { public Builder fromVAppCreationParamsType(VAppCreationParamsType<ComposeVAppParams> in) {
return Builder.class.cast(super.fromVAppCreationParamsType(in)); return Builder.class.cast(super.fromVAppCreationParamsType(in));
} }
public Builder fromComposeVAppParams(ComposeVAppParams in) { public Builder fromComposeVAppParams(ComposeVAppParams in) {
return fromVAppCreationParamsType(in) return fromVAppCreationParamsType(in)
.sourcedItem(in.getSourcedItem()) .sourcedItem(in.getSourcedItem())
@ -132,17 +126,21 @@ public class ComposeVAppParams
} }
} }
public ComposeVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Set<SourcedCompositionItemParam> sourcedItem, Boolean allEULAsAccepted, Boolean linkedClone) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn);
this.sourcedItem = ImmutableSet.copyOf(sourcedItem);
this.allEULAsAccepted = allEULAsAccepted;
this.linkedClone = linkedClone;
}
private ComposeVAppParams() { private ComposeVAppParams() {
// For JAXB and builder use // For JAXB and builder use
} }
private ComposeVAppParams(List<SourcedCompositionItemParam> sourcedItem) {
this.sourcedItem = sourcedItem;
}
@XmlElement(name = "SourcedItem") @XmlElement(name = "SourcedItem")
protected List<SourcedCompositionItemParam> sourcedItem; protected Set<SourcedCompositionItemParam> sourcedItem = Sets.newLinkedHashSet();
@XmlElement(name = "AllEULAsAccepted") @XmlElement(name = "AllEULAsAccepted")
protected Boolean allEULAsAccepted; protected Boolean allEULAsAccepted;
@XmlAttribute @XmlAttribute
@ -150,87 +148,52 @@ public class ComposeVAppParams
/** /**
* Gets the value of the sourcedItem property. * Gets the value of the sourcedItem property.
* * <p/>
* <p> * <p/>
* This accessor method returns a reference to the live list, * This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the * not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object. * returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the sourcedItem property. * This is why there is not a <CODE>set</CODE> method for the sourcedItem property.
* * <p/>
* <p> * <p/>
* For example, to add a new item, do as follows: * For example, to add a new item, do as follows:
* <pre> * <pre>
* getSourcedItem().add(newItem); * getSourcedItem().add(newItem);
* </pre> * </pre>
* * <p/>
* * <p/>
* <p> * <p/>
* Objects of the following type(s) are allowed in the list * Objects of the following type(s) are allowed in the list
* {@link SourcedCompositionItemParamType } * {@link SourcedCompositionItemParam }
*
*
*/ */
public List<SourcedCompositionItemParam> getSourcedItem() { public Set<SourcedCompositionItemParam> getSourcedItem() {
if (sourcedItem == null) {
sourcedItem = new ArrayList<SourcedCompositionItemParam>();
}
return this.sourcedItem; return this.sourcedItem;
} }
/** /**
*
* Used to confirm acceptance of all EULAs in a * Used to confirm acceptance of all EULAs in a
* vApp template. Instantiation fails if this * vApp template. Instantiation fails if this
* element is missing, empty, or set to false * element is missing, empty, or set to false
* and one or more EulaSection elements are * and one or more EulaSection elements are
* present. * present.
* *
* * @return possible object is
* @return
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isAllEULAsAccepted() { public Boolean isAllEULAsAccepted() {
return allEULAsAccepted; return allEULAsAccepted;
} }
/**
* Sets the value of the allEULAsAccepted property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setAllEULAsAccepted(Boolean value) {
this.allEULAsAccepted = value;
}
/** /**
* Gets the value of the linkedClone property. * Gets the value of the linkedClone property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isLinkedClone() { public Boolean isLinkedClone() {
return linkedClone; return linkedClone;
} }
/**
* Sets the value of the linkedClone property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setLinkedClone(Boolean value) {
this.linkedClone = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -30,14 +28,13 @@ import com.google.common.base.Objects;
/** /**
*
* Represents a compute capacity with units. * Represents a compute capacity with units.
* * <p/>
* * <p/>
* <p>Java class for ComputeCapacity complex type. * <p>Java class for ComputeCapacity complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="ComputeCapacity"> * &lt;complexType name="ComputeCapacity">
* &lt;complexContent> * &lt;complexContent>
@ -51,10 +48,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ComputeCapacity", propOrder = { @XmlType(name = "ComputeCapacity", propOrder = {
"cpu", "cpu",
"memory" "memory"
@ -89,27 +83,26 @@ public class ComputeCapacity {
return this; return this;
} }
public ComputeCapacity build() { public ComputeCapacity build() {
ComputeCapacity computeCapacity = new ComputeCapacity(); return new ComputeCapacity(cpu, memory);
computeCapacity.setCpu(cpu);
computeCapacity.setMemory(memory);
return computeCapacity;
} }
public Builder fromComputeCapacity(ComputeCapacity in) { public Builder fromComputeCapacity(ComputeCapacity in) {
return cpu(in.getCpu()) return cpu(in.getCpu())
.memory(in.getMemory()); .memory(in.getMemory());
} }
} }
private ComputeCapacity(CapacityWithUsage cpu, CapacityWithUsage memory) {
this.cpu = cpu;
this.memory = memory;
}
private ComputeCapacity() { private ComputeCapacity() {
// For JAXB and builder use // For JAXB and builder use
} }
@XmlElement(name = "Cpu", required = true) @XmlElement(name = "Cpu", required = true)
protected CapacityWithUsage cpu; protected CapacityWithUsage cpu;
@XmlElement(name = "Memory", required = true) @XmlElement(name = "Memory", required = true)
@ -118,51 +111,23 @@ public class ComputeCapacity {
/** /**
* Gets the value of the cpu property. * Gets the value of the cpu property.
* *
* @return * @return possible object is
* possible object is
* {@link CapacityWithUsage } * {@link CapacityWithUsage }
*
*/ */
public CapacityWithUsage getCpu() { public CapacityWithUsage getCpu() {
return cpu; return cpu;
} }
/**
* Sets the value of the cpu property.
*
* @param value
* allowed object is
* {@link CapacityWithUsage }
*
*/
public void setCpu(CapacityWithUsage value) {
this.cpu = value;
}
/** /**
* Gets the value of the memory property. * Gets the value of the memory property.
* *
* @return * @return possible object is
* possible object is
* {@link CapacityWithUsage } * {@link CapacityWithUsage }
*
*/ */
public CapacityWithUsage getMemory() { public CapacityWithUsage getMemory() {
return memory; return memory;
} }
/**
* Sets the value of the memory property.
*
* @param value
* allowed object is
* {@link CapacityWithUsage }
*
*/
public void setMemory(CapacityWithUsage value) {
this.memory = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,23 +20,22 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.Set;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.w3c.dom.Element;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/** /**
@ -64,12 +63,10 @@ import com.google.common.base.Objects;
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "CustomizationSection") @XmlRootElement(name = "CustomizationSection")
@XmlType(propOrder = { @XmlType(propOrder = {
"customizeOnInstantiate", "customizeOnInstantiate",
"link", "links"
"any"
}) })
public class CustomizationSection extends SectionType<CustomizationSection> { public class CustomizationSection extends SectionType<CustomizationSection> {
public static Builder builder() { public static Builder builder() {
@ -82,8 +79,7 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
public static class Builder extends SectionType.Builder<CustomizationSection> { public static class Builder extends SectionType.Builder<CustomizationSection> {
private boolean customizeOnInstantiate; private boolean customizeOnInstantiate;
private List<Link> link; private Set<Link> links = Sets.newLinkedHashSet();
private List<Object> any;
private URI href; private URI href;
private String type; private String type;
@ -96,18 +92,10 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
} }
/** /**
* @see CustomizationSection#getLink() * @see CustomizationSection#getLinks()
*/ */
public Builder link(List<Link> link) { public Builder links(Set<Link> links) {
this.link = link; this.links = checkNotNull(links, "links");
return this;
}
/**
* @see CustomizationSection#getAny()
*/
public Builder any(List<Object> any) {
this.any = any;
return this; return this;
} }
@ -129,18 +117,13 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
public CustomizationSection build() { public CustomizationSection build() {
CustomizationSection customizationSection = new CustomizationSection(info, link, any); return new CustomizationSection(info, required, customizeOnInstantiate, links, href, type);
customizationSection.setCustomizeOnInstantiate(customizeOnInstantiate);
customizationSection.setHref(href);
customizationSection.setType(type);
return customizationSection;
} }
public Builder fromCustomizationSection(CustomizationSection in) { public Builder fromCustomizationSection(CustomizationSection in) {
return fromSection(in) return fromSection(in)
.customizeOnInstantiate(in.isCustomizeOnInstantiate()) .customizeOnInstantiate(in.isCustomizeOnInstantiate())
.link(in.getLink()) .links(in.getLinks())
.any(in.getAny())
.href(in.getHref()) .href(in.getHref())
.type(in.getType()); .type(in.getType());
} }
@ -161,12 +144,22 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
return Builder.class.cast(super.info(info)); return Builder.class.cast(super.info(info));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
} }
private CustomizationSection(String info, List<Link> link, List<Object> any) { private CustomizationSection(@Nullable String info, @Nullable Boolean required, boolean customizeOnInstantiate, Set<Link> links,
super(info); URI href, String type) {
this.link = link; super(info, required);
this.any = any; this.customizeOnInstantiate = customizeOnInstantiate;
this.links = ImmutableSet.copyOf(links);
this.href = href;
this.type = type;
} }
private CustomizationSection() { private CustomizationSection() {
@ -176,9 +169,7 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
@XmlElement(name = "CustomizeOnInstantiate") @XmlElement(name = "CustomizeOnInstantiate")
protected boolean customizeOnInstantiate; protected boolean customizeOnInstantiate;
@XmlElement(name = "Link") @XmlElement(name = "Link")
protected List<Link> link; protected Set<Link> links = Sets.newLinkedHashSet();
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute @XmlAttribute
@XmlSchemaType(name = "anyURI") @XmlSchemaType(name = "anyURI")
protected URI href; protected URI href;
@ -193,65 +184,10 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
} }
/** /**
* Sets the value of the customizeOnInstantiate property. * Gets the value of the links property.
*/ */
public void setCustomizeOnInstantiate(boolean value) { public Set<Link> getLinks() {
this.customizeOnInstantiate = value; return this.links;
}
/**
* Gets the value of the link property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Link }
*/
public List<Link> getLink() {
if (link == null) {
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the any property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
} }
/** /**
@ -264,16 +200,6 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
return href; return href;
} }
/**
* Sets the value of the href property.
*
* @param value allowed object is
* {@link String }
*/
public void setHref(URI value) {
this.href = value;
}
/** /**
* Gets the value of the type property. * Gets the value of the type property.
* *
@ -284,16 +210,6 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
return type; return type;
} }
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)
@ -301,30 +217,30 @@ public class CustomizationSection extends SectionType<CustomizationSection> {
if (o == null || getClass() != o.getClass()) if (o == null || getClass() != o.getClass())
return false; return false;
CustomizationSection that = CustomizationSection.class.cast(o); CustomizationSection that = CustomizationSection.class.cast(o);
return equal(customizeOnInstantiate, that.customizeOnInstantiate) && return super.equals(that) &&
equal(link, that.link) && equal(customizeOnInstantiate, that.customizeOnInstantiate) &&
equal(any, that.any) && equal(links, that.links) &&
equal(href, that.href) && equal(href, that.href) &&
equal(type, that.type); equal(type, that.type);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(customizeOnInstantiate, return Objects.hashCode(
link, super.hashCode(),
any, customizeOnInstantiate,
links,
href, href,
type); type);
} }
@Override @Override
public String toString() { public Objects.ToStringHelper string() {
return Objects.toStringHelper("") return super.string()
.add("customizeOnInstantiate", customizeOnInstantiate) .add("customizeOnInstantiate", customizeOnInstantiate)
.add("link", link) .add("links", links)
.add("any", any)
.add("href", href) .add("href", href)
.add("type", type).toString(); .add("type", type);
} }
} }

View File

@ -29,10 +29,10 @@ import com.google.common.collect.Sets;
* An entity. * An entity.
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
* @author Adam Lowe
*/ */
public class Entity extends EntityType<Entity> { public class Entity extends EntityType<Entity> {
@SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
@ -46,13 +46,7 @@ public class Entity extends EntityType<Entity> {
@Override @Override
public Entity build() { public Entity build() {
Entity entity = new Entity(href, name); return new Entity(href, type, links, description, tasksInProgress, id, name);
entity.setDescription(description);
entity.setTasksInProgress(tasksInProgress);
entity.setId(id);
entity.setType(type);
entity.setLinks(links);
return entity;
} }
/** /**
@ -110,7 +104,7 @@ public class Entity extends EntityType<Entity> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder links(Set<Link> links) { public Builder links(Set<Link> links) {
@ -119,7 +113,7 @@ public class Entity extends EntityType<Entity> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder link(Link link) { public Builder link(Link link) {
@ -137,21 +131,11 @@ public class Entity extends EntityType<Entity> {
} }
} }
protected Entity(URI href, String name) { private Entity(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name) {
super(href, name); super(href, type, links, description, tasksInProgress, id, name);
} }
protected Entity() { private Entity() {
// For JAXB // For JAXB
} }
@Override
public boolean equals(Object o) {
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
Entity that = Entity.class.cast(o);
return super.equals(that);
}
} }

View File

@ -20,11 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -34,27 +32,19 @@ import com.google.common.collect.Sets;
/** /**
* Basic entity type in the vCloud object model. * Basic entity type in the vCloud object model.
* * <p/>
* Includes a name, an optional description, and an optional list of links * Includes a name, an optional description, and an optional list of links
* * <p/>
* <pre> * <pre>
* &lt;xs:complexType name="EntityType"&gt; * &lt;xs:complexType name="EntityType"&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
* @author Adam Lowe
*/ */
public class EntityType<T extends EntityType<T>> extends ResourceType<T> { public abstract class EntityType<T extends EntityType<T>> extends ResourceType<T> {
public static <T extends EntityType<T>> Builder<T> builder() { public static abstract class Builder<T extends EntityType<T>> extends ResourceType.Builder<T> {
return new Builder<T>();
}
@Override
public Builder<T> toBuilder() {
return new Builder<T>().fromEntityType(this);
}
public static class Builder<T extends EntityType<T>> extends ResourceType.Builder<T> {
protected String description; protected String description;
protected TasksInProgress tasksInProgress; protected TasksInProgress tasksInProgress;
@ -93,17 +83,6 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
return this; return this;
} }
@Override
public EntityType<T> build() {
EntityType<T> entity = new EntityType<T>(href, name);
entity.setDescription(description);
entity.setTasksInProgress(tasksInProgress);
entity.setId(id);
entity.setType(type);
entity.setLinks(links);
return entity;
}
/** /**
* @see ResourceType#getHref() * @see ResourceType#getHref()
*/ */
@ -156,17 +135,20 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
} }
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Description") @XmlElement(name = "Description")
private String description; private String description;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "TasksInProgress") @XmlElement(name = "TasksInProgress")
private TasksInProgress tasksInProgress; private TasksInProgress tasksInProgress;
@XmlAttribute @XmlAttribute
private String id; private String id;
@XmlAttribute(required = true) @XmlAttribute(required = true)
private String name; private String name;
protected EntityType(URI href, String name) { public EntityType(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name) {
super(href); super(href, type, links);
this.description = description;
this.tasksInProgress = tasksInProgress;
this.id = id;
this.name = name; this.name = name;
} }
@ -181,10 +163,6 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
return description; return description;
} }
public void setDescription(String description) {
this.description = description;
}
/** /**
* A list of queued, running, or recently completed tasks associated with this entity. * A list of queued, running, or recently completed tasks associated with this entity.
*/ */
@ -192,13 +170,9 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
return tasksInProgress; return tasksInProgress;
} }
public void setTasksInProgress(TasksInProgress tasksInProgress) {
this.tasksInProgress = tasksInProgress;
}
/** /**
* The resource identifier, expressed in URN format. * The resource identifier, expressed in URN format.
* * <p/>
* The value of this attribute uniquely identifies the resource, persists for the life of the * The value of this attribute uniquely identifies the resource, persists for the life of the
* resource, and is never reused. * resource, and is never reused.
*/ */
@ -206,10 +180,6 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
return id; return id;
} }
public void setId(String id) {
this.id = id;
}
/** /**
* Contains the name of the the entity. * Contains the name of the the entity.
*/ */
@ -217,10 +187,6 @@ public class EntityType<T extends EntityType<T>> extends ResourceType<T> {
return name; return name;
} }
public void setName(String name) {
this.name = name;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,10 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -33,15 +30,14 @@ import com.google.common.base.Objects;
/** /**
* The standard error message type used in the vCloud REST API. * The standard error message type used in the vCloud REST API.
* * <p/>
* <pre> * <pre>
* &lt;xs:complexType name="ErrorType"&gt; * &lt;xs:complexType name="ErrorType"&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Error") @XmlRootElement(name = "Error")
@XmlAccessorType(XmlAccessType.FIELD)
public class Error { public class Error {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.ERROR; public static final String MEDIA_TYPE = VCloudDirectorMediaType.ERROR;
@ -103,10 +99,7 @@ public class Error {
} }
public Error build() { public Error build() {
Error error = new Error(message, majorErrorCode, minorErrorCode); return new Error(message, majorErrorCode, minorErrorCode, vendorSpecificErrorCode, stackTrace);
error.setVendorSpecificErrorCode(vendorSpecificErrorCode);
error.setStackTrace(stackTrace);
return error;
} }
public Builder fromError(Error in) { public Builder fromError(Error in) {
@ -129,10 +122,12 @@ public class Error {
@XmlAttribute @XmlAttribute
private String stackTrace; private String stackTrace;
private Error(String message, Integer majorErrorCode, String minorErrorCode) { private Error(String message, Integer majorErrorCode, String minorErrorCode, String vendorSpecificErrorCode, String stackTrace) {
this.message = checkNotNull(message, "message"); this.message = checkNotNull(message, "message");
this.majorErrorCode = checkNotNull(majorErrorCode, "majorErrorCode"); this.majorErrorCode = checkNotNull(majorErrorCode, "majorErrorCode");
this.minorErrorCode = checkNotNull(minorErrorCode, "minorErrorCode"); this.minorErrorCode = checkNotNull(minorErrorCode, "minorErrorCode");
this.vendorSpecificErrorCode = vendorSpecificErrorCode;
this.stackTrace = stackTrace;
} }
private Error() { private Error() {
@ -155,7 +150,7 @@ public class Error {
/** /**
* Specific API error code. * Specific API error code.
* * <p/>
* For example - can indicate that vApp power on failed by some reason. * For example - can indicate that vApp power on failed by some reason.
*/ */
public String getMinorErrorCode() { public String getMinorErrorCode() {
@ -170,10 +165,6 @@ public class Error {
return vendorSpecificErrorCode; return vendorSpecificErrorCode;
} }
public void setVendorSpecificErrorCode(String vendorSpecificErrorCode) {
this.vendorSpecificErrorCode = vendorSpecificErrorCode;
}
/** /**
* The stack trace of the exception which when examined might make problem * The stack trace of the exception which when examined might make problem
* diagnostics easier. * diagnostics easier.
@ -182,10 +173,6 @@ public class Error {
return stackTrace; return stackTrace;
} }
public void setStackTrace(String stackTrace) {
this.stackTrace = stackTrace;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -24,9 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -38,14 +35,13 @@ import com.google.common.collect.Sets;
/** /**
*
* Represents a file to be transferred (uploaded or downloaded). * Represents a file to be transferred (uploaded or downloaded).
* * <p/>
* * <p/>
* <p>Java class for File complex type. * <p>Java class for File complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="File"> * &lt;complexType name="File">
* &lt;complexContent> * &lt;complexContent>
@ -58,20 +54,15 @@ import com.google.common.collect.Sets;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "File") @XmlType(name = "File")
public class File public class File extends EntityType<File> {
extends EntityType<File>
{
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
@Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().fromFile(this); return new Builder().fromFile(this);
} }
@ -106,16 +97,10 @@ public class File
return this; return this;
} }
public File build() { public File build() {
File file = new File(); return new File(href, type, links, description, tasksInProgress, id, name, size, bytesTransferred, checksum);
file.setSize(size);
file.setBytesTransferred(bytesTransferred);
file.setChecksum(checksum);
return file;
} }
/** /**
* @see EntityType#getId() * @see EntityType#getId()
*/ */
@ -153,7 +138,7 @@ public class File
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder links(Set<Link> links) { public Builder links(Set<Link> links) {
@ -162,7 +147,7 @@ public class File
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder link(Link link) { public Builder link(Link link) {
@ -175,6 +160,7 @@ public class File
public Builder fromEntityType(EntityType<File> in) { public Builder fromEntityType(EntityType<File> in) {
return Builder.class.cast(super.fromEntityType(in)); return Builder.class.cast(super.fromEntityType(in));
} }
public Builder fromFile(File in) { public Builder fromFile(File in) {
return fromEntityType(in) return fromEntityType(in)
.size(in.getSize()) .size(in.getSize())
@ -183,12 +169,19 @@ public class File
} }
} }
public File(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
String name, Long size, Long bytesTransferred, String checksum) {
super(href, type, links, description, tasksInProgress, id, name);
this.size = size;
this.bytesTransferred = bytesTransferred;
this.checksum = checksum;
}
private File() { private File() {
// For JAXB and builder use // For JAXB and builder use
} }
@XmlAttribute @XmlAttribute
protected Long size; protected Long size;
@XmlAttribute @XmlAttribute
@ -201,75 +194,33 @@ public class File
/** /**
* Gets the value of the size property. * Gets the value of the size property.
* *
* @return * @return possible object is
* possible object is
* {@link Long } * {@link Long }
*
*/ */
public Long getSize() { public Long getSize() {
return size; return size;
} }
/**
* Sets the value of the size property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setSize(Long value) {
this.size = value;
}
/** /**
* Gets the value of the bytesTransferred property. * Gets the value of the bytesTransferred property.
* *
* @return * @return possible object is
* possible object is
* {@link Long } * {@link Long }
*
*/ */
public Long getBytesTransferred() { public Long getBytesTransferred() {
return bytesTransferred; return bytesTransferred;
} }
/**
* Sets the value of the bytesTransferred property.
*
* @param value
* allowed object is
* {@link Long }
*
*/
public void setBytesTransferred(Long value) {
this.bytesTransferred = value;
}
/** /**
* Gets the value of the checksum property. * Gets the value of the checksum property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getChecksum() { public String getChecksum() {
return checksum; return checksum;
} }
/**
* Sets the value of the checksum property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setChecksum(String value) {
this.checksum = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -21,27 +21,24 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import java.util.ArrayList; import java.util.Set;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/** /**
*
* Represents a list of files to be transferred (uploaded * Represents a list of files to be transferred (uploaded
* or downloaded). * or downloaded).
* * <p/>
* * <p/>
* <p>Java class for FilesList complex type. * <p>Java class for FilesList complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="FilesList"> * &lt;complexType name="FilesList">
* &lt;complexContent> * &lt;complexContent>
@ -54,10 +51,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "FilesList", propOrder = { @XmlType(name = "FilesList", propOrder = {
"files" "files"
}) })
@ -72,13 +66,13 @@ public class FilesList {
public static class Builder { public static class Builder {
private List<File> files; private Set<File> files = Sets.newLinkedHashSet();
/** /**
* @see FilesList#getFiles() * @see FilesList#getFiles()
*/ */
public Builder file(List<File> file) { public Builder files(Set<File> files) {
this.files = file; this.files = files;
return this; return this;
} }
@ -90,7 +84,7 @@ public class FilesList {
public Builder fromFilesList(FilesList in) { public Builder fromFilesList(FilesList in) {
return file(in.getFiles()); return files(in.getFiles());
} }
} }
@ -98,40 +92,18 @@ public class FilesList {
// For JAXB and builder use // For JAXB and builder use
} }
private FilesList(List<File> files) { private FilesList(Set<File> files) {
this.files = files; this.files = ImmutableSet.copyOf(files);
} }
@XmlElement(name = "File", required = true) @XmlElement(name = "File", required = true)
protected List<File> files; protected Set<File> files = Sets.newLinkedHashSet();
/** /**
* Gets the value of the file property. * Gets the value of the file property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the file property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getFile().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link FileType }
*
*
*/ */
public List<File> getFiles() { public Set<File> getFiles() {
if (files == null) {
files = new ArrayList<File>();
}
return this.files; return this.files;
} }

View File

@ -20,13 +20,11 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.Collections;
import java.util.List; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -37,6 +35,8 @@ import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/** /**
@ -77,7 +77,6 @@ import com.google.common.base.Objects;
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "GuestCustomizationSection") @XmlRootElement(name = "GuestCustomizationSection")
@XmlType(propOrder = { @XmlType(propOrder = {
"enabled", "enabled",
@ -94,8 +93,7 @@ import com.google.common.base.Objects;
"resetPasswordRequired", "resetPasswordRequired",
"customizationScript", "customizationScript",
"computerName", "computerName",
"link", "links"
"any"
}) })
public class GuestCustomizationSection extends SectionType<GuestCustomizationSection> { public class GuestCustomizationSection extends SectionType<GuestCustomizationSection> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -108,7 +106,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
} }
public static class Builder extends SectionType.Builder<GuestCustomizationSection> { public static class Builder extends SectionType.Builder<GuestCustomizationSection> {
private Boolean enabled; private Boolean enabled;
private Boolean changeSid; private Boolean changeSid;
private String virtualMachineId; private String virtualMachineId;
@ -123,8 +120,7 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
private Boolean resetPasswordRequired; private Boolean resetPasswordRequired;
private String customizationScript; private String customizationScript;
private String computerName; private String computerName;
private List<Link> link; private Set<Link> links = Sets.newLinkedHashSet();
private List<Object> any;
private URI href; private URI href;
private String type; private String type;
@ -243,16 +239,8 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
/** /**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getLink() * @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getLink()
*/ */
public Builder link(List<Link> link) { public Builder links(Set<Link> links) {
this.link = link; this.links = checkNotNull(links, "links");
return this;
}
/**
* @see org.jclouds.vcloud.director.v1_5.domain.GuestCustomizationSection#getAny()
*/
public Builder any(List<Object> any) {
this.any = any;
return this; return this;
} }
@ -274,23 +262,11 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
public GuestCustomizationSection build() { public GuestCustomizationSection build() {
GuestCustomizationSection guestCustomizationSection = new GuestCustomizationSection(info, resetPasswordRequired, link, any); return new GuestCustomizationSection(info, required, enabled, changeSid, virtualMachineId,
guestCustomizationSection.setEnabled(enabled); joinDomainEnabled, useOrgSettings, domainName, domainUserName,
guestCustomizationSection.setChangeSid(changeSid); domainUserPassword, adminPasswordEnabled, adminPasswordAuto,
guestCustomizationSection.setVirtualMachineId(virtualMachineId); adminPassword, resetPasswordRequired, customizationScript,
guestCustomizationSection.setJoinDomainEnabled(joinDomainEnabled); computerName, links, href, type);
guestCustomizationSection.setUseOrgSettings(useOrgSettings);
guestCustomizationSection.setDomainName(domainName);
guestCustomizationSection.setDomainUserName(domainUserName);
guestCustomizationSection.setDomainUserPassword(domainUserPassword);
guestCustomizationSection.setAdminPasswordEnabled(adminPasswordEnabled);
guestCustomizationSection.setAdminPasswordAuto(adminPasswordAuto);
guestCustomizationSection.setAdminPassword(adminPassword);
guestCustomizationSection.setCustomizationScript(customizationScript);
guestCustomizationSection.setComputerName(computerName);
guestCustomizationSection.setHref(href);
guestCustomizationSection.setType(type);
return guestCustomizationSection;
} }
public Builder fromGuestCustomizationSection(GuestCustomizationSection in) { public Builder fromGuestCustomizationSection(GuestCustomizationSection in) {
@ -309,8 +285,7 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
.resetPasswordRequired(in.isResetPasswordRequired()) .resetPasswordRequired(in.isResetPasswordRequired())
.customizationScript(in.getCustomizationScript()) .customizationScript(in.getCustomizationScript())
.computerName(in.getComputerName()) .computerName(in.getComputerName())
.link(in.getLink()) .links(in.getLink())
.any(in.getAny())
.href(in.getHref()) .href(in.getHref())
.type(in.getType()); .type(in.getType());
} }
@ -331,58 +306,80 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return Builder.class.cast(super.info(info)); return Builder.class.cast(super.info(info));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
}
private GuestCustomizationSection(@Nullable String info, @Nullable Boolean required, Boolean enabled, Boolean changeSid, String virtualMachineId,
Boolean joinDomainEnabled, Boolean useOrgSettings, String domainName, String domainUserName,
String domainUserPassword, Boolean adminPasswordEnabled, Boolean adminPasswordAuto,
String adminPassword, Boolean resetPasswordRequired, String customizationScript,
String computerName, Set<Link> links, URI href, String type) {
super(info, required);
this.enabled = enabled;
this.changeSid = changeSid;
this.virtualMachineId = virtualMachineId;
this.joinDomainEnabled = joinDomainEnabled;
this.useOrgSettings = useOrgSettings;
this.domainName = domainName;
this.domainUserName = domainUserName;
this.domainUserPassword = domainUserPassword;
this.adminPasswordEnabled = adminPasswordEnabled;
this.adminPasswordAuto = adminPasswordAuto;
this.adminPassword = adminPassword;
this.resetPasswordRequired = resetPasswordRequired;
this.customizationScript = customizationScript;
this.computerName = computerName;
this.links = ImmutableSet.copyOf(links);
this.href = href;
this.type = type;
} }
private GuestCustomizationSection() { private GuestCustomizationSection() {
// For JAXB and builder use // For JAXB and builder use
super(null);
}
private GuestCustomizationSection(@Nullable String info, Boolean resetPasswordRequired, List<Link> link, List<Object> any) {
super(info);
this.resetPasswordRequired = resetPasswordRequired;
this.link = link;
this.any = any;
} }
@XmlElement(name = "Enabled") @XmlElement(name = "Enabled")
protected Boolean enabled; private Boolean enabled;
@XmlElement(name = "ChangeSid") @XmlElement(name = "ChangeSid")
protected Boolean changeSid; private Boolean changeSid;
@XmlElement(name = "VirtualMachineId") @XmlElement(name = "VirtualMachineId")
protected String virtualMachineId; private String virtualMachineId;
@XmlElement(name = "JoinDomainEnabled") @XmlElement(name = "JoinDomainEnabled")
protected Boolean joinDomainEnabled; private Boolean joinDomainEnabled;
@XmlElement(name = "UseOrgSettings") @XmlElement(name = "UseOrgSettings")
protected Boolean useOrgSettings; private Boolean useOrgSettings;
@XmlElement(name = "DomainName") @XmlElement(name = "DomainName")
protected String domainName; private String domainName;
@XmlElement(name = "DomainUserName") @XmlElement(name = "DomainUserName")
protected String domainUserName; private String domainUserName;
@XmlElement(name = "DomainUserPassword") @XmlElement(name = "DomainUserPassword")
protected String domainUserPassword; private String domainUserPassword;
@XmlElement(name = "AdminPasswordEnabled") @XmlElement(name = "AdminPasswordEnabled")
protected Boolean adminPasswordEnabled; private Boolean adminPasswordEnabled;
@XmlElement(name = "AdminPasswordAuto") @XmlElement(name = "AdminPasswordAuto")
protected Boolean adminPasswordAuto; private Boolean adminPasswordAuto;
@XmlElement(name = "AdminPassword") @XmlElement(name = "AdminPassword")
protected String adminPassword; private String adminPassword;
@XmlElement(name = "ResetPasswordRequired") @XmlElement(name = "ResetPasswordRequired")
protected Boolean resetPasswordRequired; private Boolean resetPasswordRequired;
@XmlElement(name = "CustomizationScript") @XmlElement(name = "CustomizationScript")
protected String customizationScript; private String customizationScript;
@XmlElement(name = "ComputerName") @XmlElement(name = "ComputerName")
protected String computerName; private String computerName;
@XmlElement(name = "Link") @XmlElement(name = "Link")
protected List<Link> link; private Set<Link> links = Sets.newLinkedHashSet();
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute @XmlAttribute
@XmlSchemaType(name = "anyURI") @XmlSchemaType(name = "anyURI")
protected URI href; private URI href;
@XmlAttribute @XmlAttribute
protected String type; private String type;
/** /**
* Gets the value of the enabled property. * Gets the value of the enabled property.
@ -394,16 +391,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return enabled; return enabled;
} }
/**
* Sets the value of the enabled property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setEnabled(Boolean value) {
this.enabled = value;
}
/** /**
* Gets the value of the changeSid property. * Gets the value of the changeSid property.
* *
@ -414,16 +401,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return changeSid; return changeSid;
} }
/**
* Sets the value of the changeSid property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setChangeSid(Boolean value) {
this.changeSid = value;
}
/** /**
* Gets the value of the virtualMachineId property. * Gets the value of the virtualMachineId property.
* *
@ -434,16 +411,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return virtualMachineId; return virtualMachineId;
} }
/**
* Sets the value of the virtualMachineId property.
*
* @param value allowed object is
* {@link String }
*/
public void setVirtualMachineId(String value) {
this.virtualMachineId = value;
}
/** /**
* Gets the value of the joinDomainEnabled property. * Gets the value of the joinDomainEnabled property.
* *
@ -454,16 +421,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return joinDomainEnabled; return joinDomainEnabled;
} }
/**
* Sets the value of the joinDomainEnabled property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setJoinDomainEnabled(Boolean value) {
this.joinDomainEnabled = value;
}
/** /**
* Gets the value of the useOrgSettings property. * Gets the value of the useOrgSettings property.
* *
@ -474,15 +431,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return useOrgSettings; return useOrgSettings;
} }
/**
* Sets the value of the useOrgSettings property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setUseOrgSettings(Boolean value) {
this.useOrgSettings = value;
}
/** /**
* Gets the value of the domainName property. * Gets the value of the domainName property.
@ -494,16 +442,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return domainName; return domainName;
} }
/**
* Sets the value of the domainName property.
*
* @param value allowed object is
* {@link String }
*/
public void setDomainName(String value) {
this.domainName = value;
}
/** /**
* Gets the value of the domainUserName property. * Gets the value of the domainUserName property.
* *
@ -514,16 +452,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return domainUserName; return domainUserName;
} }
/**
* Sets the value of the domainUserName property.
*
* @param value allowed object is
* {@link String }
*/
public void setDomainUserName(String value) {
this.domainUserName = value;
}
/** /**
* Gets the value of the domainUserPassword property. * Gets the value of the domainUserPassword property.
* *
@ -534,16 +462,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return domainUserPassword; return domainUserPassword;
} }
/**
* Sets the value of the domainUserPassword property.
*
* @param value allowed object is
* {@link String }
*/
public void setDomainUserPassword(String value) {
this.domainUserPassword = value;
}
/** /**
* Gets the value of the adminPasswordEnabled property. * Gets the value of the adminPasswordEnabled property.
* *
@ -554,16 +472,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return adminPasswordEnabled; return adminPasswordEnabled;
} }
/**
* Sets the value of the adminPasswordEnabled property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setAdminPasswordEnabled(Boolean value) {
this.adminPasswordEnabled = value;
}
/** /**
* Gets the value of the adminPasswordAuto property. * Gets the value of the adminPasswordAuto property.
* *
@ -574,16 +482,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return adminPasswordAuto; return adminPasswordAuto;
} }
/**
* Sets the value of the adminPasswordAuto property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setAdminPasswordAuto(Boolean value) {
this.adminPasswordAuto = value;
}
/** /**
* Gets the value of the adminPassword property. * Gets the value of the adminPassword property.
* *
@ -594,16 +492,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return adminPassword; return adminPassword;
} }
/**
* Sets the value of the adminPassword property.
*
* @param value allowed object is
* {@link String }
*/
public void setAdminPassword(String value) {
this.adminPassword = value;
}
/** /**
* Gets the value of the resetPasswordRequired property. * Gets the value of the resetPasswordRequired property.
* *
@ -614,16 +502,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return resetPasswordRequired; return resetPasswordRequired;
} }
/**
* Sets the value of the resetPasswordRequired property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setResetPasswordRequired(Boolean value) {
this.resetPasswordRequired = value;
}
/** /**
* Gets the value of the customizationScript property. * Gets the value of the customizationScript property.
* *
@ -634,16 +512,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return customizationScript; return customizationScript;
} }
/**
* Sets the value of the customizationScript property.
*
* @param value allowed object is
* {@link String }
*/
public void setCustomizationScript(String value) {
this.customizationScript = value;
}
/** /**
* Gets the value of the computerName property. * Gets the value of the computerName property.
* *
@ -654,69 +522,14 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return computerName; return computerName;
} }
/**
* Sets the value of the computerName property.
*
* @param value allowed object is
* {@link String }
*/
public void setComputerName(String value) {
this.computerName = value;
}
/** /**
* Gets the value of the link property. * Gets the value of the link property.
* <p/> * <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list * Objects of the following type(s) are allowed in the list
* {@link Link } * {@link Link }
*/ */
public List<Link> getLink() { public Set<Link> getLink() {
if (link == null) { return Collections.unmodifiableSet(this.links);
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the any property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link org.w3c.dom.Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
} }
/** /**
@ -726,13 +539,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return href; return href;
} }
/**
* Sets the value of the href property.
*/
public void setHref(URI value) {
this.href = value;
}
/** /**
* Gets the value of the type property. * Gets the value of the type property.
* *
@ -743,16 +549,6 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
return type; return type;
} }
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)
@ -760,7 +556,8 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
if (o == null || getClass() != o.getClass()) if (o == null || getClass() != o.getClass())
return false; return false;
GuestCustomizationSection that = GuestCustomizationSection.class.cast(o); GuestCustomizationSection that = GuestCustomizationSection.class.cast(o);
return equal(enabled, that.enabled) && return super.equals(that) &&
equal(enabled, that.enabled) &&
equal(changeSid, that.changeSid) && equal(changeSid, that.changeSid) &&
equal(virtualMachineId, that.virtualMachineId) && equal(virtualMachineId, that.virtualMachineId) &&
equal(joinDomainEnabled, that.joinDomainEnabled) && equal(joinDomainEnabled, that.joinDomainEnabled) &&
@ -774,15 +571,15 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
equal(resetPasswordRequired, that.resetPasswordRequired) && equal(resetPasswordRequired, that.resetPasswordRequired) &&
equal(customizationScript, that.customizationScript) && equal(customizationScript, that.customizationScript) &&
equal(computerName, that.computerName) && equal(computerName, that.computerName) &&
equal(link, that.link) && equal(links, that.links) &&
equal(any, that.any) &&
equal(href, that.href) && equal(href, that.href) &&
equal(type, that.type); equal(type, that.type);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(enabled, return Objects.hashCode(super.hashCode(),
enabled,
changeSid, changeSid,
virtualMachineId, virtualMachineId,
joinDomainEnabled, joinDomainEnabled,
@ -796,15 +593,14 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
resetPasswordRequired, resetPasswordRequired,
customizationScript, customizationScript,
computerName, computerName,
link, links,
any,
href, href,
type); type);
} }
@Override @Override
public String toString() { public Objects.ToStringHelper string() {
return Objects.toStringHelper("") return super.string()
.add("enabled", enabled) .add("enabled", enabled)
.add("changeSid", changeSid) .add("changeSid", changeSid)
.add("virtualMachineId", virtualMachineId) .add("virtualMachineId", virtualMachineId)
@ -819,10 +615,9 @@ public class GuestCustomizationSection extends SectionType<GuestCustomizationSec
.add("resetPasswordRequired", resetPasswordRequired) .add("resetPasswordRequired", resetPasswordRequired)
.add("customizationScript", customizationScript) .add("customizationScript", customizationScript)
.add("computerName", computerName) .add("computerName", computerName)
.add("link", link) .add("links", links)
.add("any", any)
.add("href", href) .add("href", href)
.add("type", type).toString(); .add("type", type);
} }
} }

View File

@ -20,7 +20,6 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
/** /**
* Parameters for Instantiating a vApp * Parameters for Instantiating a vApp
* *
@ -43,17 +42,7 @@ public class InstantiateVAppParams
extends InstantiateVAppParamsType.Builder<InstantiateVAppParams> { extends InstantiateVAppParamsType.Builder<InstantiateVAppParams> {
public InstantiateVAppParams build() { public InstantiateVAppParams build() {
InstantiateVAppParams instantiateVAppParams = new InstantiateVAppParams(); return new InstantiateVAppParams(description, name, vAppParent, instantiationParams, deploy, powerOn, source, isSourceDelete, linkedClone);
instantiateVAppParams.setSource(source);
instantiateVAppParams.setIsSourceDelete(isSourceDelete);
instantiateVAppParams.setLinkedClone(linkedClone);
instantiateVAppParams.setVAppParent(vAppParent);
instantiateVAppParams.setInstantiationParams(instantiationParams);
instantiateVAppParams.setDeploy(deploy);
instantiateVAppParams.setPowerOn(powerOn);
instantiateVAppParams.setDescription(description);
instantiateVAppParams.setName(name);
return instantiateVAppParams;
} }
/** /**
@ -65,7 +54,7 @@ public class InstantiateVAppParams
} }
/** /**
* @see InstantiateVAppParams#getIsSourceDelete() * @see InstantiateVAppParams#isSourceDelete()
*/ */
public Builder isSourceDelete(Boolean isSourceDelete) { public Builder isSourceDelete(Boolean isSourceDelete) {
super.isSourceDelete(isSourceDelete); super.isSourceDelete(isSourceDelete);
@ -73,7 +62,7 @@ public class InstantiateVAppParams
} }
/** /**
* @see InstantiateVAppParams#getLinkedClone() * @see InstantiateVAppParams#isLinkedClone()
*/ */
public Builder linkedClone(Boolean linkedClone) { public Builder linkedClone(Boolean linkedClone) {
super.linkedClone(linkedClone); super.linkedClone(linkedClone);
@ -113,7 +102,7 @@ public class InstantiateVAppParams
} }
/** /**
* @see VAppCreationParamsType#getDeploy() * @see VAppCreationParamsType#isDeploy()
*/ */
public Builder deploy(Boolean deploy) { public Builder deploy(Boolean deploy) {
super.deploy(deploy); super.deploy(deploy);
@ -121,7 +110,7 @@ public class InstantiateVAppParams
} }
/** /**
* @see VAppCreationParamsType#getPowerOn() * @see VAppCreationParamsType#isPowerOn()
*/ */
public Builder powerOn(Boolean powerOn) { public Builder powerOn(Boolean powerOn) {
super.powerOn(powerOn); super.powerOn(powerOn);
@ -136,11 +125,17 @@ public class InstantiateVAppParams
InstantiateVAppParamsType<InstantiateVAppParams> in) { InstantiateVAppParamsType<InstantiateVAppParams> in) {
return Builder.class.cast(super.fromVAppCreationParamsType(in)); return Builder.class.cast(super.fromVAppCreationParamsType(in));
} }
public Builder fromInstantiateVAppParams(InstantiateVAppParams in) { public Builder fromInstantiateVAppParams(InstantiateVAppParams in) {
return fromInstantiateVAppParamsType(in); return fromInstantiateVAppParamsType(in);
} }
} }
private InstantiateVAppParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Reference source, Boolean sourceDelete, Boolean linkedClone) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn, source, sourceDelete, linkedClone);
}
protected InstantiateVAppParams() { protected InstantiateVAppParams() {
// For JAXB and builder use // For JAXB and builder use
} }

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso;
@ -32,14 +30,13 @@ import com.google.common.base.Objects;
/** /**
*
* Represents vApp instantiation parameters. * Represents vApp instantiation parameters.
* * <p/>
* * <p/>
* <p>Java class for InstantiateVAppParams complex type. * <p>Java class for InstantiateVAppParams complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="InstantiateVAppParams"> * &lt;complexType name="InstantiateVAppParams">
* &lt;complexContent> * &lt;complexContent>
@ -54,10 +51,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InstantiateVAppParams", propOrder = { @XmlType(name = "InstantiateVAppParams", propOrder = {
"source", "source",
"isSourceDelete" "isSourceDelete"
@ -93,7 +87,7 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
} }
/** /**
* @see InstantiateVAppParamsType#getIsSourceDelete() * @see InstantiateVAppParamsType#isSourceDelete()
*/ */
public Builder<T> isSourceDelete(Boolean isSourceDelete) { public Builder<T> isSourceDelete(Boolean isSourceDelete) {
this.isSourceDelete = isSourceDelete; this.isSourceDelete = isSourceDelete;
@ -101,26 +95,15 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
} }
/** /**
* @see InstantiateVAppParamsType#getLinkedClone() * @see InstantiateVAppParamsType#isLinkedClone()
*/ */
public Builder<T> linkedClone(Boolean linkedClone) { public Builder<T> linkedClone(Boolean linkedClone) {
this.linkedClone = linkedClone; this.linkedClone = linkedClone;
return this; return this;
} }
public InstantiateVAppParamsType<T> build() { public InstantiateVAppParamsType<T> build() {
InstantiateVAppParamsType<T> instantiateVAppParams = new InstantiateVAppParamsType<T>(); return new InstantiateVAppParamsType<T>(description, name, vAppParent, instantiationParams, deploy, powerOn, source, isSourceDelete, linkedClone);
instantiateVAppParams.setSource(source);
instantiateVAppParams.setIsSourceDelete(isSourceDelete);
instantiateVAppParams.setLinkedClone(linkedClone);
instantiateVAppParams.setVAppParent(vAppParent);
instantiateVAppParams.setInstantiationParams(instantiationParams);
instantiateVAppParams.setDeploy(deploy);
instantiateVAppParams.setPowerOn(powerOn);
instantiateVAppParams.setDescription(description);
instantiateVAppParams.setName(name);
return instantiateVAppParams;
} }
/** /**
@ -156,7 +139,7 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
} }
/** /**
* @see VAppCreationParamsType#getDeploy() * @see VAppCreationParamsType#isDeploy()
*/ */
public Builder<T> deploy(Boolean deploy) { public Builder<T> deploy(Boolean deploy) {
super.deploy(deploy); super.deploy(deploy);
@ -164,7 +147,7 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
} }
/** /**
* @see VAppCreationParamsType#getPowerOn() * @see VAppCreationParamsType#isPowerOn()
*/ */
public Builder<T> powerOn(Boolean powerOn) { public Builder<T> powerOn(Boolean powerOn) {
super.powerOn(powerOn); super.powerOn(powerOn);
@ -179,6 +162,7 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
public Builder<T> fromVAppCreationParamsType(VAppCreationParamsType<T> in) { public Builder<T> fromVAppCreationParamsType(VAppCreationParamsType<T> in) {
return Builder.class.cast(super.fromVAppCreationParamsType(in)); return Builder.class.cast(super.fromVAppCreationParamsType(in));
} }
public Builder<T> fromInstantiateVAppParamsType(InstantiateVAppParamsType<T> in) { public Builder<T> fromInstantiateVAppParamsType(InstantiateVAppParamsType<T> in) {
return fromVAppCreationParamsType(in) return fromVAppCreationParamsType(in)
.source(in.getSource()) .source(in.getSource())
@ -187,12 +171,19 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
} }
} }
public InstantiateVAppParamsType(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Reference source, Boolean sourceDelete, Boolean linkedClone) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn);
this.source = source;
isSourceDelete = sourceDelete;
this.linkedClone = linkedClone;
}
protected InstantiateVAppParamsType() { protected InstantiateVAppParamsType() {
// For JAXB and builder use // For JAXB and builder use
} }
@XmlElement(name = "Source", required = true) @XmlElement(name = "Source", required = true)
protected Reference source; protected Reference source;
@XmlElement(name = "IsSourceDelete") @XmlElement(name = "IsSourceDelete")
@ -203,75 +194,33 @@ public class InstantiateVAppParamsType<T extends InstantiateVAppParamsType<T>>
/** /**
* Gets the value of the source property. * Gets the value of the source property.
* *
* @return * @return possible object is
* possible object is
* {@link Reference } * {@link Reference }
*
*/ */
public Reference getSource() { public Reference getSource() {
return source; return source;
} }
/**
* Sets the value of the source property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setSource(Reference value) {
this.source = value;
}
/** /**
* Gets the value of the isSourceDelete property. * Gets the value of the isSourceDelete property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isSourceDelete() { public Boolean isSourceDelete() {
return isSourceDelete; return isSourceDelete;
} }
/**
* Sets the value of the isSourceDelete property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsSourceDelete(Boolean value) {
this.isSourceDelete = value;
}
/** /**
* Gets the value of the linkedClone property. * Gets the value of the linkedClone property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isLinkedClone() { public Boolean isLinkedClone() {
return linkedClone; return linkedClone;
} }
/**
* Sets the value of the linkedClone property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setLinkedClone(Boolean value) {
this.linkedClone = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -30,14 +28,13 @@ import com.google.common.base.Objects;
/** /**
*
* Represents vApp template instantiation parameters. * Represents vApp template instantiation parameters.
* * <p/>
* * <p/>
* <p>Java class for InstantiateVAppTemplateParams complex type. * <p>Java class for InstantiateVAppTemplateParams complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="InstantiateVAppTemplateParams"> * &lt;complexType name="InstantiateVAppTemplateParams">
* &lt;complexContent> * &lt;complexContent>
@ -50,10 +47,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InstantiateVAppTemplateParams", propOrder = { @XmlType(name = "InstantiateVAppTemplateParams", propOrder = {
"allEULAsAccepted" "allEULAsAccepted"
}) })
@ -74,7 +68,7 @@ public class InstantiateVAppTemplateParams
private Boolean allEULAsAccepted; private Boolean allEULAsAccepted;
/** /**
* @see InstantiateVAppTemplateParamsType#getAllEULAsAccepted() * @see InstantiateVAppTemplateParams#isAllEULAsAccepted()
*/ */
public Builder allEULAsAccepted(Boolean allEULAsAccepted) { public Builder allEULAsAccepted(Boolean allEULAsAccepted) {
this.allEULAsAccepted = allEULAsAccepted; this.allEULAsAccepted = allEULAsAccepted;
@ -82,9 +76,7 @@ public class InstantiateVAppTemplateParams
} }
public InstantiateVAppTemplateParams build() { public InstantiateVAppTemplateParams build() {
InstantiateVAppTemplateParams instantiateVAppTemplateParams = new InstantiateVAppTemplateParams(); return new InstantiateVAppTemplateParams(description, name, vAppParent, instantiationParams, deploy, powerOn, source, isSourceDelete, linkedClone, allEULAsAccepted);
instantiateVAppTemplateParams.setAllEULAsAccepted(allEULAsAccepted);
return instantiateVAppTemplateParams;
} }
/** /**
@ -120,7 +112,7 @@ public class InstantiateVAppTemplateParams
} }
/** /**
* @see VAppCreationParamsType#getDeploy() * @see VAppCreationParamsType#isDeploy()
*/ */
public Builder deploy(Boolean deploy) { public Builder deploy(Boolean deploy) {
super.deploy(deploy); super.deploy(deploy);
@ -128,7 +120,7 @@ public class InstantiateVAppTemplateParams
} }
/** /**
* @see VAppCreationParamsType#getPowerOn() * @see VAppCreationParamsType#isPowerOn()
*/ */
public Builder powerOn(Boolean powerOn) { public Builder powerOn(Boolean powerOn) {
super.powerOn(powerOn); super.powerOn(powerOn);
@ -149,45 +141,34 @@ public class InstantiateVAppTemplateParams
} }
} }
public InstantiateVAppTemplateParams(String description, String name, Reference vAppParent, InstantiationParams instantiationParams,
Boolean deploy, Boolean powerOn, Reference source, Boolean sourceDelete, Boolean linkedClone, Boolean allEULAsAccepted) {
super(description, name, vAppParent, instantiationParams, deploy, powerOn, source, sourceDelete, linkedClone);
this.allEULAsAccepted = allEULAsAccepted;
}
private InstantiateVAppTemplateParams() { private InstantiateVAppTemplateParams() {
// For JAXB and builder use // For JAXB and builder use
} }
@XmlElement(name = "AllEULAsAccepted") @XmlElement(name = "AllEULAsAccepted")
protected Boolean allEULAsAccepted; protected Boolean allEULAsAccepted;
/** /**
*
* Used to confirm acceptance of all EULAs in a * Used to confirm acceptance of all EULAs in a
* vApp template. Instantiation fails if this * vApp template. Instantiation fails if this
* element is missing, empty, or set to false * element is missing, empty, or set to false
* and one or more EulaSection elements are * and one or more EulaSection elements are
* present. * present.
* *
* * @return possible object is
* @return
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isAllEULAsAccepted() { public Boolean isAllEULAsAccepted() {
return allEULAsAccepted; return allEULAsAccepted;
} }
/**
* Sets the value of the allEULAsAccepted property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setAllEULAsAccepted(Boolean value) {
this.allEULAsAccepted = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,13 +20,12 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Set;
import javax.xml.bind.JAXBElement; import javax.xml.bind.JAXBElement;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -38,17 +37,17 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection; import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.Sets;
/** /**
*
* Represents a list of ovf:Section to configure for instantiating a VApp. * Represents a list of ovf:Section to configure for instantiating a VApp.
* * <p/>
* * <p/>
* <p>Java class for InstantiationParams complex type. * <p>Java class for InstantiationParams complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="InstantiationParams"> * &lt;complexType name="InstantiationParams">
* &lt;complexContent> * &lt;complexContent>
@ -61,10 +60,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "InstantiationParams", propOrder = { @XmlType(name = "InstantiationParams", propOrder = {
"section" "section"
}) })
@ -78,14 +74,13 @@ public class InstantiationParams {
} }
public static class Builder { public static class Builder {
private Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
private List<JAXBElement<? extends SectionType<?>>> sections;
/** /**
* @see InstantiationParams#getSections() * @see InstantiationParams#getSections()
*/ */
public Builder sections(List<JAXBElement<? extends SectionType<?>>> sections) { public Builder sections(Set<? extends SectionType<?>> sections) {
this.sections = sections; this.sections = checkNotNull(sections, "sections");
return this; return this;
} }
@ -105,34 +100,33 @@ public class InstantiationParams {
// For JAXB and builder use // For JAXB and builder use
} }
private InstantiationParams(List<JAXBElement<? extends SectionType<?>>> sections) { private InstantiationParams(Set<? extends SectionType<?>> sections) {
this.sections = sections; this.sections = sections;
} }
@XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class) @XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class)
protected List<JAXBElement<? extends SectionType<?>>> sections; protected Set<? extends SectionType<?>> sections = Sets.newLinkedHashSet();
/** /**
*
* An ovf:Section to configure for instantiation. * An ovf:Section to configure for instantiation.
* * <p/>
* Gets the value of the section property. * Gets the value of the section property.
* * <p/>
* <p> * <p/>
* This accessor method returns a reference to the live list, * This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the * not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object. * returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the section property. * This is why there is not a <CODE>set</CODE> method for the section property.
* * <p/>
* <p> * <p/>
* For example, to add a new item, do as follows: * For example, to add a new item, do as follows:
* <pre> * <pre>
* getSection().add(newItem); * getSection().add(newItem);
* </pre> * </pre>
* * <p/>
* * <p/>
* <p> * <p/>
* Objects of the following type(s) are allowed in the list * Objects of the following type(s) are allowed in the list
* {@link JAXBElement }{@code <}{@link SectionType }{@code >} * {@link JAXBElement }{@code <}{@link SectionType }{@code >}
* {@link JAXBElement }{@code <}{@link VirtualHardwareSection }{@code >} * {@link JAXBElement }{@code <}{@link VirtualHardwareSection }{@code >}
@ -152,13 +146,8 @@ public class InstantiationParams {
* {@link JAXBElement }{@code <}{@link NetworkSection }{@code >} * {@link JAXBElement }{@code <}{@link NetworkSection }{@code >}
* {@link JAXBElement }{@code <}{@link DiskSection }{@code >} * {@link JAXBElement }{@code <}{@link DiskSection }{@code >}
* {@link JAXBElement }{@code <}{@link InstallSection }{@code >} * {@link JAXBElement }{@code <}{@link InstallSection }{@code >}
*
*
*/ */
public List<JAXBElement<? extends SectionType<?>>> getSections() { public Set<? extends SectionType<?>> getSections() {
if (sections == null) {
sections = new ArrayList<JAXBElement<? extends SectionType<?>>>();
}
return this.sections; return this.sections;
} }

View File

@ -20,10 +20,8 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -36,7 +34,7 @@ import com.google.common.collect.Sets;
* *
* @author danikov * @author danikov
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpAddresses") @XmlRootElement(name = "IpAddresses")
public class IpAddresses { public class IpAddresses {
public static Builder builder() { public static Builder builder() {
@ -83,7 +81,7 @@ public class IpAddresses {
this.ipAddresses = ImmutableSet.copyOf(orgs); this.ipAddresses = ImmutableSet.copyOf(orgs);
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IpAddress") @XmlElement(name = "IpAddress")
private Set<String> ipAddresses = Sets.newLinkedHashSet(); private Set<String> ipAddresses = Sets.newLinkedHashSet();
public Set<String> getIpAddresses() { public Set<String> getIpAddresses() {

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -31,7 +30,7 @@ import com.google.common.base.Objects;
* *
* @author danikov * @author danikov
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpRange") @XmlRootElement(name = "IpRange")
public class IpRange { public class IpRange {
public static Builder builder() { public static Builder builder() {
@ -81,10 +80,9 @@ public class IpRange {
this.endAddress = endAddress; this.endAddress = endAddress;
} }
@XmlElement(name = "StartAddress")
@XmlElement(namespace = VCLOUD_1_5_NS, name = "StartAddress")
private String startAddress; private String startAddress;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "EndAddress") @XmlElement(name = "EndAddress")
private String endAddress; private String endAddress;
/** /**

View File

@ -20,11 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -36,7 +34,7 @@ import com.google.common.collect.Sets;
* *
* @author danikov * @author danikov
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpRanges") @XmlRootElement(name = "IpRanges")
public class IpRanges { public class IpRanges {
public static Builder builder() { public static Builder builder() {
@ -83,7 +81,7 @@ public class IpRanges {
this.ipRanges = ImmutableSet.copyOf(ipRanges); this.ipRanges = ImmutableSet.copyOf(ipRanges);
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IpRange") @XmlElementRef
private Set<IpRange> ipRanges = Sets.newLinkedHashSet(); private Set<IpRange> ipRanges = Sets.newLinkedHashSet();
public Set<IpRange> getIpRanges() { public Set<IpRange> getIpRanges() {

View File

@ -19,10 +19,7 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -33,8 +30,7 @@ import com.google.common.base.Objects;
* *
* @author danikov * @author danikov
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "IpScope") @XmlRootElement(name = "IpScope")
@XmlAccessorType(XmlAccessType.FIELD)
public class IpScope { public class IpScope {
public static Builder builder() { public static Builder builder() {
@ -121,15 +117,7 @@ public class IpScope {
} }
public IpScope build() { public IpScope build() {
IpScope ipScope = new IpScope(isInherited); return new IpScope(isInherited, gateway, netmask, dns1, dns2, dnsSuffix, ipRanges, allocatedIpAddresses);
ipScope.setGateway(gateway);
ipScope.setNetmask(netmask);
ipScope.setDns1(dns1);
ipScope.setDns2(dns2);
ipScope.setDnsSuffix(dnsSuffix);
ipScope.setIpRanges(ipRanges);
ipScope.setAllocatedIpAddresses(allocatedIpAddresses);
return ipScope;
} }
public Builder fromIpScope(IpScope in) { public Builder fromIpScope(IpScope in) {
@ -147,25 +135,34 @@ public class IpScope {
// For JAXB and builder use // For JAXB and builder use
} }
private IpScope(boolean isInherited) { public IpScope(boolean inherited, String gateway, String netmask, String dns1, String dns2, String dnsSuffix,
this.isInherited = isInherited; IpRanges ipRanges, IpAddresses allocatedIpAddresses) {
this.isInherited = inherited;
this.gateway = gateway;
this.netmask = netmask;
this.dns1 = dns1;
this.dns2 = dns2;
this.dnsSuffix = dnsSuffix;
this.ipRanges = ipRanges;
this.allocatedIpAddresses = allocatedIpAddresses;
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IsInherited")
@XmlElement(name = "IsInherited")
private boolean isInherited; private boolean isInherited;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Gateway") @XmlElement(name = "Gateway")
private String gateway; private String gateway;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Netmask") @XmlElement(name = "Netmask")
private String netmask; private String netmask;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Dns1") @XmlElement(name = "Dns1")
private String dns1; private String dns1;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Dns2") @XmlElement(name = "Dns2")
private String dns2; private String dns2;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "DnsSuffix") @XmlElement(name = "DnsSuffix")
private String dnsSuffix; private String dnsSuffix;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IpRanges") @XmlElement(name = "IpRanges")
private IpRanges ipRanges; private IpRanges ipRanges;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "AllocatedIpAddresses") @XmlElement(name = "AllocatedIpAddresses")
private IpAddresses allocatedIpAddresses; private IpAddresses allocatedIpAddresses;
/** /**
@ -182,10 +179,6 @@ public class IpScope {
return gateway; return gateway;
} }
public void setGateway(String gateway) {
this.gateway = gateway;
}
/** /**
* @return Network mask. * @return Network mask.
*/ */
@ -193,10 +186,6 @@ public class IpScope {
return netmask; return netmask;
} }
public void setNetmask(String netmask) {
this.netmask = netmask;
}
/** /**
* @return Primary DNS server. * @return Primary DNS server.
*/ */
@ -204,10 +193,6 @@ public class IpScope {
return dns1; return dns1;
} }
public void setDns1(String dns1) {
this.dns1 = dns1;
}
/** /**
* @return Secondary DNS server. * @return Secondary DNS server.
*/ */
@ -215,10 +200,6 @@ public class IpScope {
return dns2; return dns2;
} }
public void setDns2(String dns2) {
this.dns2 = dns2;
}
/** /**
* @return DNS suffix. * @return DNS suffix.
*/ */
@ -226,10 +207,6 @@ public class IpScope {
return dnsSuffix; return dnsSuffix;
} }
public void setDnsSuffix(String dnsSuffix) {
this.dnsSuffix = dnsSuffix;
}
/** /**
* @return IP ranges used for static pool allocation in the network. * @return IP ranges used for static pool allocation in the network.
*/ */
@ -237,10 +214,6 @@ public class IpScope {
return ipRanges; return ipRanges;
} }
public void setIpRanges(IpRanges ipRanges) {
this.ipRanges = ipRanges;
}
/** /**
* @return Read-only list of allocated IP addresses in the network. * @return Read-only list of allocated IP addresses in the network.
*/ */
@ -248,10 +221,6 @@ public class IpScope {
return allocatedIpAddresses; return allocatedIpAddresses;
} }
public void setAllocatedIpAddresses(IpAddresses allocatedIpAddresses) {
this.allocatedIpAddresses = allocatedIpAddresses;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,14 +20,11 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS; import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.Collections;
import java.util.List; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -37,9 +34,9 @@ import javax.xml.datatype.XMLGregorianCalendar;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.w3c.dom.Element;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.Sets;
/** /**
@ -70,15 +67,13 @@ import com.google.common.base.Objects;
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "LeaseSettingsSection")
@XmlRootElement(name = "LeaseSettingsSection", namespace = VCLOUD_1_5_NS)
@XmlType(propOrder = { @XmlType(propOrder = {
"link", "links",
"deploymentLeaseInSeconds", "deploymentLeaseInSeconds",
"storageLeaseInSeconds", "storageLeaseInSeconds",
"deploymentLeaseExpiration", "deploymentLeaseExpiration",
"storageLeaseExpiration", "storageLeaseExpiration"
"any"
}) })
public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> { public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
public static <T extends LeaseSettingsSection> Builder builder() { public static <T extends LeaseSettingsSection> Builder builder() {
@ -90,20 +85,19 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
} }
public static class Builder extends SectionType.Builder<LeaseSettingsSection> { public static class Builder extends SectionType.Builder<LeaseSettingsSection> {
private List<Link> links; private Set<Link> links = Sets.newLinkedHashSet();
private Integer deploymentLeaseInSeconds; private Integer deploymentLeaseInSeconds;
private Integer storageLeaseInSeconds; private Integer storageLeaseInSeconds;
private XMLGregorianCalendar deploymentLeaseExpiration; private XMLGregorianCalendar deploymentLeaseExpiration;
private XMLGregorianCalendar storageLeaseExpiration; private XMLGregorianCalendar storageLeaseExpiration;
private List<Object> any;
private URI href; private URI href;
private String type; private String type;
/** /**
* @see LeaseSettingsSection#getLinks() * @see LeaseSettingsSection#getLinks()
*/ */
public Builder links(List<Link> links) { public Builder links(Set<Link> links) {
this.links = links; this.links = checkNotNull(links, "links");
return this; return this;
} }
@ -139,14 +133,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return this; return this;
} }
/**
* @see LeaseSettingsSection#getAny()
*/
public Builder any(List<Object> any) {
this.any = any;
return this;
}
/** /**
* @see LeaseSettingsSection#getHref() * @see LeaseSettingsSection#getHref()
*/ */
@ -165,14 +151,9 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
public LeaseSettingsSection build() { public LeaseSettingsSection build() {
LeaseSettingsSection leaseSettingsSection = new LeaseSettingsSection(info, links, any); return new LeaseSettingsSection(info, required, links, deploymentLeaseInSeconds,
leaseSettingsSection.setDeploymentLeaseInSeconds(deploymentLeaseInSeconds); storageLeaseInSeconds, deploymentLeaseExpiration,
leaseSettingsSection.setStorageLeaseInSeconds(storageLeaseInSeconds); storageLeaseExpiration, href, type);
leaseSettingsSection.setDeploymentLeaseExpiration(deploymentLeaseExpiration);
leaseSettingsSection.setStorageLeaseExpiration(storageLeaseExpiration);
leaseSettingsSection.setHref(href);
leaseSettingsSection.setType(type);
return leaseSettingsSection;
} }
public Builder fromLeaseSettingsSection(LeaseSettingsSection in) { public Builder fromLeaseSettingsSection(LeaseSettingsSection in) {
@ -182,7 +163,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
.storageLeaseInSeconds(in.getStorageLeaseInSeconds()) .storageLeaseInSeconds(in.getStorageLeaseInSeconds())
.deploymentLeaseExpiration(in.getDeploymentLeaseExpiration()) .deploymentLeaseExpiration(in.getDeploymentLeaseExpiration())
.storageLeaseExpiration(in.getStorageLeaseExpiration()) .storageLeaseExpiration(in.getStorageLeaseExpiration())
.any(in.getAny())
.href(in.getHref()) .href(in.getHref())
.type(in.getType()); .type(in.getType());
} }
@ -202,10 +182,18 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
public Builder info(String info) { public Builder info(String info) {
return Builder.class.cast(super.info(info)); return Builder.class.cast(super.info(info));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
} }
@XmlElement(name = "Link") @XmlElement(name = "Link")
protected List<Link> link; protected Set<Link> links;
@XmlElement(name = "DeploymentLeaseInSeconds") @XmlElement(name = "DeploymentLeaseInSeconds")
protected Integer deploymentLeaseInSeconds; protected Integer deploymentLeaseInSeconds;
@XmlElement(name = "StorageLeaseInSeconds") @XmlElement(name = "StorageLeaseInSeconds")
@ -216,18 +204,23 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
@XmlElement(name = "StorageLeaseExpiration") @XmlElement(name = "StorageLeaseExpiration")
@XmlSchemaType(name = "dateTime") @XmlSchemaType(name = "dateTime")
protected XMLGregorianCalendar storageLeaseExpiration; protected XMLGregorianCalendar storageLeaseExpiration;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute @XmlAttribute
@XmlSchemaType(name = "anyURI") @XmlSchemaType(name = "anyURI")
protected URI href; protected URI href;
@XmlAttribute @XmlAttribute
protected String type; protected String type;
private LeaseSettingsSection(@Nullable String info, List<Link> link, List<Object> any) { private LeaseSettingsSection(@Nullable String info, @Nullable Boolean required, Set<Link> links, Integer deploymentLeaseInSeconds,
super(info); Integer storageLeaseInSeconds, XMLGregorianCalendar deploymentLeaseExpiration,
this.link = link; XMLGregorianCalendar storageLeaseExpiration, URI href, String type) {
this.any = any; super(info, required);
this.links = links;
this.deploymentLeaseInSeconds = deploymentLeaseInSeconds;
this.storageLeaseInSeconds = storageLeaseInSeconds;
this.deploymentLeaseExpiration = deploymentLeaseExpiration;
this.storageLeaseExpiration = storageLeaseExpiration;
this.href = href;
this.type = type;
} }
private LeaseSettingsSection() { private LeaseSettingsSection() {
@ -254,11 +247,8 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
* Objects of the following type(s) are allowed in the list * Objects of the following type(s) are allowed in the list
* {@link Link } * {@link Link }
*/ */
public List<Link> getLinks() { public Set<Link> getLinks() {
if (link == null) { return Collections.unmodifiableSet(this.links);
link = new ArrayList<Link>();
}
return this.link;
} }
/** /**
@ -271,16 +261,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return deploymentLeaseInSeconds; return deploymentLeaseInSeconds;
} }
/**
* Sets the value of the deploymentLeaseInSeconds property.
*
* @param value allowed object is
* {@link Integer }
*/
public void setDeploymentLeaseInSeconds(Integer value) {
this.deploymentLeaseInSeconds = value;
}
/** /**
* Gets the value of the storageLeaseInSeconds property. * Gets the value of the storageLeaseInSeconds property.
* *
@ -291,16 +271,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return storageLeaseInSeconds; return storageLeaseInSeconds;
} }
/**
* Sets the value of the storageLeaseInSeconds property.
*
* @param value allowed object is
* {@link Integer }
*/
public void setStorageLeaseInSeconds(Integer value) {
this.storageLeaseInSeconds = value;
}
/** /**
* Gets the value of the deploymentLeaseExpiration property. * Gets the value of the deploymentLeaseExpiration property.
* *
@ -311,16 +281,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return deploymentLeaseExpiration; return deploymentLeaseExpiration;
} }
/**
* Sets the value of the deploymentLeaseExpiration property.
*
* @param value allowed object is
* {@link XMLGregorianCalendar }
*/
public void setDeploymentLeaseExpiration(XMLGregorianCalendar value) {
this.deploymentLeaseExpiration = value;
}
/** /**
* Gets the value of the storageLeaseExpiration property. * Gets the value of the storageLeaseExpiration property.
* *
@ -331,44 +291,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return storageLeaseExpiration; return storageLeaseExpiration;
} }
/**
* Sets the value of the storageLeaseExpiration property.
*
* @param value allowed object is
* {@link XMLGregorianCalendar }
*/
public void setStorageLeaseExpiration(XMLGregorianCalendar value) {
this.storageLeaseExpiration = value;
}
/**
* Gets the value of the any property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
}
/** /**
* @return the value of the href property. * @return the value of the href property.
*/ */
@ -376,15 +298,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return href; return href;
} }
/**
* Sets the value of the href property.
*
* @param value the value to set
*/
public void setHref(URI value) {
this.href = value;
}
/** /**
* Gets the value of the type property. * Gets the value of the type property.
* *
@ -395,16 +308,6 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
return type; return type;
} }
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)
@ -412,39 +315,38 @@ public class LeaseSettingsSection extends SectionType<LeaseSettingsSection> {
if (o == null || getClass() != o.getClass()) if (o == null || getClass() != o.getClass())
return false; return false;
LeaseSettingsSection that = LeaseSettingsSection.class.cast(o); LeaseSettingsSection that = LeaseSettingsSection.class.cast(o);
return equal(link, that.link) && return super.equals(that) &&
equal(links, that.links) &&
equal(deploymentLeaseInSeconds, that.deploymentLeaseInSeconds) && equal(deploymentLeaseInSeconds, that.deploymentLeaseInSeconds) &&
equal(storageLeaseInSeconds, that.storageLeaseInSeconds) && equal(storageLeaseInSeconds, that.storageLeaseInSeconds) &&
equal(deploymentLeaseExpiration, that.deploymentLeaseExpiration) && equal(deploymentLeaseExpiration, that.deploymentLeaseExpiration) &&
equal(storageLeaseExpiration, that.storageLeaseExpiration) && equal(storageLeaseExpiration, that.storageLeaseExpiration) &&
equal(any, that.any) &&
equal(href, that.href) && equal(href, that.href) &&
equal(type, that.type); equal(type, that.type);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(link, return Objects.hashCode(super.hashCode(),
links,
deploymentLeaseInSeconds, deploymentLeaseInSeconds,
storageLeaseInSeconds, storageLeaseInSeconds,
deploymentLeaseExpiration, deploymentLeaseExpiration,
storageLeaseExpiration, storageLeaseExpiration,
any,
href, href,
type); type);
} }
@Override @Override
public String toString() { public Objects.ToStringHelper string() {
return Objects.toStringHelper("") return super.string()
.add("link", link) .add("links", links)
.add("deploymentLeaseInSeconds", deploymentLeaseInSeconds) .add("deploymentLeaseInSeconds", deploymentLeaseInSeconds)
.add("storageLeaseInSeconds", storageLeaseInSeconds) .add("storageLeaseInSeconds", storageLeaseInSeconds)
.add("deploymentLeaseExpiration", deploymentLeaseExpiration) .add("deploymentLeaseExpiration", deploymentLeaseExpiration)
.add("storageLeaseExpiration", storageLeaseExpiration) .add("storageLeaseExpiration", storageLeaseExpiration)
.add("any", any)
.add("href", href) .add("href", href)
.add("type", type).toString(); .add("type", type);
} }
} }

View File

@ -25,21 +25,22 @@ import java.net.URI;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
/** /**
* A link. * A link.
* * <p/>
* <pre> * <pre>
* &lt;xs:complexType name="LinkType"&gt; * &lt;xs:complexType name="LinkType"&gt;
* </pre> * </pre>
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@XmlRootElement(name = "Link")
public class Link extends ReferenceType<Link> { public class Link extends ReferenceType<Link> {
public static final class Rel { public static final class Rel {
@ -60,7 +61,7 @@ public class Link extends ReferenceType<Link> {
/** /**
* All acceptable {@link Link#getRel()} values. * All acceptable {@link Link#getRel()} values.
* * <p/>
* This list must be updated whenever a new relationship is added. * This list must be updated whenever a new relationship is added.
*/ */
public static final List<String> ALL = Arrays.asList( public static final List<String> ALL = Arrays.asList(
@ -97,11 +98,7 @@ public class Link extends ReferenceType<Link> {
@Override @Override
public Link build() { public Link build() {
Link link = new Link(href, rel); return new Link(href, id, name, type, rel);
link.setId(id);
link.setName(name);
link.setType(type);
return link;
} }
/** /**
@ -166,8 +163,8 @@ public class Link extends ReferenceType<Link> {
@XmlAttribute(required = true) @XmlAttribute(required = true)
private String rel; private String rel;
private Link(URI href, String rel) { private Link(URI href, String id, String name, String type, String rel) {
super(href); super(href, id, name, type);
this.rel = checkNotNull(rel, "rel"); this.rel = checkNotNull(rel, "rel");
} }

View File

@ -19,13 +19,11 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -35,12 +33,12 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* Represents a media. * Represents a media.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="Media" /&gt; * &lt;complexType name="Media" /&gt;
* </pre> * </pre>
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Media") @XmlRootElement(name = "Media")
public class Media extends ResourceEntityType<Media> { public class Media extends ResourceEntityType<Media> {
public static final class ImageType { public static final class ImageType {
@ -92,18 +90,7 @@ public class Media extends ResourceEntityType<Media> {
@Override @Override
public Media build() { public Media build() {
Media media = new Media(href, name); return new Media(href, type, links, description, tasksInProgress, id, name, files, status, owner, imageType, size);
media.setOwner(owner);
media.setImageType(imageType);
media.setSize(size);
media.setFiles(files);
media.setStatus(status);
media.setDescription(description);
media.setTasksInProgress(tasksInProgress);
media.setId(id);
media.setType(type);
media.setLinks(links);
return media;
} }
/** /**
@ -179,7 +166,7 @@ public class Media extends ResourceEntityType<Media> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder links(Set<Link> links) { public Builder links(Set<Link> links) {
@ -188,7 +175,7 @@ public class Media extends ResourceEntityType<Media> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder link(Link link) { public Builder link(Link link) {
@ -206,15 +193,20 @@ public class Media extends ResourceEntityType<Media> {
} }
} }
public Media() {
public Media(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
String name, FilesList files, Integer status, Owner owner, String imageType, long size) {
super(href, type, links, description, tasksInProgress, id, name, files, status);
this.owner = owner;
this.imageType = imageType;
this.size = size;
}
private Media() {
// for JAXB // for JAXB
} }
protected Media(URI href, String name) { @XmlElement(name = "Owner")
super(href, name);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Owner")
protected Owner owner; protected Owner owner;
@XmlAttribute(required = true) @XmlAttribute(required = true)
protected String imageType; protected String imageType;
@ -228,10 +220,6 @@ public class Media extends ResourceEntityType<Media> {
return owner; return owner;
} }
public void setOwner(Owner value) {
this.owner = value;
}
/** /**
* Gets the value of the imageType property. * Gets the value of the imageType property.
*/ */
@ -239,10 +227,6 @@ public class Media extends ResourceEntityType<Media> {
return imageType; return imageType;
} }
public void setImageType(String value) {
this.imageType = value;
}
/** /**
* Gets the value of the size property. * Gets the value of the size property.
*/ */
@ -250,10 +234,6 @@ public class Media extends ResourceEntityType<Media> {
return size; return size;
} }
public void setSize(long value) {
this.size = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,11 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -37,14 +35,14 @@ import com.google.common.collect.Sets;
/** /**
* Represents a set of metadata * Represents a set of metadata
* * <p/>
* <pre> * <pre>
* &lt;xs:complexType name="Metadata"&gt; * &lt;xs:complexType name="Metadata"&gt;
* </pre> * </pre>
* *
* @author danikov * @author danikov
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Metadata") @XmlRootElement(name = "Metadata")
public class Metadata extends ResourceType<Metadata> { public class Metadata extends ResourceType<Metadata> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.METADATA; public static final String MEDIA_TYPE = VCloudDirectorMediaType.METADATA;
@ -81,10 +79,7 @@ public class Metadata extends ResourceType<Metadata> {
@Override @Override
public Metadata build() { public Metadata build() {
Metadata metadata = new Metadata(href, metadataEntries); return new Metadata(href, type, links, metadataEntries);
metadata.setType(type);
metadata.setLinks(links);
return metadata;
} }
/** /**
@ -137,15 +132,16 @@ public class Metadata extends ResourceType<Metadata> {
} }
private Metadata() { private Metadata() {
// For JAXB and builder use // For JAXB
} }
private Metadata(URI href, Set<MetadataEntry> metadataEntries) { private Metadata(URI href, String type, Set<Link> links, Set<MetadataEntry> metadataEntries) {
super(href); super(href, type, links);
this.metadataEntries = ImmutableSet.copyOf(metadataEntries); this.metadataEntries = ImmutableSet.copyOf(metadataEntries);
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "MetadataEntry")
@XmlElement(name = "MetadataEntry")
private Set<MetadataEntry> metadataEntries = Sets.newLinkedHashSet(); private Set<MetadataEntry> metadataEntries = Sets.newLinkedHashSet();
public Set<MetadataEntry> getMetadataEntries() { public Set<MetadataEntry> getMetadataEntries() {

View File

@ -20,11 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -36,14 +34,14 @@ import com.google.common.collect.Sets;
/** /**
* Represents a metadata entry * Represents a metadata entry
* * <p/>
* <pre> * <pre>
* &lt;xs:complexType name="MetadataType"&gt; * &lt;xs:complexType name="MetadataType"&gt;
* </pre> * </pre>
* *
* @author danikov * @author danikov
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "MetadataEntry") @XmlRootElement(name = "MetadataEntry")
public class MetadataEntry extends ResourceType<MetadataEntry> { public class MetadataEntry extends ResourceType<MetadataEntry> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.METADATA_ENTRY; public static final String MEDIA_TYPE = VCloudDirectorMediaType.METADATA_ENTRY;
@ -53,7 +51,6 @@ public class MetadataEntry extends ResourceType<MetadataEntry> {
return new Builder(); return new Builder();
} }
@Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().fromMetadataEntry(this); return new Builder().fromMetadataEntry(this);
} }
@ -90,10 +87,7 @@ public class MetadataEntry extends ResourceType<MetadataEntry> {
@Override @Override
public MetadataEntry build() { public MetadataEntry build() {
MetadataEntry metadataEntry = new MetadataEntry(href, key, value); return new MetadataEntry(href, type, links, key, value);
metadataEntry.setType(type);
metadataEntry.setLinks(links);
return metadataEntry;
} }
/** /**
@ -149,15 +143,15 @@ public class MetadataEntry extends ResourceType<MetadataEntry> {
// For JAXB and builder use // For JAXB and builder use
} }
private MetadataEntry(URI href, String key, String value) { public MetadataEntry(URI href, String type, Set<Link> links, String key, String value) {
super(href); super(href, type, links);
this.key = checkNotNull(key, "key"); this.key = checkNotNull(key, "key");
this.value = checkNotNull(value, "value"); this.value = checkNotNull(value, "value");
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Key") @XmlElement(name = "Key")
private String key; private String key;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Value") @XmlElement(name = "Value")
private String value; private String value;
/** /**

View File

@ -20,11 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -36,14 +34,14 @@ import com.google.common.collect.Sets;
/** /**
* Represents a metadata entry * Represents a metadata entry
* * <p/>
* <pre> * <pre>
* &lt;xs:complexType name="MetadataType"&gt; * &lt;xs:complexType name="MetadataType"&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "MetadataValue") @XmlRootElement(name = "MetadataValue")
public class MetadataValue extends ResourceType<MetadataValue> { public class MetadataValue extends ResourceType<MetadataValue> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.METADATA_ENTRY; public static final String MEDIA_TYPE = VCloudDirectorMediaType.METADATA_ENTRY;
@ -71,10 +69,7 @@ public class MetadataValue extends ResourceType<MetadataValue> {
@Override @Override
public MetadataValue build() { public MetadataValue build() {
MetadataValue metadataValue = new MetadataValue(href, value); return new MetadataValue(href, type, links, value);
metadataValue.setType(type);
metadataValue.setLinks(links);
return metadataValue;
} }
/** /**
@ -127,15 +122,15 @@ public class MetadataValue extends ResourceType<MetadataValue> {
} }
private MetadataValue() { private MetadataValue() {
// For JAXB and builder use // For JAXB
} }
private MetadataValue(URI href, String value) { private MetadataValue(URI href, String type, Set<Link> links, String value) {
super(href); super(href, type, links);
this.value = checkNotNull(value, "value"); this.value = checkNotNull(value, "value");
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Value", required = true) @XmlElement(name = "Value", required = true)
private String value; private String value;
/** /**

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -30,14 +28,13 @@ import com.google.common.base.Objects;
/** /**
*
* Represents mapping between a VM and vApp network. * Represents mapping between a VM and vApp network.
* * <p/>
* * <p/>
* <p>Java class for NetworkAssignment complex type. * <p>Java class for NetworkAssignment complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="NetworkAssignment"> * &lt;complexType name="NetworkAssignment">
* &lt;complexContent> * &lt;complexContent>
@ -49,10 +46,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NetworkAssignment") @XmlType(name = "NetworkAssignment")
public class NetworkAssignment public class NetworkAssignment
@ -87,27 +81,26 @@ public class NetworkAssignment
return this; return this;
} }
public NetworkAssignment build() { public NetworkAssignment build() {
NetworkAssignment networkAssignment = new NetworkAssignment(); return new NetworkAssignment(innerNetwork, containerNetwork);
networkAssignment.setInnerNetwork(innerNetwork);
networkAssignment.setContainerNetwork(containerNetwork);
return networkAssignment;
} }
public Builder fromNetworkAssignment(NetworkAssignment in) { public Builder fromNetworkAssignment(NetworkAssignment in) {
return innerNetwork(in.getInnerNetwork()) return innerNetwork(in.getInnerNetwork())
.containerNetwork(in.getContainerNetwork()); .containerNetwork(in.getContainerNetwork());
} }
} }
private NetworkAssignment(String innerNetwork, String containerNetwork) {
this.innerNetwork = innerNetwork;
this.containerNetwork = containerNetwork;
}
private NetworkAssignment() { private NetworkAssignment() {
// For JAXB and builder use // For JAXB and builder use
} }
@XmlAttribute(required = true) @XmlAttribute(required = true)
protected String innerNetwork; protected String innerNetwork;
@XmlAttribute(required = true) @XmlAttribute(required = true)
@ -116,51 +109,23 @@ public class NetworkAssignment
/** /**
* Gets the value of the innerNetwork property. * Gets the value of the innerNetwork property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getInnerNetwork() { public String getInnerNetwork() {
return innerNetwork; return innerNetwork;
} }
/**
* Sets the value of the innerNetwork property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setInnerNetwork(String value) {
this.innerNetwork = value;
}
/** /**
* Gets the value of the containerNetwork property. * Gets the value of the containerNetwork property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getContainerNetwork() { public String getContainerNetwork() {
return containerNetwork; return containerNetwork;
} }
/**
* Sets the value of the containerNetwork property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setContainerNetwork(String value) {
this.containerNetwork = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,14 +20,11 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS; import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.Collections;
import java.util.List; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -36,9 +33,10 @@ import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.w3c.dom.Element;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/** /**
@ -66,12 +64,10 @@ import com.google.common.base.Objects;
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "NetworkConfigSection")
@XmlRootElement(name="NetworkConfigSection", namespace = VCLOUD_1_5_NS) @XmlType(propOrder = {
@XmlType( propOrder = { "links",
"link", "networkConfigs"
"networkConfig",
"any"
}) })
public class NetworkConfigSection extends SectionType<NetworkConfigSection> { public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
public static Builder builder() { public static Builder builder() {
@ -84,33 +80,24 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
public static class Builder extends SectionType.Builder<NetworkConfigSection> { public static class Builder extends SectionType.Builder<NetworkConfigSection> {
private List<Link> link; private Set<Link> links = Sets.newLinkedHashSet();
private List<VAppNetworkConfiguration<?>> networkConfig; private Set<VAppNetworkConfiguration<?>> networkConfigs = Sets.newLinkedHashSet();
private List<Object> any;
private URI href; private URI href;
private String type; private String type;
/** /**
* @see NetworkConfigSection#getLink() * @see NetworkConfigSection#getLinks()
*/ */
public Builder link(List<Link> link) { public Builder links(Set<Link> links) {
this.link = link; this.links = checkNotNull(links, "links");
return this; return this;
} }
/** /**
* @see NetworkConfigSection#getNetworkConfig() * @see NetworkConfigSection#getNetworkConfigs()
*/ */
public Builder networkConfig(List<VAppNetworkConfiguration<?>> networkConfig) { public Builder networkConfig(Set<VAppNetworkConfiguration<?>> networkConfigs) {
this.networkConfig = networkConfig; this.networkConfigs = checkNotNull(networkConfigs, "networkConfigs");
return this;
}
/**
* @see NetworkConfigSection#getAny()
*/
public Builder any(List<Object> any) {
this.any = any;
return this; return this;
} }
@ -132,17 +119,13 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
public NetworkConfigSection build() { public NetworkConfigSection build() {
NetworkConfigSection networkConfigSection = new NetworkConfigSection(info, link, networkConfig, any); return new NetworkConfigSection(info, required, links, networkConfigs, href, type);
networkConfigSection.setHref(href);
networkConfigSection.setType(type);
return networkConfigSection;
} }
public Builder fromNetworkConfigSection(NetworkConfigSection in) { public Builder fromNetworkConfigSection(NetworkConfigSection in) {
return fromSection(in) return fromSection(in)
.link(in.getLink()) .links(in.getLinks())
.networkConfig(in.getNetworkConfig()) .networkConfig(in.getNetworkConfigs())
.any(in.getAny())
.href(in.getHref()) .href(in.getHref())
.type(in.getType()); .type(in.getType());
} }
@ -163,25 +146,33 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
return Builder.class.cast(super.info(info)); return Builder.class.cast(super.info(info));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
} }
@XmlElement(name = "Link") @XmlElement(name = "Link")
protected List<Link> link; protected Set<Link> links;
@XmlElement(name = "NetworkConfig") @XmlElement(name = "NetworkConfig")
protected List<VAppNetworkConfiguration<?>> networkConfig; protected Set<VAppNetworkConfiguration<?>> networkConfigs;
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute @XmlAttribute
@XmlSchemaType(name = "anyURI") @XmlSchemaType(name = "anyURI")
protected URI href; protected URI href;
@XmlAttribute @XmlAttribute
protected String type; protected String type;
private NetworkConfigSection(@Nullable String info, List<Link> link, List<VAppNetworkConfiguration<?>> networkConfig, List<Object> any) { public NetworkConfigSection(@Nullable String info, @Nullable Boolean required, Set<Link> links, Set<VAppNetworkConfiguration<?>> networkConfigs,
super(info); URI href, String type) {
this.link = link; super(info, required);
this.networkConfig = networkConfig; this.links = ImmutableSet.copyOf(links);
this.any = any; this.networkConfigs = ImmutableSet.copyOf(networkConfigs);
this.href = href;
this.type = type;
} }
private NetworkConfigSection() { private NetworkConfigSection() {
@ -190,84 +181,16 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
/** /**
* Gets the value of the link property. * Gets the value of the link property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Link }
*/ */
public List<Link> getLink() { public Set<Link> getLinks() {
if (link == null) { return Collections.unmodifiableSet(this.links);
link = new ArrayList<Link>();
}
return this.link;
} }
/** /**
* Gets the value of the networkConfig property. * Gets the value of the networkConfig property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the networkConfig property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getNetworkConfig().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link VAppNetworkConfiguration }
*/ */
public List<VAppNetworkConfiguration<?>> getNetworkConfig() { public Set<VAppNetworkConfiguration<?>> getNetworkConfigs() {
if (networkConfig == null) { return Collections.unmodifiableSet(this.networkConfigs);
networkConfig = new ArrayList<VAppNetworkConfiguration<?>>();
}
return this.networkConfig;
}
/**
* Gets the value of the any property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
} }
/** /**
@ -277,13 +200,6 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
return href; return href;
} }
/**
* Sets the value of the href property.
*/
public void setHref(URI value) {
this.href = value;
}
/** /**
* Gets the value of the type property. * Gets the value of the type property.
* *
@ -294,16 +210,6 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
return type; return type;
} }
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)
@ -311,30 +217,29 @@ public class NetworkConfigSection extends SectionType<NetworkConfigSection> {
if (o == null || getClass() != o.getClass()) if (o == null || getClass() != o.getClass())
return false; return false;
NetworkConfigSection that = NetworkConfigSection.class.cast(o); NetworkConfigSection that = NetworkConfigSection.class.cast(o);
return equal(link, that.link) && return super.equals(that) &&
equal(networkConfig, that.networkConfig) && equal(links, that.links) &&
equal(any, that.any) && equal(networkConfigs, that.networkConfigs) &&
equal(href, that.href) && equal(href, that.href) &&
equal(type, that.type); equal(type, that.type);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(link, return Objects.hashCode(super.hashCode(),
networkConfig, links,
any, networkConfigs,
href, href,
type); type);
} }
@Override @Override
public String toString() { public Objects.ToStringHelper string() {
return Objects.toStringHelper("") return super.string()
.add("link", link) .add("links", links)
.add("networkConfig", networkConfig) .add("networkConfigs", networkConfigs)
.add("any", any)
.add("href", href) .add("href", href)
.add("type", type).toString(); .add("type", type);
} }
} }

View File

@ -19,10 +19,8 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS; import static com.google.common.base.Preconditions.checkNotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -33,9 +31,8 @@ import com.google.common.base.Objects;
* *
* @author danikov * @author danikov
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "NetworkConfiguration") @XmlRootElement(name = "NetworkConfiguration")
@XmlAccessorType(XmlAccessType.FIELD) public class NetworkConfiguration {
public class NetworkConfiguration{
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
@ -111,14 +108,7 @@ public class NetworkConfiguration{
} }
public NetworkConfiguration build() { public NetworkConfiguration build() {
NetworkConfiguration networkConfiguration = new NetworkConfiguration(fenceMode); return new NetworkConfiguration(ipScope, parentNetwork, fenceMode, retainNetInfoAcrossDeployments, features, syslogServerSettings, routerInfo);
networkConfiguration.setIpScope(ipScope);
networkConfiguration.setParentNetwork(parentNetwork);
networkConfiguration.setRetainNetInfoAcrossDeployments(retainNetInfoAcrossDeployments);
networkConfiguration.setNetworkFeatures(features);
networkConfiguration.setSyslogServerSettings(syslogServerSettings);
networkConfiguration.setRouterInfo(routerInfo);
return networkConfiguration;
} }
public Builder fromConfiguration(NetworkConfiguration in) { public Builder fromConfiguration(NetworkConfiguration in) {
@ -130,27 +120,34 @@ public class NetworkConfiguration{
} }
} }
public NetworkConfiguration(IpScope ipScope, ReferenceType<?> parentNetwork, String fenceMode, boolean retainNetInfoAcrossDeployments,
NetworkFeatures features, SyslogServerSettings syslogServerSettings, RouterInfo routerInfo) {
this.ipScope = ipScope;
this.parentNetwork = parentNetwork;
this.fenceMode = checkNotNull(fenceMode, "fenceMode");
this.retainNetInfoAcrossDeployments = retainNetInfoAcrossDeployments;
this.features = features;
this.syslogServerSettings = syslogServerSettings;
this.routerInfo = routerInfo;
}
private NetworkConfiguration() { private NetworkConfiguration() {
// For JAXB and builder use // For JAXB and builder use
} }
private NetworkConfiguration(String fenceMode) { @XmlElement(name = "IpScope")
this.fenceMode = fenceMode;
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IpScope")
private IpScope ipScope; private IpScope ipScope;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "ParentNetwork") @XmlElement(name = "ParentNetwork")
private ReferenceType<?> parentNetwork; private ReferenceType<?> parentNetwork;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "FenceMode") @XmlElement(name = "FenceMode")
private String fenceMode; private String fenceMode;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "RetainNetInfoAcrossDeployments") @XmlElement(name = "RetainNetInfoAcrossDeployments")
private boolean retainNetInfoAcrossDeployments = false; private boolean retainNetInfoAcrossDeployments = false;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Features") @XmlElement(name = "Features")
private NetworkFeatures features; private NetworkFeatures features;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "SyslogServerSettings") @XmlElement(name = "SyslogServerSettings")
private SyslogServerSettings syslogServerSettings; private SyslogServerSettings syslogServerSettings;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "RouterInfo") @XmlElement(name = "RouterInfo")
private RouterInfo routerInfo; private RouterInfo routerInfo;
/** /**
@ -162,10 +159,6 @@ public class NetworkConfiguration{
return ipScope; return ipScope;
} }
public void setIpScope(IpScope ipScope) {
this.ipScope = ipScope;
}
/** /**
* @return reference to parent network. * @return reference to parent network.
*/ */
@ -173,10 +166,6 @@ public class NetworkConfiguration{
return parentNetwork; return parentNetwork;
} }
public void setParentNetwork(ReferenceType<?> parentNetwork) {
this.parentNetwork = parentNetwork;
}
/** /**
* @return Isolation type of the network. If ParentNetwork is specified, this property * @return Isolation type of the network. If ParentNetwork is specified, this property
* controls connectivity to the parent. One of: bridged (connected directly to the ParentNetwork), * controls connectivity to the parent. One of: bridged (connected directly to the ParentNetwork),
@ -195,10 +184,6 @@ public class NetworkConfiguration{
return retainNetInfoAcrossDeployments; return retainNetInfoAcrossDeployments;
} }
public void setRetainNetInfoAcrossDeployments(boolean retainNetInfoAcrossDeployments) {
this.retainNetInfoAcrossDeployments = retainNetInfoAcrossDeployments;
}
/** /**
* @return Network features like DHCP, firewall and NAT rules. * @return Network features like DHCP, firewall and NAT rules.
*/ */
@ -206,10 +191,6 @@ public class NetworkConfiguration{
return features; return features;
} }
public void setNetworkFeatures(NetworkFeatures features) {
this.features = features;
}
/** /**
* @return Syslog server settings for the network. * @return Syslog server settings for the network.
*/ */
@ -217,10 +198,6 @@ public class NetworkConfiguration{
return syslogServerSettings; return syslogServerSettings;
} }
public void setSyslogServerSettings(SyslogServerSettings syslogServerSettings) {
this.syslogServerSettings = syslogServerSettings;
}
/** /**
* @return router information * @return router information
*/ */
@ -228,10 +205,6 @@ public class NetworkConfiguration{
return routerInfo; return routerInfo;
} }
public void setRouterInfo(RouterInfo routerInfo) {
this.routerInfo = routerInfo;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -31,14 +29,13 @@ import com.google.common.base.Objects;
/** /**
*
* Represents a network connection. * Represents a network connection.
* * <p/>
* * <p/>
* <p>Java class for NetworkConnection complex type. * <p>Java class for NetworkConnection complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="NetworkConnection"> * &lt;complexType name="NetworkConnection">
* &lt;complexContent> * &lt;complexContent>
@ -58,10 +55,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "NetworkConnection", propOrder = { @XmlType(name = "NetworkConnection", propOrder = {
"networkConnectionIndex", "networkConnectionIndex",
"ipAddress", "ipAddress",
@ -115,7 +109,7 @@ public class NetworkConnection {
} }
/** /**
* @see NetworkConnection#getIsConnected() * @see NetworkConnection#isConnected()
*/ */
public Builder isConnected(boolean isConnected) { public Builder isConnected(boolean isConnected) {
this.isConnected = isConnected; this.isConnected = isConnected;
@ -123,7 +117,7 @@ public class NetworkConnection {
} }
/** /**
* @see NetworkConnection#getMacAddress() * @see NetworkConnection#getMACAddress()
*/ */
public Builder macAddress(String macAddress) { public Builder macAddress(String macAddress) {
this.macAddress = macAddress; this.macAddress = macAddress;
@ -147,7 +141,7 @@ public class NetworkConnection {
} }
/** /**
* @see NetworkConnection#getNeedsCustomization() * @see NetworkConnection#needsCustomization()
*/ */
public Builder needsCustomization(Boolean needsCustomization) { public Builder needsCustomization(Boolean needsCustomization) {
this.needsCustomization = needsCustomization; this.needsCustomization = needsCustomization;
@ -156,15 +150,8 @@ public class NetworkConnection {
public NetworkConnection build() { public NetworkConnection build() {
NetworkConnection networkConnection = new NetworkConnection(macAddress); return new NetworkConnection(networkConnectionIndex, ipAddress, externalIpAddress, isConnected,
networkConnection.setNetworkConnectionIndex(networkConnectionIndex); macAddress, ipAddressAllocationMode, network, needsCustomization);
networkConnection.setIpAddress(ipAddress);
networkConnection.setExternalIpAddress(externalIpAddress);
networkConnection.setIsConnected(isConnected);
networkConnection.setIpAddressAllocationMode(ipAddressAllocationMode);
networkConnection.setNetwork(network);
networkConnection.setNeedsCustomization(needsCustomization);
return networkConnection;
} }
@ -180,12 +167,20 @@ public class NetworkConnection {
} }
} }
private NetworkConnection() { public NetworkConnection(int networkConnectionIndex, String ipAddress, String externalIpAddress, boolean connected,
// For JAXB and builder use String macAddress, String ipAddressAllocationMode, String network, Boolean needsCustomization) {
this.networkConnectionIndex = networkConnectionIndex;
this.ipAddress = ipAddress;
this.externalIpAddress = externalIpAddress;
isConnected = connected;
this.macAddress = macAddress;
this.ipAddressAllocationMode = ipAddressAllocationMode;
this.network = network;
this.needsCustomization = needsCustomization;
} }
private NetworkConnection(String macAddress) { private NetworkConnection() {
this.macAddress = macAddress; // For JAXB and builder use
} }
@ -208,180 +203,78 @@ public class NetworkConnection {
/** /**
* Gets the value of the networkConnectionIndex property. * Gets the value of the networkConnectionIndex property.
*
*/ */
public int getNetworkConnectionIndex() { public int getNetworkConnectionIndex() {
return networkConnectionIndex; return networkConnectionIndex;
} }
/**
* Sets the value of the networkConnectionIndex property.
*
*/
public void setNetworkConnectionIndex(int value) {
this.networkConnectionIndex = value;
}
/** /**
* Gets the value of the ipAddress property. * Gets the value of the ipAddress property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getIpAddress() { public String getIpAddress() {
return ipAddress; return ipAddress;
} }
/**
* Sets the value of the ipAddress property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIpAddress(String value) {
this.ipAddress = value;
}
/** /**
* Gets the value of the externalIpAddress property. * Gets the value of the externalIpAddress property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getExternalIpAddress() { public String getExternalIpAddress() {
return externalIpAddress; return externalIpAddress;
} }
/**
* Sets the value of the externalIpAddress property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setExternalIpAddress(String value) {
this.externalIpAddress = value;
}
/** /**
* Gets the value of the isConnected property. * Gets the value of the isConnected property.
*
*/ */
public boolean isConnected() { public boolean isConnected() {
return isConnected; return isConnected;
} }
/**
* Sets the value of the isConnected property.
*
*/
public void setIsConnected(boolean value) {
this.isConnected = value;
}
/** /**
* Gets the value of the macAddress property. * Gets the value of the macAddress property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getMACAddress() { public String getMACAddress() {
return macAddress; return macAddress;
} }
/**
* Sets the value of the macAddress property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setMACAddress(String value) {
this.macAddress = value;
}
/** /**
* Gets the value of the ipAddressAllocationMode property. * Gets the value of the ipAddressAllocationMode property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getIpAddressAllocationMode() { public String getIpAddressAllocationMode() {
return ipAddressAllocationMode; return ipAddressAllocationMode;
} }
/**
* Sets the value of the ipAddressAllocationMode property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIpAddressAllocationMode(String value) {
this.ipAddressAllocationMode = value;
}
/** /**
* Gets the value of the network property. * Gets the value of the network property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getNetwork() { public String getNetwork() {
return network; return network;
} }
/**
* Sets the value of the network property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNetwork(String value) {
this.network = value;
}
/** /**
* Gets the value of the needsCustomization property. * Gets the value of the needsCustomization property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean needsCustomization() { public Boolean needsCustomization() {
return needsCustomization; return needsCustomization;
} }
/**
* Sets the value of the needsCustomization property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setNeedsCustomization(Boolean value) {
this.needsCustomization = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,15 +20,10 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS; import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.ArrayList; import java.util.Set;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyElement;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -37,9 +32,10 @@ import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.w3c.dom.Element;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/** /**
@ -68,13 +64,11 @@ import com.google.common.base.Objects;
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "NetworkConnectionSection")
@XmlRootElement(name="NetworkConnectionSection", namespace = VCLOUD_1_5_NS)
@XmlType(propOrder = { @XmlType(propOrder = {
"primaryNetworkConnectionIndex", "primaryNetworkConnectionIndex",
"networkConnection", "networkConnections",
"link", "links"
"any"
}) })
public class NetworkConnectionSection extends SectionType<NetworkConnectionSection> { public class NetworkConnectionSection extends SectionType<NetworkConnectionSection> {
@ -89,9 +83,8 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
public static class Builder extends SectionType.Builder<NetworkConnectionSection> { public static class Builder extends SectionType.Builder<NetworkConnectionSection> {
private Integer primaryNetworkConnectionIndex; private Integer primaryNetworkConnectionIndex;
private List<NetworkConnection> networkConnection; private Set<NetworkConnection> networkConnection = Sets.newLinkedHashSet();
private List<Link> link; private Set<Link> links = Sets.newLinkedHashSet();
private List<Object> any;
private URI href; private URI href;
private String type; private String type;
@ -104,26 +97,18 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
} }
/** /**
* @see NetworkConnectionSection#getNetworkConnection() * @see NetworkConnectionSection#getNetworkConnections()
*/ */
public Builder networkConnection(List<NetworkConnection> networkConnection) { public Builder networkConnection(Set<NetworkConnection> networkConnection) {
this.networkConnection = networkConnection; this.networkConnection = checkNotNull(networkConnection, "networkConnection");
return this; return this;
} }
/** /**
* @see NetworkConnectionSection#getLink() * @see NetworkConnectionSection#getLinks()
*/ */
public Builder link(List<Link> link) { public Builder links(Set<Link> links) {
this.link = link; this.links = checkNotNull(links, "links");
return this;
}
/**
* @see NetworkConnectionSection#getAny()
*/
public Builder any(List<Object> any) {
this.any = any;
return this; return this;
} }
@ -145,19 +130,15 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
public NetworkConnectionSection build() { public NetworkConnectionSection build() {
NetworkConnectionSection networkConnectionSection = new NetworkConnectionSection(info, networkConnection, link, any); return new NetworkConnectionSection(info, required, primaryNetworkConnectionIndex, networkConnection, links, href, type);
networkConnectionSection.setPrimaryNetworkConnectionIndex(primaryNetworkConnectionIndex);
networkConnectionSection.setHref(href);
networkConnectionSection.setType(type);
return networkConnectionSection;
} }
public Builder fromNetworkConnectionSection(NetworkConnectionSection in) { public Builder fromNetworkConnectionSection(NetworkConnectionSection in) {
return fromSection(in) return fromSection(in)
.primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex()) .primaryNetworkConnectionIndex(in.getPrimaryNetworkConnectionIndex())
.networkConnection(in.getNetworkConnection()) .networkConnection(in.getNetworkConnections())
.link(in.getLink()) .links(in.getLinks())
.any(in.getAny())
.href(in.getHref()) .href(in.getHref())
.type(in.getType()); .type(in.getType());
} }
@ -177,13 +158,25 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
public Builder info(String info) { public Builder info(String info) {
return Builder.class.cast(super.info(info)); return Builder.class.cast(super.info(info));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
} }
private NetworkConnectionSection(@Nullable String info, List<NetworkConnection> networkConnection, List<Link> link, List<Object> any) { }
super(info);
this.networkConnection = networkConnection; private NetworkConnectionSection(@Nullable String info, @Nullable Boolean required, Integer primaryNetworkConnectionIndex,
this.link = link; Set<NetworkConnection> networkConnections, Set<Link> links, URI href, String type) {
this.any = any; super(info, required);
this.primaryNetworkConnectionIndex = primaryNetworkConnectionIndex;
this.networkConnections = ImmutableSet.copyOf(networkConnections);
this.links = ImmutableSet.copyOf(links);
this.href = href;
this.type = type;
} }
private NetworkConnectionSection() { private NetworkConnectionSection() {
@ -193,11 +186,9 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
@XmlElement(name = "PrimaryNetworkConnectionIndex") @XmlElement(name = "PrimaryNetworkConnectionIndex")
protected Integer primaryNetworkConnectionIndex; protected Integer primaryNetworkConnectionIndex;
@XmlElement(name = "NetworkConnection") @XmlElement(name = "NetworkConnection")
protected List<NetworkConnection> networkConnection; protected Set<NetworkConnection> networkConnections = Sets.newLinkedHashSet();
@XmlElement(name = "Link") @XmlElement(name = "Link")
protected List<Link> link; protected Set<Link> links = Sets.newLinkedHashSet();
@XmlAnyElement(lax = true)
protected List<Object> any;
@XmlAttribute @XmlAttribute
@XmlSchemaType(name = "anyURI") @XmlSchemaType(name = "anyURI")
protected URI href; protected URI href;
@ -214,96 +205,24 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
return primaryNetworkConnectionIndex; return primaryNetworkConnectionIndex;
} }
/**
* Sets the value of the primaryNetworkConnectionIndex property.
*
* @param value allowed object is
* {@link Integer }
*/
public void setPrimaryNetworkConnectionIndex(Integer value) {
this.primaryNetworkConnectionIndex = value;
}
/** /**
* Gets the value of the networkConnection property. * Gets the value of the networkConnection property.
* <p/> * <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the networkConnection property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getNetworkConnection().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list * Objects of the following type(s) are allowed in the list
* {@link NetworkConnection } * {@link NetworkConnection }
*/ */
public List<NetworkConnection> getNetworkConnection() { public Set<NetworkConnection> getNetworkConnections() {
if (networkConnection == null) { return this.networkConnections;
networkConnection = new ArrayList<NetworkConnection>();
}
return this.networkConnection;
} }
/** /**
* Gets the value of the link property. * Gets the value of the link property.
* <p/> * <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the link property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getLink().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list * Objects of the following type(s) are allowed in the list
* {@link Link } * {@link Link }
*/ */
public List<Link> getLink() { public Set<Link> getLinks() {
if (link == null) { return this.links;
link = new ArrayList<Link>();
}
return this.link;
}
/**
* Gets the value of the any property.
* <p/>
* <p/>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the any property.
* <p/>
* <p/>
* For example, to add a new item, do as follows:
* <pre>
* getAny().add(newItem);
* </pre>
* <p/>
* <p/>
* <p/>
* Objects of the following type(s) are allowed in the list
* {@link Object }
* {@link Element }
*/
public List<Object> getAny() {
if (any == null) {
any = new ArrayList<Object>();
}
return this.any;
} }
/** /**
@ -313,15 +232,6 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
return href; return href;
} }
/**
* Sets the value of the href property.
*
* @param value the value to set
*/
public void setHref(URI value) {
this.href = value;
}
/** /**
* Gets the value of the type property. * Gets the value of the type property.
* *
@ -332,16 +242,6 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
return type; return type;
} }
/**
* Sets the value of the type property.
*
* @param value allowed object is
* {@link String }
*/
public void setType(String value) {
this.type = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)
@ -349,10 +249,10 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
if (o == null || getClass() != o.getClass()) if (o == null || getClass() != o.getClass())
return false; return false;
NetworkConnectionSection that = NetworkConnectionSection.class.cast(o); NetworkConnectionSection that = NetworkConnectionSection.class.cast(o);
return equal(primaryNetworkConnectionIndex, that.primaryNetworkConnectionIndex) && return super.equals(that) &&
equal(networkConnection, that.networkConnection) && equal(primaryNetworkConnectionIndex, that.primaryNetworkConnectionIndex) &&
equal(link, that.link) && equal(networkConnections, that.networkConnections) &&
equal(any, that.any) && equal(links, that.links) &&
equal(href, that.href) && equal(href, that.href) &&
equal(type, that.type); equal(type, that.type);
} }
@ -360,22 +260,20 @@ public class NetworkConnectionSection extends SectionType<NetworkConnectionSecti
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(primaryNetworkConnectionIndex, return Objects.hashCode(primaryNetworkConnectionIndex,
networkConnection, networkConnections,
link, links,
any,
href, href,
type); type);
} }
@Override @Override
public String toString() { public Objects.ToStringHelper string() {
return Objects.toStringHelper("") return super.string()
.add("primaryNetworkConnectionIndex", primaryNetworkConnectionIndex) .add("primaryNetworkConnectionIndex", primaryNetworkConnectionIndex)
.add("networkConnection", networkConnection) .add("networkConnection", networkConnections)
.add("link", link) .add("links", links)
.add("any", any)
.add("href", href) .add("href", href)
.add("type", type).toString(); .add("type", type);
} }
} }

View File

@ -20,10 +20,8 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -36,7 +34,7 @@ import com.google.common.collect.Sets;
* *
* @author danikov * @author danikov
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Features") @XmlRootElement(name = "Features")
public class NetworkFeatures { public class NetworkFeatures {
public static Builder builder() { public static Builder builder() {
@ -68,9 +66,7 @@ public class NetworkFeatures {
} }
public NetworkFeatures build() { public NetworkFeatures build() {
NetworkFeatures networkFeatures = new NetworkFeatures(); return new NetworkFeatures(services);
networkFeatures.setNetworkServices(services);
return networkFeatures;
} }
public Builder fromNetworkFeatures(NetworkFeatures in) { public Builder fromNetworkFeatures(NetworkFeatures in) {
@ -82,7 +78,11 @@ public class NetworkFeatures {
// For JAXB and builder use // For JAXB and builder use
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "NetworkService") public NetworkFeatures(Set<NetworkService> services) {
this.services = services;
}
@XmlElement(name = "NetworkService")
private Set<NetworkService> services = Sets.newLinkedHashSet(); private Set<NetworkService> services = Sets.newLinkedHashSet();
/** /**
@ -93,10 +93,6 @@ public class NetworkFeatures {
return ImmutableSet.copyOf(services); return ImmutableSet.copyOf(services);
} }
public void setNetworkServices(Set<NetworkService> services) {
this.services = Sets.newLinkedHashSet(checkNotNull(services, "services"));
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -31,7 +30,7 @@ import com.google.common.base.Objects;
* *
* @author danikov * @author danikov
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "NetworkService") @XmlRootElement(name = "NetworkService")
public class NetworkService { public class NetworkService {
public static Builder builder() { public static Builder builder() {
@ -55,9 +54,7 @@ public class NetworkService {
} }
public NetworkService build() { public NetworkService build() {
NetworkService networkService = new NetworkService(); return new NetworkService(isEnabled);
networkService.setEnabled(isEnabled);
return networkService;
} }
public Builder fromNetworkService(NetworkService in) { public Builder fromNetworkService(NetworkService in) {
@ -65,11 +62,15 @@ public class NetworkService {
} }
} }
private NetworkService(boolean enabled) {
isEnabled = enabled;
}
private NetworkService() { private NetworkService() {
// For JAXB and builder use // For JAXB and builder use
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IsEnabled") @XmlElement(name = "IsEnabled")
private boolean isEnabled; private boolean isEnabled;
/** /**
@ -79,10 +80,6 @@ public class NetworkService {
return isEnabled; return isEnabled;
} }
public void setEnabled(boolean isEnabled) {
this.isEnabled = isEnabled;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,11 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -32,7 +30,7 @@ import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "NetworkType") @XmlRootElement(name = "NetworkType")
public class NetworkType<T extends NetworkType<T>> extends EntityType<T> { public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
public static <T extends NetworkType<T>> Builder<T> builder() { public static <T extends NetworkType<T>> Builder<T> builder() {
@ -58,14 +56,7 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
@Override @Override
public NetworkType<T> build() { public NetworkType<T> build() {
NetworkType<T> network = new NetworkType<T>(href, name); return new NetworkType<T>(href, type, links, description, tasksInProgress, id, name, networkConfiguration);
network.setConfiguration(networkConfiguration);
network.setDescription(description);
network.setId(id);
network.setType(type);
network.setLinks(links);
network.setTasksInProgress(tasksInProgress);
return network;
} }
/** /**
@ -123,7 +114,7 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder<T> links(Set<Link> links) { public Builder<T> links(Set<Link> links) {
@ -132,7 +123,7 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder<T> link(Link link) { public Builder<T> link(Link link) {
@ -154,15 +145,17 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
} }
} }
public NetworkType(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
String id, String name, NetworkConfiguration networkConfiguration) {
super(href, type, links, description, tasksInProgress, id, name);
this.networkConfiguration = networkConfiguration;
}
protected NetworkType() { protected NetworkType() {
// For JAXB and builder use // For JAXB and builder use
} }
protected NetworkType(URI href, String name) { @XmlElement(name = "Configuration")
super(href, name);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Configuration")
private NetworkConfiguration networkConfiguration; private NetworkConfiguration networkConfiguration;
/** /**
@ -172,10 +165,6 @@ public class NetworkType<T extends NetworkType<T>> extends EntityType<T> {
return networkConfiguration; return networkConfiguration;
} }
public void setConfiguration(NetworkConfiguration networkConfiguration) {
this.networkConfiguration = networkConfiguration;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (!super.equals(o)) if (!super.equals(o))

View File

@ -20,11 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -36,16 +34,16 @@ import com.google.common.collect.Sets;
/** /**
* iRepresents an organization. * iRepresents an organization.
* * <p/>
* Unit of multi-tenancy and a top-level container. Contain vDCs, TasksList, Catalogs and Shared Network entities. * Unit of multi-tenancy and a top-level container. Contain vDCs, TasksList, Catalogs and Shared Network entities.
* * <p/>
* <pre> * <pre>
* &lt;xs:complexType name="OrgType"&gt; * &lt;xs:complexType name="OrgType"&gt;
* </pre> * </pre>
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Org") @XmlRootElement(name = "Org")
public class Org extends EntityType<Org> { public class Org extends EntityType<Org> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.ORG; public static final String MEDIA_TYPE = VCloudDirectorMediaType.ORG;
@ -99,14 +97,7 @@ public class Org extends EntityType<Org> {
@Override @Override
public Org build() { public Org build() {
Org org = new Org(href, name, fullName); return new Org(href, type, links, description, tasksInProgress, id, name, fullName, isEnabled);
org.setDescription(description);
org.setId(id);
org.setType(type);
org.setLinks(links);
org.setTasksInProgress(tasksInProgress);
org.setIsEnabled(isEnabled);
return org;
} }
/** /**
@ -164,7 +155,7 @@ public class Org extends EntityType<Org> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder links(Set<Link> links) { public Builder links(Set<Link> links) {
@ -173,7 +164,7 @@ public class Org extends EntityType<Org> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder link(Link link) { public Builder link(Link link) {
@ -195,14 +186,15 @@ public class Org extends EntityType<Org> {
// For JAXB and builder use // For JAXB and builder use
} }
private Org(URI href, String name, String fullName) { public Org(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, String fullName, Boolean enabled) {
super(href, name); super(href, type, links, description, tasksInProgress, id, name);
this.fullName = fullName; this.fullName = fullName;
isEnabled = enabled;
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "FullName", required = true) @XmlElement(name = "FullName", required = true)
private String fullName; private String fullName;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IsEnabled") @XmlElement(name = "IsEnabled")
private Boolean isEnabled; private Boolean isEnabled;
/** /**
@ -219,10 +211,6 @@ public class Org extends EntityType<Org> {
return isEnabled; return isEnabled;
} }
public void setIsEnabled(Boolean isEnabled) {
this.isEnabled = isEnabled;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,10 +20,8 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -38,7 +36,7 @@ import com.google.common.collect.Sets;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "OrgList") @XmlRootElement(name = "OrgList")
public class OrgList { public class OrgList {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.ORG_LIST; public static final String MEDIA_TYPE = VCloudDirectorMediaType.ORG_LIST;
@ -88,7 +86,7 @@ public class OrgList {
this.orgs = ImmutableSet.copyOf(orgs); this.orgs = ImmutableSet.copyOf(orgs);
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Org") @XmlElement(name = "Org")
private Set<Reference> orgs = Sets.newLinkedHashSet(); private Set<Reference> orgs = Sets.newLinkedHashSet();
public Set<Reference> getOrgs() { public Set<Reference> getOrgs() {

View File

@ -20,11 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -32,7 +30,7 @@ import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "OrgNetwork") @XmlRootElement(name = "OrgNetwork")
public class OrgNetwork extends NetworkType<OrgNetwork> { public class OrgNetwork extends NetworkType<OrgNetwork> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -68,16 +66,8 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
@Override @Override
public OrgNetwork build() { public OrgNetwork build() {
OrgNetwork network = new OrgNetwork(href, name); return new OrgNetwork(href, type, links, description, tasksInProgress, id, name, networkConfiguration,
network.setConfiguration(networkConfiguration); networkPool, allowedExternalIpAddresses);
network.setNetworkPool(networkPool);
network.setAllowedExternalIpAddresses(allowedExternalIpAddresses);
network.setDescription(description);
network.setId(id);
network.setType(type);
network.setLinks(links);
network.setTasksInProgress(tasksInProgress);
return network;
} }
/** /**
@ -143,7 +133,7 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder links(Set<Link> links) { public Builder links(Set<Link> links) {
@ -152,7 +142,7 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder link(Link link) { public Builder link(Link link) {
@ -173,16 +163,19 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
} }
private OrgNetwork() { private OrgNetwork() {
// For JAXB and builder use // For JAXB
} }
private OrgNetwork(URI href, String name) { private OrgNetwork(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
super(href, name); String id, String name, NetworkConfiguration networkConfiguration, ReferenceType<?> networkPool, IpAddresses allowedExternalIpAddresses) {
super(href, type, links, description, tasksInProgress, id, name, networkConfiguration);
this.networkPool = networkPool;
this.allowedExternalIpAddresses = allowedExternalIpAddresses;
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "NetworkPool") @XmlElement(name = "NetworkPool")
private ReferenceType<?> networkPool; private ReferenceType<?> networkPool;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "AllowedExternalIpAddresses") @XmlElement(name = "AllowedExternalIpAddresses")
private IpAddresses allowedExternalIpAddresses; private IpAddresses allowedExternalIpAddresses;
/** /**
@ -192,10 +185,6 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
return networkPool; return networkPool;
} }
public void setNetworkPool(ReferenceType<?> networkPool) {
this.networkPool = networkPool;
}
/** /**
* @return optional network pool * @return optional network pool
*/ */
@ -203,10 +192,6 @@ public class OrgNetwork extends NetworkType<OrgNetwork> {
return allowedExternalIpAddresses; return allowedExternalIpAddresses;
} }
public void setAllowedExternalIpAddresses(IpAddresses allowedExternalIpAddresses) {
this.allowedExternalIpAddresses = allowedExternalIpAddresses;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (!super.equals(o)) if (!super.equals(o))

View File

@ -24,9 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -36,14 +33,13 @@ import com.google.common.collect.Sets;
/** /**
*
* Represents the owner of this entity. * Represents the owner of this entity.
* * <p/>
* * <p/>
* <p>Java class for Owner complex type. * <p>Java class for Owner complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="Owner"> * &lt;complexType name="Owner">
* &lt;complexContent> * &lt;complexContent>
@ -56,10 +52,7 @@ import com.google.common.collect.Sets;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Owner") @XmlRootElement(name = "Owner")
@XmlType(propOrder = {"user"}) @XmlType(propOrder = {"user"})
public class Owner public class Owner
@ -71,6 +64,7 @@ public class Owner
return new Builder(); return new Builder();
} }
@Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().fromOwner(this); return new Builder().fromOwner(this);
} }
@ -89,14 +83,9 @@ public class Owner
public Owner build() { public Owner build() {
Owner owner = new Owner(href); return new Owner(href, type, links, user);
owner.setUser(user);
owner.setType(type);
owner.setLinks(links);
return owner;
} }
/** /**
* @see ResourceType#getHref() * @see ResourceType#getHref()
*/ */
@ -138,6 +127,7 @@ public class Owner
public Builder fromResourceType(ResourceType<Owner> in) { public Builder fromResourceType(ResourceType<Owner> in) {
return Builder.class.cast(super.fromResourceType(in)); return Builder.class.cast(super.fromResourceType(in));
} }
public Builder fromOwner(Owner in) { public Builder fromOwner(Owner in) {
return fromResourceType(in) return fromResourceType(in)
.user(in.getUser()); .user(in.getUser());
@ -148,39 +138,24 @@ public class Owner
// For JAXB and builder use // For JAXB and builder use
} }
private Owner(URI href) { public Owner(URI href, String type, Set<Link> links, Reference user) {
super(href); super(href, type, links);
this.user = user;
} }
@XmlElement(name = "User", required = true) @XmlElement(name = "User", required = true)
protected Reference user; protected Reference user;
/** /**
* Gets the value of the user property. * Gets the value of the user property.
* *
* @return * @return possible object is
* possible object is
* {@link Reference } * {@link Reference }
*
*/ */
public Reference getUser() { public Reference getUser() {
return user; return user;
} }
/**
* Sets the value of the user property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setUser(Reference value) {
this.user = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso;
@ -32,14 +30,13 @@ import com.google.common.base.Objects;
/** /**
*
* A basic type used to specify parameters for operations. * A basic type used to specify parameters for operations.
* * <p/>
* * <p/>
* <p>Java class for Params complex type. * <p>Java class for Params complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="Params"> * &lt;complexType name="Params">
* &lt;complexContent> * &lt;complexContent>
@ -53,19 +50,16 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Params", propOrder = { @XmlType(name = "Params", propOrder = {
"description" "description"
}) })
@XmlSeeAlso({ @XmlSeeAlso({
// CaptureVAppParams.class, CaptureVAppParams.class,
// CloneVAppTemplateParams.class, CloneVAppTemplateParams.class,
// CloneMediaParams.class, CloneMediaParams.class,
// UploadVAppTemplateParams.class, UploadVAppTemplateParams.class
// ImportVmAsVAppTemplateParams.class, //, ImportVmAsVAppTemplateParams.class,
// ImportMediaParams.class, // ImportMediaParams.class,
// UpdateResourcePoolSetParams.class, // UpdateResourcePoolSetParams.class,
// VAppCreationParams.class // VAppCreationParams.class
@ -79,7 +73,7 @@ public class ParamsType<T extends ParamsType<T>> {
return new Builder<T>().fromParamsType(this); return new Builder<T>().fromParamsType(this);
} }
public static class Builder<T extends ParamsType<T>>{ public static class Builder<T extends ParamsType<T>> {
protected String description; protected String description;
protected String name; protected String name;
@ -102,25 +96,25 @@ public class ParamsType<T extends ParamsType<T>> {
public ParamsType<T> build() { public ParamsType<T> build() {
ParamsType<T> params = new ParamsType<T>(); return new ParamsType<T>(description, name);
params.setDescription(description);
params.setName(name);
return params;
} }
public Builder<T> fromParamsType(ParamsType<T> in) { public Builder<T> fromParamsType(ParamsType<T> in) {
return description(in.getDescription()) return description(in.getDescription())
.name(in.getName()); .name(in.getName());
} }
} }
protected ParamsType(String description, String name) {
this.description = description;
this.name = name;
}
protected ParamsType() { protected ParamsType() {
// For JAXB and builder use // For JAXB and builder use
} }
@XmlElement(name = "Description") @XmlElement(name = "Description")
protected String description; protected String description;
@XmlAttribute @XmlAttribute
@ -129,51 +123,23 @@ public class ParamsType<T extends ParamsType<T>> {
/** /**
* Gets the value of the description property. * Gets the value of the description property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getDescription() { public String getDescription() {
return description; return description;
} }
/**
* Sets the value of the description property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
/** /**
* Gets the value of the name property. * Gets the value of the name property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getName() { public String getName() {
return name; return name;
} }
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -23,29 +23,24 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection; import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
/** /**
*
* Essentially a container with a list of product sections. * Essentially a container with a list of product sections.
* * <p/>
* <p>Java class for ProductSectionList complex type. * <p>Java class for ProductSectionList complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="ProductSectionList"> * &lt;complexType name="ProductSectionList">
* &lt;complexContent> * &lt;complexContent>
@ -58,10 +53,7 @@ import com.google.common.collect.Sets;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ProductSectionList", propOrder = { @XmlType(name = "ProductSectionList", propOrder = {
"productSection" "productSection"
}) })
@ -74,25 +66,26 @@ public class ProductSectionList
return new Builder(); return new Builder();
} }
@Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().fromProductSectionList(this); return new Builder().fromProductSectionList(this);
} }
public static class Builder extends ResourceType.Builder<ProductSectionList> { public static class Builder extends ResourceType.Builder<ProductSectionList> {
private List<ProductSection> productSection; private Set<ProductSection> productSections = Sets.newLinkedHashSet();
/** /**
* @see ProductSectionList#getProductSection() * @see ProductSectionList#getProductSection()
*/ */
public Builder productSection(List<ProductSection> productSection) { public Builder productSection(Set<ProductSection> productSections) {
this.productSection = productSection; this.productSections = checkNotNull(productSections, "productSection");
return this; return this;
} }
public ProductSectionList build() { public ProductSectionList build() {
ProductSectionList productSectionList = new ProductSectionList(productSection); ProductSectionList productSectionList = new ProductSectionList(productSections);
return productSectionList; return productSectionList;
} }
@ -138,6 +131,7 @@ public class ProductSectionList
public Builder fromResourceType(ResourceType<ProductSectionList> in) { public Builder fromResourceType(ResourceType<ProductSectionList> in) {
return Builder.class.cast(super.fromResourceType(in)); return Builder.class.cast(super.fromResourceType(in));
} }
public Builder fromProductSectionList(ProductSectionList in) { public Builder fromProductSectionList(ProductSectionList in) {
return fromResourceType(in) return fromResourceType(in)
.productSection(in.getProductSection()); .productSection(in.getProductSection());
@ -148,38 +142,18 @@ public class ProductSectionList
// For JAXB and builder use // For JAXB and builder use
} }
private ProductSectionList(List<ProductSection> productSection) { private ProductSectionList(Set<ProductSection> productSection) {
this.productSection = productSection; this.productSection = ImmutableSet.copyOf(productSection);
} }
@XmlElement(name = "ProductSection", namespace = "http://schemas.dmtf.org/ovf/envelope/1") @XmlElement(name = "ProductSection", namespace = "http://schemas.dmtf.org/ovf/envelope/1")
protected List<ProductSection> productSection; protected Set<ProductSection> productSection = Sets.newLinkedHashSet();
/** /**
* Gets the value of the productSection property. * Gets the value of the productSection property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the productSection property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getProductSection().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ProductSection }
*/ */
public List<ProductSection> getProductSection() { public Set<ProductSection> getProductSection() {
if (productSection == null) {
productSection = new ArrayList<ProductSection>();
}
return this.productSection; return this.productSection;
} }

View File

@ -18,10 +18,6 @@
*/ */
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlValue; import javax.xml.bind.annotation.XmlValue;
@ -30,15 +26,14 @@ import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
/** /**
* Contains key/value pair as property. * Contains key/value pair as property.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="PropertyType" /&gt; * &lt;complexType name="PropertyType" /&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "Property")
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Property")
public class Property { public class Property {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.PROPERTY; public static final String MEDIA_TYPE = VCloudDirectorMediaType.PROPERTY;
@ -83,9 +78,7 @@ public class Property {
} }
public Property build() { public Property build() {
Property property = new Property(key); return new Property(key, value);
property.setValue(value);
return property;
} }
public Builder fromProperty(Property in) { public Builder fromProperty(Property in) {
@ -94,10 +87,11 @@ public class Property {
} }
private Property() { private Property() {
// For JAXB and builder use // For JAXB
} }
private Property(String key) { private Property(String key, String value) {
this.value = value;
this.key = key; this.key = key;
} }
@ -113,10 +107,6 @@ public class Property {
return value; return value;
} }
public void setValue(String value) {
this.value = value;
}
/** /**
* Gets the value of the key property. * Gets the value of the key property.
*/ */

View File

@ -41,11 +41,7 @@ public class Reference extends ReferenceType<Reference> {
@Override @Override
public Reference build() { public Reference build() {
Reference reference = new Reference(href); return new Reference(href, id, name, type);
reference.setId(id);
reference.setName(name);
reference.setType(type);
return reference;
} }
/** /**
@ -94,8 +90,8 @@ public class Reference extends ReferenceType<Reference> {
} }
} }
protected Reference(URI href) { public Reference(URI href, String id, String name, String type) {
super(href); super(href, id, name, type);
} }
protected Reference() { protected Reference() {

View File

@ -22,9 +22,6 @@ import static com.google.common.base.Objects.equal;
import java.net.URI; import java.net.URI;
import java.util.Map; import java.util.Map;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -32,16 +29,15 @@ import com.google.common.base.Objects.ToStringHelper;
/** /**
* A reference to a resource. * A reference to a resource.
* * <p/>
* Contains an href attribute and optional name and type attributes. * Contains an href attribute and optional name and type attributes.
* * <p/>
* <pre> * <pre>
* &lt;xs:complexType name="ReferenceType"&gt; * &lt;xs:complexType name="ReferenceType"&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
public class ReferenceType<T extends ReferenceType<T>> implements URISupplier { public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
public static <T extends ReferenceType<T>> Builder<T> builder() { public static <T extends ReferenceType<T>> Builder<T> builder() {
@ -92,11 +88,7 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
} }
public ReferenceType<T> build() { public ReferenceType<T> build() {
ReferenceType<T> reference = new ReferenceType<T>(href); return new ReferenceType<T>(href, id, name, type);
reference.setId(id);
reference.setName(name);
reference.setType(type);
return reference;
} }
protected Builder<T> fromReferenceType(ReferenceType<T> in) { protected Builder<T> fromReferenceType(ReferenceType<T> in) {
@ -117,8 +109,11 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
@XmlAttribute @XmlAttribute
private String type; private String type;
protected ReferenceType(URI href) { protected ReferenceType(URI href, String id, String name, String type) {
this.href = href; this.href = href;
this.id = id;
this.name = name;
this.type = type;
} }
protected ReferenceType() { protected ReferenceType() {
@ -127,7 +122,7 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
/** /**
* Contains the URI to the entity. * Contains the URI to the entity.
* * <p/>
* An object reference, expressed in URL format. Because this URL includes the object identifier * An object reference, expressed in URL format. Because this URL includes the object identifier
* portion of the id attribute value, it uniquely identifies the object, persists for the life of * portion of the id attribute value, it uniquely identifies the object, persists for the life of
* the object, and is never reused. The value of the href attribute is a reference to a view of * the object, and is never reused. The value of the href attribute is a reference to a view of
@ -144,7 +139,7 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
/** /**
* The resource identifier, expressed in URN format. * The resource identifier, expressed in URN format.
* * <p/>
* The value of this attribute uniquely identifies the resource, persists for the life of the * The value of this attribute uniquely identifies the resource, persists for the life of the
* resource, and is never reused. * resource, and is never reused.
*/ */
@ -152,13 +147,9 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
return id; return id;
} }
public void setId(String id) {
this.id = id;
}
/** /**
* Contains the name of the the entity. * Contains the name of the the entity.
* * <p/>
* The object type, specified as a MIME content type, of the object that the link references. * The object type, specified as a MIME content type, of the object that the link references.
* This attribute is present only for links to objects. It is not present for links to actions. * This attribute is present only for links to objects. It is not present for links to actions.
* *
@ -168,13 +159,9 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
return name; return name;
} }
public void setName(String name) {
this.name = name;
}
/** /**
* Contains the type of the the entity. * Contains the type of the the entity.
* * <p/>
* The object type, specified as a MIME content type, of the object that the link references. * The object type, specified as a MIME content type, of the object that the link references.
* This attribute is present only for links to objects. It is not present for links to actions. * This attribute is present only for links to objects. It is not present for links to actions.
* *
@ -184,10 +171,6 @@ public class ReferenceType<T extends ReferenceType<T>> implements URISupplier {
return type; return type;
} }
public void setType(String type) {
this.type = type;
}
/** /**
* @see URISupplier#getURI() * @see URISupplier#getURI()
*/ */

View File

@ -19,21 +19,18 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** /**
*
* Parameters to be used for vm relocation. * Parameters to be used for vm relocation.
* * <p/>
* * <p/>
* <p>Java class for RelocateParams complex type. * <p>Java class for RelocateParams complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="RelocateParams"> * &lt;complexType name="RelocateParams">
* &lt;complexContent> * &lt;complexContent>
@ -45,10 +42,7 @@ import javax.xml.bind.annotation.XmlType;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "RelocateParams", propOrder = { @XmlType(name = "RelocateParams", propOrder = {
"datastore" "datastore"
}) })
@ -60,25 +54,10 @@ public class RelocateParams {
/** /**
* Gets the value of the datastore property. * Gets the value of the datastore property.
* *
* @return * @return possible object is
* possible object is
* {@link ReferenceType } * {@link ReferenceType }
*
*/ */
public ReferenceType<?> getDatastore() { public ReferenceType<?> getDatastore() {
return datastore; return datastore;
} }
/**
* Sets the value of the datastore property.
*
* @param value
* allowed object is
* {@link ReferenceType }
*
*/
public void setDatastore(ReferenceType<?> value) {
this.datastore = value;
}
} }

View File

@ -32,7 +32,6 @@ import com.google.common.collect.Sets;
*/ */
public class Resource extends ResourceType<Resource> { public class Resource extends ResourceType<Resource> {
@SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
@ -46,10 +45,7 @@ public class Resource extends ResourceType<Resource> {
@Override @Override
public Resource build() { public Resource build() {
Resource reference = new Resource(href); return new Resource(href, type, links);
reference.setType(type);
reference.setLinks(links);
return reference;
} }
/** /**
@ -98,11 +94,11 @@ public class Resource extends ResourceType<Resource> {
} }
} }
protected Resource(URI href) { private Resource(URI href, String type, Set<Link> links) {
super(href); super(href, type, links);
} }
protected Resource() { private Resource() {
// For JAXB // For JAXB
} }

View File

@ -22,26 +22,23 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import java.util.List; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.Lists; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/** /**
*
* Represents a list of references to resource entities. * Represents a list of references to resource entities.
* * <p/>
* * <p/>
* <p>Java class for ResourceEntities complex type. * <p>Java class for ResourceEntities complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="ResourceEntities"> * &lt;complexType name="ResourceEntities">
* &lt;complexContent> * &lt;complexContent>
@ -54,10 +51,7 @@ import com.google.common.collect.Lists;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ResourceEntities", propOrder = { @XmlType(name = "ResourceEntities", propOrder = {
"resourceEntities" "resourceEntities"
}) })
@ -72,13 +66,13 @@ public class ResourceEntities {
public static class Builder { public static class Builder {
private List<Reference> resourceEntities = Lists.newArrayList(); private Set<Reference> resourceEntities = Sets.newLinkedHashSet();
/** /**
* @see ResourceEntities#getResourceEntities() * @see ResourceEntities#getResourceEntities()
*/ */
public Builder resourceEntities(List<Reference> resourceEntities) { public Builder resourceEntities(Set<Reference> resourceEntities) {
this.resourceEntities = Lists.newArrayList(checkNotNull(resourceEntities, "resourceEntities")); this.resourceEntities = checkNotNull(resourceEntities, "resourceEntities");
return this; return this;
} }
@ -91,8 +85,7 @@ public class ResourceEntities {
} }
public ResourceEntities build() { public ResourceEntities build() {
ResourceEntities resourceEntities = new ResourceEntities(this.resourceEntities); return new ResourceEntities(this.resourceEntities);
return resourceEntities;
} }
@ -105,40 +98,18 @@ public class ResourceEntities {
// For JAXB and builder use // For JAXB and builder use
} }
private ResourceEntities(List<Reference> resourceEntity) { private ResourceEntities(Set<Reference> resourceEntity) {
this.resourceEntities = resourceEntity; this.resourceEntities = ImmutableSet.copyOf(resourceEntity);
} }
@XmlElement(name = "ResourceEntity") @XmlElement(name = "ResourceEntity")
protected List<Reference> resourceEntities; private Set<Reference> resourceEntities = Sets.newLinkedHashSet();
/** /**
* Gets the value of the resourceEntity property. * Gets the value of the resourceEntity property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the resourceEntity property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getResourceEntity().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link ReferenceType }
*
*
*/ */
public List<Reference> getResourceEntities() { public Set<Reference> getResourceEntities() {
if (resourceEntities == null) {
resourceEntities = Lists.newArrayList();
}
return this.resourceEntities; return this.resourceEntities;
} }

View File

@ -24,7 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -34,26 +33,17 @@ import com.google.common.collect.Sets;
/** /**
* Base type that represents a resource entity such as a vApp template or virtual media. * Base type that represents a resource entity such as a vApp template or virtual media.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="ResourceEntity" &gt; * &lt;complexType name="ResourceEntity" &gt;
* </pre> * </pre>
* *
* @author danikov * @author danikov
* @author Adam Lowe
*/ */
public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityType<T> { public abstract class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityType<T> {
public static <T extends ResourceEntityType<T>> Builder<T> builder() {
return new Builder<T>();
}
@Override
public Builder<T> toBuilder() {
return new Builder<T>().fromResourceEntityType(this);
}
public static class Builder<T extends ResourceEntityType<T>> extends EntityType.Builder<T> {
public static abstract class Builder<T extends ResourceEntityType<T>> extends EntityType.Builder<T> {
protected FilesList files; protected FilesList files;
protected Integer status; protected Integer status;
@ -73,19 +63,6 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
return this; return this;
} }
@Override
public ResourceEntityType<T> build() {
ResourceEntityType<T> resourceEntity = new ResourceEntityType<T>(href, name);
resourceEntity.setFiles(files);
resourceEntity.setStatus(status);
resourceEntity.setDescription(description);
resourceEntity.setTasksInProgress(tasksInProgress);
resourceEntity.setId(id);
resourceEntity.setType(type);
resourceEntity.setLinks(links);
return resourceEntity;
}
/** /**
* @see EntityType#getId() * @see EntityType#getId()
*/ */
@ -123,7 +100,7 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder<T> links(Set<Link> links) { public Builder<T> links(Set<Link> links) {
@ -132,7 +109,7 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder<T> link(Link link) { public Builder<T> link(Link link) {
@ -151,19 +128,22 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
} }
} }
protected ResourceEntityType() {
// for JAXB
}
protected ResourceEntityType(URI href, String name) {
super(href, name);
}
@XmlElement(name = "Files") @XmlElement(name = "Files")
protected FilesList files; protected FilesList files;
@XmlAttribute @XmlAttribute
protected Integer status; protected Integer status;
public ResourceEntityType(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, FilesList files, Integer status) {
super(href, type, links, description, tasksInProgress, id, name);
this.files = files;
this.status = status;
}
protected ResourceEntityType() {
// for JAXB
}
/** /**
* Gets the value of the files property. * Gets the value of the files property.
*/ */
@ -171,10 +151,6 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
return files; return files;
} }
public void setFiles(FilesList value) {
this.files = value;
}
/** /**
* Gets the value of the status property. * Gets the value of the status property.
*/ */
@ -182,10 +158,6 @@ public class ResourceEntityType<T extends ResourceEntityType<T>> extends EntityT
return status; return status;
} }
public void setStatus(Integer value) {
this.status = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,13 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
@ -36,27 +32,20 @@ import com.google.common.collect.Sets;
/** /**
* The base type for all objects in the vCloud model. * The base type for all objects in the vCloud model.
* * <p/>
* Has an optional list of links and href and type attributes. * Has an optional list of links and href and type attributes.
* * <p/>
* <pre> * <pre>
* &lt;xs:complexType name="ResourceType"&gt; * &lt;xs:complexType name="ResourceType"&gt;
* </pre> * </pre>
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@XmlAccessorType(XmlAccessType.FIELD) public abstract class ResourceType<T extends ResourceType<T>> implements URISupplier {
public class ResourceType<T extends ResourceType<T>> implements URISupplier {
public static <T extends ResourceType<T>> Builder<T> builder() { public abstract Builder<T> toBuilder();
return new Builder<T>();
}
public Builder<T> toBuilder() { public static abstract class Builder<T extends ResourceType<T>> {
return new Builder<T>().fromResourceType(this);
}
public static class Builder<T extends ResourceType<T>> {
protected URI href; protected URI href;
protected String type; protected String type;
@ -94,12 +83,7 @@ public class ResourceType<T extends ResourceType<T>> implements URISupplier {
return this; return this;
} }
public ResourceType<T> build() { public abstract ResourceType<T> build();
ResourceType<T> reference = new ResourceType<T>(href);
reference.setType(type);
reference.setLinks(links);
return reference;
}
protected Builder<T> fromResourceType(ResourceType<T> in) { protected Builder<T> fromResourceType(ResourceType<T> in) {
return href(in.getHref()).type(in.getType()).links(in.getLinks()); return href(in.getHref()).type(in.getType()).links(in.getLinks());
@ -110,11 +94,13 @@ public class ResourceType<T extends ResourceType<T>> implements URISupplier {
private URI href; private URI href;
@XmlAttribute @XmlAttribute
private String type; private String type;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Link") @XmlElement(name = "Link")
private Set<Link> links = Sets.newLinkedHashSet(); private Set<Link> links = Sets.newLinkedHashSet();
protected ResourceType(URI href) { protected ResourceType(URI href, String type, Set<Link> links) {
this.href = href; this.href = href;
this.type = type;
this.links = links;
} }
protected ResourceType() { protected ResourceType() {
@ -123,7 +109,7 @@ public class ResourceType<T extends ResourceType<T>> implements URISupplier {
/** /**
* Contains the URI to the entity. * Contains the URI to the entity.
* * <p/>
* An object reference, expressed in URL format. Because this URL includes the object identifier * An object reference, expressed in URL format. Because this URL includes the object identifier
* portion of the id attribute value, it uniquely identifies the object, persists for the life of * portion of the id attribute value, it uniquely identifies the object, persists for the life of
* the object, and is never reused. The value of the href attribute is a reference to a view of * the object, and is never reused. The value of the href attribute is a reference to a view of
@ -148,7 +134,7 @@ public class ResourceType<T extends ResourceType<T>> implements URISupplier {
/** /**
* Contains the type of the the entity. * Contains the type of the the entity.
* * <p/>
* The object type, specified as a MIME content type, of the object that the link references. * The object type, specified as a MIME content type, of the object that the link references.
* This attribute is present only for links to objects. It is not present for links to actions. * This attribute is present only for links to objects. It is not present for links to actions.
* *
@ -158,10 +144,6 @@ public class ResourceType<T extends ResourceType<T>> implements URISupplier {
return type; return type;
} }
public void setType(String type) {
this.type = type;
}
/** /**
* Set of optional links to an entity or operation associated with this object. * Set of optional links to an entity or operation associated with this object.
*/ */
@ -169,14 +151,6 @@ public class ResourceType<T extends ResourceType<T>> implements URISupplier {
return links; return links;
} }
public void setLinks(Set<Link> links) {
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
}
public void addLink(Link link) {
this.links.add(checkNotNull(link, "link"));
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -19,7 +19,6 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -31,7 +30,7 @@ import com.google.common.base.Objects;
* *
* @author danikov * @author danikov
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "RouterInfo") @XmlRootElement(name = "RouterInfo")
public class RouterInfo { public class RouterInfo {
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
@ -71,7 +70,7 @@ public class RouterInfo {
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "ExternalIp") @XmlElement(name = "ExternalIp")
private String externalIp; private String externalIp;
/** /**

View File

@ -20,13 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -44,8 +40,7 @@ import com.google.common.collect.Sets;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Session") @XmlRootElement(name = "Session")
@XmlAccessorType(XmlAccessType.FIELD)
public class Session { public class Session {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.SESSION; public static final String MEDIA_TYPE = VCloudDirectorMediaType.SESSION;
@ -124,7 +119,7 @@ public class Session {
this.links = ImmutableSet.copyOf(links); this.links = ImmutableSet.copyOf(links);
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Link") @XmlElement(name = "Link")
private Set<Link> links = Sets.newLinkedHashSet(); private Set<Link> links = Sets.newLinkedHashSet();
@XmlAttribute @XmlAttribute
private String user; private String user;
@ -138,7 +133,6 @@ public class Session {
} }
/** /**
*
* @return the user's login name. * @return the user's login name.
*/ */
public String getUser() { public String getUser() {
@ -146,7 +140,6 @@ public class Session {
} }
/** /**
*
* @return is the name of an organization of which the user is a member * @return is the name of an organization of which the user is a member
*/ */
public String getOrg() { public String getOrg() {
@ -154,7 +147,6 @@ public class Session {
} }
/** /**
*
* @return a reference to the current session * @return a reference to the current session
*/ */
public URI getHref() { public URI getHref() {

View File

@ -21,27 +21,24 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import java.util.ArrayList; import java.util.Set;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/** /**
*
* Represents a composition item. * Represents a composition item.
* * <p/>
* * <p/>
* <p>Java class for SourcedCompositionItemParam complex type. * <p>Java class for SourcedCompositionItemParam complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="SourcedCompositionItemParam"> * &lt;complexType name="SourcedCompositionItemParam">
* &lt;complexContent> * &lt;complexContent>
@ -58,10 +55,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SourcedCompositionItemParam", propOrder = { @XmlType(name = "SourcedCompositionItemParam", propOrder = {
"source", "source",
"vAppScopedLocalId", "vAppScopedLocalId",
@ -82,7 +76,7 @@ public class SourcedCompositionItemParam {
private Reference source; private Reference source;
private String vAppScopedLocalId; private String vAppScopedLocalId;
private InstantiationParams instantiationParams; private InstantiationParams instantiationParams;
private List<NetworkAssignment> networkAssignment; private Set<NetworkAssignment> networkAssignments = Sets.newLinkedHashSet();
private Boolean sourceDelete; private Boolean sourceDelete;
/** /**
@ -110,50 +104,47 @@ public class SourcedCompositionItemParam {
} }
/** /**
* @see SourcedCompositionItemParam#getNetworkAssignment() * @see SourcedCompositionItemParam#getNetworkAssignments()
*/ */
public Builder networkAssignment(List<NetworkAssignment> networkAssignment) { public Builder networkAssignments(Set<NetworkAssignment> networkAssignments) {
this.networkAssignment = networkAssignment; this.networkAssignments = networkAssignments;
return this; return this;
} }
/** /**
* @see SourcedCompositionItemParam#getSourceDelete() * @see SourcedCompositionItemParam#isSourceDelete()
*/ */
public Builder sourceDelete(Boolean sourceDelete) { public Builder sourceDelete(Boolean sourceDelete) {
this.sourceDelete = sourceDelete; this.sourceDelete = sourceDelete;
return this; return this;
} }
public SourcedCompositionItemParam build() { public SourcedCompositionItemParam build() {
SourcedCompositionItemParam sourcedCompositionItemParam = new SourcedCompositionItemParam(networkAssignment); return new SourcedCompositionItemParam(source, vAppScopedLocalId, instantiationParams, networkAssignments, sourceDelete);
sourcedCompositionItemParam.setSource(source);
sourcedCompositionItemParam.setVAppScopedLocalId(vAppScopedLocalId);
sourcedCompositionItemParam.setInstantiationParams(instantiationParams);
sourcedCompositionItemParam.setSourceDelete(sourceDelete);
return sourcedCompositionItemParam;
} }
public Builder fromSourcedCompositionItemParam(SourcedCompositionItemParam in) { public Builder fromSourcedCompositionItemParam(SourcedCompositionItemParam in) {
return source(in.getSource()) return source(in.getSource())
.vAppScopedLocalId(in.getVAppScopedLocalId()) .vAppScopedLocalId(in.getVAppScopedLocalId())
.instantiationParams(in.getInstantiationParams()) .instantiationParams(in.getInstantiationParams())
.networkAssignment(in.getNetworkAssignment()) .networkAssignments(in.getNetworkAssignments())
.sourceDelete(in.isSourceDelete()); .sourceDelete(in.isSourceDelete());
} }
} }
public SourcedCompositionItemParam(Reference source, String vAppScopedLocalId, InstantiationParams instantiationParams,
Set<NetworkAssignment> networkAssignments, Boolean sourceDelete) {
this.source = source;
this.vAppScopedLocalId = vAppScopedLocalId;
this.instantiationParams = instantiationParams;
this.networkAssignments = ImmutableSet.copyOf(networkAssignments);
this.sourceDelete = sourceDelete;
}
private SourcedCompositionItemParam() { private SourcedCompositionItemParam() {
// For JAXB and builder use // For JAXB and builder use
} }
private SourcedCompositionItemParam(List<NetworkAssignment> networkAssignment) {
this.networkAssignment = networkAssignment;
}
@XmlElement(name = "Source", required = true) @XmlElement(name = "Source", required = true)
protected Reference source; protected Reference source;
@XmlElement(name = "VAppScopedLocalId") @XmlElement(name = "VAppScopedLocalId")
@ -161,135 +152,75 @@ public class SourcedCompositionItemParam {
@XmlElement(name = "InstantiationParams") @XmlElement(name = "InstantiationParams")
protected InstantiationParams instantiationParams; protected InstantiationParams instantiationParams;
@XmlElement(name = "NetworkAssignment") @XmlElement(name = "NetworkAssignment")
protected List<NetworkAssignment> networkAssignment; protected Set<NetworkAssignment> networkAssignments = Sets.newLinkedHashSet();
@XmlAttribute @XmlAttribute
protected Boolean sourceDelete; protected Boolean sourceDelete;
/** /**
* Gets the value of the source property. * Gets the value of the source property.
* *
* @return * @return possible object is
* possible object is
* {@link Reference } * {@link Reference }
*
*/ */
public Reference getSource() { public Reference getSource() {
return source; return source;
} }
/**
* Sets the value of the source property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setSource(Reference value) {
this.source = value;
}
/** /**
* Gets the value of the vAppScopedLocalId property. * Gets the value of the vAppScopedLocalId property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getVAppScopedLocalId() { public String getVAppScopedLocalId() {
return vAppScopedLocalId; return vAppScopedLocalId;
} }
/**
* Sets the value of the vAppScopedLocalId property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setVAppScopedLocalId(String value) {
this.vAppScopedLocalId = value;
}
/** /**
* Gets the value of the instantiationParams property. * Gets the value of the instantiationParams property.
* *
* @return * @return possible object is
* possible object is
* {@link InstantiationParams } * {@link InstantiationParams }
*
*/ */
public InstantiationParams getInstantiationParams() { public InstantiationParams getInstantiationParams() {
return instantiationParams; return instantiationParams;
} }
/**
* Sets the value of the instantiationParams property.
*
* @param value
* allowed object is
* {@link InstantiationParams }
*
*/
public void setInstantiationParams(InstantiationParams value) {
this.instantiationParams = value;
}
/** /**
* Gets the value of the networkAssignment property. * Gets the value of the networkAssignment property.
* * <p/>
* <p> * <p/>
* This accessor method returns a reference to the live list, * This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the * not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object. * returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the networkAssignment property. * This is why there is not a <CODE>set</CODE> method for the networkAssignment property.
* * <p/>
* <p> * <p/>
* For example, to add a new item, do as follows: * For example, to add a new item, do as follows:
* <pre> * <pre>
* getNetworkAssignment().add(newItem); * getNetworkAssignment().add(newItem);
* </pre> * </pre>
* * <p/>
* * <p/>
* <p> * <p/>
* Objects of the following type(s) are allowed in the list * Objects of the following type(s) are allowed in the list
* {@link NetworkAssignmentType } * {@link NetworkAssignment }
*
*
*/ */
public List<NetworkAssignment> getNetworkAssignment() { public Set<NetworkAssignment> getNetworkAssignments() {
if (networkAssignment == null) { return this.networkAssignments;
networkAssignment = new ArrayList<NetworkAssignment>();
}
return this.networkAssignment;
} }
/** /**
* Gets the value of the sourceDelete property. * Gets the value of the sourceDelete property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isSourceDelete() { public Boolean isSourceDelete() {
return sourceDelete; return sourceDelete;
} }
/**
* Sets the value of the sourceDelete property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setSourceDelete(Boolean value) {
this.sourceDelete = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)
@ -300,7 +231,7 @@ public class SourcedCompositionItemParam {
return equal(source, that.source) && return equal(source, that.source) &&
equal(vAppScopedLocalId, that.vAppScopedLocalId) && equal(vAppScopedLocalId, that.vAppScopedLocalId) &&
equal(instantiationParams, that.instantiationParams) && equal(instantiationParams, that.instantiationParams) &&
equal(networkAssignment, that.networkAssignment) && equal(networkAssignments, that.networkAssignments) &&
equal(sourceDelete, that.sourceDelete); equal(sourceDelete, that.sourceDelete);
} }
@ -309,7 +240,7 @@ public class SourcedCompositionItemParam {
return Objects.hashCode(source, return Objects.hashCode(source,
vAppScopedLocalId, vAppScopedLocalId,
instantiationParams, instantiationParams,
networkAssignment, networkAssignments,
sourceDelete); sourceDelete);
} }
@ -319,7 +250,7 @@ public class SourcedCompositionItemParam {
.add("source", source) .add("source", source)
.add("vAppScopedLocalId", vAppScopedLocalId) .add("vAppScopedLocalId", vAppScopedLocalId)
.add("instantiationParams", instantiationParams) .add("instantiationParams", instantiationParams)
.add("networkAssignment", networkAssignment) .add("networkAssignments", networkAssignments)
.add("sourceDelete", sourceDelete).toString(); .add("sourceDelete", sourceDelete).toString();
} }

View File

@ -22,26 +22,23 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import java.util.List; import java.util.Collections;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.Lists; import com.google.common.collect.Sets;
/** /**
*
* Represents a list of supported VM hardware versions. * Represents a list of supported VM hardware versions.
* * <p/>
* * <p/>
* <p>Java class for SupportedHardwareVersions complex type. * <p>Java class for SupportedHardwareVersions complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="SupportedHardwareVersions"> * &lt;complexType name="SupportedHardwareVersions">
* &lt;complexContent> * &lt;complexContent>
@ -54,10 +51,7 @@ import com.google.common.collect.Lists;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "SupportedHardwareVersions", propOrder = { @XmlType(name = "SupportedHardwareVersions", propOrder = {
"supportedHardwareVersions" "supportedHardwareVersions"
}) })
@ -72,13 +66,13 @@ public class SupportedHardwareVersions {
public static class Builder { public static class Builder {
private List<String> supportedHardwareVersions = Lists.newArrayList(); private Set<String> supportedHardwareVersions = Sets.newLinkedHashSet();
/** /**
* @see SupportedHardwareVersions#getSupportedHardwareVersions() * @see SupportedHardwareVersions#getSupportedHardwareVersions()
*/ */
public Builder supportedHardwareVersions(List<String> supportedHardwareVersions) { public Builder supportedHardwareVersions(Set<String> supportedHardwareVersions) {
this.supportedHardwareVersions = Lists.newArrayList(checkNotNull(supportedHardwareVersions, "supportedHardwareVersions")); this.supportedHardwareVersions = Sets.newLinkedHashSet(checkNotNull(supportedHardwareVersions, "supportedHardwareVersions"));
return this; return this;
} }
@ -105,41 +99,19 @@ public class SupportedHardwareVersions {
// For JAXB and builder use // For JAXB and builder use
} }
private SupportedHardwareVersions(List<String> supportedHardwareVersions) { private SupportedHardwareVersions(Set<String> supportedHardwareVersions) {
this.supportedHardwareVersions = supportedHardwareVersions; this.supportedHardwareVersions = supportedHardwareVersions;
} }
@XmlElement(name = "SupportedHardwareVersion") @XmlElement(name = "SupportedHardwareVersion")
protected List<String> supportedHardwareVersions; protected Set<String> supportedHardwareVersions = Sets.newLinkedHashSet();
/** /**
* Gets the value of the supportedHardwareVersion property. * Gets the value of the supportedHardwareVersion property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the supportedHardwareVersion property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getSupportedHardwareVersion().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link String }
*
*
*/ */
public List<String> getSupportedHardwareVersions() { public Set<String> getSupportedHardwareVersions() {
if (supportedHardwareVersions == null) { return Collections.unmodifiableSet(supportedHardwareVersions);
supportedHardwareVersions = Lists.newArrayList();
}
return this.supportedHardwareVersions;
} }
@Override @Override

View File

@ -19,10 +19,7 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -34,8 +31,7 @@ import com.google.common.base.Objects;
* *
* @author danikov * @author danikov
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "SyslogServerSettings") @XmlRootElement(name = "SyslogServerSettings")
@XmlAccessorType(XmlAccessType.FIELD)
public class SyslogServerSettings { public class SyslogServerSettings {
public static Builder builder() { public static Builder builder() {
@ -83,9 +79,9 @@ public class SyslogServerSettings {
// For JAXB and builder use // For JAXB and builder use
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "SyslogServerIp1") @XmlElement(name = "SyslogServerIp1")
private String syslogServerIp1; private String syslogServerIp1;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "SyslogServerIp2") @XmlElement(name = "SyslogServerIp2")
private String syslogServerIp2; private String syslogServerIp2;
/** /**
@ -95,10 +91,6 @@ public class SyslogServerSettings {
return syslogServerIp1; return syslogServerIp1;
} }
public void setSyslogServerIp1(String syslogServerIp1) {
this.syslogServerIp1 = syslogServerIp1;
}
/** /**
* @return Secondary syslog server. * @return Secondary syslog server.
*/ */
@ -106,10 +98,6 @@ public class SyslogServerSettings {
return syslogServerIp2; return syslogServerIp2;
} }
public void setSyslogServerIp2(String syslogServerIp2) {
this.syslogServerIp2 = syslogServerIp2;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,14 +20,12 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -40,14 +38,14 @@ import com.google.common.collect.Sets;
/** /**
* Represents an asynchronous or long-running task in the vCloud environment. * Represents an asynchronous or long-running task in the vCloud environment.
* * <p/>
* <pre> * <pre>
* &lt;xs:complexType name="TaskType"&gt; * &lt;xs:complexType name="TaskType"&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "Task") @XmlRootElement(name = "Task")
public class Task extends EntityType<Task> { public class Task extends EntityType<Task> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.TASK; public static final String MEDIA_TYPE = VCloudDirectorMediaType.TASK;
@ -67,7 +65,6 @@ public class Task extends EntityType<Task> {
); );
} }
@SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
@ -190,25 +187,8 @@ public class Task extends EntityType<Task> {
@Override @Override
public Task build() { public Task build() {
Task task = new Task(href, name); return new Task(href, type, links, description, tasksInProgress, id, name,
task.setDescription(description); error, org, progress, owner, user, params, status, operation, operationName, startTime, endTime, expiryTime);
task.setTasksInProgress(tasksInProgress);
task.setId(id);
task.setType(type);
task.setLinks(links);
task.setError(error);
task.setOrg(org);
task.setOwner(owner);
task.setUser(user);
task.setParams(params);
task.setProgress(progress);
task.setStatus(status);
task.setOperation(operation);
task.setOperationName(operationName);
task.setStartTime(startTime);
task.setEndTime(endTime);
task.setExpiryTime(expiryTime);
return task;
} }
/** /**
@ -266,7 +246,7 @@ public class Task extends EntityType<Task> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder links(Set<Link> links) { public Builder links(Set<Link> links) {
@ -275,7 +255,7 @@ public class Task extends EntityType<Task> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder link(Link link) { public Builder link(Link link) {
@ -295,25 +275,41 @@ public class Task extends EntityType<Task> {
} }
} }
public Task(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
String id, String name, Error error, Reference org, Integer progress, Reference owner,
Reference user, Object params, String status, String operation, String operationName,
Date startTime, Date endTime, Date expiryTime) {
super(href, type, links, description, tasksInProgress, id, name);
this.error = error;
this.org = org;
this.progress = progress;
this.owner = owner;
this.user = user;
this.params = params;
this.status = status;
this.operation = operation;
this.operationName = operationName;
this.startTime = startTime;
this.endTime = endTime;
this.expiryTime = expiryTime;
}
private Task() { private Task() {
// For JAXB and builder use // For JAXB and builder use
} }
private Task(URI href, String name) {
super(href, name);
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Error") @XmlElement(name = "Error")
private Error error; private Error error;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Organization") @XmlElement(name = "Organization")
private Reference org; private Reference org;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Progress") @XmlElement(name = "Progress")
private Integer progress; private Integer progress;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Owner") @XmlElement(name = "Owner")
private Reference owner; private Reference owner;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "User") @XmlElement(name = "User")
private Reference user; private Reference user;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Params") @XmlElement(name = "Params")
private Object params; private Object params;
@XmlAttribute @XmlAttribute
private String status; private String status;
@ -335,10 +331,6 @@ public class Task extends EntityType<Task> {
return error; return error;
} }
public void setError(Error error) {
this.error = error;
}
/** /**
* The organization that started the task. * The organization that started the task.
*/ */
@ -346,10 +338,6 @@ public class Task extends EntityType<Task> {
return org; return org;
} }
public void setOrg(Reference org) {
this.org = org;
}
/** /**
* Reference to the owner of the task. * Reference to the owner of the task.
*/ */
@ -357,10 +345,6 @@ public class Task extends EntityType<Task> {
return owner; return owner;
} }
public void setOwner(Reference owner) {
this.owner = owner;
}
/** /**
* The user who started the task. * The user who started the task.
*/ */
@ -368,10 +352,6 @@ public class Task extends EntityType<Task> {
return user; return user;
} }
public void setUser(Reference user) {
this.user = user;
}
/** /**
* The parameters with which this task has been run. * The parameters with which this task has been run.
*/ */
@ -379,13 +359,9 @@ public class Task extends EntityType<Task> {
return params; return params;
} }
public void setParams(Object params) {
this.params = params;
}
/** /**
* The progress of a long running asynchronous task. * The progress of a long running asynchronous task.
* * <p/>
* The value is between 0 - 100. Not all tasks have progress, the value is not * The value is between 0 - 100. Not all tasks have progress, the value is not
* present for task which progress is not available. * present for task which progress is not available.
*/ */
@ -393,13 +369,9 @@ public class Task extends EntityType<Task> {
return progress; return progress;
} }
public void setProgress(Integer progress) {
this.progress = progress;
}
/** /**
* The execution status of the task. * The execution status of the task.
* * <p/>
* One of: * One of:
* <ul> * <ul>
* <li>queued - The task has been queued for execution. * <li>queued - The task has been queued for execution.
@ -415,10 +387,6 @@ public class Task extends EntityType<Task> {
return status; return status;
} }
public void setStatus(String status) {
this.status = status;
}
/** /**
* The display name of the operation that is tracked by this task. * The display name of the operation that is tracked by this task.
*/ */
@ -426,10 +394,6 @@ public class Task extends EntityType<Task> {
return operation; return operation;
} }
public void setOperation(String operation) {
this.operation = operation;
}
/** /**
* The name of the operation that is tracked by this task. * The name of the operation that is tracked by this task.
*/ */
@ -437,49 +401,33 @@ public class Task extends EntityType<Task> {
return operationName; return operationName;
} }
public void setOperationName(String operationName) {
this.operationName = operationName;
}
/** /**
* The date and time the system started executing the task. * The date and time the system started executing the task.
* * <p/>
* May not be present if the task hasn't been executed yet. * May not be present if the task hasn't been executed yet.
*/ */
public Date getStartTime() { public Date getStartTime() {
return startTime; return startTime;
} }
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
/** /**
* The date and time that processing of the task was completed. * The date and time that processing of the task was completed.
* * <p/>
* May not be present if the task is still being executed. * May not be present if the task is still being executed.
*/ */
public Date getEndTime() { public Date getEndTime() {
return endTime; return endTime;
} }
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
/** /**
* The date and time at which the task resource will be destroyed and no longer available for retrieval. * The date and time at which the task resource will be destroyed and no longer available for retrieval.
* * <p/>
* May not be present if the task has not been executed or is still being executed. * May not be present if the task has not been executed or is still being executed.
*/ */
public Date getExpiryTime() { public Date getExpiryTime() {
return expiryTime; return expiryTime;
} }
public void setExpiryTime(Date expiryTime) {
this.expiryTime = expiryTime;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,13 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.util.Collection; import java.util.Collection;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -37,8 +33,7 @@ import com.google.common.collect.Sets;
/** /**
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "TasksInProgress") @XmlRootElement(name = "TasksInProgress")
@XmlAccessorType(XmlAccessType.FIELD)
public class TasksInProgress { public class TasksInProgress {
public static Builder builder() { public static Builder builder() {
@ -86,7 +81,7 @@ public class TasksInProgress {
this.tasks = ImmutableSet.copyOf(tasks); this.tasks = ImmutableSet.copyOf(tasks);
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Task") @XmlElement(name = "Task")
private Set<Task> tasks = Sets.newLinkedHashSet(); private Set<Task> tasks = Sets.newLinkedHashSet();
public Set<Task> getTasks() { public Set<Task> getTasks() {

View File

@ -20,11 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -40,12 +38,11 @@ import com.google.common.collect.Sets;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "TasksList") @XmlRootElement(name = "TasksList")
public class TasksList extends EntityType<TasksList> { public class TasksList extends EntityType<TasksList> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.TASKS_LIST; public static final String MEDIA_TYPE = VCloudDirectorMediaType.TASKS_LIST;
@SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
@ -77,13 +74,7 @@ public class TasksList extends EntityType<TasksList> {
@Override @Override
public TasksList build() { public TasksList build() {
TasksList taskslist = new TasksList(href, name, tasks); return new TasksList(href, type, links, description, tasksInProgress, id, name, tasks);
taskslist.setDescription(description);
taskslist.setTasksInProgress(tasksInProgress);
taskslist.setId(id);
taskslist.setType(type);
taskslist.setLinks(links);
return taskslist;
} }
/** /**
@ -141,7 +132,7 @@ public class TasksList extends EntityType<TasksList> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder links(Set<Link> links) { public Builder links(Set<Link> links) {
@ -150,7 +141,7 @@ public class TasksList extends EntityType<TasksList> {
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder link(Link link) { public Builder link(Link link) {
@ -172,12 +163,12 @@ public class TasksList extends EntityType<TasksList> {
// For JAXB and builder use // For JAXB and builder use
} }
protected TasksList(URI href, String name, Set<Task> tasks) { public TasksList(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, Set<Task> tasks) {
super(href, name); super(href, type, links, description, tasksInProgress, id, name);
this.tasks = ImmutableSet.copyOf(tasks); this.tasks = ImmutableSet.copyOf(tasks);
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Task") @XmlElement(name = "Task")
private Set<Task> tasks = Sets.newLinkedHashSet(); private Set<Task> tasks = Sets.newLinkedHashSet();
public Set<Task> getTasks() { public Set<Task> getTasks() {

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -30,14 +28,13 @@ import com.google.common.base.Objects;
/** /**
*
* Represents vApp Template upload parameters. * Represents vApp Template upload parameters.
* * <p/>
* * <p/>
* <p>Java class for UploadVAppTemplateParams complex type. * <p>Java class for UploadVAppTemplateParams complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="UploadVAppTemplateParams"> * &lt;complexType name="UploadVAppTemplateParams">
* &lt;complexContent> * &lt;complexContent>
@ -49,10 +46,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "UploadVAppTemplateParams") @XmlType(name = "UploadVAppTemplateParams")
public class UploadVAppTemplateParams public class UploadVAppTemplateParams
extends ParamsType<UploadVAppTemplateParams> extends ParamsType<UploadVAppTemplateParams>
@ -81,7 +75,7 @@ public class UploadVAppTemplateParams
} }
/** /**
* @see UploadVAppTemplateParams#getManifestRequired() * @see UploadVAppTemplateParams#isManifestRequired()
*/ */
public Builder manifestRequired(Boolean manifestRequired) { public Builder manifestRequired(Boolean manifestRequired) {
this.manifestRequired = manifestRequired; this.manifestRequired = manifestRequired;
@ -90,10 +84,7 @@ public class UploadVAppTemplateParams
public UploadVAppTemplateParams build() { public UploadVAppTemplateParams build() {
UploadVAppTemplateParams uploadVAppTemplateParams = new UploadVAppTemplateParams(); return new UploadVAppTemplateParams(description, name, transferFormat, manifestRequired);
uploadVAppTemplateParams.setTransferFormat(transferFormat);
uploadVAppTemplateParams.setManifestRequired(manifestRequired);
return uploadVAppTemplateParams;
} }
@ -101,6 +92,7 @@ public class UploadVAppTemplateParams
public Builder fromParamsType(ParamsType<UploadVAppTemplateParams> in) { public Builder fromParamsType(ParamsType<UploadVAppTemplateParams> in) {
return Builder.class.cast(super.fromParamsType(in)); return Builder.class.cast(super.fromParamsType(in));
} }
public Builder fromUploadVAppTemplateParams(UploadVAppTemplateParams in) { public Builder fromUploadVAppTemplateParams(UploadVAppTemplateParams in) {
return fromParamsType(in) return fromParamsType(in)
.transferFormat(in.getTransferFormat()) .transferFormat(in.getTransferFormat())
@ -108,10 +100,15 @@ public class UploadVAppTemplateParams
} }
} }
private UploadVAppTemplateParams() { public UploadVAppTemplateParams(String description, String name, String transferFormat, Boolean manifestRequired) {
// For JAXB and builder use super(description, name);
this.transferFormat = transferFormat;
this.manifestRequired = manifestRequired;
} }
private UploadVAppTemplateParams() {
// For JAXB
}
@XmlAttribute @XmlAttribute
@ -122,51 +119,23 @@ public class UploadVAppTemplateParams
/** /**
* Gets the value of the transferFormat property. * Gets the value of the transferFormat property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getTransferFormat() { public String getTransferFormat() {
return transferFormat; return transferFormat;
} }
/**
* Sets the value of the transferFormat property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTransferFormat(String value) {
this.transferFormat = value;
}
/** /**
* Gets the value of the manifestRequired property. * Gets the value of the manifestRequired property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isManifestRequired() { public Boolean isManifestRequired() {
return manifestRequired; return manifestRequired;
} }
/**
* Sets the value of the manifestRequired property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setManifestRequired(Boolean value) {
this.manifestRequired = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -23,24 +23,21 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
/** /**
*
* Represents users in the vCloud system. * Represents users in the vCloud system.
* * <p/>
* * <p/>
* <p>Java class for User complex type. * <p>Java class for User complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="User"> * &lt;complexType name="User">
* &lt;complexContent> * &lt;complexContent>
@ -70,11 +67,9 @@ import com.google.common.collect.Sets;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "User")
@XmlType(name = "User", propOrder = { @XmlType(propOrder = {
"fullName", "fullName",
"emailAddress", "emailAddress",
"telephone", "telephone",
@ -98,11 +93,11 @@ public class User
extends EntityType<User> extends EntityType<User>
{ {
@SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
@Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().fromUser(this); return new Builder().fromUser(this);
} }
@ -153,7 +148,7 @@ public class User
} }
/** /**
* @see User#getIsEnabled() * @see User#isEnabled()
*/ */
public Builder isEnabled(Boolean isEnabled) { public Builder isEnabled(Boolean isEnabled) {
this.isEnabled = isEnabled; this.isEnabled = isEnabled;
@ -161,7 +156,7 @@ public class User
} }
/** /**
* @see User#getIsLocked() * @see User#isLocked()
*/ */
public Builder isLocked(Boolean isLocked) { public Builder isLocked(Boolean isLocked) {
this.isLocked = isLocked; this.isLocked = isLocked;
@ -169,7 +164,7 @@ public class User
} }
/** /**
* @see User#getIm() * @see User#getIM()
*/ */
public Builder im(String im) { public Builder im(String im) {
this.im = im; this.im = im;
@ -185,7 +180,7 @@ public class User
} }
/** /**
* @see User#getIsAlertEnabled() * @see User#isAlertEnabled()
*/ */
public Builder isAlertEnabled(Boolean isAlertEnabled) { public Builder isAlertEnabled(Boolean isAlertEnabled) {
this.isAlertEnabled = isAlertEnabled; this.isAlertEnabled = isAlertEnabled;
@ -209,7 +204,7 @@ public class User
} }
/** /**
* @see User#getIsExternal() * @see User#isExternal()
*/ */
public Builder isExternal(Boolean isExternal) { public Builder isExternal(Boolean isExternal) {
this.isExternal = isExternal; this.isExternal = isExternal;
@ -217,7 +212,7 @@ public class User
} }
/** /**
* @see User#getIsDefaultCached() * @see User#isDefaultCached()
*/ */
public Builder isDefaultCached(Boolean isDefaultCached) { public Builder isDefaultCached(Boolean isDefaultCached) {
this.isDefaultCached = isDefaultCached; this.isDefaultCached = isDefaultCached;
@ -225,7 +220,7 @@ public class User
} }
/** /**
* @see User#getIsGroupRole() * @see User#isGroupRole()
*/ */
public Builder isGroupRole(Boolean isGroupRole) { public Builder isGroupRole(Boolean isGroupRole) {
this.isGroupRole = isGroupRole; this.isGroupRole = isGroupRole;
@ -274,25 +269,11 @@ public class User
public User build() { public User build() {
User user = new User(im); return new User(href, type, links, description, tasksInProgress, id,
user.setFullName(fullName); name, fullName, emailAddress, telephone, isEnabled, isLocked,
user.setEmailAddress(emailAddress); im, nameInSource, isAlertEnabled, alertEmailPrefix, alertEmail,
user.setTelephone(telephone); isExternal, isDefaultCached, isGroupRole, storedVmQuota, deployedVmQuota,
user.setIsEnabled(isEnabled); role, password, groupReferences);
user.setIsLocked(isLocked);
user.setNameInSource(nameInSource);
user.setIsAlertEnabled(isAlertEnabled);
user.setAlertEmailPrefix(alertEmailPrefix);
user.setAlertEmail(alertEmail);
user.setIsExternal(isExternal);
user.setIsDefaultCached(isDefaultCached);
user.setIsGroupRole(isGroupRole);
user.setStoredVmQuota(storedVmQuota);
user.setDeployedVmQuota(deployedVmQuota);
user.setRole(role);
user.setPassword(password);
user.setGroupReferences(groupReferences);
return user;
} }
@ -333,7 +314,7 @@ public class User
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder links(Set<Link> links) { public Builder links(Set<Link> links) {
@ -342,7 +323,7 @@ public class User
} }
/** /**
* @see ReferenceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder link(Link link) { public Builder link(Link link) {
@ -355,6 +336,7 @@ public class User
public Builder fromEntityType(EntityType<User> in) { public Builder fromEntityType(EntityType<User> in) {
return Builder.class.cast(super.fromEntityType(in)); return Builder.class.cast(super.fromEntityType(in));
} }
public Builder fromUser(User in) { public Builder fromUser(User in) {
return fromEntityType(in) return fromEntityType(in)
.fullName(in.getFullName()) .fullName(in.getFullName())
@ -378,15 +360,6 @@ public class User
} }
} }
private User() {
// For JAXB and builder use
}
private User(String im) {
this.im = im;
}
@XmlElement(name = "FullName") @XmlElement(name = "FullName")
protected String fullName; protected String fullName;
@XmlElement(name = "EmailAddress") @XmlElement(name = "EmailAddress")
@ -424,438 +397,217 @@ public class User
@XmlElement(name = "GroupReferences") @XmlElement(name = "GroupReferences")
protected Object /* GroupsList */ groupReferences; protected Object /* GroupsList */ groupReferences;
public User(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id,
String name, String fullName, String emailAddress, String telephone, Boolean enabled, Boolean locked,
String im, String nameInSource, Boolean alertEnabled, String alertEmailPrefix, String alertEmail,
Boolean external, Boolean defaultCached, Boolean groupRole, Integer storedVmQuota, Integer deployedVmQuota,
Reference role, String password, Object groupReferences) {
super(href, type, links, description, tasksInProgress, id, name);
this.fullName = fullName;
this.emailAddress = emailAddress;
this.telephone = telephone;
isEnabled = enabled;
isLocked = locked;
this.im = checkNotNull(im, "im");
this.nameInSource = nameInSource;
isAlertEnabled = alertEnabled;
this.alertEmailPrefix = alertEmailPrefix;
this.alertEmail = alertEmail;
isExternal = external;
isDefaultCached = defaultCached;
isGroupRole = groupRole;
this.storedVmQuota = storedVmQuota;
this.deployedVmQuota = deployedVmQuota;
this.role = role;
this.password = password;
this.groupReferences = groupReferences;
}
private User() {
// For JAXB
}
/** /**
* Gets the value of the fullName property. * Gets the value of the fullName property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getFullName() { public String getFullName() {
return fullName; return fullName;
} }
/**
* Sets the value of the fullName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setFullName(String value) {
this.fullName = value;
}
/** /**
* Gets the value of the emailAddress property. * Gets the value of the emailAddress property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getEmailAddress() { public String getEmailAddress() {
return emailAddress; return emailAddress;
} }
/**
* Sets the value of the emailAddress property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setEmailAddress(String value) {
this.emailAddress = value;
}
/** /**
* Gets the value of the telephone property. * Gets the value of the telephone property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getTelephone() { public String getTelephone() {
return telephone; return telephone;
} }
/**
* Sets the value of the telephone property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setTelephone(String value) {
this.telephone = value;
}
/** /**
* Gets the value of the isEnabled property. * Gets the value of the isEnabled property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isEnabled() { public Boolean isEnabled() {
return isEnabled; return isEnabled;
} }
/**
* Sets the value of the isEnabled property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsEnabled(Boolean value) {
this.isEnabled = value;
}
/** /**
* Gets the value of the isLocked property. * Gets the value of the isLocked property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isLocked() { public Boolean isLocked() {
return isLocked; return isLocked;
} }
/**
* Sets the value of the isLocked property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsLocked(Boolean value) {
this.isLocked = value;
}
/** /**
* Gets the value of the im property. * Gets the value of the im property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getIM() { public String getIM() {
return im; return im;
} }
/**
* Sets the value of the im property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIM(String value) {
this.im = value;
}
/** /**
* Gets the value of the nameInSource property. * Gets the value of the nameInSource property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getNameInSource() { public String getNameInSource() {
return nameInSource; return nameInSource;
} }
/**
* Sets the value of the nameInSource property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNameInSource(String value) {
this.nameInSource = value;
}
/** /**
* Gets the value of the isAlertEnabled property. * Gets the value of the isAlertEnabled property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isAlertEnabled() { public Boolean isAlertEnabled() {
return isAlertEnabled; return isAlertEnabled;
} }
/**
* Sets the value of the isAlertEnabled property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsAlertEnabled(Boolean value) {
this.isAlertEnabled = value;
}
/** /**
* Gets the value of the alertEmailPrefix property. * Gets the value of the alertEmailPrefix property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getAlertEmailPrefix() { public String getAlertEmailPrefix() {
return alertEmailPrefix; return alertEmailPrefix;
} }
/**
* Sets the value of the alertEmailPrefix property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAlertEmailPrefix(String value) {
this.alertEmailPrefix = value;
}
/** /**
* Gets the value of the alertEmail property. * Gets the value of the alertEmail property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getAlertEmail() { public String getAlertEmail() {
return alertEmail; return alertEmail;
} }
/**
* Sets the value of the alertEmail property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAlertEmail(String value) {
this.alertEmail = value;
}
/** /**
* Gets the value of the isExternal property. * Gets the value of the isExternal property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isExternal() { public Boolean isExternal() {
return isExternal; return isExternal;
} }
/**
* Sets the value of the isExternal property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsExternal(Boolean value) {
this.isExternal = value;
}
/** /**
* Gets the value of the isDefaultCached property. * Gets the value of the isDefaultCached property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isDefaultCached() { public Boolean isDefaultCached() {
return isDefaultCached; return isDefaultCached;
} }
/**
* Sets the value of the isDefaultCached property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsDefaultCached(Boolean value) {
this.isDefaultCached = value;
}
/** /**
* Gets the value of the isGroupRole property. * Gets the value of the isGroupRole property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isGroupRole() { public Boolean isGroupRole() {
return isGroupRole; return isGroupRole;
} }
/**
* Sets the value of the isGroupRole property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsGroupRole(Boolean value) {
this.isGroupRole = value;
}
/** /**
* Gets the value of the storedVmQuota property. * Gets the value of the storedVmQuota property.
* *
* @return * @return possible object is
* possible object is
* {@link Integer } * {@link Integer }
*
*/ */
public Integer getStoredVmQuota() { public Integer getStoredVmQuota() {
return storedVmQuota; return storedVmQuota;
} }
/**
* Sets the value of the storedVmQuota property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setStoredVmQuota(Integer value) {
this.storedVmQuota = value;
}
/** /**
* Gets the value of the deployedVmQuota property. * Gets the value of the deployedVmQuota property.
* *
* @return * @return possible object is
* possible object is
* {@link Integer } * {@link Integer }
*
*/ */
public Integer getDeployedVmQuota() { public Integer getDeployedVmQuota() {
return deployedVmQuota; return deployedVmQuota;
} }
/**
* Sets the value of the deployedVmQuota property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setDeployedVmQuota(Integer value) {
this.deployedVmQuota = value;
}
/** /**
* Gets the value of the role property. * Gets the value of the role property.
* *
* @return * @return possible object is
* possible object is
* {@link Reference } * {@link Reference }
*
*/ */
public Reference getRole() { public Reference getRole() {
return role; return role;
} }
/**
* Sets the value of the role property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setRole(Reference value) {
this.role = value;
}
/** /**
* Gets the value of the password property. * Gets the value of the password property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getPassword() { public String getPassword() {
return password; return password;
} }
/**
* Sets the value of the password property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPassword(String value) {
this.password = value;
}
/** /**
* Gets the value of the groupReferences property. * Gets the value of the groupReferences property.
* *
* @return * @return possible object is
* possible object is * {@link GroupsListType }
* {@link GroupsList }
*
*/ */
public Object /* GroupsList */ getGroupReferences() { public Object /* GroupsList */ getGroupReferences() {
return groupReferences; return groupReferences;
} }
/**
* Sets the value of the groupReferences property.
*
* @param value
* allowed object is
* {@link GroupsList }
*
*/
public void setGroupReferences(Object /* GroupsList */ value) {
this.groupReferences = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -21,8 +21,6 @@ package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso;
@ -32,14 +30,13 @@ import com.google.common.base.Objects;
/** /**
*
* Represents vApp creation parameters. * Represents vApp creation parameters.
* * <p/>
* * <p/>
* <p>Java class for VAppCreationParams complex type. * <p>Java class for VAppCreationParams complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="VAppCreationParams"> * &lt;complexType name="VAppCreationParams">
* &lt;complexContent> * &lt;complexContent>
@ -55,10 +52,7 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VAppCreationParams", propOrder = { @XmlType(name = "VAppCreationParams", propOrder = {
"vAppParent", "vAppParent",
"instantiationParams" "instantiationParams"
@ -105,7 +99,7 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
} }
/** /**
* @see VAppCreationParamsType#getDeploy() * @see VAppCreationParamsType#isDeploy()
*/ */
public Builder<T> deploy(Boolean deploy) { public Builder<T> deploy(Boolean deploy) {
this.deploy = deploy; this.deploy = deploy;
@ -113,7 +107,7 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
} }
/** /**
* @see VAppCreationParamsType#getPowerOn() * @see VAppCreationParamsType#isPowerOn()
*/ */
public Builder<T> powerOn(Boolean powerOn) { public Builder<T> powerOn(Boolean powerOn) {
this.powerOn = powerOn; this.powerOn = powerOn;
@ -122,14 +116,7 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
public VAppCreationParamsType<T> build() { public VAppCreationParamsType<T> build() {
VAppCreationParamsType<T> vAppCreationParams = new VAppCreationParamsType<T>(); return new VAppCreationParamsType<T>(description, name, vAppParent, instantiationParams,deploy, powerOn);
vAppCreationParams.setVAppParent(vAppParent);
vAppCreationParams.setInstantiationParams(instantiationParams);
vAppCreationParams.setDeploy(deploy);
vAppCreationParams.setPowerOn(powerOn);
vAppCreationParams.setDescription(description);
vAppCreationParams.setName(name);
return vAppCreationParams;
} }
/** /**
@ -156,6 +143,7 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
public Builder<T> fromParamsType(ParamsType<T> in) { public Builder<T> fromParamsType(ParamsType<T> in) {
return Builder.class.cast(super.fromParamsType(in)); return Builder.class.cast(super.fromParamsType(in));
} }
public Builder<T> fromVAppCreationParamsType(VAppCreationParamsType<T> in) { public Builder<T> fromVAppCreationParamsType(VAppCreationParamsType<T> in) {
return fromParamsType(in) return fromParamsType(in)
.vAppParent(in.getVAppParent()) .vAppParent(in.getVAppParent())
@ -165,10 +153,6 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
} }
} }
protected VAppCreationParamsType() {
// For JAXB and builder use
}
@XmlElement(name = "VAppParent") @XmlElement(name = "VAppParent")
protected Reference vAppParent; protected Reference vAppParent;
@XmlElement(name = "InstantiationParams") @XmlElement(name = "InstantiationParams")
@ -178,102 +162,59 @@ public class VAppCreationParamsType<T extends VAppCreationParamsType<T>>
@XmlAttribute @XmlAttribute
protected Boolean powerOn; protected Boolean powerOn;
public VAppCreationParamsType(String description, String name, Reference vAppParent,
InstantiationParams instantiationParams, Boolean deploy, Boolean powerOn) {
super(description, name);
this.vAppParent = vAppParent;
this.instantiationParams = instantiationParams;
this.deploy = deploy;
this.powerOn = powerOn;
}
protected VAppCreationParamsType() {
// For JAXB and builder use
}
/** /**
* Gets the value of the vAppParent property. * Gets the value of the vAppParent property.
* *
* @return * @return possible object is
* possible object is
* {@link Reference } * {@link Reference }
*
*/ */
public Reference getVAppParent() { public Reference getVAppParent() {
return vAppParent; return vAppParent;
} }
/**
* Sets the value of the vAppParent property.
*
* @param value
* allowed object is
* {@link Reference }
*
*/
public void setVAppParent(Reference value) {
this.vAppParent = value;
}
/** /**
* Gets the value of the instantiationParams property. * Gets the value of the instantiationParams property.
* *
* @return * @return possible object is
* possible object is
* {@link InstantiationParams } * {@link InstantiationParams }
*
*/ */
public InstantiationParams getInstantiationParams() { public InstantiationParams getInstantiationParams() {
return instantiationParams; return instantiationParams;
} }
/**
* Sets the value of the instantiationParams property.
*
* @param value
* allowed object is
* {@link InstantiationParams }
*
*/
public void setInstantiationParams(InstantiationParams value) {
this.instantiationParams = value;
}
/** /**
* Gets the value of the deploy property. * Gets the value of the deploy property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isDeploy() { public Boolean isDeploy() {
return deploy; return deploy;
} }
/**
* Sets the value of the deploy property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setDeploy(Boolean value) {
this.deploy = value;
}
/** /**
* Gets the value of the powerOn property. * Gets the value of the powerOn property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isPowerOn() { public Boolean isPowerOn() {
return powerOn; return powerOn;
} }
/**
* Sets the value of the powerOn property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setPowerOn(Boolean value) {
this.powerOn = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -24,9 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
@ -36,14 +33,13 @@ import com.google.common.collect.Sets;
/** /**
*
* Represents a VApp network configuration. * Represents a VApp network configuration.
* * <p/>
* * <p/>
* <p>Java class for VAppNetworkConfiguration complex type. * <p>Java class for VAppNetworkConfiguration complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="VAppNetworkConfiguration"> * &lt;complexType name="VAppNetworkConfiguration">
* &lt;complexContent> * &lt;complexContent>
@ -59,23 +55,18 @@ import com.google.common.collect.Sets;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "VAppNetworkConfiguration", propOrder = { @XmlType(name = "VAppNetworkConfiguration", propOrder = {
"description", "description",
"configuration", "configuration",
"isDeployed" "isDeployed"
}) })
public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>> extends ResourceType<T> {
extends ResourceType<T>
{
public static <T extends VAppNetworkConfiguration<T>> Builder<T> builder() { public static <T extends VAppNetworkConfiguration<T>> Builder<T> builder() {
return new Builder<T>(); return new Builder<T>();
} }
@Override
public Builder<T> toBuilder() { public Builder<T> toBuilder() {
return new Builder<T>().fromVAppNetworkConfiguration(this); return new Builder<T>().fromVAppNetworkConfiguration(this);
} }
@ -104,7 +95,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>>
} }
/** /**
* @see VAppNetworkConfiguration#getIsDeployed() * @see VAppNetworkConfiguration#isDeployed()
*/ */
public Builder<T> isDeployed(Boolean isDeployed) { public Builder<T> isDeployed(Boolean isDeployed) {
this.isDeployed = isDeployed; this.isDeployed = isDeployed;
@ -121,12 +112,8 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>>
public VAppNetworkConfiguration<T> build() { public VAppNetworkConfiguration<T> build() {
VAppNetworkConfiguration<T> vAppNetworkConfiguration = new VAppNetworkConfiguration<T>(); return new VAppNetworkConfiguration<T>(href, type, links,
vAppNetworkConfiguration.setDescription(description); description, configuration, isDeployed, networkName);
vAppNetworkConfiguration.setConfiguration(configuration);
vAppNetworkConfiguration.setIsDeployed(isDeployed);
vAppNetworkConfiguration.setNetworkName(networkName);
return vAppNetworkConfiguration;
} }
@ -173,6 +160,7 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>>
public Builder<T> fromResourceType(ResourceType<T> in) { public Builder<T> fromResourceType(ResourceType<T> in) {
return Builder.class.cast(super.fromResourceType(in)); return Builder.class.cast(super.fromResourceType(in));
} }
public Builder<T> fromVAppNetworkConfiguration(VAppNetworkConfiguration<T> in) { public Builder<T> fromVAppNetworkConfiguration(VAppNetworkConfiguration<T> in) {
return fromResourceType(in) return fromResourceType(in)
.description(in.getDescription()) .description(in.getDescription())
@ -182,12 +170,6 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>>
} }
} }
private VAppNetworkConfiguration() {
// For JAXB and builder use
}
@XmlElement(name = "Description") @XmlElement(name = "Description")
protected String description; protected String description;
@XmlElement(name = "Configuration", required = true) @XmlElement(name = "Configuration", required = true)
@ -197,102 +179,59 @@ public class VAppNetworkConfiguration<T extends VAppNetworkConfiguration<T>>
@XmlAttribute(required = true) @XmlAttribute(required = true)
protected String networkName; protected String networkName;
public VAppNetworkConfiguration(URI href, String type, Set<Link> links, String description,
NetworkConfiguration configuration, Boolean deployed, String networkName) {
super(href, type, links);
this.description = description;
this.configuration = configuration;
isDeployed = deployed;
this.networkName = networkName;
}
private VAppNetworkConfiguration() {
// For JAXB
}
/** /**
* Gets the value of the description property. * Gets the value of the description property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getDescription() { public String getDescription() {
return description; return description;
} }
/**
* Sets the value of the description property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setDescription(String value) {
this.description = value;
}
/** /**
* Gets the value of the configuration property. * Gets the value of the configuration property.
* *
* @return * @return possible object is
* possible object is
* {@link NetworkConfiguration } * {@link NetworkConfiguration }
*
*/ */
public NetworkConfiguration getConfiguration() { public NetworkConfiguration getConfiguration() {
return configuration; return configuration;
} }
/**
* Sets the value of the configuration property.
*
* @param value
* allowed object is
* {@link NetworkConfiguration }
*
*/
public void setConfiguration(NetworkConfiguration value) {
this.configuration = value;
}
/** /**
* Gets the value of the isDeployed property. * Gets the value of the isDeployed property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isDeployed() { public Boolean isDeployed() {
return isDeployed; return isDeployed;
} }
/**
* Sets the value of the isDeployed property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsDeployed(Boolean value) {
this.isDeployed = value;
}
/** /**
* Gets the value of the networkName property. * Gets the value of the networkName property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getNetworkName() { public String getNetworkName() {
return networkName; return networkName;
} }
/**
* Sets the value of the networkName property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNetworkName(String value) {
this.networkName = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,20 +20,16 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.DeploymentOptionSection; import org.jclouds.vcloud.director.v1_5.domain.ovf.DeploymentOptionSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.DiskSection; import org.jclouds.vcloud.director.v1_5.domain.ovf.DiskSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection; import org.jclouds.vcloud.director.v1_5.domain.ovf.NetworkSection;
@ -42,6 +38,8 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection; import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualHardwareSection;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/** /**
@ -70,7 +68,6 @@ import com.google.common.base.Objects;
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "VAppTemplate") @XmlRootElement(name = "VAppTemplate")
@XmlType(propOrder = { @XmlType(propOrder = {
"owner", "owner",
@ -78,23 +75,20 @@ import com.google.common.base.Objects;
"sections", "sections",
"vAppScopedLocalId" "vAppScopedLocalId"
}) })
public class VAppTemplate public class VAppTemplate extends ResourceEntityType<VAppTemplate> {
extends ResourceEntityType<VAppTemplate>
{
@SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
@Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().fromVAppTemplate(this); return new Builder().fromVAppTemplate(this);
} }
public static class Builder extends ResourceEntityType.Builder<VAppTemplate> { public static class Builder extends ResourceEntityType.Builder<VAppTemplate> {
private Owner owner; private Owner owner;
private VAppTemplateChildren children; private Set<VAppTemplate> children = Sets.newLinkedHashSet();
private List<SectionType> sections; private Set<SectionType> sections = Sets.newLinkedHashSet();
private String vAppScopedLocalId; private String vAppScopedLocalId;
private Boolean ovfDescriptorUploaded; private Boolean ovfDescriptorUploaded;
private Boolean goldMaster; private Boolean goldMaster;
@ -110,15 +104,15 @@ public class VAppTemplate
/** /**
* @see VAppTemplate#getChildren() * @see VAppTemplate#getChildren()
*/ */
public Builder children(VAppTemplateChildren children) { public Builder children(Set<VAppTemplate> children) {
this.children = children; this.children = checkNotNull(children, "children");
return this; return this;
} }
/** /**
* @see VAppTemplate#getSections() * @see VAppTemplate#getSections()
*/ */
public Builder sections(List<SectionType> sections) { public Builder sections(Set<SectionType> sections) {
this.sections = sections; this.sections = sections;
return this; return this;
} }
@ -149,18 +143,9 @@ public class VAppTemplate
@Override @Override
public VAppTemplate build() { public VAppTemplate build() {
VAppTemplate result = new VAppTemplate(href, name, owner, children, sections, vAppScopedLocalId, ovfDescriptorUploaded, goldMaster); return new VAppTemplate(href, type, links, description, tasksInProgress, id, name, files, status, owner, children, sections, vAppScopedLocalId, ovfDescriptorUploaded, goldMaster);
result.setFiles(files);
result.setStatus(status);
result.setDescription(description);
result.setTasksInProgress(tasksInProgress);
result.setId(id);
result.setType(type);
result.setLinks(links);
return result;
} }
@Override @Override
public Builder fromResourceEntityType(ResourceEntityType<VAppTemplate> in) { public Builder fromResourceEntityType(ResourceEntityType<VAppTemplate> in) {
return Builder.class.cast(super.fromResourceEntityType(in)); return Builder.class.cast(super.fromResourceEntityType(in));
@ -270,10 +255,10 @@ public class VAppTemplate
@XmlElementRef @XmlElementRef
protected Owner owner; protected Owner owner;
@XmlElement(name = "Children")
protected VAppTemplateChildren children;
@XmlElementRef @XmlElementRef
protected List<SectionType> sections; protected VAppTemplateChildren children = VAppTemplateChildren.builder().build();
@XmlElementRef
protected Set<SectionType> sections = Sets.newLinkedHashSet();
@XmlElement(name = "VAppScopedLocalId") @XmlElement(name = "VAppScopedLocalId")
protected String vAppScopedLocalId; protected String vAppScopedLocalId;
@XmlAttribute @XmlAttribute
@ -281,20 +266,19 @@ public class VAppTemplate
@XmlAttribute @XmlAttribute
protected Boolean goldMaster; protected Boolean goldMaster;
private VAppTemplate(URI href, String name, @Nullable Owner owner, @Nullable VAppTemplateChildren children, private VAppTemplate(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress,
List<SectionType> sections, @Nullable String vAppScopedLocalId, String id, String name, FilesList files, Integer status, Owner owner, Set<VAppTemplate> children, Set<SectionType> sections, String vAppScopedLocalId, Boolean ovfDescriptorUploaded, Boolean goldMaster) {
@Nullable Boolean ovfDescriptorUploaded, @Nullable Boolean goldMaster) { super(href, type, links, description, tasksInProgress, id, name, files, status);
super(href, name);
this.sections = sections;
this.owner = owner; this.owner = owner;
this.children = children; this.children = VAppTemplateChildren.builder().vms(children).build();
this.sections = ImmutableSet.copyOf(sections);
this.vAppScopedLocalId = vAppScopedLocalId; this.vAppScopedLocalId = vAppScopedLocalId;
this.ovfDescriptorUploaded = ovfDescriptorUploaded; this.ovfDescriptorUploaded = ovfDescriptorUploaded;
this.goldMaster = goldMaster; this.goldMaster = goldMaster;
} }
private VAppTemplate() { private VAppTemplate() {
// For JAXB and builder use // For JAXB
} }
/** /**
@ -307,34 +291,14 @@ public class VAppTemplate
return owner; return owner;
} }
/**
* Sets the value of the owner property.
*
* @param value allowed object is
* {@link Owner }
*/
public void setOwner(Owner value) {
this.owner = value;
}
/** /**
* Gets the value of the children property. * Gets the value of the children property.
* *
* @return possible object is * @return possible object is
* {@link VAppTemplateChildren } * {@link VAppTemplateChildren }
*/ */
public VAppTemplateChildren getChildren() { public Set<VAppTemplate> getChildren() {
return children; return children.getVms();
}
/**
* Sets the value of the children property.
*
* @param value allowed object is
* {@link VAppTemplateChildren }
*/
public void setChildren(VAppTemplateChildren value) {
this.children = value;
} }
/** /**
@ -375,10 +339,7 @@ public class VAppTemplate
* {@link JAXBElement }{@code <}{@link DiskSection }{@code >} * {@link JAXBElement }{@code <}{@link DiskSection }{@code >}
* {@link JAXBElement }{@code <}{@link InstallSection }{@code >} * {@link JAXBElement }{@code <}{@link InstallSection }{@code >}
*/ */
public List<SectionType> getSections() { public Set<SectionType> getSections() {
if (sections == null) {
sections = new ArrayList<SectionType>();
}
return this.sections; return this.sections;
} }
@ -392,16 +353,6 @@ public class VAppTemplate
return vAppScopedLocalId; return vAppScopedLocalId;
} }
/**
* Sets the value of the vAppScopedLocalId property.
*
* @param value allowed object is
* {@link String }
*/
public void setVAppScopedLocalId(String value) {
this.vAppScopedLocalId = value;
}
/** /**
* Gets the value of the ovfDescriptorUploaded property. * Gets the value of the ovfDescriptorUploaded property.
* *
@ -412,16 +363,6 @@ public class VAppTemplate
return ovfDescriptorUploaded; return ovfDescriptorUploaded;
} }
/**
* Sets the value of the ovfDescriptorUploaded property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setOvfDescriptorUploaded(Boolean value) {
this.ovfDescriptorUploaded = value;
}
/** /**
* Gets the value of the goldMaster property. * Gets the value of the goldMaster property.
* *
@ -436,16 +377,6 @@ public class VAppTemplate
} }
} }
/**
* Sets the value of the goldMaster property.
*
* @param value allowed object is
* {@link Boolean }
*/
public void setGoldMaster(Boolean value) {
this.goldMaster = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,27 +20,26 @@
package org.jclouds.vcloud.director.v1_5.domain; package org.jclouds.vcloud.director.v1_5.domain;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.ArrayList; import java.util.Set;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;
/** /**
*
* Represents vApp template children. * Represents vApp template children.
* * <p/>
* * <p/>
* <p>Java class for VAppTemplateChildren complex type. * <p>Java class for VAppTemplateChildren complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="VAppTemplateChildren"> * &lt;complexType name="VAppTemplateChildren">
* &lt;complexContent> * &lt;complexContent>
@ -53,12 +52,10 @@ import com.google.common.base.Objects;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "Children")
@XmlType(name = "VAppTemplateChildren", propOrder = { @XmlType(propOrder = {
"vm" "vms"
}) })
public class VAppTemplateChildren { public class VAppTemplateChildren {
public static Builder builder() { public static Builder builder() {
@ -70,68 +67,43 @@ public class VAppTemplateChildren {
} }
public static class Builder { public static class Builder {
private Set<VAppTemplate> vms = Sets.newLinkedHashSet();
private List<VAppTemplate> vm;
/** /**
* @see VAppTemplateChildren#getVm() * @see VAppTemplateChildren#getVms()
*/ */
public Builder vm(List<VAppTemplate> vm) { public Builder vms(Set<VAppTemplate> vms) {
this.vm = vm; this.vms = checkNotNull(vms, "vms");
return this; return this;
} }
public VAppTemplateChildren build() { public VAppTemplateChildren build() {
VAppTemplateChildren vAppTemplateChildren = new VAppTemplateChildren(vm); return new VAppTemplateChildren(vms);
return vAppTemplateChildren;
} }
public Builder fromVAppTemplateChildren(VAppTemplateChildren in) { public Builder fromVAppTemplateChildren(VAppTemplateChildren in) {
return vm(in.getVm()); return vms(in.getVms());
} }
} }
private VAppTemplateChildren(Set<VAppTemplate> vm) {
this.vms = ImmutableSet.copyOf(vm);
}
private VAppTemplateChildren() { private VAppTemplateChildren() {
// For JAXB and builder use // For JAXB
} }
private VAppTemplateChildren(List<VAppTemplate> vm) {
this.vm = vm;
}
@XmlElement(name = "Vm") @XmlElement(name = "Vm")
protected List<VAppTemplate> vm; protected Set<VAppTemplate> vms = Sets.newLinkedHashSet();
/** /**
* Gets the value of the vm property. * Gets the value of the vm property.
*
* <p>
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a <CODE>set</CODE> method for the vm property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getVm().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link VAppTemplate }
*
*
*/ */
public List<VAppTemplate> getVm() { public Set<VAppTemplate> getVms() {
if (vm == null) { return this.vms;
vm = new ArrayList<VAppTemplate>();
}
return this.vm;
} }
@Override @Override
@ -141,18 +113,18 @@ public class VAppTemplateChildren {
if (o == null || getClass() != o.getClass()) if (o == null || getClass() != o.getClass())
return false; return false;
VAppTemplateChildren that = VAppTemplateChildren.class.cast(o); VAppTemplateChildren that = VAppTemplateChildren.class.cast(o);
return equal(vm, that.vm); return equal(vms, that.vms);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(vm); return Objects.hashCode(vms);
} }
@Override @Override
public String toString() { public String toString() {
return Objects.toStringHelper("") return Objects.toStringHelper("")
.add("vm", vm).toString(); .add("vms", vms).toString();
} }
} }

View File

@ -24,9 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
@ -38,14 +35,13 @@ import com.google.common.collect.Sets;
/** /**
*
* Represents a virtual data center (vDC). * Represents a virtual data center (vDC).
* * <p/>
* * <p/>
* <p>Java class for Vdc complex type. * <p>Java class for Vdc complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="Vdc"> * &lt;complexType name="Vdc">
* &lt;complexContent> * &lt;complexContent>
@ -68,10 +64,7 @@ import com.google.common.collect.Sets;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Vdc") @XmlRootElement(name = "Vdc")
@XmlType(propOrder = { @XmlType(propOrder = {
"allocationModel", "allocationModel",
@ -92,11 +85,11 @@ public class Vdc
extends EntityType<Vdc> extends EntityType<Vdc>
{ {
@SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
@Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().fromVdc(this); return new Builder().fromVdc(this);
} }
@ -203,21 +196,11 @@ public class Vdc
return this; return this;
} }
public Vdc build() { public Vdc build() {
Vdc vdc = new Vdc(); return new Vdc(
vdc.setAllocationModel(allocationModel); href, type, links, description, tasksInProgress, id, name, allocationModel, storageCapacity,
vdc.setStorageCapacity(storageCapacity); computeCapacity, resourceEntities, availableNetworks, capabilities, nicQuota, networkQuota,
vdc.setComputeCapacity(computeCapacity); vmQuota, isEnabled, status);
vdc.setResourceEntities(resourceEntities);
vdc.setAvailableNetworks(availableNetworks);
vdc.setCapabilities(capabilities);
vdc.setNicQuota(nicQuota);
vdc.setNetworkQuota(networkQuota);
vdc.setVmQuota(vmQuota);
vdc.setIsEnabled(isEnabled);
vdc.setStatus(status);
return vdc;
} }
/** /**
@ -295,6 +278,7 @@ public class Vdc
public Builder fromEntityType(EntityType<Vdc> in) { public Builder fromEntityType(EntityType<Vdc> in) {
return Builder.class.cast(super.fromEntityType(in)); return Builder.class.cast(super.fromEntityType(in));
} }
public Builder fromVdc(Vdc in) { public Builder fromVdc(Vdc in) {
return fromEntityType(in) return fromEntityType(in)
.allocationModel(in.getAllocationModel()) .allocationModel(in.getAllocationModel())
@ -311,8 +295,23 @@ public class Vdc
} }
} }
public Vdc(URI href, String type, Set<Link> links, String description, TasksInProgress tasksInProgress, String id, String name, String allocationModel, CapacityWithUsage storageCapacity, ComputeCapacity computeCapacity, ResourceEntities resourceEntities, AvailableNetworks availableNetworks, Capabilities capabilities, int nicQuota, int networkQuota, Integer vmQuota, Boolean enabled, Integer status) {
super(href, type, links, description, tasksInProgress, id, name);
this.allocationModel = allocationModel;
this.storageCapacity = storageCapacity;
this.computeCapacity = computeCapacity;
this.resourceEntities = resourceEntities;
this.availableNetworks = availableNetworks;
this.capabilities = capabilities;
this.nicQuota = nicQuota;
this.networkQuota = networkQuota;
this.vmQuota = vmQuota;
isEnabled = enabled;
this.status = status;
}
private Vdc() { private Vdc() {
// For JAXB and builder use // For JAXB
} }
@ -342,251 +341,107 @@ public class Vdc
/** /**
* Gets the value of the allocationModel property. * Gets the value of the allocationModel property.
* *
* @return * @return possible object is
* possible object is
* {@link String } * {@link String }
*
*/ */
public String getAllocationModel() { public String getAllocationModel() {
return allocationModel; return allocationModel;
} }
/**
* Sets the value of the allocationModel property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setAllocationModel(String value) {
this.allocationModel = value;
}
/** /**
* Gets the value of the storageCapacity property. * Gets the value of the storageCapacity property.
* *
* @return * @return possible object is
* possible object is
* {@link CapacityWithUsage } * {@link CapacityWithUsage }
*
*/ */
public CapacityWithUsage getStorageCapacity() { public CapacityWithUsage getStorageCapacity() {
return storageCapacity; return storageCapacity;
} }
/**
* Sets the value of the storageCapacity property.
*
* @param value
* allowed object is
* {@link CapacityWithUsage }
*
*/
public void setStorageCapacity(CapacityWithUsage value) {
this.storageCapacity = value;
}
/** /**
* Gets the value of the computeCapacity property. * Gets the value of the computeCapacity property.
* *
* @return * @return possible object is
* possible object is
* {@link ComputeCapacity } * {@link ComputeCapacity }
*
*/ */
public ComputeCapacity getComputeCapacity() { public ComputeCapacity getComputeCapacity() {
return computeCapacity; return computeCapacity;
} }
/**
* Sets the value of the computeCapacity property.
*
* @param value
* allowed object is
* {@link ComputeCapacity }
*
*/
public void setComputeCapacity(ComputeCapacity value) {
this.computeCapacity = value;
}
/** /**
* Gets the value of the resourceEntities property. * Gets the value of the resourceEntities property.
* *
* @return * @return possible object is
* possible object is
* {@link ResourceEntities } * {@link ResourceEntities }
*
*/ */
public ResourceEntities getResourceEntities() { public ResourceEntities getResourceEntities() {
return resourceEntities; return resourceEntities;
} }
/**
* Sets the value of the resourceEntities property.
*
* @param value
* allowed object is
* {@link ResourceEntities }
*
*/
public void setResourceEntities(ResourceEntities value) {
this.resourceEntities = value;
}
/** /**
* Gets the value of the availableNetworks property. * Gets the value of the availableNetworks property.
* *
* @return * @return possible object is
* possible object is
* {@link AvailableNetworks } * {@link AvailableNetworks }
*
*/ */
public AvailableNetworks getAvailableNetworks() { public AvailableNetworks getAvailableNetworks() {
return availableNetworks; return availableNetworks;
} }
/**
* Sets the value of the availableNetworks property.
*
* @param value
* allowed object is
* {@link AvailableNetworks }
*
*/
public void setAvailableNetworks(AvailableNetworks value) {
this.availableNetworks = value;
}
/** /**
* Gets the value of the capabilities property. * Gets the value of the capabilities property.
* *
* @return * @return possible object is
* possible object is
* {@link Capabilities } * {@link Capabilities }
*
*/ */
public Capabilities getCapabilities() { public Capabilities getCapabilities() {
return capabilities; return capabilities;
} }
/**
* Sets the value of the capabilities property.
*
* @param value
* allowed object is
* {@link Capabilities }
*
*/
public void setCapabilities(Capabilities value) {
this.capabilities = value;
}
/** /**
* Gets the value of the nicQuota property. * Gets the value of the nicQuota property.
*
*/ */
public int getNicQuota() { public int getNicQuota() {
return nicQuota; return nicQuota;
} }
/**
* Sets the value of the nicQuota property.
*
*/
public void setNicQuota(int value) {
this.nicQuota = value;
}
/** /**
* Gets the value of the networkQuota property. * Gets the value of the networkQuota property.
*
*/ */
public int getNetworkQuota() { public int getNetworkQuota() {
return networkQuota; return networkQuota;
} }
/**
* Sets the value of the networkQuota property.
*
*/
public void setNetworkQuota(int value) {
this.networkQuota = value;
}
/** /**
* Gets the value of the vmQuota property. * Gets the value of the vmQuota property.
* *
* @return * @return possible object is
* possible object is
* {@link Integer } * {@link Integer }
*
*/ */
public Integer getVmQuota() { public Integer getVmQuota() {
return vmQuota; return vmQuota;
} }
/**
* Sets the value of the vmQuota property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setVmQuota(Integer value) {
this.vmQuota = value;
}
/** /**
* Gets the value of the isEnabled property. * Gets the value of the isEnabled property.
* *
* @return * @return possible object is
* possible object is
* {@link Boolean } * {@link Boolean }
*
*/ */
public Boolean isEnabled() { public Boolean isEnabled() {
return isEnabled; return isEnabled;
} }
/**
* Sets the value of the isEnabled property.
*
* @param value
* allowed object is
* {@link Boolean }
*
*/
public void setIsEnabled(Boolean value) {
this.isEnabled = value;
}
/** /**
* Gets the value of the status property. * Gets the value of the status property.
* *
* @return * @return possible object is
* possible object is
* {@link Integer } * {@link Integer }
*
*/ */
public Integer getStatus() { public Integer getStatus() {
return status; return status;
} }
/**
* Sets the value of the status property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setStatus(Integer value) {
this.status = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,11 +20,8 @@ package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -33,7 +30,6 @@ import com.google.common.base.Objects;
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Configuration", namespace = VCLOUD_OVF_NS, propOrder = { @XmlType(name = "Configuration", namespace = VCLOUD_OVF_NS, propOrder = {
"label", "description" "label", "description"
}) })

View File

@ -19,14 +19,14 @@
package org.jclouds.vcloud.director.v1_5.domain.ovf; package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Collections;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -41,8 +41,7 @@ import com.google.common.collect.Sets;
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "DeploymentOptionSection")
@XmlRootElement(name = "DeploymentOptionSection", namespace = VCLOUD_OVF_NS)
public class DeploymentOptionSection extends SectionType<DeploymentOptionSection> { public class DeploymentOptionSection extends SectionType<DeploymentOptionSection> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -82,7 +81,7 @@ public class DeploymentOptionSection extends SectionType<DeploymentOptionSection
*/ */
@Override @Override
public DeploymentOptionSection build() { public DeploymentOptionSection build() {
return new DeploymentOptionSection(info, configurations); return new DeploymentOptionSection(info, required, configurations);
} }
public Builder fromDeploymentOptionSection(DeploymentOptionSection in) { public Builder fromDeploymentOptionSection(DeploymentOptionSection in) {
@ -105,21 +104,32 @@ public class DeploymentOptionSection extends SectionType<DeploymentOptionSection
return Builder.class.cast(super.info(info)); return Builder.class.cast(super.info(info));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
} }
@XmlElement(name = "Configuration") @XmlElement(name = "Configuration")
protected Set<Configuration> configurations; protected Set<Configuration> configurations;
private DeploymentOptionSection(String info, Iterable<Configuration> configurations) { private DeploymentOptionSection(@Nullable String info, @Nullable Boolean required, Iterable<Configuration> configurations) {
super(info); super(info, required);
this.configurations = ImmutableSet.<Configuration>copyOf(checkNotNull(configurations, "configurations")); this.configurations = ImmutableSet.copyOf(configurations);
} }
private DeploymentOptionSection() { private DeploymentOptionSection() {
// For JAXB // For JAXB
} }
public Set<Configuration> getConfigurations() {
return Collections.unmodifiableSet(configurations);
}
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(super.hashCode(), configurations); return Objects.hashCode(super.hashCode(), configurations);
@ -139,9 +149,4 @@ public class DeploymentOptionSection extends SectionType<DeploymentOptionSection
protected Objects.ToStringHelper string() { protected Objects.ToStringHelper string() {
return super.string().add("configurations", configurations); return super.string().add("configurations", configurations);
} }
public Set<Configuration> getConfigurations() {
return configurations;
}
} }

View File

@ -18,19 +18,15 @@
*/ */
package org.jclouds.vcloud.director.v1_5.domain.ovf; package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.net.URI; import java.net.URI;
import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** /**
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "Disk")
@XmlType(name = "Disk", namespace = VCLOUD_OVF_NS)
public class Disk implements Comparable<Disk>{ public class Disk implements Comparable<Disk>{
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();

View File

@ -22,12 +22,12 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -40,7 +40,6 @@ import com.google.common.collect.Sets;
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "DiskSection", namespace = VCLOUD_OVF_NS) @XmlRootElement(name = "DiskSection", namespace = VCLOUD_OVF_NS)
@XmlType(propOrder = { @XmlType(propOrder = {
"disks" "disks"
@ -84,7 +83,7 @@ public class DiskSection extends SectionType<DiskSection> {
*/ */
@Override @Override
public DiskSection build() { public DiskSection build() {
return new DiskSection(info, disks); return new DiskSection(info, required, disks);
} }
public Builder fromDiskSection(DiskSection in) { public Builder fromDiskSection(DiskSection in) {
@ -107,12 +106,21 @@ public class DiskSection extends SectionType<DiskSection> {
return Builder.class.cast(super.info(info)); return Builder.class.cast(super.info(info));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
} }
}
@XmlElementRef
private Set<Disk> disks; private Set<Disk> disks;
private DiskSection(String info, Iterable<Disk> disks) { private DiskSection(@Nullable String info, @Nullable Boolean required, Iterable<Disk> disks) {
super(info); super(info, required);
this.disks = ImmutableSet.<Disk>copyOf(checkNotNull(disks, "disks")); this.disks = ImmutableSet.<Disk>copyOf(checkNotNull(disks, "disks"));
} }

View File

@ -20,12 +20,9 @@ package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.domain.ovf.internal.BaseEnvelope; import org.jclouds.vcloud.director.v1_5.domain.ovf.internal.BaseEnvelope;
import org.jclouds.vcloud.director.v1_5.domain.ovf.VirtualSystem;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
@ -33,7 +30,6 @@ import com.google.common.collect.Multimap;
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "Envelope", namespace = VCLOUD_OVF_NS) @XmlRootElement(name = "Envelope", namespace = VCLOUD_OVF_NS)
public class Envelope extends BaseEnvelope<VirtualSystem, Envelope> { public class Envelope extends BaseEnvelope<VirtualSystem, Envelope> {

View File

@ -19,18 +19,13 @@
package org.jclouds.vcloud.director.v1_5.domain.ovf; package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
/** /**
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "Network")
@XmlRootElement(name = "Network", namespace = VCLOUD_OVF_NS)
public class Network { public class Network {
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();

View File

@ -19,14 +19,12 @@
package org.jclouds.vcloud.director.v1_5.domain.ovf; package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -37,8 +35,7 @@ import com.google.common.collect.Sets;
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlRootElement(name = "NetworkSection")
@XmlRootElement(name = "NetworkSection", namespace = VCLOUD_OVF_NS)
public class NetworkSection extends SectionType<NetworkSection> { public class NetworkSection extends SectionType<NetworkSection> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -78,7 +75,7 @@ public class NetworkSection extends SectionType<NetworkSection> {
*/ */
@Override @Override
public NetworkSection build() { public NetworkSection build() {
return new NetworkSection(info, networks); return new NetworkSection(info, required, networks);
} }
public Builder fromNetworkSection(NetworkSection in) { public Builder fromNetworkSection(NetworkSection in) {
@ -101,12 +98,20 @@ public class NetworkSection extends SectionType<NetworkSection> {
return Builder.class.cast(super.info(info)); return Builder.class.cast(super.info(info));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
} }
private Set<Network> networks; private Set<Network> networks;
private NetworkSection(String info, Iterable<Network> networks) { private NetworkSection(@Nullable String info, @Nullable Boolean required, Iterable<Network> networks) {
super(info); super(info, required);
this.networks = ImmutableSet.<Network> copyOf(checkNotNull(networks, "networks")); this.networks = ImmutableSet.<Network> copyOf(checkNotNull(networks, "networks"));
} }

View File

@ -18,14 +18,11 @@
*/ */
package org.jclouds.vcloud.director.v1_5.domain.ovf; package org.jclouds.vcloud.director.v1_5.domain.ovf;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.javax.annotation.Nullable; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
@ -35,7 +32,6 @@ import com.google.common.base.Objects;
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "VirtualHardwareSection") @XmlRootElement(name = "VirtualHardwareSection")
public class OperatingSystemSection extends SectionType<OperatingSystemSection> { public class OperatingSystemSection extends SectionType<OperatingSystemSection> {
@ -86,7 +82,7 @@ public class OperatingSystemSection extends SectionType<OperatingSystemSection>
*/ */
@Override @Override
public OperatingSystemSection build() { public OperatingSystemSection build() {
return new OperatingSystemSection(info, id, version, description); return new OperatingSystemSection(info, required, id, version, description);
} }
public Builder fromOperatingSystemSection(OperatingSystemSection in) { public Builder fromOperatingSystemSection(OperatingSystemSection in) {
@ -109,6 +105,13 @@ public class OperatingSystemSection extends SectionType<OperatingSystemSection>
return Builder.class.cast(super.info(info)); return Builder.class.cast(super.info(info));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
} }
@XmlAttribute @XmlAttribute
@ -118,8 +121,8 @@ public class OperatingSystemSection extends SectionType<OperatingSystemSection>
@XmlElement @XmlElement
protected String description; protected String description;
public OperatingSystemSection(@Nullable String info, @Nullable Integer id, @Nullable String version, @Nullable String description) { public OperatingSystemSection(@Nullable String info, @Nullable Boolean required, @Nullable Integer id, @Nullable String version, @Nullable String description) {
super(info); super(info, required);
this.id = id; this.id = id;
this.description = description; this.description = description;
this.version = version; this.version = version;

View File

@ -22,10 +22,10 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.collect.ImmutableSet; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
@ -34,10 +34,11 @@ import com.google.common.collect.Sets;
* The ProductSection element specifies product-information for an appliance, such as product name, * The ProductSection element specifies product-information for an appliance, such as product name,
* version, and vendor. * version, and vendor.
* *
* TODO this should contain a multitude of other elements!
*
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "ProductSection", namespace = VCLOUD_OVF_NS) @XmlRootElement(name = "ProductSection", namespace = VCLOUD_OVF_NS)
public class ProductSection extends SectionType<ProductSection> { public class ProductSection extends SectionType<ProductSection> {
@ -78,7 +79,7 @@ public class ProductSection extends SectionType<ProductSection> {
*/ */
@Override @Override
public ProductSection build() { public ProductSection build() {
return new ProductSection(info, properties); return new ProductSection(info, required, properties);
} }
public Builder fromDeploymentOptionSection(ProductSection in) { public Builder fromDeploymentOptionSection(ProductSection in) {
@ -100,13 +101,22 @@ public class ProductSection extends SectionType<ProductSection> {
public Builder info(String info) { public Builder info(String info) {
return Builder.class.cast(super.info(info)); return Builder.class.cast(super.info(info));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
} }
protected Set<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> properties;
private ProductSection(String info, Iterable<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> properties) { private Set<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> properties;
super(info);
this.properties = ImmutableSet.<org.jclouds.vcloud.director.v1_5.domain.ovf.Property> copyOf(checkNotNull(properties, "properties")); private ProductSection(@Nullable String info, @Nullable Boolean required, Set<Property> properties) {
super(info, required);
this.properties = ImmutableSet.copyOf(checkNotNull(properties, "properties"));
} }
private ProductSection() { private ProductSection() {

View File

@ -20,16 +20,12 @@ package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType; import javax.xml.bind.annotation.XmlType;
/** /**
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Property", namespace = VCLOUD_OVF_NS) @XmlType(name = "Property", namespace = VCLOUD_OVF_NS)
public class Property { public class Property {
public static Builder builder() { public static Builder builder() {

View File

@ -20,6 +20,7 @@ package org.jclouds.vcloud.director.v1_5.domain.ovf;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso;
@ -54,38 +55,49 @@ import com.google.common.base.Objects;
NetworkConnectionSection.class, NetworkConnectionSection.class,
ProductSection.class, ProductSection.class,
VirtualHardwareSection.class, VirtualHardwareSection.class,
VirtualSystem.class }) VirtualSystem.class})
public abstract class SectionType<T extends SectionType<T>> { public abstract class SectionType<T extends SectionType<T>> {
public abstract Builder<T> toBuilder(); public abstract Builder<T> toBuilder();
public static abstract class Builder<T extends SectionType<T>> { public static abstract class Builder<T extends SectionType<T>> {
protected String info; protected String info;
protected Boolean required;
public abstract SectionType<T> build(); public abstract SectionType<T> build();
/** /**
* @see SectionType#getInfo * @see SectionType#getInfo()
*/ */
public Builder<T> info(String info) { public Builder<T> info(String info) {
this.info = info; this.info = info;
return this; return this;
} }
/**
* @see SectionType#isRequired()
*/
public Builder<T> required(Boolean required) {
this.required = required;
return this;
}
public Builder<T> fromSection(SectionType<T> in) { public Builder<T> fromSection(SectionType<T> in) {
return info(in.getInfo()); return info(in.getInfo()).required(in.isRequired());
} }
} }
@XmlElement(name = "Info", namespace = VCLOUD_OVF_NS) @XmlElement(name = "Info")
protected String info; private String info;
@XmlAttribute(namespace = VCLOUD_OVF_NS)
private boolean required;
public SectionType(@Nullable String info) { protected SectionType(@Nullable String info, @Nullable Boolean required) {
this.info = info; this.info = info;
this.required = required;
} }
protected SectionType() { protected SectionType() {
// For Builders and JAXB // For JAXB
} }
/** /**
@ -98,9 +110,13 @@ public abstract class SectionType<T extends SectionType<T>> {
return info; return info;
} }
public Boolean isRequired() {
return required;
}
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(info); return Objects.hashCode(info, required);
} }
@Override @Override
@ -112,7 +128,7 @@ public abstract class SectionType<T extends SectionType<T>> {
if (getClass() != obj.getClass()) if (getClass() != obj.getClass())
return false; return false;
SectionType<?> other = (SectionType<?>) obj; SectionType<?> other = (SectionType<?>) obj;
return Objects.equal(info, other.info); return Objects.equal(info, other.info) && Objects.equal(required, other.required);
} }
@Override @Override
@ -121,7 +137,7 @@ public abstract class SectionType<T extends SectionType<T>> {
} }
protected Objects.ToStringHelper string() { protected Objects.ToStringHelper string() {
return Objects.toStringHelper("").add("info", info); return Objects.toStringHelper("").add("info", info).add("required", required);
} }
} }

View File

@ -22,10 +22,9 @@ import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS; import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OVF_NS;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData; import org.jclouds.vcloud.director.v1_5.domain.cim.ResourceAllocationSettingData;
import org.jclouds.vcloud.director.v1_5.domain.cim.VirtualSystemSettingData; import org.jclouds.vcloud.director.v1_5.domain.cim.VirtualSystemSettingData;
@ -43,7 +42,6 @@ import com.google.common.collect.Sets;
* @author Adrian Cole * @author Adrian Cole
* @author Adam Lowe * @author Adam Lowe
*/ */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "VirtualHardwareSection", namespace = VCLOUD_OVF_NS) @XmlRootElement(name = "VirtualHardwareSection", namespace = VCLOUD_OVF_NS)
public class VirtualHardwareSection extends SectionType<VirtualHardwareSection> { public class VirtualHardwareSection extends SectionType<VirtualHardwareSection> {
@ -111,7 +109,7 @@ public class VirtualHardwareSection extends SectionType<VirtualHardwareSection>
*/ */
@Override @Override
public VirtualHardwareSection build() { public VirtualHardwareSection build() {
return new VirtualHardwareSection(info, transports, virtualSystem, items); return new VirtualHardwareSection(info, required, transports, virtualSystem, items);
} }
public Builder fromVirtualHardwareSection(VirtualHardwareSection in) { public Builder fromVirtualHardwareSection(VirtualHardwareSection in) {
@ -135,15 +133,22 @@ public class VirtualHardwareSection extends SectionType<VirtualHardwareSection>
return Builder.class.cast(super.info(info)); return Builder.class.cast(super.info(info));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
} }
private VirtualSystemSettingData virtualSystem; private VirtualSystemSettingData virtualSystem;
private Set<String> transports; private Set<String> transports;
private Set<ResourceAllocationSettingData> items; private Set<ResourceAllocationSettingData> items;
private VirtualHardwareSection(String info, Iterable<String> transports, VirtualSystemSettingData virtualSystem, private VirtualHardwareSection(@Nullable String info, @Nullable Boolean required, Iterable<String> transports, VirtualSystemSettingData virtualSystem,
Iterable<? extends ResourceAllocationSettingData> items) { Iterable<? extends ResourceAllocationSettingData> items) {
super(info); super(info, required);
this.virtualSystem = virtualSystem; this.virtualSystem = virtualSystem;
this.transports = ImmutableSet.<String>copyOf(checkNotNull(transports, "transports")); this.transports = ImmutableSet.<String>copyOf(checkNotNull(transports, "transports"));
this.items = ImmutableSet.<ResourceAllocationSettingData>copyOf(checkNotNull(items, "items")); this.items = ImmutableSet.<ResourceAllocationSettingData>copyOf(checkNotNull(items, "items"));

View File

@ -22,7 +22,7 @@ import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_OV
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection; import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.internal.BaseVirtualSystem; import org.jclouds.vcloud.director.v1_5.domain.ovf.internal.BaseVirtualSystem;
import com.google.common.collect.Multimap; import com.google.common.collect.Multimap;
@ -50,7 +50,7 @@ public class VirtualSystem extends BaseVirtualSystem<VirtualSystem> {
*/ */
@Override @Override
public VirtualSystem build() { public VirtualSystem build() {
return new VirtualSystem(id, info, name, operatingSystem, virtualHardwareSections, productSections, return new VirtualSystem(id, info, required, name, operatingSystem, virtualHardwareSections, productSections,
additionalSections); additionalSections);
} }
@ -120,6 +120,14 @@ public class VirtualSystem extends BaseVirtualSystem<VirtualSystem> {
return Builder.class.cast(super.info(info)); return Builder.class.cast(super.info(info));
} }
/**
* {@inheritDoc}
*/
@Override
public Builder required(Boolean required) {
return Builder.class.cast(super.required(required));
}
/** /**
* {@inheritDoc} * {@inheritDoc}
*/ */
@ -154,11 +162,10 @@ public class VirtualSystem extends BaseVirtualSystem<VirtualSystem> {
} }
@SuppressWarnings("unchecked") private VirtualSystem(String id, String info, @Nullable Boolean required, String name, OperatingSystemSection operatingSystem,
private VirtualSystem(String id, String info, String name, OperatingSystemSection operatingSystem,
Iterable<? extends VirtualHardwareSection> virtualHardwareSections, Iterable<? extends VirtualHardwareSection> virtualHardwareSections,
Iterable<? extends ProductSection> productSections, Multimap<String, SectionType> additionalSections) { Iterable<? extends ProductSection> productSections, Multimap<String, SectionType> additionalSections) {
super(id, info, name, operatingSystem, virtualHardwareSections, productSections, additionalSections); super(id, info, required, name, operatingSystem, virtualHardwareSections, productSections, additionalSections);
} }
private VirtualSystem() { private VirtualSystem() {

View File

@ -22,6 +22,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Set; import java.util.Set;
import org.jclouds.javax.annotation.Nullable;
import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection; import org.jclouds.vcloud.director.v1_5.domain.ovf.OperatingSystemSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection; import org.jclouds.vcloud.director.v1_5.domain.ovf.ProductSection;
import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType; import org.jclouds.vcloud.director.v1_5.domain.ovf.SectionType;
@ -164,10 +165,10 @@ public abstract class BaseVirtualSystem<T extends BaseVirtualSystem<T>> extends
private Multimap<String, SectionType> additionalSections; private Multimap<String, SectionType> additionalSections;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
protected BaseVirtualSystem(String id, String info, String name, OperatingSystemSection operatingSystem, protected BaseVirtualSystem(String id, String info, @Nullable Boolean required, String name, OperatingSystemSection operatingSystem,
Iterable<? extends VirtualHardwareSection> virtualHardwareSections, Iterable<? extends VirtualHardwareSection> virtualHardwareSections,
Iterable<? extends ProductSection> productSections, Multimap<String, SectionType> additionalSections) { Iterable<? extends ProductSection> productSections, Multimap<String, SectionType> additionalSections) {
super(info); super(info, required);
this.id = id; this.id = id;
this.name = name; this.name = name;
this.operatingSystem = checkNotNull(operatingSystem, "operatingSystem"); this.operatingSystem = checkNotNull(operatingSystem, "operatingSystem");
@ -216,7 +217,7 @@ public abstract class BaseVirtualSystem<T extends BaseVirtualSystem<T>> extends
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hashCode(id, name, info, operatingSystem, virtualHardwareSections, productSections, additionalSections); return Objects.hashCode(super.hashCode(), id, name, operatingSystem, virtualHardwareSections, productSections, additionalSections);
} }
@Override @Override
@ -226,22 +227,17 @@ public abstract class BaseVirtualSystem<T extends BaseVirtualSystem<T>> extends
if (getClass() != obj.getClass()) return false; if (getClass() != obj.getClass()) return false;
BaseVirtualSystem<?> other = (BaseVirtualSystem<?>) obj; BaseVirtualSystem<?> other = (BaseVirtualSystem<?>) obj;
return Objects.equal(id, other.id) return super.equals(other)
&& Objects.equal(id, other.id)
&& Objects.equal(name, other.name) && Objects.equal(name, other.name)
&& Objects.equal(info, other.info)
&& Objects.equal(operatingSystem, other.operatingSystem) && Objects.equal(operatingSystem, other.operatingSystem)
&& Objects.equal(virtualHardwareSections, other.virtualHardwareSections) && Objects.equal(virtualHardwareSections, other.virtualHardwareSections)
&& Objects.equal(productSections, other.productSections) && Objects.equal(productSections, other.productSections)
&& Objects.equal(additionalSections, other.additionalSections); && Objects.equal(additionalSections, other.additionalSections);
} }
@Override
public String toString() {
return string().toString();
}
protected Objects.ToStringHelper string() { protected Objects.ToStringHelper string() {
return Objects.toStringHelper("").add("id", id).add("name", name).add("info", info) return super.string().add("id", id).add("name", name)
.add("operatingSystem", operatingSystem).add("virtualHardwareSections", virtualHardwareSections) .add("operatingSystem", operatingSystem).add("virtualHardwareSections", virtualHardwareSections)
.add("productSections", productSections).add("additionalSections", additionalSections) .add("productSections", productSections).add("additionalSections", additionalSections)
.add("additionalSections", additionalSections); .add("additionalSections", additionalSections);

View File

@ -20,12 +20,9 @@
package org.jclouds.vcloud.director.v1_5.domain.query; package org.jclouds.vcloud.director.v1_5.domain.query;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.List;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.domain.CatalogReference; import org.jclouds.vcloud.director.v1_5.domain.CatalogReference;
@ -35,17 +32,16 @@ import com.google.common.collect.Sets;
/** /**
* Represents the results from a vCloud query as references. * Represents the results from a vCloud query as references.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="QueryResultReferences" /&gt; * &lt;complexType name="QueryResultReferences" /&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "CatalogReferences") @XmlRootElement(name = "CatalogReferences")
public class CatalogReferences extends QueryResultReferences<CatalogReference> { public class CatalogReferences extends QueryResultReferences<CatalogReference> {
@SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
@ -59,22 +55,14 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
@Override @Override
public CatalogReferences build() { public CatalogReferences build() {
CatalogReferences queryResultReferences = new CatalogReferences(href); return new CatalogReferences(href, type, links, name, page, pageSize, total, references);
queryResultReferences.setReferences(references);
queryResultReferences.setName(name);
queryResultReferences.setPage(page);
queryResultReferences.setPageSize(pageSize);
queryResultReferences.setTotal(total);
queryResultReferences.setType(type);
queryResultReferences.setLinks(links);
return queryResultReferences;
} }
/** /**
* @see QueryResultReferences#getReferences() * @see QueryResultReferences#getReferences()
*/ */
@Override @Override
public Builder references(List<CatalogReference> references) { public Builder references(Set<CatalogReference> references) {
this.references = references; this.references = references;
return this; return this;
} }
@ -89,7 +77,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
} }
/** /**
* @see Container#getName() * @see CatalogReference#getName()
*/ */
@Override @Override
public Builder name(String name) { public Builder name(String name) {
@ -98,7 +86,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
} }
/** /**
* @see Container#getPage() * @see CatalogReference#getPage()
*/ */
@Override @Override
public Builder page(Integer page) { public Builder page(Integer page) {
@ -107,7 +95,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
} }
/** /**
* @see Container#getPageSize() * @see CatalogReference#getPageSize()
*/ */
@Override @Override
public Builder pageSize(Integer pageSize) { public Builder pageSize(Integer pageSize) {
@ -116,7 +104,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
} }
/** /**
* @see Container#getTotal() * @see CatalogReference#getTotal()
*/ */
@Override @Override
public Builder total(Long total) { public Builder total(Long total) {
@ -125,7 +113,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
} }
/** /**
* @see ResourceType#getHref() * @see CatalogReference#getHref()
*/ */
@Override @Override
public Builder href(URI href) { public Builder href(URI href) {
@ -134,7 +122,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
} }
/** /**
* @see ResourceType#getType() * @see CatalogReference#getType()
*/ */
@Override @Override
public Builder type(String type) { public Builder type(String type) {
@ -143,7 +131,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
} }
/** /**
* @see ResourceType#getLinks() * @see CatalogReference#getLinks()
*/ */
@Override @Override
public Builder links(Set<Link> links) { public Builder links(Set<Link> links) {
@ -152,7 +140,7 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
} }
/** /**
* @see ResourceType#getLinks() * @see CatalogReference#getLinks()
*/ */
@Override @Override
public Builder link(Link link) { public Builder link(Link link) {
@ -170,11 +158,11 @@ public class CatalogReferences extends QueryResultReferences<CatalogReference> {
} }
} }
public CatalogReferences(URI href, String type, Set<Link> links, String name, Integer page, Integer pageSize, Long total, Set<CatalogReference> references) {
super(href, type, links, name, page, pageSize, total, references);
}
protected CatalogReferences() { protected CatalogReferences() {
// For JAXB and builder use // For JAXB and builder use
} }
protected CatalogReferences(URI href) {
super(href);
}
} }

View File

@ -24,7 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.Link;
@ -36,7 +35,7 @@ import com.google.common.collect.Sets;
/** /**
* Container for query result sets. * Container for query result sets.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="Container" /&gt; * &lt;complexType name="Container" /&gt;
* </pre> * </pre>
@ -62,7 +61,7 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
protected Long total; protected Long total;
/** /**
* @see Container#getName() * @see ContainerType#getName()
*/ */
public Builder<T> name(String name) { public Builder<T> name(String name) {
this.name = name; this.name = name;
@ -70,7 +69,7 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
} }
/** /**
* @see Container#getPage() * @see ContainerType#getPage()
*/ */
public Builder<T> page(Integer page) { public Builder<T> page(Integer page) {
this.page = page; this.page = page;
@ -78,7 +77,7 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
} }
/** /**
* @see Container#getPageSize() * @see ContainerType#getPageSize()
*/ */
public Builder<T> pageSize(Integer pageSize) { public Builder<T> pageSize(Integer pageSize) {
this.pageSize = pageSize; this.pageSize = pageSize;
@ -86,7 +85,7 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
} }
/** /**
* @see Container#getTotal() * @see ContainerType#getTotal()
*/ */
public Builder<T> total(Long total) { public Builder<T> total(Long total) {
this.total = total; this.total = total;
@ -95,14 +94,7 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
@Override @Override
public ContainerType<T> build() { public ContainerType<T> build() {
ContainerType<T> container = new ContainerType<T>(href); return new ContainerType<T>(href, type, links, name, page, pageSize, total);
container.setName(name);
container.setPage(page);
container.setPageSize(pageSize);
container.setTotal(total);
container.setType(type);
container.setLinks(links);
return container;
} }
/** /**
@ -151,15 +143,6 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
} }
} }
protected ContainerType() {
// For JAXB and builder use
}
protected ContainerType(URI href) {
super(href);
}
@XmlAttribute @XmlAttribute
protected String name; protected String name;
@XmlAttribute @XmlAttribute
@ -169,6 +152,18 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
@XmlAttribute @XmlAttribute
protected Long total; protected Long total;
public ContainerType(URI href, String type, Set<Link> links, String name, Integer page, Integer pageSize, Long total) {
super(href, type, links);
this.name = name;
this.page = page;
this.pageSize = pageSize;
this.total = total;
}
protected ContainerType() {
// For JAXB and builder use
}
/** /**
* Query name that generated this result set. * Query name that generated this result set.
*/ */
@ -176,10 +171,6 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
return name; return name;
} }
public void setName(String value) {
this.name = value;
}
/** /**
* Page of the result set that this container holds. The first page is page number 1. * Page of the result set that this container holds. The first page is page number 1.
*/ */
@ -187,10 +178,6 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
return page; return page;
} }
public void setPage(Integer value) {
this.page = value;
}
/** /**
* Page size, as a number of records or references. * Page size, as a number of records or references.
*/ */
@ -198,10 +185,6 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
return pageSize; return pageSize;
} }
public void setPageSize(Integer value) {
this.pageSize = value;
}
/** /**
* Total number of records or references in the container. * Total number of records or references in the container.
*/ */
@ -209,10 +192,6 @@ public class ContainerType<T extends ContainerType<T>> extends ResourceType<T> {
return total; return total;
} }
public void setTotal(Long value) {
this.total = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -23,15 +23,14 @@ import javax.xml.bind.annotation.XmlType;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
/** /**
*
* Container for the list of typed queries available to the * Container for the list of typed queries available to the
* requesting user. * requesting user.
* * <p/>
* * <p/>
* <p>Java class for QueryList complex type. * <p>Java class for QueryList complex type.
* * <p/>
* <p>The following schema fragment specifies the expected content contained within this class. * <p>The following schema fragment specifies the expected content contained within this class.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="QueryList"> * &lt;complexType name="QueryList">
* &lt;complexContent> * &lt;complexContent>
@ -41,16 +40,15 @@ import com.google.common.base.Objects.ToStringHelper;
* &lt;/complexContent> * &lt;/complexContent>
* &lt;/complexType> * &lt;/complexType>
* </pre> * </pre>
*
*
*/ */
@XmlType(name = "QueryList") @XmlType(name = "QueryList")
public class QueryList extends ContainerType<QueryList> { public class QueryList extends ContainerType<QueryList> {
@SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
return new Builder(); return new Builder();
} }
@Override
public Builder toBuilder() { public Builder toBuilder() {
return new Builder().fromQueryList(this); return new Builder().fromQueryList(this);
} }
@ -66,6 +64,7 @@ public class QueryList extends ContainerType<QueryList> {
public Builder fromContainerType(ContainerType<QueryList> in) { public Builder fromContainerType(ContainerType<QueryList> in) {
return Builder.class.cast(super.fromContainerType(in)); return Builder.class.cast(super.fromContainerType(in));
} }
public Builder fromQueryList(QueryList in) { public Builder fromQueryList(QueryList in) {
return fromContainerType(in); return fromContainerType(in);
} }
@ -82,7 +81,7 @@ public class QueryList extends ContainerType<QueryList> {
if (o == null || getClass() != o.getClass()) if (o == null || getClass() != o.getClass())
return false; return false;
QueryList that = QueryList.class.cast(o); QueryList that = QueryList.class.cast(o);
return super.equals(that) ; return super.equals(that);
} }
@Override @Override

View File

@ -21,12 +21,10 @@ package org.jclouds.vcloud.director.v1_5.domain.query;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.Date; import java.util.Date;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlSchemaType;
@ -39,14 +37,14 @@ import com.google.common.collect.Sets;
/** /**
* Represents the results from a Catalog vCloud query as a record. * Represents the results from a Catalog vCloud query as a record.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="QueryResultCatalogRecord" /&gt; * &lt;complexType name="QueryResultCatalogRecord" /&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlRootElement(name = "CatalogRecord", namespace = VCLOUD_1_5_NS) @XmlRootElement(name = "CatalogRecord")
public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultCatalogRecord> { public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultCatalogRecord> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -80,7 +78,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
} }
/** /**
* @see QueryResultCatalogRecord#getIsPublished() * @see QueryResultCatalogRecord#isPublished()
*/ */
public Builder isPublished(Boolean isPublished) { public Builder isPublished(Boolean isPublished) {
this.isPublished = isPublished; this.isPublished = isPublished;
@ -88,7 +86,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
} }
/** /**
* @see QueryResultCatalogRecord#getIsPublished() * @see QueryResultCatalogRecord#isPublished()
*/ */
public Builder published() { public Builder published() {
this.isPublished = Boolean.TRUE; this.isPublished = Boolean.TRUE;
@ -96,7 +94,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
} }
/** /**
* @see QueryResultCatalogRecord#getIsPublished() * @see QueryResultCatalogRecord#isPublished()
*/ */
public Builder notPublished() { public Builder notPublished() {
this.isPublished = Boolean.FALSE; this.isPublished = Boolean.FALSE;
@ -104,7 +102,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
} }
/** /**
* @see QueryResultCatalogRecord#getIsShared() * @see QueryResultCatalogRecord#isShared()
*/ */
public Builder isShared(Boolean isShared) { public Builder isShared(Boolean isShared) {
this.isShared = isShared; this.isShared = isShared;
@ -112,7 +110,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
} }
/** /**
* @see QueryResultCatalogRecord#getIsShared() * @see QueryResultCatalogRecord#isShared()
*/ */
public Builder shared() { public Builder shared() {
this.isShared = Boolean.TRUE; this.isShared = Boolean.TRUE;
@ -120,7 +118,7 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
} }
/** /**
* @see QueryResultCatalogRecord#getIsShared() * @see QueryResultCatalogRecord#isShared()
*/ */
public Builder notShared() { public Builder notShared() {
this.isShared = Boolean.FALSE; this.isShared = Boolean.FALSE;
@ -177,20 +175,8 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
@Override @Override
public QueryResultCatalogRecord build() { public QueryResultCatalogRecord build() {
QueryResultCatalogRecord queryResultCatalogRecord = new QueryResultCatalogRecord(href); return new QueryResultCatalogRecord(links, href, id, type,name, isPublished, isShared, creationDate, orgName,
queryResultCatalogRecord.setName(name); ownerName, numberOfVAppTemplates, numberOfMedia, owner);
queryResultCatalogRecord.setIsPublished(isPublished);
queryResultCatalogRecord.setIsShared(isShared);
queryResultCatalogRecord.setCreationDate(creationDate);
queryResultCatalogRecord.setOrgName(orgName);
queryResultCatalogRecord.setOwnerName(ownerName);
queryResultCatalogRecord.setNumberOfVAppTemplates(numberOfVAppTemplates);
queryResultCatalogRecord.setNumberOfMedia(numberOfMedia);
queryResultCatalogRecord.setOwner(owner);
queryResultCatalogRecord.setId(id);
queryResultCatalogRecord.setType(type);
queryResultCatalogRecord.setLinks(links);
return queryResultCatalogRecord;
} }
/** /**
@ -249,13 +235,26 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
} }
} }
private QueryResultCatalogRecord(Set<Link> links, URI href, String id, String type, String name,
Boolean published, Boolean shared, Date creationDate, String orgName,
String ownerName, Integer numberOfVAppTemplates, Integer numberOfMedia,
URI owner) {
super(links, href, id, type);
this.name = name;
isPublished = published;
isShared = shared;
this.creationDate = creationDate;
this.orgName = orgName;
this.ownerName = ownerName;
this.numberOfVAppTemplates = numberOfVAppTemplates;
this.numberOfMedia = numberOfMedia;
this.owner = owner;
}
private QueryResultCatalogRecord() { private QueryResultCatalogRecord() {
// For JAXB and builder use // For JAXB and builder use
} }
private QueryResultCatalogRecord(URI href) {
super(href);
}
@XmlAttribute @XmlAttribute
protected String name; protected String name;
@ -284,32 +283,21 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return name; return name;
} }
public void setName(String value) {
this.name = value;
}
/**
* Gets the value of the isPublished property.
*/
public Boolean isPublished() { public Boolean isPublished() {
return isPublished; return isPublished;
} }
/** /**
* Sets the value of the isPublished property. * Gets the value of the isShared property.
*/ */
public void setIsPublished(Boolean value) {
this.isPublished = value;
}
public Boolean isShared() { public Boolean isShared() {
return isShared; return isShared;
} }
/**
* Sets the value of the isShared property.
*/
public void setIsShared(Boolean value) {
this.isShared = value;
}
/** /**
* Gets the value of the creationDate property. * Gets the value of the creationDate property.
*/ */
@ -317,10 +305,6 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return creationDate; return creationDate;
} }
public void setCreationDate(Date value) {
this.creationDate = value;
}
/** /**
* Gets the value of the orgName property. * Gets the value of the orgName property.
*/ */
@ -328,10 +312,6 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return orgName; return orgName;
} }
public void setOrgName(String value) {
this.orgName = value;
}
/** /**
* Gets the value of the ownerName property. * Gets the value of the ownerName property.
*/ */
@ -339,10 +319,6 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return ownerName; return ownerName;
} }
public void setOwnerName(String value) {
this.ownerName = value;
}
/** /**
* Gets the value of the numberOfVAppTemplates property. * Gets the value of the numberOfVAppTemplates property.
*/ */
@ -350,10 +326,6 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return numberOfVAppTemplates; return numberOfVAppTemplates;
} }
public void setNumberOfVAppTemplates(Integer value) {
this.numberOfVAppTemplates = value;
}
/** /**
* Gets the value of the numberOfMedia property. * Gets the value of the numberOfMedia property.
*/ */
@ -361,10 +333,6 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return numberOfMedia; return numberOfMedia;
} }
public void setNumberOfMedia(Integer value) {
this.numberOfMedia = value;
}
/** /**
* Gets the value of the owner property. * Gets the value of the owner property.
*/ */
@ -372,10 +340,6 @@ public class QueryResultCatalogRecord extends QueryResultRecordType<QueryResultC
return owner; return owner;
} }
public void setOwner(URI value) {
this.owner = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -24,7 +24,6 @@ import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.Link;
@ -35,7 +34,7 @@ import com.google.common.collect.Sets;
/** /**
* Represents the results from a Network vCloud query as a record. * Represents the results from a Network vCloud query as a record.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="QueryResultNetworkRecord" /&gt; * &lt;complexType name="QueryResultNetworkRecord" /&gt;
* </pre> * </pre>
@ -146,19 +145,8 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
@Override @Override
public QueryResultNetworkRecord build() { public QueryResultNetworkRecord build() {
QueryResultNetworkRecord queryResultNetworkRecord = new QueryResultNetworkRecord(href); return new QueryResultNetworkRecord(links, href, id, type,
queryResultNetworkRecord.setName(name); name, ipScopeId, gateway, netmask, dns1, dns2, dnsSuffix, isBusy);
queryResultNetworkRecord.setIpScopeId(ipScopeId);
queryResultNetworkRecord.setGateway(gateway);
queryResultNetworkRecord.setNetmask(netmask);
queryResultNetworkRecord.setDns1(dns1);
queryResultNetworkRecord.setDns2(dns2);
queryResultNetworkRecord.setDnsSuffix(dnsSuffix);
queryResultNetworkRecord.setIsBusy(isBusy);
queryResultNetworkRecord.setId(id);
queryResultNetworkRecord.setType(type);
queryResultNetworkRecord.setLinks(links);
return queryResultNetworkRecord;
} }
/** /**
@ -219,12 +207,21 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
} }
} }
private QueryResultNetworkRecord() { public QueryResultNetworkRecord(Set<Link> links, URI href, String id, String type, String name, String ipScopeId,
// For JAXB and builder use String gateway, String netmask, String dns1, String dns2, String dnsSuffix, Boolean busy) {
super(links, href, id, type);
this.name = name;
this.ipScopeId = ipScopeId;
this.gateway = gateway;
this.netmask = netmask;
this.dns1 = dns1;
this.dns2 = dns2;
this.dnsSuffix = dnsSuffix;
isBusy = busy;
} }
private QueryResultNetworkRecord(URI href) { private QueryResultNetworkRecord() {
super(href); // For JAXB and builder use
} }
@XmlAttribute @XmlAttribute
@ -251,10 +248,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return name; return name;
} }
public void setName(String value) {
this.name = value;
}
/** /**
* IP scope object of this network. * IP scope object of this network.
*/ */
@ -262,9 +255,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return ipScopeId; return ipScopeId;
} }
public void setIpScopeId(String value) {
this.ipScopeId = value;
}
/** /**
* Gateway for the network. * Gateway for the network.
@ -273,10 +263,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return gateway; return gateway;
} }
public void setGateway(String value) {
this.gateway = value;
}
/** /**
* Netmask for the network. * Netmask for the network.
*/ */
@ -284,10 +270,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return netmask; return netmask;
} }
public void setNetmask(String value) {
this.netmask = value;
}
/** /**
* Primary DNS for the network. * Primary DNS for the network.
*/ */
@ -295,10 +277,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return dns1; return dns1;
} }
public void setDns1(String value) {
this.dns1 = value;
}
/** /**
* Secondary DNS for the network. * Secondary DNS for the network.
*/ */
@ -306,10 +284,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return dns2; return dns2;
} }
public void setDns2(String value) {
this.dns2 = value;
}
/** /**
* DNS suffix for the network. * DNS suffix for the network.
*/ */
@ -317,10 +291,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return dnsSuffix; return dnsSuffix;
} }
public void setDnsSuffix(String value) {
this.dnsSuffix = value;
}
/** /**
* Shows whether it is busy. * Shows whether it is busy.
*/ */
@ -328,10 +298,6 @@ public class QueryResultNetworkRecord extends QueryResultRecordType<QueryResultN
return isBusy; return isBusy;
} }
public void setIsBusy(Boolean value) {
this.isBusy = value;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -20,21 +20,13 @@ package org.jclouds.vcloud.director.v1_5.domain.query;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.HashMap;
import java.util.Map;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAnyAttribute;
import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlSchemaType;
import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.namespace.QName;
import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.Link;
@ -44,15 +36,14 @@ import com.google.common.collect.Sets;
/** /**
* Base type for query result Records. Subtypes define more specific elements. * Base type for query result Records. Subtypes define more specific elements.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="QueryResultRecordType" /&gt; * &lt;complexType name="QueryResultRecordType" /&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlAccessorType(XmlAccessType.FIELD) @XmlSeeAlso({QueryResultCatalogRecord.class, QueryResultNetworkRecord.class})
@XmlSeeAlso({ QueryResultCatalogRecord.class, QueryResultNetworkRecord.class })
public class QueryResultRecordType<T extends QueryResultRecordType<T>> { public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
public static <T extends QueryResultRecordType<T>> Builder<T> builder() { public static <T extends QueryResultRecordType<T>> Builder<T> builder() {
@ -111,11 +102,7 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
} }
public QueryResultRecordType<T> build() { public QueryResultRecordType<T> build() {
QueryResultRecordType<T> record = new QueryResultRecordType<T>(href); return new QueryResultRecordType<T>(links, href, id, type);
record.setId(id);
record.setType(type);
record.setLinks(links);
return record;
} }
public Builder<T> fromQueryResultRecordType(QueryResultRecordType<T> in) { public Builder<T> fromQueryResultRecordType(QueryResultRecordType<T> in) {
@ -123,7 +110,7 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
} }
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Link") @XmlElement(name = "Link")
private Set<Link> links = Sets.newLinkedHashSet(); private Set<Link> links = Sets.newLinkedHashSet();
@XmlAttribute @XmlAttribute
@XmlSchemaType(name = "anyURI") @XmlSchemaType(name = "anyURI")
@ -132,9 +119,13 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
private String id; private String id;
@XmlAttribute @XmlAttribute
private String type; private String type;
@XmlAnyAttribute
// XXX not sure about this public QueryResultRecordType(Set<Link> links, URI href, String id, String type) {
private Map<QName, String> otherAttributes = new HashMap<QName, String>(); this.links = links;
this.href = href;
this.id = id;
this.type = type;
}
public QueryResultRecordType(URI href) { public QueryResultRecordType(URI href) {
this.href = href; this.href = href;
@ -151,14 +142,6 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
return links; return links;
} }
public void setLinks(Set<Link> links) {
this.links = Sets.newLinkedHashSet(checkNotNull(links, "links"));
}
public void addLink(Link link) {
this.links.add(checkNotNull(link, "link"));
}
/** /**
* Contains the URI to the entity. An object reference, expressed in URL format. Because this URL includes the object identifier * Contains the URI to the entity. An object reference, expressed in URL format. Because this URL includes the object identifier
* portion of the id attribute value, it uniquely identifies the object, persists for the life of the object, and is never * portion of the id attribute value, it uniquely identifies the object, persists for the life of the object, and is never
@ -173,10 +156,6 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
return href; return href;
} }
public void setHref(URI href) {
this.href = href;
}
/** /**
* The resource identifier, expressed in URN format. The value of this attribute uniquely identifies the resource, persists for * The resource identifier, expressed in URN format. The value of this attribute uniquely identifies the resource, persists for
* the life of the resource, and is never reused. * the life of the resource, and is never reused.
@ -184,11 +163,6 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
public String getId() { public String getId() {
return id; return id;
} }
public void setId(String id) {
this.id = id;
}
/** /**
* Contains the type of the the entity. The object type, specified as a MIME content type, of the object that the link * Contains the type of the the entity. The object type, specified as a MIME content type, of the object that the link
* references. This attribute is present only for links to objects. It is not present for links to actions. * references. This attribute is present only for links to objects. It is not present for links to actions.
@ -199,19 +173,6 @@ public class QueryResultRecordType<T extends QueryResultRecordType<T>> {
return type; return type;
} }
public void setType(String type) {
this.type = type;
}
// XXX not sure about this
/**
* Gets a map that contains attributes that aren't bound to any typed property on this class.
*/
public Map<QName, String> getOtherAttributes() {
return otherAttributes;
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -21,33 +21,31 @@ package org.jclouds.vcloud.director.v1_5.domain.query;
import static com.google.common.base.Objects.equal; import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.VCLOUD_1_5_NS;
import java.net.URI; import java.net.URI;
import java.util.List;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
import org.jclouds.vcloud.director.v1_5.domain.EntityType;
import org.jclouds.vcloud.director.v1_5.domain.Link; import org.jclouds.vcloud.director.v1_5.domain.Link;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Lists; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
/** /**
* Represents the results from a vCloud query as records. * Represents the results from a vCloud query as records.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="QueryResultRecords" /&gt; * &lt;complexType name="QueryResultRecords" /&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
@XmlRootElement(namespace = VCLOUD_1_5_NS, name = "QueryResultRecords") @XmlRootElement(name = "QueryResultRecords")
public class QueryResultRecords<T extends QueryResultRecordType<T>> extends ContainerType<QueryResultRecords<T>> { public class QueryResultRecords<T extends QueryResultRecordType<T>> extends ContainerType<QueryResultRecords<T>> {
public static final String MEDIA_TYPE = VCloudDirectorMediaType.QUERY_RESULT_RECORDS; public static final String MEDIA_TYPE = VCloudDirectorMediaType.QUERY_RESULT_RECORDS;
@ -63,13 +61,13 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
public static class Builder<T extends QueryResultRecordType<T>> extends ContainerType.Builder<QueryResultRecords<T>> { public static class Builder<T extends QueryResultRecordType<T>> extends ContainerType.Builder<QueryResultRecords<T>> {
private List<T> records = Lists.newArrayList(); private Set<T> records = Sets.newLinkedHashSet();
/** /**
* @see QueryResultRecords#getRecords() * @see QueryResultRecords#getRecords()
*/ */
public Builder<T> records(List<T> records) { public Builder<T> records(Set<T> records) {
this.records = records; this.records = checkNotNull(records, "records");
return this; return this;
} }
@ -83,15 +81,7 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
@Override @Override
public QueryResultRecords<T> build() { public QueryResultRecords<T> build() {
QueryResultRecords<T> queryResultRecords = new QueryResultRecords<T>(href); return new QueryResultRecords<T>(href, type, links, name, page, pageSize, total, records);
queryResultRecords.setRecords(records);
queryResultRecords.setName(name);
queryResultRecords.setPage(page);
queryResultRecords.setPageSize(pageSize);
queryResultRecords.setTotal(total);
queryResultRecords.setType(type);
queryResultRecords.setLinks(links);
return queryResultRecords;
} }
/** /**
@ -131,7 +121,7 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
} }
/** /**
* @see ResourceType#getHref() * @see EntityType#getHref()
*/ */
@Override @Override
public Builder<T> href(URI href) { public Builder<T> href(URI href) {
@ -140,7 +130,7 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
} }
/** /**
* @see ResourceType#getType() * @see EntityType#getType()
*/ */
@Override @Override
public Builder<T> type(String type) { public Builder<T> type(String type) {
@ -149,7 +139,7 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
} }
/** /**
* @see ResourceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder<T> links(Set<Link> links) { public Builder<T> links(Set<Link> links) {
@ -158,7 +148,7 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
} }
/** /**
* @see ResourceType#getLinks() * @see EntityType#getLinks()
*/ */
@Override @Override
public Builder<T> link(Link link) { public Builder<T> link(Link link) {
@ -176,32 +166,25 @@ public class QueryResultRecords<T extends QueryResultRecordType<T>> extends Cont
} }
} }
protected QueryResultRecords() { protected QueryResultRecords(URI href, String type, Set<Link> links, String name, Integer page, Integer pageSize, Long total, Set<T> records) {
// For JAXB and builder use super(href, type, links, name, page, pageSize, total);
this.records = ImmutableSet.copyOf(records);
} }
protected QueryResultRecords(URI href) { protected QueryResultRecords() {
super(href); // For JAXB
} }
@XmlElementRef @XmlElementRef
protected List<T> records; private Set<T> records = Sets.newLinkedHashSet();
/** /**
* Set of records representing query results. * Set of records representing query results.
*/ */
public List<T> getRecords() { public Set<T> getRecords() {
return records; return records;
} }
public void setRecords(List<T> records) {
this.records = Lists.newArrayList(checkNotNull(records, "records"));
}
public void addRecords(T record) {
this.records.add(checkNotNull(record, "record"));
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -23,9 +23,7 @@ import static com.google.common.base.Objects.equal;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
import java.net.URI; import java.net.URI;
import java.util.List;
import java.util.Set; import java.util.Set;
import javax.xml.bind.annotation.XmlElementRef; import javax.xml.bind.annotation.XmlElementRef;
import javax.xml.bind.annotation.XmlElementRefs; import javax.xml.bind.annotation.XmlElementRefs;
@ -36,12 +34,12 @@ import org.jclouds.vcloud.director.v1_5.domain.ReferenceType;
import com.google.common.base.Objects; import com.google.common.base.Objects;
import com.google.common.base.Objects.ToStringHelper; import com.google.common.base.Objects.ToStringHelper;
import com.google.common.collect.Lists; import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets; import com.google.common.collect.Sets;
/** /**
* Represents the results from a vCloud query as references. * Represents the results from a vCloud query as references.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="QueryResultReferences" /&gt; * &lt;complexType name="QueryResultReferences" /&gt;
* </pre> * </pre>
@ -63,13 +61,13 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
public static class Builder<T extends ReferenceType<T>> extends ContainerType.Builder<QueryResultReferences<T>> { public static class Builder<T extends ReferenceType<T>> extends ContainerType.Builder<QueryResultReferences<T>> {
protected List<T> references = Lists.newArrayList(); protected Set<T> references = Sets.newLinkedHashSet();
/** /**
* @see QueryResultReferences#getReferences() * @see QueryResultReferences#getReferences()
*/ */
public Builder<T> references(List<T> references) { public Builder<T> references(Set<T> references) {
this.references = references; this.references = checkNotNull(references, "references");
return this; return this;
} }
@ -83,19 +81,11 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
@Override @Override
public QueryResultReferences<T> build() { public QueryResultReferences<T> build() {
QueryResultReferences<T> queryResultReferences = new QueryResultReferences<T>(href); return new QueryResultReferences<T>(href, type, links, name, page, pageSize, total, references);
queryResultReferences.setReferences(references);
queryResultReferences.setName(name);
queryResultReferences.setPage(page);
queryResultReferences.setPageSize(pageSize);
queryResultReferences.setTotal(total);
queryResultReferences.setType(type);
queryResultReferences.setLinks(links);
return queryResultReferences;
} }
/** /**
* @see Container#getName() * @see ContainerType#getName()
*/ */
@Override @Override
public Builder<T> name(String name) { public Builder<T> name(String name) {
@ -104,7 +94,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
} }
/** /**
* @see Container#getPage() * @see ContainerType#getPage()
*/ */
@Override @Override
public Builder<T> page(Integer page) { public Builder<T> page(Integer page) {
@ -113,7 +103,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
} }
/** /**
* @see Container#getPageSize() * @see ContainerType#getPageSize()
*/ */
@Override @Override
public Builder<T> pageSize(Integer pageSize) { public Builder<T> pageSize(Integer pageSize) {
@ -122,7 +112,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
} }
/** /**
* @see Container#getTotal() * @see ContainerType#getTotal()
*/ */
@Override @Override
public Builder<T> total(Long total) { public Builder<T> total(Long total) {
@ -131,7 +121,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
} }
/** /**
* @see ResourceType#getHref() * @see ContainerType#getHref()
*/ */
@Override @Override
public Builder<T> href(URI href) { public Builder<T> href(URI href) {
@ -140,7 +130,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
} }
/** /**
* @see ResourceType#getType() * @see ContainerType#getType()
*/ */
@Override @Override
public Builder<T> type(String type) { public Builder<T> type(String type) {
@ -149,7 +139,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
} }
/** /**
* @see ResourceType#getLinks() * @see ContainerType#getLinks()
*/ */
@Override @Override
public Builder<T> links(Set<Link> links) { public Builder<T> links(Set<Link> links) {
@ -158,7 +148,7 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
} }
/** /**
* @see ResourceType#getLinks() * @see ContainerType#getLinks()
*/ */
@Override @Override
public Builder<T> link(Link link) { public Builder<T> link(Link link) {
@ -176,35 +166,28 @@ public class QueryResultReferences<T extends ReferenceType<T>> extends Container
} }
} }
protected QueryResultReferences() { protected QueryResultReferences(URI href, String type, Set<Link> links, String name, Integer page, Integer pageSize, Long total, Set<T> references) {
// For JAXB and builder use super(href, type, links, name, page, pageSize, total);
this.references = ImmutableSet.copyOf(references);
} }
protected QueryResultReferences(URI href) { protected QueryResultReferences() {
super(href); // For JAXB and builder use
} }
// NOTE add other types as they are used. probably not the best way to do this. // NOTE add other types as they are used. probably not the best way to do this.
@XmlElementRefs({ @XmlElementRefs({
@XmlElementRef(type = CatalogReference.class) @XmlElementRef(type = CatalogReference.class)
}) })
protected List<T> references = Lists.newArrayList(); private Set<T> references = Sets.newLinkedHashSet();
/** /**
* Set of references representing query results. * Set of references representing query results.
*/ */
public List<T> getReferences() { public Set<T> getReferences() {
return references; return references;
} }
public void setReferences(List<T> references) {
this.references = Lists.newArrayList(checkNotNull(references, "references"));
}
public void addReference(T reference) {
this.references.add(checkNotNull(reference, "reference"));
}
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) if (this == o)

View File

@ -23,15 +23,16 @@ import org.jclouds.vcloud.director.v1_5.domain.ResourceEntityType;
/** /**
* Represents a base type for VAppType and VmType. * Represents a base type for VAppType and VmType.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="AbstractVAppType" &gt; * &lt;complexType name="AbstractVAppType" &gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
public abstract class AbstractVAppType extends ResourceEntityType<AbstractVAppType> { public abstract class AbstractVAppType<T extends AbstractVAppType<T>> extends ResourceEntityType<T> {
public static abstract class Builder<T extends AbstractVAppType<T>> extends ResourceEntityType.Builder<T> {}
// @XmlElement(name = "VAppParent") // @XmlElement(name = "VAppParent")
// protected ReferenceType vAppParent; // protected ReferenceType vAppParent;
// @XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class) // @XmlElementRef(name = "Section", namespace = "http://schemas.dmtf.org/ovf/envelope/1", type = JAXBElement.class)

View File

@ -20,26 +20,28 @@ package org.jclouds.vcloud.director.v1_5.domain.vapp;
/** /**
* Represents a vApp. * Represents a vApp.
* * <p/>
* <pre> * <pre>
* &lt;complexType name="VApp" /&gt; * &lt;complexType name="VApp" /&gt;
* </pre> * </pre>
* *
* @author grkvlt@apache.org * @author grkvlt@apache.org
*/ */
public class VApp extends AbstractVAppType { public class VApp extends AbstractVAppType<VApp> {
// //
// @SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
// public static Builder builder() { public static Builder builder() {
// return new Builder(); return new Builder();
// } }
//
// public Builder toBuilder() { //
// return new Builder().fromVApp(this); @Override
// } public Builder toBuilder() {
// return new Builder().fromVApp(this);
// public static class Builder extends AbstractVAppType.Builder<VApp> { }
//
public static class Builder extends AbstractVAppType.Builder<VApp> {
//
// private Owner owner; // private Owner owner;
// private Boolean inMaintenanceMode; // private Boolean inMaintenanceMode;
// private VAppChildren children; // private VAppChildren children;
@ -78,8 +80,11 @@ public class VApp extends AbstractVAppType {
// } // }
// //
// //
// public VApp build() { public VApp build() {
// VApp vApp = new VApp(); return new VApp();
}
// VApp vApp = new VApp();
// vApp.setOwner(owner); // vApp.setOwner(owner);
// vApp.setInMaintenanceMode(inMaintenanceMode); // vApp.setInMaintenanceMode(inMaintenanceMode);
// vApp.setChildren(children); // vApp.setChildren(children);
@ -92,18 +97,20 @@ public class VApp extends AbstractVAppType {
// public Builder fromAbstractVAppType(AbstractVAppType<VApp> in) { // public Builder fromAbstractVAppType(AbstractVAppType<VApp> in) {
// return Builder.class.cast(super.fromAbstractVAppType(in)); // return Builder.class.cast(super.fromAbstractVAppType(in));
// } // }
// public Builder fromVApp(VApp in) { public Builder fromVApp(VApp in) {
return new Builder();
}
// return fromAbstractVAppType(in) // return fromAbstractVAppType(in)
// .owner(in.getOwner()) // .owner(in.getOwner())
// .inMaintenanceMode(in.getInMaintenanceMode()) // .inMaintenanceMode(in.getInMaintenanceMode())
// .children(in.getChildren()) // .children(in.getChildren())
// .ovfDescriptorUploaded(in.getOvfDescriptorUploaded()); // .ovfDescriptorUploaded(in.getOvfDescriptorUploaded());
// } // }
// } }
//
// private VApp() { private VApp() {
// // For JAXB and builder use // For JAXB and builder use
// } }
// //
// //
// //