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;
}
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");
}
}
Aggregations