diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminCatalog.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminCatalog.java index af42723b72..6f466e7597 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminCatalog.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/AdminCatalog.java @@ -26,7 +26,7 @@ import java.util.Set; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlRootElement; import com.google.common.collect.Sets; @@ -54,7 +54,7 @@ import com.google.common.collect.Sets; * */ @XmlAccessorType(XmlAccessType.FIELD) -@XmlType(name = "AdminCatalog") +@XmlRootElement(name = "AdminCatalog") public class AdminCatalog extends CatalogType { @SuppressWarnings("unchecked") @@ -69,14 +69,13 @@ public class AdminCatalog extends CatalogType { public static class Builder extends CatalogType.Builder { public AdminCatalog build() { - AdminCatalog adminCatalog = new AdminCatalog(); - return adminCatalog; + return new AdminCatalog(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, isPublished); } /** * @see CatalogType#getOwner() */ - public Builder owner(Entity owner) { + public Builder owner(Owner owner) { super.owner(owner); return this; } @@ -186,7 +185,13 @@ public class AdminCatalog extends CatalogType { } } + @SuppressWarnings("unused") private AdminCatalog() { // For JAXB } + + public AdminCatalog(URI href, String type, Set links, String description, TasksInProgress tasksInProgress, String id, + String name, Owner owner, CatalogItems catalogItems, Boolean published) { + super(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, published); + } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java index ba5ec47507..7454d952d1 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Catalog.java @@ -63,7 +63,7 @@ public class Catalog extends CatalogType { /** * @see Catalog#getOwner() */ - public Builder owner(Entity owner) { + public Builder owner(Owner owner) { super.owner(owner); return this; } @@ -175,7 +175,7 @@ public class Catalog extends CatalogType { } public Catalog(URI href, String type, Set links, String description, TasksInProgress tasksInProgress, String id, - String name, Entity owner, CatalogItems catalogItems, Boolean published) { + String name, Owner owner, CatalogItems catalogItems, Boolean published) { super(href, type, links, description, tasksInProgress, id, name, owner, catalogItems, published); } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItems.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItems.java index 01037a1dfa..15b42492b3 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItems.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogItems.java @@ -18,16 +18,20 @@ */ package org.jclouds.vcloud.director.v1_5.domain; +import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; import java.util.Collection; import java.util.Collections; import java.util.Set; + import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; import com.google.common.collect.Sets; /** @@ -85,7 +89,7 @@ public class CatalogItems { // For JAXB and builder use } - private CatalogItems(Collection tasks) { + private CatalogItems(Set catalogItems) { this.catalogItems = catalogItems; } @@ -98,4 +102,28 @@ public class CatalogItems { public Set getCatalogItems() { return Collections.unmodifiableSet(this.catalogItems); } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + CatalogItems that = CatalogItems.class.cast(o); + return equal(this.catalogItems, that.catalogItems); + } + + @Override + public int hashCode() { + return Objects.hashCode(catalogItems); + } + + @Override + public String toString() { + return string().toString(); + } + + protected ToStringHelper string() { + return Objects.toStringHelper("").add("catalogItems", catalogItems); + } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogType.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogType.java index 5fa21d5872..f56095d5f6 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogType.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogType.java @@ -52,14 +52,14 @@ public class CatalogType> extends EntityType { public static class Builder> extends EntityType.Builder { - protected Entity owner; + protected Owner owner; protected CatalogItems catalogItems; protected Boolean isPublished; /** * @see CatalogType#getOwner() */ - public Builder owner(Entity owner) { + public Builder owner(Owner owner) { this.owner = owner; return this; } @@ -177,7 +177,7 @@ public class CatalogType> extends EntityType { } public CatalogType(URI href, String type, Set links, String description, TasksInProgress tasksInProgress, String id, - String name, Entity owner, CatalogItems catalogItems, Boolean published) { + String name, Owner owner, CatalogItems catalogItems, Boolean published) { super(href, type, links, description, tasksInProgress, id, name); this.owner = owner; this.catalogItems = catalogItems; @@ -189,7 +189,7 @@ public class CatalogType> extends EntityType { } @XmlElement(name = "Owner") - private Entity owner; + private Owner owner; @XmlElement(name = "CatalogItems") private CatalogItems catalogItems; @XmlElement(name = "IsPublished") @@ -198,7 +198,7 @@ public class CatalogType> extends EntityType { /** * Gets the value of the owner property. */ - public Entity getOwner() { + public Owner getOwner() { return owner; } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogsList.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogsList.java index bd4ec005ed..4571917f6b 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogsList.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/CatalogsList.java @@ -18,6 +18,7 @@ */ package org.jclouds.vcloud.director.v1_5.domain; +import static com.google.common.base.Objects.equal; import static com.google.common.base.Preconditions.checkNotNull; import java.util.Collection; @@ -27,6 +28,8 @@ import javax.xml.bind.annotation.XmlRootElement; import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType; +import com.google.common.base.Objects; +import com.google.common.base.Objects.ToStringHelper; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; @@ -98,5 +101,28 @@ public class CatalogsList { public Set getCatalogItems() { return this.catalogReferences; } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + CatalogsList that = CatalogsList.class.cast(o); + return equal(this.catalogReferences, that.catalogReferences); + } + + @Override + public int hashCode() { + return Objects.hashCode(catalogReferences); + } + @Override + public String toString() { + return string().toString(); + } + + protected ToStringHelper string() { + return Objects.toStringHelper("").add("catalogReferences", catalogReferences); + } } diff --git a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java index b20e2fdee4..2736f5af3f 100644 --- a/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java +++ b/labs/vcloud-director/src/main/java/org/jclouds/vcloud/director/v1_5/domain/Owner.java @@ -24,6 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import java.net.URI; import java.util.Set; + import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlType; @@ -59,7 +60,6 @@ public class Owner extends ResourceType { - @SuppressWarnings("unchecked") public static Builder builder() { return new Builder(); } @@ -134,6 +134,7 @@ public class Owner } } + @SuppressWarnings("unused") private Owner() { // For JAXB and builder use }