Search in sources :

Example 1 with CertReviewEvent

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

the class CertEventFactory method createReviewDeadlineApproachingEvent.

public CertReviewEvent createReviewDeadlineApproachingEvent(ObjectReferenceType reviewerRef, List<AccessCertificationCaseType> cases, AccessCertificationCampaignType campaign, Task task, OperationResult result) {
    CertReviewEvent event = new CertReviewEvent(idGenerator, cases, campaign, EventOperationType.MODIFY);
    fillInReviewerRelatedEvent(reviewerRef, task, event);
    return event;
}
Also used : CertReviewEvent(com.evolveum.midpoint.notifications.api.events.CertReviewEvent)

Example 2 with CertReviewEvent

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

the class CertEventFactory method createReviewRequestedEvent.

public CertReviewEvent createReviewRequestedEvent(ObjectReferenceType reviewerRef, List<AccessCertificationCaseType> cases, AccessCertificationCampaignType campaign, Task task, OperationResult result) {
    CertReviewEvent event = new CertReviewEvent(idGenerator, cases, campaign, EventOperationType.ADD);
    fillInReviewerRelatedEvent(reviewerRef, task, event);
    return event;
}
Also used : CertReviewEvent(com.evolveum.midpoint.notifications.api.events.CertReviewEvent)

Example 3 with CertReviewEvent

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

the class CertificationListener method onReviewDeadlineApproaching.

@Override
public void onReviewDeadlineApproaching(ObjectReferenceType reviewerRef, List<AccessCertificationCaseType> cases, AccessCertificationCampaignType campaign, Task task, OperationResult result) {
    CertReviewEvent event = certEventFactory.createReviewDeadlineApproachingEvent(reviewerRef, cases, campaign, task, result);
    processEvent(event, task, result);
}
Also used : CertReviewEvent(com.evolveum.midpoint.notifications.api.events.CertReviewEvent)

Example 4 with CertReviewEvent

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

the class CertificationListener method onReviewRequested.

@Override
public void onReviewRequested(ObjectReferenceType reviewerRef, List<AccessCertificationCaseType> cases, AccessCertificationCampaignType campaign, Task task, OperationResult result) {
    CertReviewEvent event = certEventFactory.createReviewRequestedEvent(reviewerRef, cases, campaign, task, result);
    processEvent(event, task, result);
}
Also used : CertReviewEvent(com.evolveum.midpoint.notifications.api.events.CertReviewEvent)

Example 5 with CertReviewEvent

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

the class SimpleReviewerNotifier method getBody.

@Override
protected String getBody(Event event, GeneralNotifierType generalNotifierType, String transport, Task task, OperationResult result) {
    StringBuilder body = new StringBuilder();
    CertReviewEvent reviewEvent = (CertReviewEvent) event;
    AccessCertificationCampaignType campaign = reviewEvent.getCampaign();
    body.append("You have been requested to provide a review in a certification campaign.");
    body.append("\n\nCampaign: ").append(certHelper.getCampaignNameAndOid(reviewEvent));
    body.append("\nState: ").append(certHelper.formatState(reviewEvent));
    body.append("\n\n");
    AccessCertificationStageType stage = CertCampaignTypeUtil.getCurrentStage(campaign);
    if (stage != null) {
        body.append("Stage start time: ").append(XmlTypeConverter.toDate(stage.getStartTimestamp()));
        body.append("\nStage deadline: ").append(XmlTypeConverter.toDate(stage.getDeadline()));
        if (stage.getEscalationLevel() != null) {
            body.append("\nEscalation level: ").append(WfContextUtil.getEscalationLevelInfo(stage.getEscalationLevel()));
        }
        if (stage.getDeadline() != null) {
            long delta = XmlTypeConverter.toMillis(stage.getDeadline()) - System.currentTimeMillis();
            if (delta > 0) {
                if (reviewEvent.isModify()) {
                    body.append("\n\nThis is to notify you that the stage ends in ");
                } else {
                    body.append("\n\nThe stage ends in ");
                }
                body.append(DurationFormatUtils.formatDurationWords(delta, true, true));
            } else if (delta < 0) {
                body.append("\n\nThe stage should have ended ");
                body.append(DurationFormatUtils.formatDurationWords(-delta, true, true));
                body.append(" ago");
            }
        }
        body.append("\n\n");
        body.append("There are ").append(reviewEvent.getCases().size()).append(" cases assigned to you. ");
        body.append("Out of them, ").append(reviewEvent.getCasesAwaitingResponseFromRequestee().size()).append(" have no response from you yet.");
    }
    return body.toString();
}
Also used : AccessCertificationStageType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationStageType) CertReviewEvent(com.evolveum.midpoint.notifications.api.events.CertReviewEvent) AccessCertificationCampaignType(com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType)

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