use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class MappedItems method createAuxObjClassesMappingCreationRequest.
/**
* Creates a mapping creation request for mapping(s) for auxiliary object classes.
*
* @see #createAttributeMappingCreationRequest(QName)
* @see #createAttributeMappingCreationRequest(QName)
*/
private void createAuxObjClassesMappingCreationRequest() {
// 1. Definitions
ItemName itemPath = ShadowType.F_AUXILIARY_OBJECT_CLASS;
String itemDescription = "auxiliary object classes";
ResourceBidirectionalMappingAndDefinitionType auxiliaryObjectClassMappings = source.resourceObjectDefinition.getAuxiliaryObjectClassMappings();
if (auxiliaryObjectClassMappings == null) {
return;
}
// TODO add filtering after these mappings are promoted to InboundMappingType
List<MappingType> mappingBeans = auxiliaryObjectClassMappings.getInbound();
if (mappingBeans.isEmpty()) {
return;
}
// 2. Values
ItemDelta<PrismPropertyValue<QName>, PrismPropertyDefinition<QName>> itemAPrioriDelta = getItemAPrioriDelta(itemPath);
MappedItem.ItemProvider<PrismPropertyValue<QName>, PrismPropertyDefinition<QName>> itemProvider = this::getCurrentAuxiliaryObjectClasses;
// 3. Processing source
ProcessingMode processingMode = source.getItemProcessingMode(itemDescription, itemAPrioriDelta, mappingBeans, // aux OCs are never ignored
false, // aux OCs are never unreadable
null);
if (processingMode == ProcessingMode.NONE) {
return;
}
// 4. Mapping creation request
// Note that we intentionally ignore a-priori delta for aux OCs. The reason is unknown for me, but
// this is how it was done before 4.5.
//
// We also insist on fetching the full shadow, unless getProcessingSource() has told us that we should not process
// these mappings.
//
// TODO reconsider these irregularities in behavior (comparing with attribute/association mappings).
mappedItems.add(new MappedItem<>(source, target, context, mappingBeans, itemPath, itemDescription, // ignoring a priori delta
null, lazyAuxiliaryObjectClassPropertyDefinition.get(), itemProvider, // postprocessor
null, // variable producer
null, ProcessingMode.ABSOLUTE_STATE));
}
use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class MappedItems method createAssociationMappingCreationRequest.
/**
* Creates a mapping creation request for mapping(s) for given association.
*
* The situation is complicated by the fact that all associations are mixed up in `shadow.association` container.
*
* @see #createAttributeMappingCreationRequest(QName)
* @see #createAuxObjClassesMappingCreationRequest()
*/
private void createAssociationMappingCreationRequest(QName associationName) {
// 1. Definitions
ResourceAssociationDefinition associationDefinition = Objects.requireNonNull(source.resourceObjectDefinition.findAssociationDefinition(associationName), () -> "No definition for association " + associationName);
ItemName itemPath = ShadowType.F_ASSOCIATION;
String itemDescription = "association " + associationName;
List<InboundMappingType> mappingBeans = source.filterApplicableMappingBeans(associationDefinition.getInboundMappingTypes());
if (mappingBeans.isEmpty()) {
LOGGER.trace("No applicable beans for this phase");
return;
}
// 2. Values
// TODO Shouldn't we filter the apriori delta for specific association? (Instead of passing any association deltas?)
ItemDelta<PrismContainerValue<ShadowAssociationType>, PrismContainerDefinition<ShadowAssociationType>> associationAPrioriDelta = getItemAPrioriDelta(itemPath);
MappedItem.ItemProvider<PrismContainerValue<ShadowAssociationType>, PrismContainerDefinition<ShadowAssociationType>> associationProvider = () -> getCurrentAssociation(associationName);
// 3. Processing source
ProcessingMode processingMode = source.getItemProcessingMode(itemDescription, associationAPrioriDelta, mappingBeans, associationDefinition.isIgnored(LayerType.MODEL), associationDefinition.getLimitations(LayerType.MODEL));
if (processingMode == ProcessingMode.NONE) {
return;
}
// 4. Mapping creation request
mappedItems.add(new MappedItem<>(source, target, context, mappingBeans, // source path (cannot point to specified association name!)
itemPath, itemDescription, // a priori delta for all associations - see TO-DO above
associationAPrioriDelta, lazyAssociationContainerDefinition.get(), // association item provider
associationProvider, // postprocessor
source::resolveInputEntitlements, // so-called variable producer
source::getEntitlementVariableProducer, processingMode));
}
use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class CaseWorkItemReferenceMapper method map.
@Override
public RCaseWorkItemReference map(Referencable input, MapperContext context) {
RCaseWorkItem owner = (RCaseWorkItem) context.getOwner();
ObjectReferenceType objectRef = buildReference(input);
RCaseWorkItemReferenceOwner type;
ItemName name = context.getDelta().getPath().lastName();
if (QNameUtil.match(name, CaseWorkItemType.F_ASSIGNEE_REF)) {
type = RCaseWorkItemReferenceOwner.ASSIGNEE;
} else if (QNameUtil.match(name, CaseWorkItemType.F_CANDIDATE_REF)) {
type = RCaseWorkItemReferenceOwner.CANDIDATE;
} else {
throw new IllegalStateException("Unknown case work item reference owner: " + name + "(delta = " + context.getDelta() + ")");
}
return RCaseWorkItemReference.jaxbRefToRepo(objectRef, owner, context.getRelationRegistry(), type);
}
use of com.evolveum.midpoint.prism.path.ItemName in project midpoint by Evolveum.
the class ClassDefinitionParser method addVirtualDefinitionsForClass.
private void addVirtualDefinitionsForClass(Class jpaClass, JpaEntityDefinition entityDef) {
QueryEntity qEntity = (QueryEntity) jpaClass.getAnnotation(QueryEntity.class);
if (qEntity == null) {
return;
}
for (VirtualAny any : qEntity.anyElements()) {
ItemName jaxbName = new ItemName(any.jaxbNameNamespace(), any.jaxbNameLocalPart());
VirtualAnyContainerDefinition def = new VirtualAnyContainerDefinition(any.ownerType());
JpaLinkDefinition linkDefinition = new JpaLinkDefinition<>(jaxbName, null, null, false, def);
entityDef.addDefinition(linkDefinition);
}
for (VirtualCollection collection : qEntity.collections()) {
// only collections of entities expected at this moment
VirtualCollectionSpecification colSpec = new VirtualCollectionSpecification(collection.additionalParams());
ItemName jaxbName = createItemName(collection.jaxbName());
String jpaName = collection.jpaName();
JpaEntityDefinition content = parseClass(collection.collectionType());
JpaLinkDefinition linkDefinition = new JpaLinkDefinition<>(jaxbName, jpaName, colSpec, false, content);
entityDef.addDefinition(linkDefinition);
}
}
Aggregations