Search in sources :

Example 1 with SynchronizationActionType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationActionType in project midpoint by Evolveum.

the class SynchronizationServiceImpl method executeActions.

private <F extends FocusType> void executeActions(SynchronizationReactionType reactionDef, LensContext<F> context, SynchronizationSituation<F> situation, BeforeAfterType order, ResourceType resource, boolean logDebug, Task task, OperationResult parentResult) throws ConfigurationException, SchemaException {
    for (SynchronizationActionType actionDef : reactionDef.getAction()) {
        if ((actionDef.getOrder() == null && order == BeforeAfterType.BEFORE) || (actionDef.getOrder() != null && actionDef.getOrder() == order)) {
            String handlerUri = actionDef.getHandlerUri();
            if (handlerUri == null) {
                handlerUri = actionDef.getRef();
            }
            if (handlerUri == null) {
                LOGGER.error("Action definition in resource {} doesn't contain handler URI", resource);
                throw new ConfigurationException("Action definition in resource " + resource + " doesn't contain handler URI");
            }
            Action action = actionManager.getActionInstance(handlerUri);
            if (action == null) {
                LOGGER.warn("Couldn't create action with uri '{}' in resource {}, skipping action.", new Object[] { handlerUri, resource });
                continue;
            }
            // TODO: legacy userTemplate
            Map<QName, Object> parameters = null;
            if (actionDef.getParameters() != null) {
            // TODO: process parameters
            // parameters = actionDef.getParameters().getAny();
            }
            if (logDebug) {
                LOGGER.debug("SYNCHRONIZATION: ACTION: Executing: {}.", new Object[] { action.getClass() });
            } else {
                LOGGER.trace("SYNCHRONIZATION: ACTION: Executing: {}.", new Object[] { action.getClass() });
            }
            action.handle(context, situation, parameters, task, parentResult);
        }
    }
}
Also used : SynchronizationActionType(com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationActionType) ConfigurationException(com.evolveum.midpoint.util.exception.ConfigurationException) QName(javax.xml.namespace.QName) PrismObject(com.evolveum.midpoint.prism.PrismObject) PolyString(com.evolveum.midpoint.prism.polystring.PolyString)

Example 2 with SynchronizationActionType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationActionType in project midpoint by Evolveum.

the class Migrator method migrateObjectSynchronization.

private void migrateObjectSynchronization(ObjectSynchronizationType sync) {
    if (sync == null || sync.getReaction() == null) {
        return;
    }
    List<SynchronizationReactionType> migratedReactions = new ArrayList<SynchronizationReactionType>();
    for (SynchronizationReactionType reaction : sync.getReaction()) {
        if (reaction.getAction() == null) {
            continue;
        }
        List<SynchronizationActionType> migratedAction = new ArrayList<SynchronizationActionType>();
        for (SynchronizationActionType action : reaction.getAction()) {
            migratedAction.add(migrateAction(action));
        }
        SynchronizationReactionType migratedReaction = reaction.clone();
        migratedReaction.getAction().clear();
        migratedReaction.getAction().addAll(migratedAction);
        migratedReactions.add(migratedReaction);
    }
    sync.getReaction().clear();
    sync.getReaction().addAll(migratedReactions);
}
Also used : SynchronizationActionType(com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationActionType) SynchronizationReactionType(com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationReactionType) ArrayList(java.util.ArrayList)

Aggregations

SynchronizationActionType (com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationActionType)2 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)1 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)1 SynchronizationReactionType (com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationReactionType)1 ArrayList (java.util.ArrayList)1 QName (javax.xml.namespace.QName)1