public class CohortMembership extends BaseChangeableOpenmrsData implements Comparable<CohortMembership>
Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID |
creator
Constructor and Description |
---|
CohortMembership() |
CohortMembership(Integer patientId) |
CohortMembership(Integer patientId,
Date startDate) |
Modifier and Type | Method and Description |
---|---|
int |
compareTo(CohortMembership o)
Sorts by following fields, in order:
voided (voided memberships sort last)
endDate descending (so ended memberships are towards the end, and the older the more towards the end
startDate descending (so started more recently is towards the front)
patientId ascending (intuitive and consistent tiebreaker for client code)
uuid ascending (just so we have a final consistent tie breaker)
|
boolean |
equals(Object otherCohortMembershipObject)
Returns
true if and only if x and y refer to the same
object (x == y has the value true ) or both have the same
uuid (((x.uuid ! |
Cohort |
getCohort() |
Integer |
getCohortMemberId() |
Date |
getEndDate() |
Integer |
getId() |
Integer |
getPatientId() |
Date |
getStartDate() |
int |
hashCode()
Returns a hash code based on the
uuid field. |
boolean |
isActive() |
boolean |
isActive(Date asOfDate)
Compares asOfDate to [startDate, endDate], inclusive of both endpoints.
|
void |
setCohort(Cohort cohort) |
void |
setCohortMemberId(Integer cohortMemberId) |
void |
setEndDate(Date endDate)
OpenMRS treats a membership as active from its startDate to endDate inclusive of both.
|
void |
setId(Integer id) |
void |
setPatientId(Integer patientId) |
void |
setStartDate(Date startDate) |
getChangedBy, getCreator, getDateChanged, getDateCreated, getDateVoided, getVoided, getVoidedBy, getVoidReason, isVoided, setChangedBy, setCreator, setDateChanged, setDateCreated, setDateVoided, setVoided, setVoidedBy, setVoidReason
getUuid, setUuid, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getUuid, setUuid
public static final long serialVersionUID
public CohortMembership()
public CohortMembership(Integer patientId)
public boolean isActive(Date asOfDate)
asOfDate
- date to compare if membership is active or inactivepublic boolean isActive()
public Integer getId()
getId
in interface OpenmrsObject
public void setId(Integer id)
setId
in interface OpenmrsObject
id
- - The unique Identifier for the objectpublic Integer getCohortMemberId()
public void setCohortMemberId(Integer cohortMemberId)
public Cohort getCohort()
public void setCohort(Cohort cohort)
public Integer getPatientId()
public void setPatientId(Integer patientId)
public Date getStartDate()
public void setStartDate(Date startDate)
public Date getEndDate()
public void setEndDate(Date endDate)
endDate
- public int compareTo(CohortMembership o)
compareTo
in interface Comparable<CohortMembership>
o
- other membership to compare this to0
if this is not voided and o is voided; or value less
than 0
if this is voided and o is not voided; if both is voided or not then
value greater than 0
if o.getEndDate() return null; or value less than
0
if this.getEndDate() return null; if both are null or not then value
greater than 0
if this.getEndDate() is before o.getEndDate(); or value less
than 0
if this.getEndDate() is after o.getEndDate(); if are equal then value
greater than 0
if this.getStartDate() return null; or value less than
0
if o.getStartDate() return null; if both are null or not then value greater
than 0
if this.getStartDate() is before o.getStartDate(); or value less than
0
if this.getStartDate() is after o.getStartDate(); if are equal then value
greater than 0
if o.getPatientId() is greater than this.getPatientId(); or
value less than 0
if o.getPatientId() is less than this.getPatientId(); if
are equal then value greater than 0
if o.getUuid() is greater than
this.getUuid(); or value less than 0
if o.getUuid() is less than
this.getUuid(); or 0
if are equalpublic boolean equals(Object otherCohortMembershipObject)
BaseOpenmrsObject
true
if and only if x
and y
refer to the same
object (x == y
has the value true
) or both have the same
uuid
(((x.uuid != null) && x.uuid.equals(y.uuid))
has the value
true
).equals
in class BaseOpenmrsObject
otherCohortMembershipObject
- is a CohortMembership object that should be checked for equality with this objectShould return false if given obj is not instance of BaseOpenmrsObject
Should return false if given obj is null
Should return false if given obj has null uuid
Should return false if uuid is null
Should return true if objects are the same
Should return true if uuids are equal
public int hashCode()
BaseOpenmrsObject
uuid
field.
If the uuid
field is null
, it delegates to
Object.hashCode()
.
hashCode
in class BaseOpenmrsObject
Should not fail if uuid is null
Copyright © 2024 OpenMRS Inc.. All rights reserved.