static ExtensionType collectExtensions(AssignmentPathType path, int startAt, ModelService modelService, Task task, OperationResult result) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException { return AssignmentPathUtil.collectExtensions(path, startAt, modelService, task, result); }
public static ExtensionType collectExtensions(AssignmentPathType path, int startAt, ModelService modelService, Task task, OperationResult result) throws SchemaException, ConfigurationException, ObjectNotFoundException, CommunicationException, SecurityViolationException, ExpressionEvaluationException { ExtensionType rv = new ExtensionType(modelService.getPrismContext()); PrismContainerValue<?> pcv = rv.asPrismContainerValue(); PrismObject<? extends ObjectType> lastTarget = null; // used for caching for (int i = startAt; i < path.getSegment().size(); i++) { AssignmentPathSegmentType segment = path.getSegment().get(i); AssignmentType assignment = getAssignment(segment, lastTarget, modelService, task, result); if (assignment != null && assignment.getExtension() != null) { ObjectTypeUtil.mergeExtension(pcv, assignment.getExtension().asPrismContainerValue()); } PrismObject<? extends ObjectType> target = getAssignmentTarget(segment, modelService, task, result); if (target != null && target.getExtension() != null) { ObjectTypeUtil.mergeExtension(pcv, target.getExtensionContainerValue()); } lastTarget = target; } return rv; }
private static PrismObject<? extends ObjectType> getAssignmentTarget(AssignmentPathSegmentType segment, ModelService modelService, Task task, OperationResult result) throws CommunicationException, ObjectNotFoundException, SchemaException, SecurityViolationException, ConfigurationException, ExpressionEvaluationException { if (segment.getTargetRef() == null || segment.getTargetRef().getOid() == null) { return null; } return getObject(segment.getTargetRef(), modelService, task, result); }
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())); }
@Override public ExtensionType collectExtensions(int startAt) throws SchemaException { return AssignmentPathUtil.collectExtensions(this, startAt, prismContext); }