public static String getOutcome(AbstractWorkItemOutputType output) { return output != null ? output.getOutcome() : null; }
@Override public String getOutcome() { AbstractWorkItemOutputType output = getOutput(); return output != null ? output.getOutcome() : null; }
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); }
public static Boolean approvalBooleanValue(AbstractWorkItemOutputType result) { return result != null ? approvalBooleanValue(fromUri(result.getOutcome())) : null; }
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 ""; } }
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); } } } }
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) + ")"; } }
@SuppressWarnings("unused") public List<PrismContainerValue<AccessCertificationWorkItemType>> getCertificationCampaignNonResponders(String campaignName, Integer stageNumber) throws SchemaException, SecurityViolationException, ConfigurationException, ObjectNotFoundException, ExpressionEvaluationException, CommunicationException { List<AccessCertificationWorkItemType> workItems = new ArrayList<>(); AccessCertificationCampaignType campaign = getCampaignByName(campaignName); if (campaign != null) { List<AccessCertificationCaseType> cases = getCertificationCampaignNotRespondedCasesAsBeans(campaignName); for (AccessCertificationCaseType aCase : cases) { for (AccessCertificationWorkItemType workItem : aCase.getWorkItem()) { if (norm(workItem.getIteration()) == norm(campaign.getIteration()) && (workItem.getOutput() == null || workItem.getOutput().getOutcome() == null) && (stageNumber == null || Objects.equals(workItem.getStageNumber(), stageNumber))) { workItems.add(workItem); } } } } else { LOGGER.debug("No campaign named '{}' was found", campaignName); } return PrismContainerValue.toPcvList(workItems); }
String answer = ApprovalUtils.makeNiceFromUri(output.getOutcome()); record.setResult(answer); message.append(answer);
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(); }
if (stageDef.getEvaluationStrategy() == LevelEvaluationStrategyType.FIRST_DECIDES) { Set<String> outcomes = itemEvents.stream() .map(e -> e.getOutput().getOutcome()) .collect(Collectors.toSet()); if (outcomes.size() > 1) {
@Override public AuditEventRecord prepareWorkItemDeletedAuditRecord(WorkItemType workItem, WorkItemEventCauseInformationType cause, TaskEvent taskEvent, WfTask wfTask, OperationResult result) throws WorkflowException { AuditEventRecord auditEventRecord = baseAuditHelper.prepareWorkItemDeletedAuditRecord(workItem, cause, wfTask, result); try { AbstractWorkItemOutputType output = workItem.getOutput(); // TODO - or merge with original deltas? if (output != null && ApprovalUtils.fromUri(output.getOutcome()) == WorkItemOutcomeType.APPROVE && output instanceof WorkItemResultType && ((WorkItemResultType) output).getAdditionalDeltas() != null) { addDeltasToEventRecord(auditEventRecord, ObjectTreeDeltas.fromObjectTreeDeltasType(((WorkItemResultType) output).getAdditionalDeltas(), getPrismContext())); } } catch (SchemaException e) { LoggingUtils.logUnexpectedException(LOGGER, "Couldn't retrieve deltas to be put into audit record", e); } return auditEventRecord; }
.item(CaseType.F_WORK_ITEM, workItemId, WorkItemType.F_OUTPUT).replace(output) .item(CaseType.F_STATE).replace(SchemaConstants.CASE_STATE_CLOSED) .item(CaseType.F_OUTCOME).replace(output != null ? output.getOutcome() : null) .item(CaseType.F_CLOSE_TIMESTAMP).replace(now) .asObjectDeltaCast(caseOid);
&& existing.getOriginalAssigneeRef() != null && Objects.equals(existing.getOriginalAssigneeRef().getOid(), reviewer.getOid()) && existing.getOutput() != null && normalizeToNull(fromUri(existing.getOutput().getOutcome())) != null) { skipCreation = true; LOGGER.trace("Skipping creation of a work item for {}, because the relevant outcome already exists in {}",
throw new IllegalStateException("Couldn't delegate a work item that is not in a current iteration. Current stage: " + norm(workItemCampaign.getIteration()) + ", work item iteration: " + norm(workItem.getIteration())); if (workItem.getOutput() != null && workItem.getOutput().getOutcome() != null) {
eventMap.put(c.getExternalWorkItemId(), c); assertNotNull("No result in "+c, c.getOutput()); assertEquals("Wrong outcome in "+c, WorkItemOutcomeType.REJECT, ApprovalUtils.fromUri(c.getOutput().getOutcome())); assertNotNull("No cause in "+c, c.getCause()); assertEquals("Wrong cause type in "+c, WorkItemEventCauseTypeType.TIMED_ACTION, c.getCause().getType());