public static String getOutcome(AbstractWorkItemOutputType output) { return output != null ? output.getOutcome() : null; }
/** * Create an instance of {@link AbstractWorkItemOutputType } * */ public AbstractWorkItemOutputType createAbstractWorkItemOutputType() { return new AbstractWorkItemOutputType(); }
public static String prettyPrintCertCommentForReport(AbstractWorkItemOutputType output) { return output != null ? output.getComment() : null; }
public AbstractWorkItemOutputType clone() { AbstractWorkItemOutputType object = new AbstractWorkItemOutputType(); PrismContainerValue value = asPrismContainerValue().clone(); object.setupContainerValue(value); return object; }
public static String prettyPrintOutputChangeForReport(PrismContainerValue<AccessCertificationWorkItemType> workItemPcv) { if (workItemPcv == null) { // should not occur return ""; } AccessCertificationWorkItemType workItem = workItemPcv.asContainerable(); if (workItem.getOutputChangeTimestamp() != null && workItem.getOutput() != null && (workItem.getOutput().getOutcome() != null || StringUtils.isNotBlank(workItem.getOutput().getComment()))) { // output change timestamp is shown only if there's a real outcome (either result or comment) return prettyPrintForReport(workItem.getOutputChangeTimestamp()); } else { return ""; } }
@Test public void test220ModifyWorkItemProperties() throws Exception { OperationResult result = new OperationResult("test220ModifyWorkItemProperties"); List<ItemDelta<?, ?>> modifications = deltaFor(AccessCertificationCampaignType.class) .item(F_CASE, 1L, F_WORK_ITEM, 1L, F_OUTPUT).replace( new AbstractWorkItemOutputType() .outcome(SchemaConstants.MODEL_CERTIFICATION_OUTCOME_NOT_DECIDED) .comment("hi")) .asItemDeltas(); executeAndCheckModification(modifications, result, 0); checksCountsStandard(result); }
public static String prettyPrintPerformerOrAssigneesForReport(PrismContainerValue<AbstractWorkItemType> workItemPcv) { if (workItemPcv == null) { // should not occur return ""; } AbstractWorkItemType workItem = workItemPcv.asContainerable(); if (workItem.getPerformerRef() != null && workItem.getOutput() != null && (workItem.getOutput().getOutcome() != null || StringUtils.isNotBlank(workItem.getOutput().getComment()))) { // performer is shown only if there's a real outcome (either result or comment) return prettyPrintForReport(workItem.getPerformerRef(), false); } else { return "(" + prettyPrintReferencesForReport(workItem.getAssigneeRef(), false) + ")"; } }
@Test public void test230ModifyAllLevels() throws Exception { OperationResult result = new OperationResult("test230ModifyAllLevels"); List<ItemDelta<?, ?>> modifications = deltaFor(AccessCertificationCampaignType.class) .item(F_NAME).replace(new PolyString("Campaign 2", "campaign 2")) .item(F_STATE).replace(IN_REMEDIATION) .item(F_CASE, 2, F_CURRENT_STAGE_OUTCOME).replace(SchemaConstants.MODEL_CERTIFICATION_OUTCOME_NO_RESPONSE) .item(F_CASE, 2, AccessCertificationCaseType.F_STAGE_NUMBER).replace(400) .item(F_CASE, 1, F_WORK_ITEM, 1, F_OUTPUT).replace( new AbstractWorkItemOutputType() .outcome(SchemaConstants.MODEL_CERTIFICATION_OUTCOME_NOT_DECIDED) .comment("low")) .asItemDeltas(); executeAndCheckModification(modifications, result, 1); checksCountsStandard(result); }
public static String prettyPrintCertOutcomeForReport(AbstractWorkItemOutputType output, boolean noResponseIfEmpty) { String outcome = output != null ? output.getOutcome() : null; if (noResponseIfEmpty && outcome == null) { outcome = SchemaConstants.MODEL_CERTIFICATION_OUTCOME_NO_RESPONSE; } return prettyPrintCertOutcomeForReport(outcome, noResponseIfEmpty); }
String answer = ApprovalUtils.makeNiceFromUri(output.getOutcome()); record.setResult(answer); message.append(answer); if (output.getComment() != null) { message.append(" : ").append(output.getComment()); record.addPropertyValue(WorkflowConstants.AUDIT_COMMENT, output.getComment());
Collection<ItemDelta<?,?>> deltaList = prismContext.deltaFor(AccessCertificationCampaignType.class) .item(workItemPath.append(AccessCertificationWorkItemType.F_OUTPUT)) .replace(new AbstractWorkItemOutputType() .outcome(toUri(normalizeToNull(response))) .comment(comment)) .item(workItemPath.append(AccessCertificationWorkItemType.F_OUTPUT_CHANGE_TIMESTAMP)).replace(now) .item(workItemPath.append(AccessCertificationWorkItemType.F_PERFORMER_REF)).replace(responderRef)
/** * Create an instance of {@link AbstractWorkItemOutputType } * */ public AbstractWorkItemOutputType createAbstractWorkItemOutputType() { return new AbstractWorkItemOutputType(); }
public static String getComment(AbstractWorkItemOutputType output) { return output != null ? output.getComment() : null; }
@Override public String getOutcome() { AbstractWorkItemOutputType output = getOutput(); return output != null ? output.getOutcome() : null; }
private List<ItemDelta<?, ?>> createMetadataDeltas(AccessCertificationCaseType aCase, AccessCertificationCampaignType campaign, Class<? extends ObjectType> objectClass, ItemPath pathPrefix, RunContext runContext, OperationResult result) throws SchemaException { String outcome = aCase.getOutcome(); if (OutcomeUtils.isNoneOrNotDecided(outcome)) { return emptyList(); } Set<ObjectReferenceType> certifiers = new HashSet<>(); Set<String> comments = new HashSet<>(); for (AccessCertificationWorkItemType workItem : aCase.getWorkItem()) { AbstractWorkItemOutputType output = workItem.getOutput(); if (workItem.getPerformerRef() == null || output == null) { continue; } boolean commentNotEmpty = StringUtils.isNotEmpty(output.getComment()); if (commentNotEmpty || !OutcomeUtils.isNoneOrNotDecided(output.getOutcome())) { certifiers.add(workItem.getPerformerRef().clone()); String formattedComment = runContext.commentsFormatter.formatComment(workItem, runContext.task, result); if (StringUtils.isNotEmpty(formattedComment)) { comments.add(formattedComment); } } } return prismContext.deltaFor(objectClass) .item(pathPrefix.append(MetadataType.F_CERTIFICATION_FINISHED_TIMESTAMP)).replace(campaign.getEndTimestamp()) .item(pathPrefix.append(MetadataType.F_CERTIFICATION_OUTCOME)).replace(outcome) .item(pathPrefix.append(MetadataType.F_CERTIFIER_REF)).replaceRealValues(certifiers) .item(pathPrefix.append(MetadataType.F_CERTIFIER_COMMENT)).replaceRealValues(comments) .asItemDeltas(); }
/** * Create an instance of {@link AbstractWorkItemOutputType } * */ public AbstractWorkItemOutputType createAbstractWorkItemOutputType() { return new AbstractWorkItemOutputType(); }
private String formatComment(ObjectReferenceType performerRef, AbstractWorkItemOutputType output, AbstractWorkItemType workItem, WorkItemCompletionEventType event, Task task, OperationResult result) { if (formatting == null || formatting.getCondition() == null && formatting.getValue() == null) { return output.getComment(); LoggingUtils.logUnexpectedException(LOGGER, "Couldn't evaluate value expression in comments formatter - using plain comment value; " + "performer = {}, output = {}, workItem = {}, event = {}", e, performer, output, workItem, event); return output.getComment(); return output.getComment();
public static Boolean approvalBooleanValue(AbstractWorkItemOutputType result) { return result != null ? approvalBooleanValue(fromUri(result.getOutcome())) : null; }
public AbstractWorkItemOutputType beginOutput() { AbstractWorkItemOutputType value = new AbstractWorkItemOutputType(); output(value); return value; }
void notifyReviewers(AccessCertificationCampaignType campaign, boolean unansweredOnly, Task task, OperationResult result) throws SchemaException { List<AccessCertificationCaseType> caseList = queryHelper.getAllCurrentIterationCases(campaign.getOid(), norm(campaign.getIteration()), null, result); Collection<String> reviewers = CertCampaignTypeUtil.getActiveReviewers(caseList); for (String reviewerOid : reviewers) { List<AccessCertificationCaseType> cases = queryHelper.getOpenCasesForReviewer(campaign, reviewerOid, result); boolean notify = !unansweredOnly || cases.stream() .flatMap(c -> c.getWorkItem().stream()) .anyMatch(wi -> ObjectTypeUtil.containsOid(wi.getAssigneeRef(), reviewerOid) && (wi.getOutput() == null || wi.getOutput().getOutcome() == null)); if (notify) { ObjectReferenceType actualReviewerRef = ObjectTypeUtil.createObjectRef(reviewerOid, ObjectTypes.USER); for (ObjectReferenceType reviewerOrDeputyRef : getReviewerAndDeputies(actualReviewerRef, task, result)) { eventHelper.onReviewRequested(reviewerOrDeputyRef, actualReviewerRef, cases, campaign, task, result); } } } }