rebase OrgNetwork off abstract type

This commit is contained in:
danikov 2012-02-13 12:05:54 +00:00
parent 8d26cf75bc
commit ed316161ac
1 changed files with 16 additions and 32 deletions

View File

@ -18,9 +18,9 @@
*/ */
package org.jclouds.vcloud.director.v1_5.domain; 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.*; import static com.google.common.base.Preconditions.checkNotNull;
import static org.jclouds.vcloud.director.v1_5.VCloudDirectorConstants.*; 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;
@ -33,7 +33,7 @@ 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(namespace = VCLOUD_1_5_NS, name = "OrgNetwork")
public class OrgNetwork extends EntityType<OrgNetwork> { public class OrgNetwork extends NetworkType<OrgNetwork> {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public static Builder builder() { public static Builder builder() {
@ -45,20 +45,11 @@ public class OrgNetwork extends EntityType<OrgNetwork> {
return new Builder().fromOrgNetwork(this); return new Builder().fromOrgNetwork(this);
} }
public static class Builder extends EntityType.Builder<OrgNetwork> { public static class Builder extends NetworkType.Builder<OrgNetwork> {
private NetworkConfiguration networkConfiguration;
private ReferenceType<?> networkPool; private ReferenceType<?> networkPool;
private IpAddresses allowedExternalIpAddresses; private IpAddresses allowedExternalIpAddresses;
/**
* @see OrgNetwork#getConfiguration()
*/
public Builder configuration(NetworkConfiguration networkConfiguration) {
this.networkConfiguration = networkConfiguration;
return this;
}
/** /**
* @see OrgNetwork#getNetworkPool() * @see OrgNetwork#getNetworkPool()
*/ */
@ -89,6 +80,14 @@ public class OrgNetwork extends EntityType<OrgNetwork> {
return network; return network;
} }
/**
* @see NetworkType#getConfiguration()
*/
public Builder configuration(NetworkConfiguration networkConfiguration) {
this.networkConfiguration = networkConfiguration;
return this;
}
/** /**
* @see EntityType#getName() * @see EntityType#getName()
*/ */
@ -181,24 +180,11 @@ public class OrgNetwork extends EntityType<OrgNetwork> {
super(href, name); super(href, name);
} }
@XmlElement(namespace = VCLOUD_1_5_NS, name = "Configuration")
private NetworkConfiguration networkConfiguration;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "NetworkPool") @XmlElement(namespace = VCLOUD_1_5_NS, name = "NetworkPool")
private ReferenceType<?> networkPool; private ReferenceType<?> networkPool;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "AllowedExternalIpAddresses") @XmlElement(namespace = VCLOUD_1_5_NS, name = "AllowedExternalIpAddresses")
private IpAddresses allowedExternalIpAddresses; private IpAddresses allowedExternalIpAddresses;
/**
* @return optional configuration
*/
public NetworkConfiguration getConfiguration() {
return networkConfiguration;
}
public void setConfiguration(NetworkConfiguration networkConfiguration) {
this.networkConfiguration = networkConfiguration;
}
/** /**
* @return optional network pool * @return optional network pool
*/ */
@ -226,20 +212,18 @@ public class OrgNetwork extends EntityType<OrgNetwork> {
if (!super.equals(o)) if (!super.equals(o))
return false; return false;
OrgNetwork that = OrgNetwork.class.cast(o); OrgNetwork that = OrgNetwork.class.cast(o);
return super.equals(that) && equal(networkConfiguration, that.networkConfiguration) && return super.equals(that) && equal(networkPool, that.networkPool) &&
equal(networkPool, that.networkPool) &&
equal(allowedExternalIpAddresses, that.allowedExternalIpAddresses); equal(allowedExternalIpAddresses, that.allowedExternalIpAddresses);
} }
@Override @Override
public int hashCode() { public int hashCode() {
return super.hashCode() + Objects.hashCode(networkConfiguration, return super.hashCode() + Objects.hashCode(networkPool, allowedExternalIpAddresses);
networkPool, allowedExternalIpAddresses);
} }
@Override @Override
public ToStringHelper string() { public ToStringHelper string() {
return super.string().add("configuration", networkConfiguration).add("networkPool", networkPool) return super.string().add("networkPool", networkPool)
.add("allowedExternalIpAddresses", allowedExternalIpAddresses); .add("allowedExternalIpAddresses", allowedExternalIpAddresses);
} }