use of com.evolveum.midpoint.model.impl.lens.LensObjectDeltaOperation in project midpoint by Evolveum.
the class ContextLoader method removeRottenContexts.
/**
* Removes projection contexts that are not fresh.
* These are usually artifacts left after the context reload. E.g. an account that used to be linked to a user before
* but was removed in the meantime.
*/
private <F extends ObjectType> void removeRottenContexts(LensContext<F> context) {
Iterator<LensProjectionContext> projectionIterator = context.getProjectionContextsIterator();
while (projectionIterator.hasNext()) {
LensProjectionContext projectionContext = projectionIterator.next();
if (projectionContext.getPrimaryDelta() != null && !projectionContext.getPrimaryDelta().isEmpty()) {
// Vox populi vox dei
continue;
}
if (projectionContext.getWave() >= context.getExecutionWave()) {
// chance to be executed yet
continue;
}
ResourceShadowDiscriminator discr = projectionContext.getResourceShadowDiscriminator();
if (discr != null && discr.getOrder() > 0) {
// HACK never rot higher-order context. TODO: check if lower-order context is rotten, the also rot this one
continue;
}
if (!projectionContext.isFresh()) {
if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Removing rotten context {}", projectionContext.getHumanReadableName());
}
if (projectionContext.isToBeArchived()) {
context.getHistoricResourceObjects().add(projectionContext.getResourceShadowDiscriminator());
}
List<LensObjectDeltaOperation<ShadowType>> executedDeltas = projectionContext.getExecutedDeltas();
context.getRottenExecutedDeltas().addAll(executedDeltas);
projectionIterator.remove();
}
}
}
use of com.evolveum.midpoint.model.impl.lens.LensObjectDeltaOperation in project midpoint by Evolveum.
the class DependencyProcessor method wasProvisioned.
private <F extends ObjectType> boolean wasProvisioned(LensProjectionContext accountContext, int executionWave) {
int accountWave = accountContext.getWave();
if (accountWave >= executionWave) {
// This had no chance to be provisioned yet, so we assume it will be provisioned
return true;
}
if (accountContext.getSynchronizationPolicyDecision() == SynchronizationPolicyDecision.BROKEN || accountContext.getSynchronizationPolicyDecision() == SynchronizationPolicyDecision.IGNORE) {
return false;
}
PrismObject<ShadowType> objectCurrent = accountContext.getObjectCurrent();
if (objectCurrent != null && objectCurrent.asObjectable().getFailedOperationType() != null) {
// There is unfinished operation in the shadow. We cannot continue.
return false;
}
if (accountContext.isExists()) {
return true;
}
if (accountContext.isAdd()) {
List<LensObjectDeltaOperation<ShadowType>> executedDeltas = accountContext.getExecutedDeltas();
if (executedDeltas == null || executedDeltas.isEmpty()) {
return false;
}
for (LensObjectDeltaOperation<ShadowType> executedDelta : executedDeltas) {
OperationResult executionResult = executedDelta.getExecutionResult();
if (executionResult == null || !executionResult.isSuccess()) {
return false;
}
}
return true;
}
return false;
}
Aggregations