mirror of https://github.com/apache/jclouds.git
Issue 830: Use XmlElementWrapper annotation where possible
This commit is contained in:
parent
d4713572e4
commit
9e860a2328
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Preconditions.*;
|
||||
|
||||
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.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
/**
|
||||
* A list of access settings for a resource.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="AccessSettings" />
|
||||
* </pre>
|
||||
*
|
||||
* @since 0.9
|
||||
*/
|
||||
@XmlRootElement(name = "AccessSettings")
|
||||
@XmlType(name = "AccessSettingsType")
|
||||
public class AccessSettings {
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromAccessSettings(this);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private List<AccessSetting> accessSettings = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* @see AccessSettings#getAccessSettings()
|
||||
*/
|
||||
public Builder accessSettings(List<AccessSetting> accessSettings) {
|
||||
this.accessSettings = checkNotNull(accessSettings, "accessSettings");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AccessSettings#getAccessSettings()
|
||||
*/
|
||||
public Builder accessSetting(AccessSetting accessSetting) {
|
||||
this.accessSettings.add(checkNotNull(accessSetting, "accessSetting"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public AccessSettings build() {
|
||||
return new AccessSettings(accessSettings);
|
||||
}
|
||||
|
||||
public Builder fromAccessSettings(AccessSettings in) {
|
||||
return accessSettings(in.getAccessSettings());
|
||||
}
|
||||
}
|
||||
|
||||
protected AccessSettings() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
public AccessSettings(List<AccessSetting> accessSettings) {
|
||||
this.accessSettings = accessSettings;
|
||||
}
|
||||
|
||||
@XmlElement(name = "AccessSetting", required = true)
|
||||
protected List<AccessSetting> accessSettings = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* Gets the value of the accessSetting property.
|
||||
*/
|
||||
public List<AccessSetting> getAccessSettings() {
|
||||
return accessSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
AccessSettings that = AccessSettings.class.cast(o);
|
||||
return equal(this.accessSettings, that.accessSettings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(accessSettings);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("").add("accessSettings", accessSettings).toString();
|
||||
}
|
||||
}
|
|
@ -45,6 +45,7 @@ public class AdminCatalog extends CatalogType {
|
|||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<?> toBuilder() {
|
||||
return builder().fromAdminCatalog(this);
|
||||
}
|
||||
|
@ -54,6 +55,7 @@ public class AdminCatalog extends CatalogType {
|
|||
|
||||
public static abstract class Builder<B extends Builder<B>> extends CatalogType.Builder<B> {
|
||||
|
||||
@Override
|
||||
public AdminCatalog build() {
|
||||
return new AdminCatalog(this);
|
||||
}
|
||||
|
|
|
@ -19,15 +19,19 @@
|
|||
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.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* The AdminOrg represents an administrative view of an organization.
|
||||
|
@ -67,6 +71,7 @@ public class AdminOrg extends Org {
|
|||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<?> toBuilder() {
|
||||
return builder().fromAdminOrg(this);
|
||||
}
|
||||
|
@ -77,11 +82,11 @@ public class AdminOrg extends Org {
|
|||
public static abstract class Builder<B extends Builder<B>> extends Org.Builder<B> {
|
||||
|
||||
private OrgSettings settings;
|
||||
private UsersList users;
|
||||
private GroupsList groups;
|
||||
private CatalogsList catalogs;
|
||||
private Vdcs vdcs;
|
||||
private Networks networks;
|
||||
private Set<Reference> users = Sets.newLinkedHashSet();
|
||||
private Set<Reference> groups = Sets.newLinkedHashSet();
|
||||
private Set<Reference> catalogs = Sets.newLinkedHashSet();
|
||||
private Set<Reference> vdcs = Sets.newLinkedHashSet();
|
||||
private Set<Reference> networks = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* @see AdminOrg#getSettings()
|
||||
|
@ -94,43 +99,82 @@ public class AdminOrg extends Org {
|
|||
/**
|
||||
* @see AdminOrg#getUsers()
|
||||
*/
|
||||
public B users(UsersList users) {
|
||||
this.users = users;
|
||||
public B users(Iterable<Reference> users) {
|
||||
this.users = Sets.newLinkedHashSet(checkNotNull(users, "users"));
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AdminOrg#getUsers()
|
||||
*/
|
||||
public B user(Reference user) {
|
||||
users.add(checkNotNull(user, "user"));
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AdminOrg#getGroups()
|
||||
*/
|
||||
public B groups(GroupsList groups) {
|
||||
this.groups = groups;
|
||||
public B groups(Iterable<Reference> groups) {
|
||||
this.groups = Sets.newLinkedHashSet(checkNotNull(groups, "groups"));
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AdminOrg#getGroups()
|
||||
*/
|
||||
public B group(Reference group) {
|
||||
groups.add(checkNotNull(group, "group"));
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AdminOrg#getCatalogs()
|
||||
*/
|
||||
public B catalogs(CatalogsList catalogs) {
|
||||
this.catalogs = catalogs;
|
||||
public B catalogs(Iterable<Reference> catalogReferences) {
|
||||
this.catalogs = Sets.newLinkedHashSet(checkNotNull(catalogs, "catalogs"));
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AdminOrg#getCatalogs()
|
||||
*/
|
||||
public B catalog(Reference catalog) {
|
||||
this.catalogs.add(checkNotNull(catalog, "catalog"));
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AdminOrg#getVdcs()
|
||||
*/
|
||||
public B vdcs(Vdcs vdcs) {
|
||||
this.vdcs = vdcs;
|
||||
public B vdcs(Iterable<Reference> vdcs) {
|
||||
this.vdcs = Sets.newLinkedHashSet(checkNotNull(vdcs, "vdcs"));
|
||||
return self();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see AdminOrg#getVdcs()
|
||||
*/
|
||||
public B vdc(Reference vdc) {
|
||||
this.vdcs.add(checkNotNull(vdc, "vdc"));
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AdminOrg#getNetworks()
|
||||
*/
|
||||
public B networks(Networks networks) {
|
||||
this.networks = networks;
|
||||
public B networks(Iterable<Reference> networks) {
|
||||
this.networks = Sets.newLinkedHashSet(checkNotNull(networks, "networks"));
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see AdminOrg#getNetworks()
|
||||
*/
|
||||
public B network(Reference network) {
|
||||
this.networks.add(checkNotNull(network, "network"));
|
||||
return self();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AdminOrg build() {
|
||||
return new AdminOrg(this);
|
||||
}
|
||||
|
@ -153,33 +197,33 @@ public class AdminOrg extends Org {
|
|||
protected AdminOrg(Builder<?> builder) {
|
||||
super(builder);
|
||||
this.settings = builder.settings;
|
||||
this.users = builder.users;
|
||||
this.groups = builder.groups;
|
||||
this.catalogs = builder.catalogs;
|
||||
this.vdcs = builder.vdcs;
|
||||
this.networks = builder.networks;
|
||||
this.users = builder.users == null ? Sets.<Reference>newLinkedHashSet() : ImmutableSet.copyOf(builder.users);
|
||||
this.groups = builder.groups == null ? Sets.<Reference>newLinkedHashSet() : ImmutableSet.copyOf(builder.groups);
|
||||
this.catalogs = builder.catalogs == null ? Sets.<Reference>newLinkedHashSet() : ImmutableSet.copyOf(builder.catalogs);
|
||||
this.vdcs = builder.vdcs == null ? Sets.<Reference>newLinkedHashSet() : ImmutableSet.copyOf(builder.vdcs);
|
||||
this.networks = builder.networks == null ? Sets.<Reference>newLinkedHashSet() : ImmutableSet.copyOf(builder.networks);
|
||||
}
|
||||
|
||||
@XmlElement(name = "Settings", required = true)
|
||||
private OrgSettings settings;
|
||||
@XmlElement(name = "Users")
|
||||
private UsersList users;
|
||||
@XmlElement(name = "Groups")
|
||||
private GroupsList groups;
|
||||
@XmlElement(name = "Catalogs")
|
||||
private CatalogsList catalogs;
|
||||
@XmlElement(name = "Vdcs")
|
||||
private Vdcs vdcs;
|
||||
@XmlElement(name = "Networks")
|
||||
private Networks networks;
|
||||
@XmlElementWrapper(name = "Users")
|
||||
@XmlElement(name = "UserReference")
|
||||
protected Set<Reference> users = Sets.newLinkedHashSet();
|
||||
@XmlElementWrapper(name = "Groups")
|
||||
@XmlElement(name = "GroupReference")
|
||||
protected Set<Reference> groups = Sets.newLinkedHashSet();
|
||||
@XmlElementWrapper(name = "Catalogs")
|
||||
@XmlElement(name = "CatalogReference")
|
||||
private Set<Reference> catalogs = Sets.newLinkedHashSet();
|
||||
@XmlElementWrapper(name = "Vdcs")
|
||||
@XmlElement(name = "Vdc")
|
||||
protected Set<Reference> vdcs = Sets.newLinkedHashSet();
|
||||
@XmlElementWrapper(name = "Networks")
|
||||
@XmlElement(name = "Network")
|
||||
protected Set<Reference> networks = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* Gets the value of the settings property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link OrgSettings }
|
||||
*
|
||||
*/
|
||||
public OrgSettings getSettings() {
|
||||
return settings;
|
||||
|
@ -187,61 +231,36 @@ public class AdminOrg extends Org {
|
|||
|
||||
/**
|
||||
* Gets the value of the users property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link UsersList }
|
||||
*
|
||||
*/
|
||||
public UsersList getUsers() {
|
||||
public Set<Reference> getUsers() {
|
||||
return users;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the groups property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link GroupsList }
|
||||
*
|
||||
*/
|
||||
public GroupsList getGroups() {
|
||||
public Set<Reference> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the catalogs property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link CatalogsList }
|
||||
*
|
||||
*/
|
||||
public CatalogsList getCatalogs() {
|
||||
public Set<Reference> getCatalogs() {
|
||||
return catalogs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the vdcs property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Vdcs }
|
||||
*
|
||||
*/
|
||||
public Vdcs getVdcs() {
|
||||
public Set<Reference> getVdcs() {
|
||||
return vdcs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the networks property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Networks }
|
||||
*
|
||||
*/
|
||||
public Networks getNetworks() {
|
||||
public Set<Reference> getNetworks() {
|
||||
return networks;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,130 +0,0 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package 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.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Represents a list of catalog item references.
|
||||
* <p/>
|
||||
* <pre>
|
||||
* <complexType name="CatalogItemsType" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlRootElement(name = "CatalogItems")
|
||||
public class CatalogItems {
|
||||
|
||||
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEMS;
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private Set<Reference> catalogItems = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* @see CatalogItems#getCatalogItems()
|
||||
*/
|
||||
public Builder items(Collection<Reference> catalogItems) {
|
||||
this.catalogItems = Sets.newLinkedHashSet(checkNotNull(catalogItems, "catalogItems"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogItems#getCatalogItems()
|
||||
*/
|
||||
public Builder item(Reference catalogItem) {
|
||||
this.catalogItems.add(checkNotNull(catalogItem, "catalogItem"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CatalogItems build() {
|
||||
return new CatalogItems(catalogItems);
|
||||
}
|
||||
|
||||
public Builder fromCatalogItems(CatalogItems in) {
|
||||
return items(in.getCatalogItems());
|
||||
}
|
||||
}
|
||||
|
||||
private CatalogItems() {
|
||||
// For JAXB
|
||||
}
|
||||
|
||||
private CatalogItems(Set<Reference> catalogItems) {
|
||||
this.catalogItems = ImmutableSet.copyOf(catalogItems);
|
||||
}
|
||||
|
||||
@XmlElement(name = "CatalogItem")
|
||||
private Set<Reference> catalogItems = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* Gets the value of the catalogItems property.
|
||||
*/
|
||||
public Set<Reference> 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);
|
||||
}
|
||||
}
|
|
@ -19,16 +19,22 @@
|
|||
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.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* Container for references to VappTemplate and Media objects.
|
||||
* <p/>
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="CatalogType" />
|
||||
* </pre>
|
||||
|
@ -42,6 +48,7 @@ public class CatalogType extends EntityType {
|
|||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<?> toBuilder() {
|
||||
return builder().fromCatalogType(this);
|
||||
}
|
||||
|
@ -52,7 +59,7 @@ public class CatalogType extends EntityType {
|
|||
public static class Builder<B extends Builder<B>> extends EntityType.Builder<B> {
|
||||
|
||||
private Owner owner;
|
||||
private CatalogItems catalogItems;
|
||||
private Set<Reference> catalogItems = Sets.newLinkedHashSet();
|
||||
private Boolean isPublished;
|
||||
|
||||
/**
|
||||
|
@ -64,10 +71,18 @@ public class CatalogType extends EntityType {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see CatalogType#getCatalogItems()
|
||||
* @see CatalogItems#getCatalogItems()
|
||||
*/
|
||||
public B catalogItems(CatalogItems catalogItems) {
|
||||
this.catalogItems = catalogItems;
|
||||
public B items(Iterable<Reference> catalogItems) {
|
||||
this.catalogItems = Sets.newLinkedHashSet(checkNotNull(catalogItems, "catalogItems"));
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogItems#getCatalogItems()
|
||||
*/
|
||||
public B item(Reference catalogItem) {
|
||||
this.catalogItems.add(checkNotNull(catalogItem, "catalogItem"));
|
||||
return self();
|
||||
}
|
||||
|
||||
|
@ -93,14 +108,14 @@ public class CatalogType extends EntityType {
|
|||
}
|
||||
|
||||
public B fromCatalogType(CatalogType in) {
|
||||
return fromEntityType(in).owner(in.getOwner()).catalogItems(in.getCatalogItems()).isPublished(in.isPublished());
|
||||
return fromEntityType(in).owner(in.getOwner()).items(in.getCatalogItems()).isPublished(in.isPublished());
|
||||
}
|
||||
}
|
||||
|
||||
protected CatalogType(Builder<?> builder) {
|
||||
super(builder);
|
||||
this.owner = builder.owner;
|
||||
this.catalogItems = builder.catalogItems;
|
||||
this.catalogItems = builder.catalogItems == null || builder.catalogItems.isEmpty() ? null : ImmutableSet.copyOf(builder.catalogItems);
|
||||
this.isPublished = builder.isPublished;
|
||||
}
|
||||
|
||||
|
@ -110,8 +125,9 @@ public class CatalogType extends EntityType {
|
|||
|
||||
@XmlElement(name = "Owner")
|
||||
private Owner owner;
|
||||
@XmlElement(name = "CatalogItems")
|
||||
private CatalogItems catalogItems;
|
||||
@XmlElementWrapper(name = "CatalogItems")
|
||||
@XmlElement(name = "CatalogItem")
|
||||
private Set<Reference> catalogItems;
|
||||
@XmlElement(name = "IsPublished")
|
||||
private Boolean isPublished;
|
||||
|
||||
|
@ -125,8 +141,8 @@ public class CatalogType extends EntityType {
|
|||
/**
|
||||
* Gets the value of the catalogItems property.
|
||||
*/
|
||||
public CatalogItems getCatalogItems() {
|
||||
return catalogItems;
|
||||
public Set<Reference> getCatalogItems() {
|
||||
return catalogItems == null ? ImmutableSet.<Reference>of() : ImmutableSet.copyOf(catalogItems);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -145,19 +161,19 @@ public class CatalogType extends EntityType {
|
|||
CatalogType that = CatalogType.class.cast(o);
|
||||
return super.equals(that) &&
|
||||
equal(this.owner, that.owner) &&
|
||||
equal(this.catalogItems, that.catalogItems) &&
|
||||
equal(this.getCatalogItems(), that.getCatalogItems()) &&
|
||||
equal(this.isPublished, that.isPublished);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(super.hashCode(), owner, catalogItems, catalogItems);
|
||||
return Objects.hashCode(super.hashCode(), owner, getCatalogItems(), catalogItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ToStringHelper string() {
|
||||
return super.string().add("owner", owner)
|
||||
.add("catalogItems", catalogItems)
|
||||
.add("catalogItems", getCatalogItems())
|
||||
.add("isPublished", isPublished);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,129 +0,0 @@
|
|||
/*
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package 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.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.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Container for ReferenceType elements that reference catalogs.
|
||||
* <p/>
|
||||
* <pre>
|
||||
* <complexType name="CatalogsListType" />
|
||||
* </pre>
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
@XmlRootElement(name = "CatalogsList")
|
||||
public class CatalogsList {
|
||||
|
||||
public static final String MEDIA_TYPE = VCloudDirectorMediaType.CATALOG_ITEMS;
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private Set<Reference> catalogReferences = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* @see CatalogsList#getCatalogItems()
|
||||
*/
|
||||
public Builder catalogs(Set<Reference> catalogReferences) {
|
||||
this.catalogReferences = checkNotNull(catalogReferences, "catalogReferences");
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see CatalogsList#getCatalogItems()
|
||||
*/
|
||||
public Builder catalog(Reference catalog) {
|
||||
this.catalogReferences.add(checkNotNull(catalog, "catalog"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public CatalogsList build() {
|
||||
return new CatalogsList(catalogReferences);
|
||||
}
|
||||
|
||||
public Builder fromCatalogsList(CatalogsList in) {
|
||||
return catalogs(in.getCatalogItems());
|
||||
}
|
||||
}
|
||||
|
||||
private CatalogsList() {
|
||||
// for JAXB
|
||||
}
|
||||
|
||||
private CatalogsList(Set<Reference> catalogReferences) {
|
||||
this.catalogReferences = ImmutableSet.copyOf(checkNotNull(catalogReferences, "catalogReferences"));
|
||||
}
|
||||
|
||||
@XmlElement(name = "CatalogReference")
|
||||
private Set<Reference> catalogReferences = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* Gets the value of the catalogReferences property.
|
||||
*/
|
||||
public Set<Reference> getCatalogItems() {
|
||||
return Collections.unmodifiableSet(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);
|
||||
}
|
||||
}
|
|
@ -18,15 +18,19 @@
|
|||
*/
|
||||
package org.jclouds.vcloud.director.v1_5.domain;
|
||||
|
||||
import static com.google.common.base.Objects.*;
|
||||
import static com.google.common.base.Objects.equal;
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
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.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
/**
|
||||
* Used to control access to resources.
|
||||
|
@ -53,7 +57,7 @@ public class ControlAccessParams {
|
|||
|
||||
private Boolean sharedToEveryone = Boolean.FALSE;
|
||||
private String everyoneAccessLevel;
|
||||
private AccessSettings accessSettings;
|
||||
private Set<AccessSetting> accessSettings = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* @see ControlAccessParams#getIsSharedToEveryone()
|
||||
|
@ -90,8 +94,16 @@ public class ControlAccessParams {
|
|||
/**
|
||||
* @see ControlAccessParams#getAccessSettings()
|
||||
*/
|
||||
public Builder accessSettings(AccessSettings accessSettings) {
|
||||
this.accessSettings = accessSettings;
|
||||
public Builder accessSettings(Iterable<AccessSetting> accessSettings) {
|
||||
this.accessSettings = Sets.newLinkedHashSet(checkNotNull(accessSettings, "accessSettings"));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ControlAccessParams#getAccessSettings()
|
||||
*/
|
||||
public Builder accessSetting(AccessSetting accessSetting) {
|
||||
this.accessSettings.add(checkNotNull(accessSetting, "accessSetting"));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -109,18 +121,19 @@ public class ControlAccessParams {
|
|||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
public ControlAccessParams(Boolean sharedToEveryone, String everyoneAccessLevel, AccessSettings accessSettings) {
|
||||
public ControlAccessParams(Boolean sharedToEveryone, String everyoneAccessLevel, Iterable<AccessSetting> accessSettings) {
|
||||
this.sharedToEveryone = sharedToEveryone;
|
||||
this.everyoneAccessLevel = everyoneAccessLevel;
|
||||
this.accessSettings = accessSettings;
|
||||
this.accessSettings = accessSettings == null ? Sets.<AccessSetting>newLinkedHashSet() : ImmutableSet.copyOf(accessSettings);
|
||||
}
|
||||
|
||||
@XmlElement(name = "IsSharedToEveryone", required = true)
|
||||
protected Boolean sharedToEveryone;
|
||||
@XmlElement(name = "EveryoneAccessLevel")
|
||||
protected String everyoneAccessLevel;
|
||||
@XmlElement(name = "AccessSettings")
|
||||
protected AccessSettings accessSettings;
|
||||
@XmlElementWrapper(name = "AccessSettings")
|
||||
@XmlElement(name = "AccessSetting")
|
||||
protected Set<AccessSetting> accessSettings = Sets.newLinkedHashSet();
|
||||
|
||||
/**
|
||||
* If true, this means that the resource is shared with everyone in the organization.
|
||||
|
@ -143,7 +156,7 @@ public class ControlAccessParams {
|
|||
*
|
||||
* Required on create and modify if {@link #isSharedToEveryone()} is false.
|
||||
*/
|
||||
public AccessSettings getAccessSettings() {
|
||||
public Set<AccessSetting> getAccessSettings() {
|
||||
return accessSettings;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,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.Collections;
|
||||
import java.util.Set;
|
||||
|
@ -52,6 +53,7 @@ public class EntityType extends ResourceType {
|
|||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<?> toBuilder() {
|
||||
return builder().fromEntityType(this);
|
||||
}
|
||||
|
@ -62,7 +64,7 @@ public class EntityType extends ResourceType {
|
|||
public static abstract class Builder<B extends Builder<B>> extends ResourceType.Builder<B> {
|
||||
|
||||
private String description;
|
||||
private Set<Task> tasks;
|
||||
private Set<Task> tasks = Sets.newLinkedHashSet();
|
||||
private String name;
|
||||
private String id;
|
||||
|
||||
|
@ -93,8 +95,16 @@ public class EntityType extends ResourceType {
|
|||
/**
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
public B tasks(Set<Task> tasks) {
|
||||
this.tasks = tasks;
|
||||
public B tasks(Iterable<Task> tasks) {
|
||||
this.tasks = Sets.newLinkedHashSet(checkNotNull(tasks, "tasks"));
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see EntityType#getTasks()
|
||||
*/
|
||||
public B task(Task task) {
|
||||
this.tasks.add(checkNotNull(task, "task"));
|
||||
return self();
|
||||
}
|
||||
|
||||
|
@ -105,7 +115,7 @@ public class EntityType extends ResourceType {
|
|||
|
||||
public B fromEntityType(EntityType in) {
|
||||
return fromResourceType(in)
|
||||
.description(in.getDescription()).tasks(Sets.newLinkedHashSet(in.getTasks()))
|
||||
.description(in.getDescription()).tasks(in.getTasks())
|
||||
.id(in.getId()).name(in.getName());
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +133,6 @@ public class EntityType extends ResourceType {
|
|||
protected EntityType(Builder<?> builder) {
|
||||
super(builder);
|
||||
this.description = builder.description;
|
||||
// nullable so that jaxb wont persist empty collections
|
||||
this.tasks = builder.tasks == null || builder.tasks.isEmpty() ? null : ImmutableSet.copyOf(builder.tasks);
|
||||
this.id = builder.id;
|
||||
this.name = builder.name;
|
||||
|
|
|
@ -20,14 +20,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.Set;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -69,6 +75,7 @@ public class Group extends EntityType {
|
|||
return new ConcreteBuilder();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Builder<?> toBuilder() {
|
||||
return builder().fromGroup(this);
|
||||
}
|
||||
|
@ -79,7 +86,7 @@ public class Group extends EntityType {
|
|||
public static abstract class Builder<B extends Builder<B>> extends EntityType.Builder<B> {
|
||||
|
||||
private String nameInSource;
|
||||
private UsersList usersList;
|
||||
private Set<Reference> users = Sets.newLinkedHashSet();
|
||||
private Reference role;
|
||||
|
||||
/**
|
||||
|
@ -91,10 +98,18 @@ public class Group extends EntityType {
|
|||
}
|
||||
|
||||
/**
|
||||
* @see Group#getUsersList()
|
||||
* @see Group#getUsers()
|
||||
*/
|
||||
public B usersList(UsersList usersList) {
|
||||
this.usersList = usersList;
|
||||
public B users(Iterable<Reference> users) {
|
||||
this.users = Sets.newLinkedHashSet(checkNotNull(users, "users"));
|
||||
return self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Group#getUsers()
|
||||
*/
|
||||
public B user(Reference user) {
|
||||
users.add(checkNotNull(user, "user"));
|
||||
return self();
|
||||
}
|
||||
|
||||
|
@ -106,6 +121,7 @@ public class Group extends EntityType {
|
|||
return self();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Group build() {
|
||||
return new Group(this);
|
||||
}
|
||||
|
@ -113,7 +129,7 @@ public class Group extends EntityType {
|
|||
public B fromGroup(Group in) {
|
||||
return fromEntityType(in)
|
||||
.nameInSource(in.getNameInSource())
|
||||
.usersList(in.getUsersList())
|
||||
.users(in.getUsersList())
|
||||
.role(in.getRole());
|
||||
}
|
||||
}
|
||||
|
@ -126,48 +142,34 @@ public class Group extends EntityType {
|
|||
protected Group(Builder<?> builder) {
|
||||
super(builder);
|
||||
this.nameInSource = builder.nameInSource;
|
||||
this.usersList = builder.usersList;
|
||||
this.usersList = builder.users == null ? Sets.<Reference>newLinkedHashSet() : ImmutableSet.copyOf(builder.users);
|
||||
this.role = builder.role;
|
||||
}
|
||||
|
||||
@XmlElement(name = "NameInSource")
|
||||
protected String nameInSource;
|
||||
@XmlElement(name = "UsersList")
|
||||
protected UsersList usersList;
|
||||
@XmlElementWrapper(name = "UsersList")
|
||||
@XmlElement(name = "UserReference")
|
||||
protected Set<Reference> usersList = Sets.newLinkedHashSet();
|
||||
@XmlElement(name = "Role")
|
||||
protected Reference role;
|
||||
|
||||
/**
|
||||
* Gets the value of the nameInSource property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link String }
|
||||
*
|
||||
*/
|
||||
public String getNameInSource() {
|
||||
return nameInSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the usersList property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link UsersList }
|
||||
*
|
||||
* Gets the value of the users property.
|
||||
*/
|
||||
public UsersList getUsersList() {
|
||||
public Set<Reference> getUsersList() {
|
||||
return usersList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the role property.
|
||||
*
|
||||
* @return
|
||||
* possible object is
|
||||
* {@link Reference }
|
||||
*
|
||||
*/
|
||||
public Reference getRole() {
|
||||
return role;
|
||||
|
|
|
@ -1,165 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package 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.ArrayList;
|
||||
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.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Container for ReferenceType elements that reference groups.
|
||||
*
|
||||
*
|
||||
* <p>Java class for GroupsList complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="GroupsList">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
|
||||
* <sequence>
|
||||
* <element name="GroupReference" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "GroupsList")
|
||||
@XmlType(propOrder = {
|
||||
"groups"
|
||||
})
|
||||
public class GroupsList {
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromGroupsList(this);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private List<Reference> groups;
|
||||
|
||||
/**
|
||||
* @see GroupsList#getGroupReference()
|
||||
*/
|
||||
public Builder groups(List<Reference> groups) {
|
||||
this.groups = ImmutableList.copyOf(groups);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see GroupsList#getGroupReference()
|
||||
*/
|
||||
public Builder group(Reference group) {
|
||||
groups.add(checkNotNull(group, "group"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public GroupsList build() {
|
||||
return new GroupsList(groups);
|
||||
}
|
||||
|
||||
public Builder fromGroupsList(GroupsList in) {
|
||||
return groups(in.getGroups());
|
||||
}
|
||||
}
|
||||
|
||||
private GroupsList() {
|
||||
// For JAXB
|
||||
}
|
||||
|
||||
private GroupsList(List<Reference> groups) {
|
||||
this.groups = groups;
|
||||
}
|
||||
|
||||
@XmlElement(name = "GroupReference")
|
||||
protected List<Reference> groups;
|
||||
|
||||
/**
|
||||
* Gets the value of the groupReference 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 groupReference property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getGroupReference().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link Reference }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<Reference> getGroups() {
|
||||
if (groups == null) {
|
||||
groups = new ArrayList<Reference>();
|
||||
}
|
||||
return this.groups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
GroupsList that = GroupsList.class.cast(o);
|
||||
return equal(groups, that.groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("groups", groups).toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,172 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package 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.ArrayList;
|
||||
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.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Container for ReferenceType elements that reference ExternalNetwork objects.
|
||||
* This element is created by the server and is read only.
|
||||
*
|
||||
*
|
||||
* <p>Java class for Networks complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="Networks">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
|
||||
* <sequence>
|
||||
* <element name="Network" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlType(name = "Networks", propOrder = {
|
||||
"networks"
|
||||
})
|
||||
public class Networks {
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromNetworks(this);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private List<Reference> networks = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* @see Networks#getNetwork()
|
||||
*/
|
||||
public Builder networks(List<Reference> networks) {
|
||||
this.networks = ImmutableList.copyOf(networks);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Networks#getNetwork()
|
||||
*/
|
||||
public Builder network(Reference network) {
|
||||
this.networks.add(checkNotNull(network, "network"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Networks build() {
|
||||
return new Networks(networks);
|
||||
}
|
||||
|
||||
|
||||
public Builder fromNetworks(Networks in) {
|
||||
return networks(in.getNetwork());
|
||||
}
|
||||
}
|
||||
|
||||
private Networks() {
|
||||
// For JAXB
|
||||
}
|
||||
|
||||
private Networks(List<Reference> networks) {
|
||||
this.networks = networks;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Network")
|
||||
protected List<Reference> networks;
|
||||
|
||||
/**
|
||||
* 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 Reference }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<Reference> getNetwork() {
|
||||
if (networks == null) {
|
||||
networks = new ArrayList<Reference>();
|
||||
}
|
||||
return this.networks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
Networks that = Networks.class.cast(o);
|
||||
return equal(networks, that.networks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(networks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
public ToStringHelper string() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("networks", networks);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,166 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package 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.ArrayList;
|
||||
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.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Container for ReferenceType elements that reference users.
|
||||
*
|
||||
*
|
||||
* <p>Java class for UsersList complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="UsersList">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
|
||||
* <sequence>
|
||||
* <element name="UserReference" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "UsersList")
|
||||
@XmlType(propOrder = {
|
||||
"users"
|
||||
})
|
||||
public class UsersList {
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromUsersList(this);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private List<Reference> users = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* @see UsersList#getUsers()
|
||||
*/
|
||||
public Builder users(List<Reference> users) {
|
||||
this.users = ImmutableList.copyOf(users);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see UsersList#getUsers()
|
||||
*/
|
||||
public Builder user(Reference user) {
|
||||
users.add(checkNotNull(user, "user"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public UsersList build() {
|
||||
return new UsersList(users);
|
||||
}
|
||||
|
||||
public Builder fromUsersList(UsersList in) {
|
||||
return users(in.getUsers());
|
||||
}
|
||||
}
|
||||
|
||||
private UsersList() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private UsersList(List<Reference> users) {
|
||||
this.users = users;
|
||||
}
|
||||
|
||||
@XmlElement(name = "UserReference")
|
||||
protected List<Reference> users;
|
||||
|
||||
/**
|
||||
* Gets the value of the userReference 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 userReference property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getUserReference().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link Reference }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<Reference> getUsers() {
|
||||
if (users == null) {
|
||||
users = new ArrayList<Reference>();
|
||||
}
|
||||
return this.users;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
UsersList that = UsersList.class.cast(o);
|
||||
return equal(users, that.users);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(users);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("userReference", users).toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,176 +0,0 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package 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.ArrayList;
|
||||
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.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlType;
|
||||
|
||||
import com.google.common.base.Objects;
|
||||
import com.google.common.base.Objects.ToStringHelper;
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Represents a list of references to virtual data centers.
|
||||
*
|
||||
*
|
||||
* <p>Java class for Vdcs complex type.
|
||||
*
|
||||
* <p>The following schema fragment specifies the expected content contained within this class.
|
||||
*
|
||||
* <pre>
|
||||
* <complexType name="Vdcs">
|
||||
* <complexContent>
|
||||
* <extension base="{http://www.vmware.com/vcloud/v1.5}VCloudExtensibleType">
|
||||
* <sequence>
|
||||
* <element name="Vdc" type="{http://www.vmware.com/vcloud/v1.5}ReferenceType" maxOccurs="unbounded" minOccurs="0"/>
|
||||
* </sequence>
|
||||
* <anyAttribute processContents='lax' namespace='##other'/>
|
||||
* </extension>
|
||||
* </complexContent>
|
||||
* </complexType>
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "Vdcs")
|
||||
@XmlType(propOrder = {
|
||||
"vdcs"
|
||||
})
|
||||
public class Vdcs {
|
||||
|
||||
// FIXME Delete Vdcs, and use Set<Vdc>
|
||||
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
public Builder toBuilder() {
|
||||
return new Builder().fromVdcs(this);
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
|
||||
private List<Reference> vdcs = Lists.newArrayList();
|
||||
|
||||
/**
|
||||
* @see Vdcs#getVdc()
|
||||
*/
|
||||
public Builder vdcs(List<Reference> vdcs) {
|
||||
this.vdcs = ImmutableList.copyOf(vdcs);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Vdcs#getVdc()
|
||||
*/
|
||||
public Builder vdc(Reference vdc) {
|
||||
this.vdcs.add(checkNotNull(vdc, "vdc"));
|
||||
return this;
|
||||
}
|
||||
|
||||
public Vdcs build() {
|
||||
return new Vdcs(vdcs);
|
||||
}
|
||||
|
||||
public Builder fromVdcs(Vdcs in) {
|
||||
return vdcs(in.getVdcs());
|
||||
}
|
||||
}
|
||||
|
||||
private Vdcs() {
|
||||
// For JAXB and builder use
|
||||
}
|
||||
|
||||
private Vdcs(List<Reference> vdcs) {
|
||||
this.vdcs = vdcs;
|
||||
}
|
||||
|
||||
|
||||
@XmlElement(name = "Vdc")
|
||||
protected List<Reference> vdcs;
|
||||
|
||||
/**
|
||||
* Gets the value of the vdc 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 vdc property.
|
||||
*
|
||||
* <p>
|
||||
* For example, to add a new item, do as follows:
|
||||
* <pre>
|
||||
* getVdc().add(newItem);
|
||||
* </pre>
|
||||
*
|
||||
*
|
||||
* <p>
|
||||
* Objects of the following type(s) are allowed in the list
|
||||
* {@link Reference }
|
||||
*
|
||||
*
|
||||
*/
|
||||
public List<Reference> getVdcs() {
|
||||
if (vdcs == null) {
|
||||
vdcs = new ArrayList<Reference>();
|
||||
}
|
||||
return this.vdcs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o == null || getClass() != o.getClass())
|
||||
return false;
|
||||
Vdcs that = Vdcs.class.cast(o);
|
||||
return equal(vdcs, that.vdcs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(vdcs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return string().toString();
|
||||
}
|
||||
|
||||
public ToStringHelper string() {
|
||||
return Objects.toStringHelper("")
|
||||
.add("vdcs", vdcs);
|
||||
}
|
||||
|
||||
}
|
|
@ -68,6 +68,7 @@ import org.jclouds.vcloud.director.v1_5.domain.query.QueryResultRecordType;
|
|||
|
||||
import com.beust.jcommander.internal.Maps;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.net.InetAddresses;
|
||||
|
||||
|
@ -110,11 +111,18 @@ public class Checks {
|
|||
/**
|
||||
* Assumes the validTypes to be vcloud-specific types.
|
||||
*
|
||||
* @see checkReferenceType(ReferenceType, Collection<String>)
|
||||
* @see #checkReferenceType(Reference, Collection)
|
||||
*/
|
||||
public static void checkReferenceType(Reference reference) {
|
||||
checkReferenceType(reference, VCloudDirectorMediaType.ALL);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see #checkReferenceType(Reference, Collection)
|
||||
*/
|
||||
public static void checkReferenceType(Reference reference, String type) {
|
||||
checkReferenceType(reference, ImmutableSet.of(type));
|
||||
}
|
||||
|
||||
public static void checkReferenceType(Reference reference, Collection<String> validTypes) {
|
||||
// Check required fields
|
||||
|
@ -283,41 +291,26 @@ public class Checks {
|
|||
assertNotNull(org.getSettings(), String.format(NOT_NULL_OBJ_FIELD_FMT, "settings", "AdminOrg"));
|
||||
|
||||
// optional
|
||||
if (org.getGroups() != null) {
|
||||
checkGroupsList(org.getGroups());
|
||||
for (Reference user : org.getUsers()) {
|
||||
checkReferenceType(user, VCloudDirectorMediaType.ADMIN_USER);
|
||||
}
|
||||
if (org.getCatalogs() != null) {
|
||||
checkCatalogsList(org.getCatalogs());
|
||||
for (Reference group : org.getGroups()) {
|
||||
checkReferenceType(group, VCloudDirectorMediaType.GROUP);
|
||||
}
|
||||
if (org.getVdcs() != null) {
|
||||
checkVdcs(org.getVdcs());
|
||||
for (Reference catalog : org.getCatalogs()) {
|
||||
checkReferenceType(catalog, VCloudDirectorMediaType.ADMIN_CATALOG);
|
||||
}
|
||||
if (org.getNetworks() != null) {
|
||||
checkNetworks(org.getNetworks());
|
||||
for (Reference vdc : org.getVdcs()) {
|
||||
checkReferenceType(vdc, VCloudDirectorMediaType.ADMIN_VDC);
|
||||
}
|
||||
for (Reference network : org.getNetworks()) {
|
||||
checkReferenceType(network, VCloudDirectorMediaType.ADMIN_NETWORK);
|
||||
}
|
||||
|
||||
// Check parent type
|
||||
checkOrg(org);
|
||||
}
|
||||
|
||||
public static void checkCatalogsList(CatalogsList catalogList) {
|
||||
for (Reference catalogItem : catalogList.getCatalogItems()) {
|
||||
checkReferenceType(catalogItem);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkVdcs(Vdcs vdcs) {
|
||||
for (Reference vdc : vdcs.getVdcs()) {
|
||||
checkReferenceType(vdc);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkNetworks(Networks networks) {
|
||||
for (Reference network : networks.getNetwork()) {
|
||||
checkReferenceType(network);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkAdminCatalog(AdminCatalog catalog) {
|
||||
// Check parent type
|
||||
checkCatalogType(catalog);
|
||||
|
@ -327,11 +320,8 @@ public class Checks {
|
|||
// Check optional elements/attributes
|
||||
Owner owner = catalog.getOwner();
|
||||
if (owner != null) checkOwner(owner);
|
||||
CatalogItems catalogItems = catalog.getCatalogItems();
|
||||
if (catalogItems != null) {
|
||||
for (Reference catalogItemReference : catalogItems.getCatalogItems()) {
|
||||
checkReferenceType(catalogItemReference);
|
||||
}
|
||||
for (Reference catalogItemReference : catalog.getCatalogItems()) {
|
||||
checkReferenceType(catalogItemReference, VCloudDirectorMediaType.CATALOG_ITEM);
|
||||
}
|
||||
// NOTE isPublished cannot be checked
|
||||
|
||||
|
@ -695,16 +685,9 @@ public class Checks {
|
|||
if (params.isSharedToEveryone()) {
|
||||
assertNotNull(params.getEveryoneAccessLevel(), String.format(OBJ_FIELD_REQ, "ControlAccessParams", "EveryoneAccessLevel"));
|
||||
} else {
|
||||
AccessSettings accessSettings = params.getAccessSettings();
|
||||
checkAccessSettings(accessSettings);
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkAccessSettings(AccessSettings accessSettings) {
|
||||
if (accessSettings != null && accessSettings.getAccessSettings() != null) {
|
||||
for (AccessSetting setting : accessSettings.getAccessSettings()) {
|
||||
checkAccessSetting(setting);
|
||||
}
|
||||
for (AccessSetting setting : params.getAccessSettings()) {
|
||||
checkAccessSetting(setting);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -778,37 +761,19 @@ public class Checks {
|
|||
checkResourceEntityType(media);
|
||||
}
|
||||
|
||||
public static void checkGroupsList(GroupsList groupsList) {
|
||||
// Check optional fields
|
||||
if (groupsList.getGroups() != null) {
|
||||
for (Reference group : groupsList.getGroups()) {
|
||||
checkReferenceType(group);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkGroup(Group group) {
|
||||
// Check optional fields
|
||||
// NOTE nameInSource cannot be checked
|
||||
if (group.getUsersList() != null) {
|
||||
checkUsersList(group.getUsersList());
|
||||
for (Reference user : group.getUsersList()) {
|
||||
checkReferenceType(user, VCloudDirectorMediaType.USER);
|
||||
}
|
||||
if (group.getRole() != null) {
|
||||
checkReferenceType(group.getRole());
|
||||
checkReferenceType(group.getRole(), VCloudDirectorMediaType.ROLE);
|
||||
}
|
||||
|
||||
// parent type
|
||||
checkEntityType(group);
|
||||
}
|
||||
|
||||
public static void checkUsersList(UsersList usersList) {
|
||||
// Check optional fields
|
||||
if (usersList.getUsers() != null) {
|
||||
for (Reference user : usersList.getUsers()) {
|
||||
checkReferenceType(user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkOrgSettings(OrgSettings settings) {
|
||||
// Check optional fields
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.net.URI;
|
|||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.AdminCatalog;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogItems;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Owner;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.PublishCatalogParams;
|
||||
|
@ -37,7 +36,7 @@ import org.testng.annotations.Test;
|
|||
import com.google.common.collect.ImmutableSet;
|
||||
|
||||
/**
|
||||
* Test the {@link CatalogClient} by observing its side effects.
|
||||
* Test the {@link AdminCatalogClient} by observing its side effects.
|
||||
*
|
||||
* @author grkvlt@apache.org
|
||||
*/
|
||||
|
@ -289,8 +288,6 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
.build())
|
||||
.build())
|
||||
.build())
|
||||
.catalogItems(CatalogItems.builder()
|
||||
.build())
|
||||
.isPublished(false)
|
||||
.build();
|
||||
}
|
||||
|
@ -337,27 +334,25 @@ public class AdminCatalogClientExpectTest extends BaseVCloudDirectorRestClientEx
|
|||
.build())
|
||||
.description("Testing")
|
||||
.owner(owner())
|
||||
.catalogItems(CatalogItems.builder()
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("image")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/67a469a1-aafe-4b5b-bb31-a6202ad8961f"))
|
||||
.build())
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("ubuntu10")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.build())
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("imageTesting")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"))
|
||||
.build())
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("TestCase")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/f7598606-aea4-41d7-8f67-2090e28e7876"))
|
||||
.build())
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("image")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/67a469a1-aafe-4b5b-bb31-a6202ad8961f"))
|
||||
.build())
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("ubuntu10")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.build())
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("imageTesting")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"))
|
||||
.build())
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("TestCase")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/f7598606-aea4-41d7-8f67-2090e28e7876"))
|
||||
.build())
|
||||
.isPublished(false)
|
||||
.build();
|
||||
|
|
|
@ -25,10 +25,7 @@ import java.net.URI;
|
|||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.AdminOrg;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogsList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.GroupsList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Networks;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgEmailSettings;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgGeneralSettings;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.OrgLdapSettings;
|
||||
|
@ -38,13 +35,11 @@ import org.jclouds.vcloud.director.v1_5.domain.OrgSettings;
|
|||
import org.jclouds.vcloud.director.v1_5.domain.OrgVAppTemplateLeaseSettings;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Reference;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.SmtpServerSettings;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.UsersList;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Vdcs;
|
||||
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
/**
|
||||
* Test the {@link GroupClient} by observing its side effects.
|
||||
* Test the {@link AdminOrgClient} by observing its side effects.
|
||||
*
|
||||
* @author danikov
|
||||
*/
|
||||
|
@ -126,7 +121,6 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
|
|||
.fullName("JClouds")
|
||||
.isEnabled(true)
|
||||
.settings(settings())
|
||||
.users(UsersList.builder()
|
||||
.user(Reference.builder()
|
||||
.type("application/vnd.vmware.admin.user+xml")
|
||||
.name("adam.lowe@cloudsoftcorp.com")
|
||||
|
@ -152,10 +146,6 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
|
|||
.name("adk@cloudsoftcorp.com")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/user/e9eb1b29-0404-4c5e-8ef7-e584acc51da9"))
|
||||
.build())
|
||||
.build())
|
||||
.groups(GroupsList.builder()
|
||||
.build())
|
||||
.catalogs(CatalogsList.builder()
|
||||
.catalog(Reference.builder()
|
||||
.type("application/vnd.vmware.admin.catalog+xml")
|
||||
.name("QunyingTestCatalog")
|
||||
|
@ -176,15 +166,11 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
|
|||
.name("test")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/catalog/b7289d54-4ca4-497f-9a93-2d4afc97e3da"))
|
||||
.build())
|
||||
.build())
|
||||
.vdcs(Vdcs.builder()
|
||||
.vdc(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.vdc+xml")
|
||||
.name("Cluster01-JClouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/vdc/d16d333b-e3c0-4176-845d-a5ee6392df07"))
|
||||
.build())
|
||||
.build())
|
||||
.networks(Networks.builder()
|
||||
.network(Reference.builder()
|
||||
.type("application/vnd.vmware.admin.network+xml")
|
||||
.name("ilsolation01-Jclouds")
|
||||
|
@ -195,7 +181,6 @@ public class AdminOrgClientExpectTest extends BaseVCloudDirectorRestClientExpect
|
|||
.name("internet01-Jclouds")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/admin/network/55a677cf-ab3f-48ae-b880-fab90421980c"))
|
||||
.build())
|
||||
.build())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ import org.jclouds.http.HttpResponse;
|
|||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorClient;
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorMediaType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogItem;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogItems;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.CatalogType;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Link;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Metadata;
|
||||
|
@ -376,7 +375,6 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
assertEquals(client.getCatalogClient().getCatalogItemMetadataClient().deleteMetadataEntry(catalogItemURI, "KEY"), expected);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static final CatalogType catalog() {
|
||||
return CatalogType.builder()
|
||||
.name("QunyingTestCatalog")
|
||||
|
@ -398,18 +396,16 @@ public class CatalogClientExpectTest extends BaseVCloudDirectorRestClientExpectT
|
|||
.type("application/vnd.vmware.vcloud.metadata+xml")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalog/7212e451-76e1-4631-b2de-ba1dfd8080e4/metadata"))
|
||||
.build())
|
||||
.catalogItems(CatalogItems.builder()
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("ubuntu10")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.build())
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("imageTesting")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"))
|
||||
.build())
|
||||
.build())
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("ubuntu10")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a36fdac9-b8c2-43e2-9a4c-2ffaf3ee13df"))
|
||||
.build())
|
||||
.item(Reference.builder()
|
||||
.type("application/vnd.vmware.vcloud.catalogItem+xml")
|
||||
.name("imageTesting")
|
||||
.href(URI.create("https://vcloudbeta.bluelock.com/api/catalogItem/a9e0afdb-a42b-4688-8409-2ac68cf22939"))
|
||||
.build())
|
||||
.description("Testing")
|
||||
.isPublished(false)
|
||||
.build();
|
||||
|
|
|
@ -64,7 +64,6 @@ import java.util.concurrent.TimeUnit;
|
|||
|
||||
import org.jclouds.vcloud.director.v1_5.VCloudDirectorException;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.AccessSetting;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.AccessSettings;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.Checks;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.ControlAccessParams;
|
||||
import org.jclouds.vcloud.director.v1_5.domain.DeployVAppParams;
|
||||
|
@ -325,11 +324,9 @@ public class VAppClientLiveTest extends AbstractVAppClientLiveTest {
|
|||
public void testControlAccessUser() {
|
||||
ControlAccessParams params = ControlAccessParams.builder()
|
||||
.notSharedToEveryone()
|
||||
.accessSettings(AccessSettings.builder()
|
||||
.accessSetting(AccessSetting.builder()
|
||||
.subject(Reference.builder().href(userURI).type(ADMIN_USER).build())
|
||||
.accessLevel("ReadOnly")
|
||||
.build())
|
||||
.accessSetting(AccessSetting.builder()
|
||||
.subject(Reference.builder().href(userURI).type(ADMIN_USER).build())
|
||||
.accessLevel("ReadOnly")
|
||||
.build())
|
||||
.build();
|
||||
|
||||
|
|
Loading…
Reference in New Issue