use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectAssociationType in project midpoint by Evolveum.
the class Construction method evaluateAssociations.
private void evaluateAssociations(Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException {
associationMappings = new ArrayList<>();
for (ResourceObjectAssociationType associationDefinitionType : getConstructionType().getAssociation()) {
QName assocName = ItemPathUtil.getOnlySegmentQName(associationDefinitionType.getRef());
if (assocName == null) {
throw new SchemaException("No association name (ref) in association definition in construction in " + getSource());
}
MappingType outboundMappingType = associationDefinitionType.getOutbound();
if (outboundMappingType == null) {
throw new SchemaException("No outbound section in definition of association " + assocName + " in construction in " + getSource());
}
Mapping<PrismContainerValue<ShadowAssociationType>, PrismContainerDefinition<ShadowAssociationType>> assocMapping = evaluateAssociation(associationDefinitionType, task, result);
if (assocMapping != null) {
associationMappings.add(assocMapping);
}
}
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectAssociationType in project midpoint by Evolveum.
the class ResourceTypeAssignmentPopupTabPanel method getSelectedAssignmentsMap.
@Override
protected Map<String, AssignmentType> getSelectedAssignmentsMap() {
Map<String, AssignmentType> assignmentList = new HashMap<>();
List<ResourceType> selectedObjects = getSelectedObjectsList();
ShadowKindType kind = getKindValue();
String intent = getIntentValue();
selectedObjects.forEach(selectedObject -> {
AssignmentType newConstructionAssignment = ObjectTypeUtil.createAssignmentWithConstruction(selectedObject.asPrismObject(), kind, intent, getPageBase().getPrismContext());
if (isEntitlementAssignment()) {
NameItemPathSegment segment = getAssociationValue() != null ? new NameItemPathSegment(getAssociationValue().getName()) : null;
if (segment != null) {
ResourceObjectAssociationType association = new ResourceObjectAssociationType();
association.setRef(new ItemPathType(ItemPath.create(segment)));
newConstructionAssignment.getConstruction().getAssociation().add(association);
}
}
assignmentList.put(selectedObject.getOid(), newConstructionAssignment);
});
return assignmentList;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ResourceObjectAssociationType in project midpoint by Evolveum.
the class Construction method evaluateAssociation.
private Mapping<PrismContainerValue<ShadowAssociationType>, PrismContainerDefinition<ShadowAssociationType>> evaluateAssociation(ResourceObjectAssociationType associationDefinitionType, Task task, OperationResult result) throws ExpressionEvaluationException, ObjectNotFoundException, SchemaException {
QName assocName = ItemPathUtil.getOnlySegmentQName(associationDefinitionType.getRef());
if (assocName == null) {
throw new SchemaException("Missing 'ref' in association in construction in " + getSource());
}
MappingType outboundMappingType = associationDefinitionType.getOutbound();
if (outboundMappingType == null) {
throw new SchemaException("No outbound section in definition of association " + assocName + " in construction in " + getSource());
}
PrismContainerDefinition<ShadowAssociationType> outputDefinition = getAssociationContainerDefinition();
Mapping.Builder<PrismContainerValue<ShadowAssociationType>, PrismContainerDefinition<ShadowAssociationType>> mappingBuilder = mappingFactory.<PrismContainerValue<ShadowAssociationType>, PrismContainerDefinition<ShadowAssociationType>>createMappingBuilder().mappingType(outboundMappingType).contextDescription("for association " + PrettyPrinter.prettyPrint(assocName) + " in " + getSource()).originType(OriginType.ASSIGNMENTS).originObject(getSource());
RefinedAssociationDefinition rAssocDef = refinedObjectClassDefinition.findAssociationDefinition(assocName);
if (rAssocDef == null) {
throw new SchemaException("No association " + assocName + " in object class " + refinedObjectClassDefinition.getHumanReadableName() + " in construction in " + getSource());
}
Mapping<PrismContainerValue<ShadowAssociationType>, PrismContainerDefinition<ShadowAssociationType>> evaluatedMapping = evaluateMapping(mappingBuilder, assocName, outputDefinition, rAssocDef.getAssociationTarget(), task, result);
LOGGER.trace("Evaluated mapping for association " + assocName + ": " + evaluatedMapping);
return evaluatedMapping;
}
Aggregations