@NotNull public static AccessCertificationCaseType getCaseChecked(AccessCertificationWorkItemType workItem) { AccessCertificationCaseType aCase = getCase(workItem); if (aCase == null) { throw new IllegalStateException("No certification case for work item " + workItem); } return aCase; }
protected AccessCertificationWorkItemType findWorkItem(Collection<AccessCertificationWorkItemType> workItems, String subjectOid, String targetOid, int iteration) { for (AccessCertificationWorkItemType workItem : workItems) { AccessCertificationCaseType aCase = CertCampaignTypeUtil.getCase(workItem); if (aCase != null && aCase.getTargetRef() != null && aCase.getTargetRef().getOid().equals(targetOid) && aCase.getObjectRef() != null && aCase.getObjectRef().getOid().equals(subjectOid) && norm(workItem.getIteration()) == iteration) { return workItem; } } return null; }
private void executeCompleteAction(AccessCertificationCampaignType campaign, CompleteWorkItemActionType completeAction, Task task, OperationResult result) throws SchemaException, SecurityViolationException, ObjectNotFoundException, ObjectAlreadyExistsException, ExpressionEvaluationException, CommunicationException, ConfigurationException { List<AccessCertificationWorkItemType> workItems = queryHelper.searchOpenWorkItems( CertCampaignTypeUtil.createWorkItemsForCampaignQuery(campaign.getOid(), prismContext), null, true, null, result); for (AccessCertificationWorkItemType workItem : workItems) { AccessCertificationCaseType aCase = CertCampaignTypeUtil.getCase(workItem); if (aCase == null || aCase.getId() == null || workItem.getId() == null) { LOGGER.error("Couldn't auto-complete work item {} in case {}: some identifiers are missing", aCase, workItem); // shouldn't occur } else { certManager.recordDecision(campaign.getOid(), aCase.getId(), workItem.getId(), OutcomeUtils.fromUri(completeAction.getOutcome()), null, task, result); } } }
protected AccessCertificationCaseType checkWorkItemSanity(Collection<AccessCertificationWorkItemType> workItems, String subjectOid, String targetOid, FocusType focus, int iteration) { AccessCertificationWorkItemType workItem = findWorkItem(workItems, subjectOid, targetOid, iteration); assertNotNull("Certification work item for " + subjectOid + ":" + targetOid + " was not found (iteration " + iteration + ")", workItem); AccessCertificationCaseType aCase = CertCampaignTypeUtil.getCase(workItem); assertNotNull("No case for " + workItem, aCase); assertNotNull("reviewRequestedTimestamp", aCase.getCurrentStageCreateTimestamp()); assertNotNull("deadline", aCase.getCurrentStageDeadline()); assertNull("remediedTimestamp", aCase.getRemediedTimestamp()); return checkCaseAssignmentSanity(aCase, focus); }