use of org.apache.commons.lang.builder.EqualsBuilder in project candlepin by candlepin.
the class PoolDTO method equals.
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof PoolDTO) {
PoolDTO that = (PoolDTO) obj;
EqualsBuilder builder = new EqualsBuilder().append(this.getId(), that.getId()).append(this.hasSharedAncestor(), that.hasSharedAncestor()).append(this.getQuantity(), that.getQuantity()).append(this.getStartDate(), that.getStartDate()).append(this.getEndDate(), that.getEndDate()).append(this.getAttributes(), that.getAttributes()).append(this.getRestrictedToUsername(), that.getRestrictedToUsername()).append(this.getConsumed(), that.getConsumed()).append(this.getProductId(), that.getProductId()).append(this.getProductAttributes(), that.getProductAttributes()).append(this.getDerivedProductId(), that.getDerivedProductId()).append(this.getProvidedProducts(), that.getProvidedProducts()).append(this.getDerivedProvidedProducts(), that.getDerivedProvidedProducts());
return builder.isEquals();
}
return false;
}
use of org.apache.commons.lang.builder.EqualsBuilder in project candlepin by candlepin.
the class ContentDTO method equals.
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof ContentDTO && super.equals(obj)) {
ContentDTO that = (ContentDTO) obj;
EqualsBuilder builder = new EqualsBuilder().append(this.getUuid(), that.getUuid()).append(this.getId(), that.getId()).append(this.getType(), that.getType()).append(this.getLabel(), that.getLabel()).append(this.getName(), that.getName()).append(this.getVendor(), that.getVendor()).append(this.getContentUrl(), that.getContentUrl()).append(this.getRequiredTags(), that.getRequiredTags()).append(this.getReleaseVersion(), that.getReleaseVersion()).append(this.getGpgUrl(), that.getGpgUrl()).append(this.getMetadataExpire(), that.getMetadataExpire()).append(this.getModifiedProductIds(), that.getModifiedProductIds()).append(this.getArches(), that.getArches());
return builder.isEquals();
}
return false;
}
use of org.apache.commons.lang.builder.EqualsBuilder in project candlepin by candlepin.
the class EntitlementDTO method equals.
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof EntitlementDTO && super.equals(obj)) {
EntitlementDTO that = (EntitlementDTO) obj;
// Pull the nested object IDs, as we're not interested in verifying that the objects
// themselves are equal; just so long as they point to the same object.
String thisOwnerId = this.getOwner() != null ? this.getOwner().getId() : null;
String thatOwnerId = that.getOwner() != null ? that.getOwner().getId() : null;
String thisPoolId = this.getPool() != null ? this.getPool().getId() : null;
String thatPoolId = that.getPool() != null ? that.getPool().getId() : null;
String thisConsumerId = this.getConsumer() != null ? this.getConsumer().getUuid() : null;
String thatConsumerId = that.getConsumer() != null ? that.getConsumer().getUuid() : null;
EqualsBuilder builder = new EqualsBuilder().append(this.getId(), that.getId()).append(thisOwnerId, thatOwnerId).append(thisPoolId, thatPoolId).append(thisConsumerId, thatConsumerId).append(this.getQuantity(), that.getQuantity()).append(this.isDeletedFromPool(), that.isDeletedFromPool()).append(this.getEndDate(), that.getEndDate()).append(this.getStartDate(), that.getStartDate());
// 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();
equals = equals && Util.collectionsAreEqual(this.getCertificates(), that.getCertificates(), (c1, c2) -> {
if (c1 == c2) {
return 0;
}
if (c1 != null && c1.getId() != null) {
return c1.getId().compareTo(c2.getId());
}
return 1;
});
return equals;
}
return false;
}
use of org.apache.commons.lang.builder.EqualsBuilder in project candlepin by candlepin.
the class EnvironmentDTO method equals.
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof EnvironmentDTO && super.equals(obj)) {
EnvironmentDTO that = (EnvironmentDTO) 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.getId(), that.getId()).append(this.getName(), that.getName()).append(this.getDescription(), that.getDescription()).append(thisOid, thatOid);
return builder.isEquals() && Util.collectionsAreEqual(this.getEnvironmentContent(), that.getEnvironmentContent());
}
return false;
}
use of org.apache.commons.lang.builder.EqualsBuilder in project candlepin by candlepin.
the class EventDTO method equals.
/**
* {@inheritDoc}
*/
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj instanceof EventDTO) {
EventDTO that = (EventDTO) obj;
EqualsBuilder builder = new EqualsBuilder().append(this.getId(), that.getId()).append(this.getTargetName(), that.getTargetName()).append(this.getConsumerUuid(), that.getConsumerUuid()).append(this.getEntityId(), that.getEntityId()).append(this.getMessageText(), that.getMessageText()).append(this.getOwnerId(), that.getOwnerId()).append(this.getPrincipalStore(), that.getPrincipalStore()).append(this.getPrincipal(), that.getPrincipal()).append(this.getReferenceId(), that.getReferenceId()).append(this.getTimestamp(), that.getTimestamp()).append(this.getType(), that.getType()).append(this.getTarget(), that.getTarget()).append(this.getReferenceType(), that.getReferenceType()).append(this.getEventData(), that.getEventData());
return builder.isEquals();
}
return false;
}
Aggregations