private <F extends ObjectType> Collection<PrismContainerValue<AssignmentType>> determineChangedAssignmentValues( LensFocusContext<F> focusContext, QName assignmentElementQName, ContainerDelta<AssignmentType> assignmentDelta, PlusMinusZero plusMinusZero) { Collection<PrismContainerValue<AssignmentType>> changedAssignmentValues = assignmentDelta.getValueChanges(plusMinusZero); if (plusMinusZero == PlusMinusZero.PLUS) { return changedAssignmentValues; } Collection<PrismContainerValue<AssignmentType>> processedChangedAssignmentValues = new ArrayList<>(changedAssignmentValues.size()); PrismObject<F> existingObject = focusContext.getObjectCurrentOrOld(); PrismContainer<AssignmentType> existingAssignmentContainer = existingObject.findContainer(ItemName.fromQName(assignmentElementQName)); for (PrismContainerValue<AssignmentType> changedAssignmentValue : changedAssignmentValues) { if (changedAssignmentValue.isIdOnly()) { if (existingAssignmentContainer != null) { PrismContainerValue<AssignmentType> existingAssignmentValue = existingAssignmentContainer.findValue(changedAssignmentValue.getId()); if (existingAssignmentValue != null) { processedChangedAssignmentValues.add(existingAssignmentValue); } } } else { processedChangedAssignmentValues.add(changedAssignmentValue); } } return processedChangedAssignmentValues; }
PrismContainerValue<Containerable> containerCVal = container.findValue(id); if (containerCVal != null) { for (Item<?,?> containerItem: containerCVal.getItems()) {
public CaseWorkItemType updateLoadedCaseWorkItem(GetContainerableIdOnlyResult result, Map<String, PrismObject<CaseType>> ownersMap, Collection<SelectorOptions<GetOperationOptions>> options, Session session, OperationResult operationResult) throws SchemaException, ObjectNotFoundException, DtoTranslationException { String ownerOid = result.getOwnerOid(); PrismObject<CaseType> aCase = resolveCase(ownerOid, ownersMap, session, operationResult); PrismContainer<Containerable> workItemContainer = aCase.findContainer(CaseType.F_WORK_ITEM); if (workItemContainer == null) { throw new ObjectNotFoundException("Case " + aCase + " has no work items even if it should have " + result); } PrismContainerValue<?> workItemPcv = workItemContainer.findValue(result.getId()); if (workItemPcv == null) { throw new ObjectNotFoundException("Case " + aCase + " has no work item " + result); } return (CaseWorkItemType) workItemPcv.asContainerable(); }
PrismObject<CaseType> aCase = getObject(CaseType.class, caseOid, null, task, result); PrismContainer<Containerable> workItems = aCase.findContainer(CaseType.F_WORK_ITEM); PrismContainerValue<Containerable> workItemPcv = workItems.findValue(workItemId); if (workItemPcv == null) { throw new ObjectNotFoundException("Work item with ID " + workItemId + " was not found in " + aCase);
private static AssignmentType getAssignment(AssignmentPathSegmentType segment, PrismObject<? extends ObjectType> candidate, ModelService modelService, Task task, OperationResult result) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException { if (segment.getSourceRef() == null || segment.getSourceRef().getOid() == null || segment.getAssignmentId() == null) { return null; } PrismObject<? extends ObjectType> source; if (candidate != null && segment.getSourceRef().getOid().equals(candidate.getOid()) && candidate.asObjectable() instanceof FocusType) { source = candidate; } else { source = getObject(segment.getSourceRef(), modelService, task, result); } PrismContainer<AssignmentType> assignmentContainer = source.findContainer(FocusType.F_ASSIGNMENT); if (assignmentContainer == null) { return null; } return asContainerable(assignmentContainer.findValue(segment.getAssignmentId())); }
@Test(enabled=false) // MID-3966 public void testAssignmentEquals2() throws Exception { System.out.println("\n\n===[ testAssignmentEquals2 ]===\n"); PrismContext prismContext = PrismTestUtil.getPrismContext(); PrismObject<RoleType> roleCompare = prismContext.parseObject(ROLE_COMPARE_FILE); PrismContainer<AssignmentType> inducementContainer = roleCompare.findContainer(RoleType.F_INDUCEMENT); AssignmentType a1 = inducementContainer.findValue(1L).asContainerable(); AssignmentType a2 = inducementContainer.findValue(2L).asContainerable(); AssignmentType a3 = inducementContainer.findValue(3L).asContainerable(); // WHEN assertFalse(a1.equals(a3)); assertFalse(a2.equals(a3)); assertTrue(a1.equals(a1)); assertTrue(a1.equals(a2)); assertTrue(a2.equals(a1)); assertTrue(a2.equals(a2)); assertTrue(a3.equals(a3)); }
sceneSrcValue = container.findValue(lastId);