Search in sources :

Example 1 with ExtendedReduced

use of de.symeda.sormas.api.utils.ExtendedReduced in project SORMAS-Project by hzi-braunschweig.

the class CaseDataForm method onQuarantineEndChange.

// This logic should be consistent with CaseFacadeEjb.onCaseChanged
private void onQuarantineEndChange() {
    if (quarantineChangedByFollowUpUntilChange) {
        quarantineChangedByFollowUpUntilChange = false;
    } else {
        Date newQuarantineEnd = dfQuarantineTo.getValue();
        CaseDataDto originalCase = getInternalValue();
        Date oldQuarantineEnd = originalCase.getQuarantineTo();
        ExtendedReduced changeType = null;
        if (oldQuarantineEnd != null && newQuarantineEnd != null) {
            changeType = newQuarantineEnd.after(oldQuarantineEnd) ? ExtendedReduced.EXTENDED : (newQuarantineEnd.before(oldQuarantineEnd) ? ExtendedReduced.REDUCED : null);
        }
        if (changeType != null) {
            confirmQuarantineEndChanged(changeType, originalCase);
        } else {
            resetPreviousQuarantineTo(originalCase);
        }
    }
}
Also used : CaseDataDto(de.symeda.sormas.api.caze.CaseDataDto) ExtendedReduced(de.symeda.sormas.api.utils.ExtendedReduced) Date(java.util.Date)

Example 2 with ExtendedReduced

use of de.symeda.sormas.api.utils.ExtendedReduced in project SORMAS-Project by hzi-braunschweig.

the class ContactDataForm method onQuarantineEndChange.

// This logic should be consistent with ContactFacadeEjb.onQuarantineEndChange
private void onQuarantineEndChange() {
    if (quarantineChangedByFollowUpUntilChange) {
        quarantineChangedByFollowUpUntilChange = false;
    } else {
        Date newQuarantineEnd = dfQuarantineTo.getValue();
        ContactDto originalContact = getInternalValue();
        Date oldQuarantineEnd = originalContact.getQuarantineTo();
        Date oldPreviousQuarantineTo = originalContact.getPreviousQuarantineTo();
        ExtendedReduced changeType = null;
        if (oldQuarantineEnd != null && newQuarantineEnd != null) {
            changeType = newQuarantineEnd.after(oldQuarantineEnd) ? ExtendedReduced.EXTENDED : (newQuarantineEnd.before(oldQuarantineEnd) ? ExtendedReduced.REDUCED : null);
        }
        if (changeType != null) {
            confirmQuarantineEndChanged(changeType, originalContact);
        } else {
            resetPreviousQuarantineTo(originalContact);
        }
    }
}
Also used : ContactDto(de.symeda.sormas.api.contact.ContactDto) ExtendedReduced(de.symeda.sormas.api.utils.ExtendedReduced) Date(java.util.Date) LocalDate(org.joda.time.LocalDate)

Aggregations

ExtendedReduced (de.symeda.sormas.api.utils.ExtendedReduced)2 Date (java.util.Date)2 CaseDataDto (de.symeda.sormas.api.caze.CaseDataDto)1 ContactDto (de.symeda.sormas.api.contact.ContactDto)1 LocalDate (org.joda.time.LocalDate)1