Added IsEnabled property to Org

This commit is contained in:
Andrew Donald Kennedy 2012-02-09 13:25:15 +00:00
parent fbe68686d3
commit d983eb3826
1 changed files with 44 additions and 6 deletions

View File

@ -63,6 +63,7 @@ public class Org extends EntityType<Org> {
public static class Builder extends EntityType.Builder<Org> {
private String fullName;
private Boolean isEnabled;
/**
* @see Org#getFullName()
@ -72,6 +73,30 @@ public class Org extends EntityType<Org> {
return this;
}
/**
* @see Org#isEnabled()
*/
public Builder isEnabled(Boolean isEnabled) {
this.isEnabled = isEnabled;
return this;
}
/**
* @see Org#isEnabled()
*/
public Builder enabled() {
this.isEnabled = Boolean.TRUE;
return this;
}
/**
* @see Org#isEnabled()
*/
public Builder disabled() {
this.isEnabled = Boolean.FALSE;
return this;
}
@Override
public Org build() {
Org org = new Org(href, name, fullName);
@ -80,6 +105,7 @@ public class Org extends EntityType<Org> {
org.setType(type);
org.setLinks(links);
org.setTasksInProgress(tasksInProgress);
org.setIsEnabled(isEnabled);
return org;
}
@ -174,17 +200,29 @@ public class Org extends EntityType<Org> {
this.fullName = fullName;
}
@XmlElement(namespace = VCLOUD_1_5_NS, name = "FullName")
@XmlElement(namespace = VCLOUD_1_5_NS, name = "FullName", required = true)
private String fullName;
@XmlElement(namespace = VCLOUD_1_5_NS, name = "IsEnabled")
private Boolean isEnabled;
/**
*
* @return fullName of the org
* Full name of the organization.
*/
public String getFullName() {
return fullName;
}
/**
* Full name of the organization.
*/
public Boolean isEnabled() {
return isEnabled;
}
public void isEnabled(Boolean isEnabled) {
this.isEnabled = isEnabled;
}
@Override
public boolean equals(Object o) {
if (this == o)
@ -192,16 +230,16 @@ public class Org extends EntityType<Org> {
if (o == null || getClass() != o.getClass())
return false;
Org that = Org.class.cast(o);
return super.equals(that) && equal(fullName, that.fullName);
return super.equals(that) && equal(fullName, that.fullName) && equal(this.isEnabled, that.isEnabled);
}
@Override
public int hashCode() {
return super.hashCode() + Objects.hashCode(fullName);
return super.hashCode() + Objects.hashCode(fullName, isEnabled);
}
@Override
public ToStringHelper string() {
return super.string().add("fullName", fullName);
return super.string().add("fullName", fullName).add("isEnabled", isEnabled);
}
}