use of org.apache.commons.lang.builder.EqualsBuilder in project candlepin by candlepin.
the class OwnerDTO method equals.
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof OwnerDTO && super.equals(obj)) {
OwnerDTO that = (OwnerDTO) obj;
// Pull the parent owner IDs, as we're not interested in verifying that the parent owners
// themselves are equal; just so long as they point to the same parent owner.
String lpoid = this.getParentOwner() != null ? this.getParentOwner().getId() : null;
String rpoid = that.getParentOwner() != null ? that.getParentOwner().getId() : null;
// Same with the upstream consumer
String lucid = this.getUpstreamConsumer() != null ? this.getUpstreamConsumer().getId() : null;
String rucid = that.getUpstreamConsumer() != null ? that.getUpstreamConsumer().getId() : null;
EqualsBuilder builder = new EqualsBuilder().append(this.getId(), that.getId()).append(this.getKey(), that.getKey()).append(this.getDisplayName(), that.getDisplayName()).append(lpoid, rpoid).append(this.getContentPrefix(), that.getContentPrefix()).append(this.getDefaultServiceLevel(), that.getDefaultServiceLevel()).append(lucid, rucid).append(this.getLogLevel(), that.getLogLevel()).append(this.isAutobindDisabled(), that.isAutobindDisabled()).append(this.getContentAccessMode(), that.getContentAccessMode()).append(this.getContentAccessModeList(), that.getContentAccessModeList()).append(this.getLastRefreshed(), that.getLastRefreshed());
return builder.isEquals();
}
return false;
}
use of org.apache.commons.lang.builder.EqualsBuilder in project candlepin by candlepin.
the class PoolQuantityDTO method equals.
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof PoolQuantityDTO) {
PoolQuantityDTO that = (PoolQuantityDTO) obj;
EqualsBuilder builder = new EqualsBuilder().append(this.getQuantity() != null ? this.getQuantity().intValue() : null, that.getQuantity() != null ? that.getQuantity().intValue() : null).append(this.getPool() != null ? this.getPool().getId() : null, that.getPool() != null ? that.getPool().getId() : null);
return builder.isEquals();
}
return false;
}
use of org.apache.commons.lang.builder.EqualsBuilder in project candlepin by candlepin.
the class ProductDTO method equals.
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof ProductDTO && super.equals(obj)) {
ProductDTO that = (ProductDTO) obj;
EqualsBuilder builder = new EqualsBuilder().append(this.getUuid(), that.getUuid()).append(this.getId(), that.getId()).append(this.getName(), that.getName()).append(this.getMultiplier(), that.getMultiplier()).append(this.getAttributes(), that.getAttributes()).append(this.getDependentProductIds(), that.getDependentProductIds()).append(this.getHref(), that.getHref()).append(this.isLocked(), that.isLocked());
// As with many collections here, we need to explicitly check the elements ourselves,
// since it seems very common for collection implementations to not properly implement
// .equals
// Note that we're using the boolean operator here as a shorthand way to skip checks
// when the equality check has already failed.
boolean equals = builder.isEquals();
// Check product content
equals = equals && Util.collectionsAreEqual(this.getProductContent(), that.getProductContent());
return equals;
}
return false;
}
use of org.apache.commons.lang.builder.EqualsBuilder in project candlepin by candlepin.
the class ConsumerDTO method equals.
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof ConsumerDTO) {
ConsumerDTO that = (ConsumerDTO) obj;
String thisOid = this.getOwner() != null ? this.getOwner().getId() : null;
String thatOid = that.getOwner() != null ? that.getOwner().getId() : null;
EqualsBuilder builder = new EqualsBuilder().append(this.getUuid(), that.getUuid()).append(this.getName(), that.getName()).append(thisOid, thatOid).append(this.getContentAccessMode(), that.getContentAccessMode()).append(this.getType(), that.getType()).append(this.getUrlWeb(), that.getUrlWeb()).append(this.getUrlApi(), that.getUrlApi());
return builder.isEquals();
}
return false;
}
use of org.apache.commons.lang.builder.EqualsBuilder in project candlepin by candlepin.
the class ActivationKeyDTO method equals.
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof ActivationKeyDTO && super.equals(obj)) {
ActivationKeyDTO that = (ActivationKeyDTO) obj;
// Pull the owner IDs, as we're not interested in verifying that the owners
// themselves are equal; just so long as they point to the same owner.
String thisOwnerId = this.getOwner() != null ? this.getOwner().getId() : null;
String thatOwnerId = that.getOwner() != null ? that.getOwner().getId() : null;
EqualsBuilder builder = new EqualsBuilder().append(this.getId(), that.getId()).append(this.getName(), that.getName()).append(this.getDescription(), that.getDescription()).append(thisOwnerId, thatOwnerId).append(this.getReleaseVersion(), that.getReleaseVersion()).append(this.getServiceLevel(), that.getServiceLevel()).append(this.isAutoAttach(), that.isAutoAttach()).append(this.getPools(), that.getPools()).append(this.getProductIds(), that.getProductIds()).append(this.getContentOverrides(), that.getContentOverrides());
return builder.isEquals();
}
return false;
}
Aggregations