use of com.evolveum.midpoint.xml.ns._public.common.common_3.VariableBindingDefinitionType in project midpoint by Evolveum.
the class ObjectTemplateProcessor method getUpdatedFocusOdo.
private <F extends FocusType> ObjectDeltaObject<F> getUpdatedFocusOdo(LensContext<F> context, ObjectDeltaObject<F> focusOdo, Map<ItemPath, DeltaSetTriple<? extends ItemValueWithOrigin<?, ?>>> outputTripleMap, ObjectTemplateMappingType mappingType, String contextDesc) throws ExpressionEvaluationException, PolicyViolationException, SchemaException {
ObjectDeltaObject<F> focusOdoCloned = null;
for (VariableBindingDefinitionType source : mappingType.getSource()) {
if (source.getPath() == null) {
continue;
}
ItemPath path = stripFocusVariableSegment(source.getPath().getItemPath());
if (path.startsWithVariable()) {
continue;
}
DeltaSetTriple<? extends ItemValueWithOrigin<?, ?>> triple = DeltaSetTriple.find(outputTripleMap, path);
if (triple == null) {
continue;
}
if (focusOdoCloned == null) {
LOGGER.trace("Cloning and updating focusOdo because of chained mappings; chained source path: {}", path);
focusOdoCloned = focusOdo.clone();
} else {
LOGGER.trace("Updating focusOdo because of chained mappings; chained source path: {}", path);
}
Class<F> focusClass = context.getFocusContext().getObjectTypeClass();
ItemDefinition<?> itemDefinition = getObjectDefinition(focusClass).findItemDefinition(path);
// TODO not much sure about the parameters
ItemDelta itemDelta = LensUtil.consolidateTripleToDelta(path, (DeltaSetTriple) triple, itemDefinition, getAprioriItemDelta(focusOdo.getObjectDelta(), path), focusOdo.getNewObject(), null, null, true, true, false, " updating chained source (" + path + ") in " + contextDesc, true);
LOGGER.trace("Updating focus ODO with delta:\n{}", itemDelta.debugDumpLazily());
focusOdoCloned.update(itemDelta);
}
return focusOdoCloned != null ? focusOdoCloned : focusOdo;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.VariableBindingDefinitionType in project midpoint by Evolveum.
the class ObjectTemplateProcessor method collectMappings.
private List<ObjectTemplateMappingType> collectMappings(ObjectTemplateType objectTemplateType) {
List<ObjectTemplateMappingType> mappings = new ArrayList<ObjectTemplateMappingType>();
mappings.addAll(objectTemplateType.getMapping());
for (ObjectTemplateItemDefinitionType templateItemDefType : objectTemplateType.getItem()) {
for (ObjectTemplateMappingType mapping : templateItemDefType.getMapping()) {
VariableBindingDefinitionType target = mapping.getTarget();
if (target == null) {
target = new VariableBindingDefinitionType();
target.setPath(templateItemDefType.getRef());
mapping.setTarget(target);
} else if (target.getPath() == null) {
target = target.clone();
target.setPath(templateItemDefType.getRef());
mapping.setTarget(target);
}
mappings.add(mapping);
}
}
return mappings;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.VariableBindingDefinitionType in project midpoint by Evolveum.
the class VariableBindingDefinitionTypePanel method initLayout.
private void initLayout() {
ItemPathPanel pathPanel = new ItemPathPanel(ID_PATH_PANEL, createPathModel()) {
@Override
protected void onUpdate(ItemPathDto itemPathDto) {
ItemPath newPath = getModelObject().toItemPath();
ItemPathType newPathtype = null;
if (newPath != null) {
newPathtype = new ItemPathType(newPath);
}
VariableBindingDefinitionType var = VariableBindingDefinitionTypePanel.this.getModelObject();
if (var == null) {
var = new VariableBindingDefinitionType();
VariableBindingDefinitionTypePanel.this.getModel().setObject(var);
}
VariableBindingDefinitionTypePanel.this.getModelObject().setPath(newPathtype);
}
};
pathPanel.setOutputMarkupId(true);
add(pathPanel);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.VariableBindingDefinitionType in project midpoint by Evolveum.
the class TransformationalMetadataComputation method createMetadataComputationInput.
// Temporary implementation
private MetadataComputationInput createMetadataComputationInput(MetadataMappingBuilder<?, ?> builder, MetadataMappingType metadataMappingBean) {
MetadataComputationInput metadataComputationInput = new MetadataComputationInput();
for (PrismValue inputDataValue : inputValues) {
Map<String, Collection<?>> metadataSourceMap = new HashMap<>();
if (inputDataValue != null) {
for (VariableBindingDefinitionType sourceDef : metadataMappingBean.getSource()) {
ItemPath metadataSourcePath = getSourcePath(sourceDef);
QName metadataSourceName = getSourceName(sourceDef, metadataSourcePath);
List<PrismValue> metadataSourceValues = new ArrayList<>();
for (PrismContainerValue<Containerable> metadataValue : inputDataValue.getValueMetadata().getValues()) {
Item<PrismValue, ItemDefinition> sourceItem = metadataValue.findItem(metadataSourcePath);
if (sourceItem != null) {
// noinspection unchecked
metadataSourceValues.addAll(sourceItem.clone().getRealValues());
}
}
metadataSourceMap.put(metadataSourceName.getLocalPart(), metadataSourceValues);
}
metadataComputationInput.add(inputDataValue, metadataSourceMap);
}
}
return metadataComputationInput;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.VariableBindingDefinitionType in project midpoint by Evolveum.
the class MappingParser method parseTarget.
private void parseTarget() throws SchemaException {
VariableBindingDefinitionType targetSpecification = m.mappingBean.getTarget();
if (targetSpecification == null) {
outputDefinition = m.defaultTargetDefinition;
outputPath = m.defaultTargetPath;
} else {
ItemPathType itemPathType = targetSpecification.getPath();
if (itemPathType == null) {
outputDefinition = m.defaultTargetDefinition;
outputPath = m.defaultTargetPath;
} else {
ItemPath path = itemPathType.getItemPath();
outputDefinition = ExpressionUtil.resolveDefinitionPath(path, m.variables, m.targetContext, "target definition in " + m.getMappingContextDescription());
if (outputDefinition == null) {
throw new SchemaException("No target item that would conform to the path " + path + " in " + m.getMappingContextDescription());
}
outputPath = path.stripVariableSegment();
}
}
if (m.valuePolicySupplier != null) {
m.valuePolicySupplier.setOutputDefinition(outputDefinition);
m.valuePolicySupplier.setOutputPath(outputPath);
}
}
Aggregations