Skip to content

Commit

Permalink
Adding the condition equals method - TRUNK-5373
Browse files Browse the repository at this point in the history
  • Loading branch information
dkayiwa committed May 11, 2018
1 parent 0c37c7e commit b800f2d
Showing 1 changed file with 44 additions and 4 deletions.
48 changes: 44 additions & 4 deletions api/src/main/java/org/openmrs/Condition.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
*/
package org.openmrs;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Embedded;
import java.util.Date;

/**
Expand Down Expand Up @@ -291,4 +287,48 @@ public void setPatient(Patient patient) {
this.patient = patient;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
if (!super.equals(o)) {
return false;
}

Condition condition = (Condition) o;

if (!patient.equals(condition.patient)) {
return false;
}
if (clinicalStatus != condition.clinicalStatus) {
return false;
}
if (verificationStatus != condition.verificationStatus) {
return false;
}
if (!this.condition.getCoded().equals(condition.getCondition().getCoded())) {
return false;
}
if (this.condition.getNonCoded() != null ?
!this.condition.getNonCoded().equals(condition.getCondition().getNonCoded()) :
condition.getCondition().getNonCoded() != null) {
return false;
}
if (onsetDate != null ? !onsetDate.equals(condition.onsetDate) : condition.onsetDate != null) {
return false;
}
if (additionalDetail != null ?
!additionalDetail.equals(condition.additionalDetail) :
condition.additionalDetail != null) {
return false;
}
if (endDate != null ? !endDate.equals(condition.endDate) : condition.endDate != null) {
return false;
}
return endReason != null ? endReason.equals(condition.endReason) : condition.endReason == null;
}
}

0 comments on commit b800f2d

Please sign in to comment.