use of com.evolveum.midpoint.model.api.util.MergeDeltas in project midpoint by Evolveum.
the class ObjectMerger method computeMergeDeltas.
public <O extends ObjectType> MergeDeltas<O> computeMergeDeltas(Class<O> type, String leftOid, String rightOid, final String mergeConfigurationName, final Task task, final OperationResult result) throws ObjectNotFoundException, SchemaException, ConfigurationException, ExpressionEvaluationException, CommunicationException, SecurityViolationException {
final PrismObject<O> objectLeft = (PrismObject<O>) objectResolver.getObjectSimple(type, leftOid, null, task, result).asPrismObject();
final PrismObject<O> objectRight = (PrismObject<O>) objectResolver.getObjectSimple(type, rightOid, null, task, result).asPrismObject();
PrismObject<SystemConfigurationType> systemConfiguration = systemObjectCache.getSystemConfiguration(result);
MergeConfigurationType mergeConfiguration = selectConfiguration(systemConfiguration, mergeConfigurationName);
if (mergeConfiguration == null) {
throw new ConfigurationException("No merge configuration defined");
}
// The "left" object is always the one that will be the result. We will use its OID.
final ObjectDelta<O> leftObjectDelta = objectLeft.createModifyDelta();
final ObjectDelta<O> leftLinkDelta = objectLeft.createModifyDelta();
final ObjectDelta<O> rightLinkDelta = objectRight.createModifyDelta();
final List<ItemPath> processedPaths = new ArrayList<>();
computeItemDeltas(leftObjectDelta, objectLeft, objectRight, processedPaths, mergeConfiguration, mergeConfigurationName, task, result);
computeDefaultDeltas(leftObjectDelta, objectLeft, objectRight, processedPaths, mergeConfiguration, mergeConfigurationName, task, result);
computeProjectionDeltas(leftLinkDelta, rightLinkDelta, objectLeft, objectRight, mergeConfiguration, mergeConfigurationName, task, result);
return new MergeDeltas<>(leftObjectDelta, leftLinkDelta, rightLinkDelta);
}
Aggregations