use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType 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();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.AccessCertificationCampaignType in project midpoint by Evolveum.
the class SimpleCampaignStageNotifier method getBody.
@Override
protected String getBody(Event event, GeneralNotifierType generalNotifierType, String transport, Task task, OperationResult result) {
StringBuilder body = new StringBuilder();
CertCampaignStageEvent csEvent = (CertCampaignStageEvent) event;
AccessCertificationCampaignType campaign = csEvent.getCampaign();
body.append("A certification campaign stage ");
if (csEvent.isAdd()) {
body.append("has been started");
} else if (csEvent.isDelete()) {
body.append("has been closed");
} else if (csEvent.isModify()) {
body.append("is about to be closed");
}
body.append(".");
body.append("\n\nCampaign: ");
body.append(certHelper.getCampaignNameAndOid(csEvent));
body.append("\nState: ");
body.append(certHelper.formatState(csEvent));
// the event is generated in the real time
body.append("\n\nTime: ").append(new Date());
AccessCertificationStageType stage = CertCampaignTypeUtil.getCurrentStage(campaign);
if (stage != null) {
body.append("\n\nStage start time: ").append(XmlTypeConverter.toDate(stage.getStartTimestamp()));
body.append("\nStage deadline time: ").append(XmlTypeConverter.toDate(stage.getDeadline()));
if (csEvent.isModify() && stage.getDeadline() != null) {
long delta = XmlTypeConverter.toMillis(stage.getDeadline()) - System.currentTimeMillis();
if (delta > 0) {
body.append("\n\nStage ends in ");
body.append(DurationFormatUtils.formatDurationWords(delta, true, true));
} else if (delta < 0) {
body.append("\n\nStage should have ended ");
body.append(DurationFormatUtils.formatDurationWords(-delta, true, true));
body.append(" ago");
}
}
}
body.append("\n");
if (csEvent.isAdd() || csEvent.isDelete()) {
body.append("\nRequester: ").append(formatRequester(event, result));
body.append("\nOperation status: ").append(certHelper.formatStatus(csEvent));
body.append("\n");
}
body.append("\n");
certHelper.appendStatistics(body, campaign, task, result);
body.append("\n\n");
functions.addRequesterAndChannelInformation(body, event, result);
return body.toString();
}
Aggregations