Search in sources :

Example 6 with CertReviewEvent

use of com.evolveum.midpoint.notifications.api.events.CertReviewEvent in project midpoint by Evolveum.

the class SimpleReviewerNotifier method quickCheckApplicability.

@Override
protected boolean quickCheckApplicability(Event event, GeneralNotifierType generalNotifierType, OperationResult result) {
    if (!(event instanceof CertReviewEvent)) {
        LOGGER.trace("SimpleReviewerNotifier is not applicable for this kind of event, continuing in the handler chain; event class = " + event.getClass());
        return false;
    }
    CertReviewEvent reviewEvent = (CertReviewEvent) event;
    if (reviewEvent.isAdd()) {
        return true;
    }
    if (reviewEvent.isDelete()) {
        // such events are not even created
        return false;
    }
    AccessCertificationStageDefinitionType stageDef = reviewEvent.getCurrentStageDefinition();
    if (stageDef == null) {
        // should not occur
        return false;
    }
    if (Boolean.FALSE.equals(stageDef.isNotifyOnlyWhenNoDecision())) {
        return true;
    }
    if (reviewEvent.getCasesAwaitingResponseFromRequestee().isEmpty()) {
        return false;
    }
    return true;
}
Also used : AccessCertificationStageDefinitionType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationStageDefinitionType) CertReviewEvent(com.evolveum.midpoint.notifications.api.events.CertReviewEvent)

Example 7 with CertReviewEvent

use of com.evolveum.midpoint.notifications.api.events.CertReviewEvent in project midpoint by Evolveum.

the class SimpleReviewerNotifier method getSubject.

@Override
protected String getSubject(Event event, GeneralNotifierType generalNotifierType, String transport, Task task, OperationResult result) {
    CertReviewEvent reviewEvent = (CertReviewEvent) event;
    String campaignName = reviewEvent.getCampaignName();
    if (reviewEvent.isAdd()) {
        return "Your review is requested in campaign " + campaignName;
    } else if (reviewEvent.isModify()) {
        return "Deadline for your review in campaign " + campaignName + " is approaching";
    } else {
        throw new IllegalStateException("Unexpected review event type: neither ADD nor MODIFY");
    }
}
Also used : CertReviewEvent(com.evolveum.midpoint.notifications.api.events.CertReviewEvent)

Aggregations

CertReviewEvent (com.evolveum.midpoint.notifications.api.events.CertReviewEvent)7 AccessCertificationCampaignType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType)1 AccessCertificationStageDefinitionType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationStageDefinitionType)1 AccessCertificationStageType (com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationStageType)1