syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [04/13] syncope git commit: [SYNCOPE-771] Rename completed
Date Fri, 11 Mar 2016 13:45:52 GMT
http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/LDAPMembershipSyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/LDAPMembershipSyncActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/LDAPMembershipSyncActions.java
deleted file mode 100644
index 464c56b..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/LDAPMembershipSyncActions.java
+++ /dev/null
@@ -1,335 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.provisioning.java.syncpull;
-
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.collections4.IterableUtils;
-import org.apache.commons.collections4.Predicate;
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.syncope.common.lib.patch.AnyPatch;
-import org.apache.syncope.common.lib.patch.MembershipPatch;
-import org.apache.syncope.common.lib.patch.UserPatch;
-import org.apache.syncope.common.lib.to.AnyTO;
-import org.apache.syncope.common.lib.to.GroupTO;
-import org.apache.syncope.common.lib.to.MembershipTO;
-import org.apache.syncope.common.lib.types.AuditElements;
-import org.apache.syncope.common.lib.types.AuditElements.Result;
-import org.apache.syncope.common.lib.types.ConnConfProperty;
-import org.apache.syncope.common.lib.types.PatchOperation;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
-import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
-import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
-import org.apache.syncope.core.provisioning.api.Connector;
-import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationException;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
-import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
-import org.apache.syncope.core.provisioning.api.syncpull.ProvisioningProfile;
-import org.apache.syncope.core.provisioning.api.syncpull.ProvisioningReport;
-import org.apache.syncope.core.persistence.api.dao.AnyTypeDAO;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.user.UMembership;
-import org.apache.syncope.core.provisioning.api.AuditManager;
-import org.apache.syncope.core.provisioning.api.notification.NotificationManager;
-import org.apache.syncope.core.workflow.api.UserWorkflowAdapter;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.ObjectClass;
-import org.identityconnectors.framework.common.objects.OperationOptionsBuilder;
-import org.identityconnectors.framework.common.objects.SyncDelta;
-import org.quartz.JobExecutionException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-
-/**
- * Simple action for synchronizing LDAP groups memberships to Syncope group memberships, when the same resource is
- * configured for both users and groups.
- *
- * @see org.apache.syncope.core.provisioning.java.propagation.LDAPMembershipPropagationActions
- */
-public class LDAPMembershipSyncActions extends DefaultSyncActions {
-
-    protected static final Logger LOG = LoggerFactory.getLogger(LDAPMembershipSyncActions.class);
-
-    @Autowired
-    protected AnyTypeDAO anyTypeDAO;
-
-    @Autowired
-    protected UserDAO userDAO;
-
-    @Autowired
-    protected GroupDAO groupDAO;
-
-    @Autowired
-    protected UserWorkflowAdapter uwfAdapter;
-
-    @Autowired
-    protected PropagationManager propagationManager;
-
-    @Autowired
-    private PropagationTaskExecutor taskExecutor;
-
-    @Autowired
-    private NotificationManager notificationManager;
-
-    @Autowired
-    private AuditManager auditManager;
-
-    @Autowired
-    private SyncUtils syncUtils;
-
-    protected Map<Long, Long> membersBeforeGroupUpdate = Collections.<Long, Long>emptyMap();
-
-    /**
-     * Allows easy subclassing for the ConnId AD connector bundle.
-     *
-     * @param connector A Connector instance to query for the groupMemberAttribute property name
-     * @return the name of the attribute used to keep track of group memberships
-     */
-    protected String getGroupMembershipAttrName(final Connector connector) {
-        ConnConfProperty groupMembership = IterableUtils.find(connector.getConnInstance().getConf(),
-                new Predicate<ConnConfProperty>() {
-
-            @Override
-            public boolean evaluate(final ConnConfProperty property) {
-                return "groupMemberAttribute".equals(property.getSchema().getName())
-                        && property.getValues() != null && !property.getValues().isEmpty();
-            }
-        });
-
-        return groupMembership == null
-                ? "uniquemember"
-                : (String) groupMembership.getValues().get(0);
-    }
-
-    /**
-     * Keep track of members of the group being updated <b>before</b> actual update takes place. This is not needed on
-     * <ul> <li>beforeProvision() - because the synchronizing group does not exist yet on Syncope</li>
-     * <li>beforeDelete() - because group delete cascades as membership removal for all users involved</li> </ul>
-     *
-     * {@inheritDoc}
-     */
-    @Override
-    public <A extends AnyTO, M extends AnyPatch> SyncDelta beforeUpdate(
-            final ProvisioningProfile<?, ?> profile,
-            final SyncDelta delta, final A any, final M anyPatch) throws JobExecutionException {
-
-        if (any instanceof GroupTO) {
-            // search for all users assigned to given group
-            Group group = groupDAO.find(any.getKey());
-            if (group != null) {
-                List<UMembership> membs = groupDAO.findUMemberships(group);
-                // save memberships before group update takes place
-                membersBeforeGroupUpdate = new HashMap<>(membs.size());
-                for (UMembership memb : membs) {
-                    membersBeforeGroupUpdate.put(memb.getLeftEnd().getKey(), memb.getKey());
-                }
-            }
-        }
-
-        return super.beforeUpdate(profile, delta, any, anyPatch);
-    }
-
-    /**
-     * Build UserPatch for adding membership to given user, for given group.
-     *
-     * @param userKey user to be assigned membership to given group
-     * @param groupTO group for adding membership
-     * @return UserPatch for user update
-     */
-    protected UserPatch getUserPatch(final Long userKey, final GroupTO groupTO) {
-        UserPatch userPatch = new UserPatch();
-        // no actual modification takes place when user has already the group assigned
-        if (membersBeforeGroupUpdate.containsKey(userKey)) {
-            membersBeforeGroupUpdate.remove(userKey);
-        } else {
-            userPatch.setKey(userKey);
-
-            userPatch.getMemberships().add(
-                    new MembershipPatch.Builder().
-                    operation(PatchOperation.ADD_REPLACE).
-                    membershipTO(new MembershipTO.Builder().group(groupTO.getKey(), null).build()).
-                    build());
-        }
-
-        return userPatch;
-    }
-
-    /**
-     * Read values of attribute returned by getGroupMembershipAttrName(); if not present in the given delta, perform an
-     * additional read on the underlying connector.
-     *
-     * @param delta representing the synchronizing group
-     * @param connector associated to the current resource
-     * @return value of attribute returned by
-     * {@link #getGroupMembershipAttrName}
-     */
-    protected List<Object> getMembAttrValues(final SyncDelta delta, final Connector connector) {
-        List<Object> result = Collections.<Object>emptyList();
-        String groupMemberName = getGroupMembershipAttrName(connector);
-
-        // first, try to read the configured attribute from delta, returned by the ongoing synchronization
-        Attribute membAttr = delta.getObject().getAttributeByName(groupMemberName);
-        // if not found, perform an additional read on the underlying connector for the same connector object
-        if (membAttr == null) {
-            OperationOptionsBuilder oob = new OperationOptionsBuilder();
-            oob.setAttributesToGet(groupMemberName);
-            ConnectorObject remoteObj = connector.getObject(ObjectClass.GROUP, delta.getUid(), oob.build());
-            if (remoteObj == null) {
-                LOG.debug("Object for '{}' not found", delta.getUid().getUidValue());
-            } else {
-                membAttr = remoteObj.getAttributeByName(groupMemberName);
-            }
-        }
-        if (membAttr != null && membAttr.getValue() != null) {
-            result = membAttr.getValue();
-        }
-
-        return result;
-    }
-
-    /**
-     * Perform actual modifications (i.e. membership add / remove) for the given group on the given resource.
-     *
-     * @param userPatch modifications to perform on the user
-     * @param resourceName resource to be propagated for changes
-     */
-    protected void userUpdate(final UserPatch userPatch, final String resourceName) {
-        if (userPatch.getKey() == 0) {
-            return;
-        }
-
-        Result result;
-
-        WorkflowResult<Pair<UserPatch, Boolean>> updated = null;
-
-        try {
-            updated = uwfAdapter.update(userPatch);
-
-            List<PropagationTask> tasks = propagationManager.getUserUpdateTasks(
-                    updated, false, Collections.singleton(resourceName));
-
-            taskExecutor.execute(tasks);
-            result = Result.SUCCESS;
-        } catch (PropagationException e) {
-            result = Result.FAILURE;
-            LOG.error("Could not propagate {}", userPatch, e);
-        } catch (Exception e) {
-            result = Result.FAILURE;
-            LOG.error("Could not perform update {}", userPatch, e);
-        }
-
-        notificationManager.createTasks(
-                AuditElements.EventCategoryType.SYNCHRONIZATION,
-                this.getClass().getSimpleName(),
-                null,
-                "update",
-                result,
-                null, // searching for before object is too much expensive ... 
-                updated == null ? null : updated.getResult().getKey(),
-                userPatch,
-                resourceName);
-
-        auditManager.audit(
-                AuditElements.EventCategoryType.SYNCHRONIZATION,
-                this.getClass().getSimpleName(),
-                null,
-                "update",
-                result,
-                null, // searching for before object is too much expensive ... 
-                updated == null ? null : updated.getResult().getKey(),
-                userPatch,
-                resourceName);
-    }
-
-    /**
-     * Synchronize Syncope memberships with the situation read on the external resource's group.
-     *
-     * @param profile sync profile
-     * @param delta representing the synchronizing group
-     * @param groupTO group after modification performed by the handler
-     * @throws JobExecutionException if anything goes wrong
-     */
-    protected void synchronizeMemberships(
-            final ProvisioningProfile<?, ?> profile, final SyncDelta delta, final GroupTO groupTO)
-            throws JobExecutionException {
-
-        ProvisioningTask task = profile.getTask();
-        ExternalResource resource = task.getResource();
-        Connector connector = profile.getConnector();
-
-        for (Object membValue : getMembAttrValues(delta, connector)) {
-            Long userKey = syncUtils.findMatchingAnyKey(
-                    anyTypeDAO.findUser(),
-                    membValue.toString(),
-                    profile.getTask().getResource(),
-                    profile.getConnector());
-            if (userKey != null) {
-                UserPatch userPatch = getUserPatch(userKey, groupTO);
-                userUpdate(userPatch, resource.getKey());
-            }
-        }
-
-        // finally remove any residual membership that was present before group update but not any more
-        for (Map.Entry<Long, Long> member : membersBeforeGroupUpdate.entrySet()) {
-            UserPatch userPatch = new UserPatch();
-            userPatch.setKey(member.getKey());
-
-            userPatch.getMemberships().add(
-                    new MembershipPatch.Builder().
-                    operation(PatchOperation.DELETE).
-                    membershipTO(new MembershipTO.Builder().group(groupTO.getKey(), null).build()).
-                    build());
-
-            userUpdate(userPatch, resource.getKey());
-        }
-    }
-
-    /**
-     * Synchronize membership at group synchronization time (because SyncJob first synchronize users then groups).
-     * {@inheritDoc}
-     */
-    @Override
-    public <A extends AnyTO> void after(
-            final ProvisioningProfile<?, ?> profile,
-            final SyncDelta delta,
-            final A any,
-            final ProvisioningReport result) throws JobExecutionException {
-
-        if (!(profile.getTask() instanceof SyncTask)) {
-            return;
-        }
-
-        if (!(any instanceof GroupTO)
-                || profile.getTask().getResource().getProvision(anyTypeDAO.findUser()) == null
-                || profile.getTask().getResource().getProvision(anyTypeDAO.findUser()).getMapping() == null) {
-
-            super.after(profile, delta, any, result);
-        } else {
-            synchronizeMemberships(profile, delta, (GroupTO) any);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/LDAPPasswordSyncActions.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/LDAPPasswordSyncActions.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/LDAPPasswordSyncActions.java
deleted file mode 100644
index 134c1f1..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/LDAPPasswordSyncActions.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.provisioning.java.syncpull;
-
-import org.apache.syncope.common.lib.patch.AnyPatch;
-import org.apache.syncope.common.lib.patch.PasswordPatch;
-import org.apache.syncope.common.lib.patch.UserPatch;
-import org.apache.syncope.common.lib.to.AnyTO;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.CipherAlgorithm;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.provisioning.api.syncpull.ProvisioningProfile;
-import org.apache.syncope.core.provisioning.api.syncpull.ProvisioningReport;
-import org.identityconnectors.framework.common.objects.SyncDelta;
-import org.quartz.JobExecutionException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.crypto.codec.Base64;
-import org.springframework.security.crypto.codec.Hex;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * A SyncActions implementation which allows the ability to import passwords from an LDAP backend
- * that are hashed.
- */
-public class LDAPPasswordSyncActions extends DefaultSyncActions {
-
-    protected static final Logger LOG = LoggerFactory.getLogger(LDAPPasswordSyncActions.class);
-
-    @Autowired
-    private UserDAO userDAO;
-
-    private String encodedPassword;
-
-    private CipherAlgorithm cipher;
-
-    @Transactional(readOnly = true)
-    @Override
-    public <A extends AnyTO> SyncDelta beforeProvision(
-            final ProvisioningProfile<?, ?> profile,
-            final SyncDelta delta,
-            final A any) throws JobExecutionException {
-
-        if (any instanceof UserTO) {
-            String password = ((UserTO) any).getPassword();
-            parseEncodedPassword(password);
-        }
-
-        return delta;
-    }
-
-    @Transactional(readOnly = true)
-    @Override
-    public <A extends AnyTO, M extends AnyPatch> SyncDelta beforeUpdate(
-            final ProvisioningProfile<?, ?> profile,
-            final SyncDelta delta,
-            final A any,
-            final M anyPatch) throws JobExecutionException {
-
-        if (anyPatch instanceof UserPatch) {
-            PasswordPatch modPassword = ((UserPatch) anyPatch).getPassword();
-            parseEncodedPassword(modPassword == null ? null : modPassword.getValue());
-        }
-
-        return delta;
-    }
-
-    private void parseEncodedPassword(final String password) {
-        if (password != null && password.startsWith("{")) {
-            int closingBracketIndex = password.indexOf('}');
-            String digest = password.substring(1, password.indexOf('}'));
-            if (digest != null) {
-                digest = digest.toUpperCase();
-            }
-            try {
-                encodedPassword = password.substring(closingBracketIndex + 1);
-                cipher = CipherAlgorithm.valueOf(digest);
-            } catch (IllegalArgumentException e) {
-                LOG.error("Cipher algorithm not allowed: {}", digest, e);
-                encodedPassword = null;
-            }
-        }
-    }
-
-    @Transactional(readOnly = true)
-    @Override
-    public <A extends AnyTO> void after(
-            final ProvisioningProfile<?, ?> profile,
-            final SyncDelta delta,
-            final A any,
-            final ProvisioningReport result) throws JobExecutionException {
-
-        if (any instanceof UserTO && encodedPassword != null && cipher != null) {
-            User syncopeUser = userDAO.find(any.getKey());
-            if (syncopeUser != null) {
-                byte[] encodedPasswordBytes = Base64.decode(encodedPassword.getBytes());
-                char[] encodedHex = Hex.encode(encodedPasswordBytes);
-                String encodedHexStr = new String(encodedHex).toUpperCase();
-
-                syncopeUser.setEncodedPassword(encodedHexStr, cipher);
-            }
-            encodedPassword = null;
-            cipher = null;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/PlainAttrsSyncCorrelationRule.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/PlainAttrsSyncCorrelationRule.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/PlainAttrsSyncCorrelationRule.java
deleted file mode 100644
index 343ba3f..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/PlainAttrsSyncCorrelationRule.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.provisioning.java.syncpull;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import org.apache.syncope.core.provisioning.java.MappingManagerImpl;
-import org.apache.syncope.core.persistence.api.dao.search.AnyCond;
-import org.apache.syncope.core.persistence.api.dao.search.AttributeCond;
-import org.apache.syncope.core.persistence.api.dao.search.SearchCond;
-import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
-import org.apache.syncope.core.persistence.api.entity.resource.Provision;
-import org.apache.syncope.core.provisioning.api.data.MappingItemTransformer;
-import org.apache.syncope.core.provisioning.api.syncpull.SyncCorrelationRule;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-
-public class PlainAttrsSyncCorrelationRule implements SyncCorrelationRule {
-
-    private final List<String> plainSchemaNames;
-
-    private final Provision provision;
-
-    public PlainAttrsSyncCorrelationRule(final String[] plainSchemaNames, final Provision provision) {
-        this.plainSchemaNames = Arrays.asList(plainSchemaNames);
-        this.provision = provision;
-    }
-
-    @Override
-    public SearchCond getSearchCond(final ConnectorObject connObj) {
-        Map<String, MappingItem> mappingItems = new HashMap<>();
-        for (MappingItem item : MappingManagerImpl.getSyncMappingItems(provision)) {
-            mappingItems.put(item.getIntAttrName(), item);
-        }
-
-        // search for anys by attribute(s) specified in the policy
-        SearchCond searchCond = null;
-
-        for (String schema : plainSchemaNames) {
-            Attribute attr = mappingItems.get(schema) == null
-                    ? null
-                    : connObj.getAttributeByName(mappingItems.get(schema).getExtAttrName());
-            if (attr == null) {
-                throw new IllegalArgumentException(
-                        "Connector object does not contains the attributes to perform the search: " + schema);
-            }
-
-            List<Object> values = attr.getValue();
-            for (MappingItemTransformer transformer
-                    : MappingManagerImpl.getMappingItemTransformers(mappingItems.get(schema))) {
-
-                values = transformer.beforeSync(values);
-            }
-
-            AttributeCond.Type type;
-            String expression = null;
-
-            if (values == null || values.isEmpty() || (values.size() == 1 && values.get(0) == null)) {
-                type = AttributeCond.Type.ISNULL;
-            } else {
-                type = AttributeCond.Type.EQ;
-                expression = values.size() > 1
-                        ? values.toString()
-                        : values.get(0).toString();
-            }
-
-            SearchCond nodeCond;
-            // users: just key or username can be selected
-            // groups: just key or name can be selected
-            // any objects: just key can be selected
-            if ("key".equalsIgnoreCase(schema)
-                    || "username".equalsIgnoreCase(schema) || "name".equalsIgnoreCase(schema)) {
-
-                AnyCond cond = new AnyCond();
-                cond.setSchema(schema);
-                cond.setType(type);
-                cond.setExpression(expression);
-
-                nodeCond = SearchCond.getLeafCond(cond);
-            } else {
-                AttributeCond cond = new AttributeCond();
-                cond.setSchema(schema);
-                cond.setType(type);
-                cond.setExpression(expression);
-
-                nodeCond = SearchCond.getLeafCond(cond);
-            }
-
-            searchCond = searchCond == null
-                    ? nodeCond
-                    : SearchCond.getAndCond(searchCond, nodeCond);
-        }
-
-        return searchCond;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/PushJobDelegate.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/PushJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/PushJobDelegate.java
deleted file mode 100644
index 4d44086..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/PushJobDelegate.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.provisioning.java.syncpull;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.SyncopeConstants;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.core.persistence.api.search.SearchCondConverter;
-import org.apache.syncope.core.spring.ApplicationContextProvider;
-import org.apache.syncope.core.persistence.api.dao.AnyDAO;
-import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
-import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
-import org.apache.syncope.core.persistence.api.entity.Any;
-import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.resource.Provision;
-import org.apache.syncope.core.persistence.api.entity.task.PushTask;
-import org.apache.syncope.core.provisioning.api.Connector;
-import org.apache.syncope.core.provisioning.api.syncpull.AnyObjectPushResultHandler;
-import org.apache.syncope.core.provisioning.api.syncpull.GroupPushResultHandler;
-import org.apache.syncope.core.provisioning.api.syncpull.ProvisioningProfile;
-import org.apache.syncope.core.provisioning.api.syncpull.PushActions;
-import org.apache.syncope.core.provisioning.api.syncpull.SyncopePushResultHandler;
-import org.apache.syncope.core.provisioning.api.syncpull.UserPushResultHandler;
-import org.quartz.JobExecutionException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-
-public class PushJobDelegate extends AbstractProvisioningJobDelegate<PushTask> {
-
-    private static final int PAGE_SIZE = 1000;
-
-    /**
-     * User DAO.
-     */
-    @Autowired
-    private UserDAO userDAO;
-
-    /**
-     * Search DAO.
-     */
-    @Autowired
-    private AnySearchDAO searchDAO;
-
-    /**
-     * Group DAO.
-     */
-    @Autowired
-    private GroupDAO groupDAO;
-
-    @Autowired
-    private AnyObjectDAO anyObjectDAO;
-
-    private AnyDAO<?> getAnyDAO(final AnyTypeKind anyTypeKind) {
-        AnyDAO<?> result;
-        switch (anyTypeKind) {
-            case USER:
-                result = userDAO;
-                break;
-
-            case GROUP:
-                result = groupDAO;
-                break;
-
-            case ANY_OBJECT:
-            default:
-                result = anyObjectDAO;
-        }
-
-        return result;
-    }
-
-    protected void handle(
-            final List<? extends Any<?>> anys,
-            final SyncopePushResultHandler handler,
-            final ExternalResource resource)
-            throws JobExecutionException {
-
-        for (Any<?> any : anys) {
-            try {
-                handler.handle(any.getKey());
-            } catch (Exception e) {
-                LOG.warn("Failure pushing '{}' on '{}'", any, resource, e);
-                throw new JobExecutionException("While pushing " + any + " on " + resource, e);
-            }
-        }
-    }
-
-    @Override
-    protected String doExecuteProvisioning(
-            final PushTask pushTask,
-            final Connector connector,
-            final boolean dryRun) throws JobExecutionException {
-
-        LOG.debug("Executing push on {}", pushTask.getResource());
-
-        List<PushActions> actions = new ArrayList<>();
-        for (String className : pushTask.getActionsClassNames()) {
-            try {
-                Class<?> actionsClass = Class.forName(className);
-
-                PushActions syncActions = (PushActions) ApplicationContextProvider.getBeanFactory().
-                        createBean(actionsClass, AbstractBeanDefinition.AUTOWIRE_BY_TYPE, true);
-                actions.add(syncActions);
-            } catch (Exception e) {
-                LOG.info("Class '{}' not found", className, e);
-            }
-        }
-
-        ProvisioningProfile<PushTask, PushActions> profile = new ProvisioningProfile<>(connector, pushTask);
-        profile.setDryRun(dryRun);
-        profile.setResAct(null);
-
-        AnyObjectPushResultHandler ahandler =
-                (AnyObjectPushResultHandler) ApplicationContextProvider.getBeanFactory().
-                createBean(AnyObjectPushResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
-        ahandler.setProfile(profile);
-
-        UserPushResultHandler uhandler =
-                (UserPushResultHandler) ApplicationContextProvider.getBeanFactory().
-                createBean(UserPushResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
-        uhandler.setProfile(profile);
-
-        GroupPushResultHandler ghandler =
-                (GroupPushResultHandler) ApplicationContextProvider.getBeanFactory().
-                createBean(GroupPushResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
-        ghandler.setProfile(profile);
-
-        if (!profile.isDryRun()) {
-            for (PushActions action : actions) {
-                action.beforeAll(profile);
-            }
-        }
-
-        for (Provision provision : pushTask.getResource().getProvisions()) {
-            if (provision.getMapping() != null) {
-                AnyDAO<?> anyDAO = getAnyDAO(provision.getAnyType().getKind());
-
-                SyncopePushResultHandler handler;
-                switch (provision.getAnyType().getKind()) {
-                    case USER:
-                        handler = uhandler;
-                        break;
-
-                    case GROUP:
-                        handler = ghandler;
-                        break;
-
-                    case ANY_OBJECT:
-                    default:
-                        handler = ahandler;
-                }
-
-                String filter = pushTask.getFilter(provision.getAnyType()) == null
-                        ? null
-                        : pushTask.getFilter(provision.getAnyType()).getFIQLCond();
-                if (StringUtils.isBlank(filter)) {
-                    handle(anyDAO.findAll(), handler, pushTask.getResource());
-                } else {
-                    int count = anyDAO.count(SyncopeConstants.FULL_ADMIN_REALMS);
-                    for (int page = 1; page <= (count / PAGE_SIZE) + 1; page++) {
-                        List<? extends Any<?>> anys = searchDAO.search(
-                                SyncopeConstants.FULL_ADMIN_REALMS,
-                                SearchCondConverter.convert(filter),
-                                page,
-                                PAGE_SIZE,
-                                Collections.<OrderByClause>emptyList(),
-                                provision.getAnyType().getKind());
-                        handle(anys, handler, pushTask.getResource());
-                    }
-                }
-            }
-        }
-
-        if (!profile.isDryRun()) {
-            for (PushActions action : actions) {
-                action.afterAll(profile);
-            }
-        }
-
-        String result = createReport(profile.getResults(), pushTask.getResource().getSyncTraceLevel(), dryRun);
-        LOG.debug("Sync result: {}", result);
-        return result;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/SyncJobDelegate.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/SyncJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/SyncJobDelegate.java
deleted file mode 100644
index 78f253a..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/SyncJobDelegate.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.provisioning.java.syncpull;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import org.apache.commons.collections4.IteratorUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.policy.SyncPolicySpec;
-import org.apache.syncope.core.provisioning.java.MappingManagerImpl;
-import org.apache.syncope.core.spring.ApplicationContextProvider;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
-import org.apache.syncope.core.persistence.api.dao.NotFoundException;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.dao.VirSchemaDAO;
-import org.apache.syncope.core.persistence.api.entity.VirSchema;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
-import org.apache.syncope.core.persistence.api.entity.resource.Provision;
-import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
-import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
-import org.apache.syncope.core.provisioning.api.Connector;
-import org.apache.syncope.core.provisioning.api.syncpull.AnyObjectSyncResultHandler;
-import org.apache.syncope.core.provisioning.api.syncpull.GroupSyncResultHandler;
-import org.apache.syncope.core.provisioning.api.syncpull.ProvisioningProfile;
-import org.apache.syncope.core.provisioning.api.syncpull.SyncActions;
-import org.apache.syncope.core.provisioning.api.syncpull.UserSyncResultHandler;
-import org.identityconnectors.framework.common.objects.SyncResultsHandler;
-import org.identityconnectors.framework.common.objects.SyncToken;
-import org.quartz.JobExecutionException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.support.AbstractBeanDefinition;
-import org.apache.syncope.core.provisioning.api.syncpull.ReconciliationFilterBuilder;
-
-public class SyncJobDelegate extends AbstractProvisioningJobDelegate<SyncTask> {
-
-    @Autowired
-    private UserDAO userDAO;
-
-    @Autowired
-    private GroupDAO groupDAO;
-
-    @Autowired
-    private VirSchemaDAO virSchemaDAO;
-
-    @Autowired
-    protected SyncUtils syncUtils;
-
-    protected void setGroupOwners(final GroupSyncResultHandler ghandler) {
-        for (Map.Entry<Long, String> entry : ghandler.getGroupOwnerMap().entrySet()) {
-            Group group = groupDAO.find(entry.getKey());
-            if (group == null) {
-                throw new NotFoundException("Group " + entry.getKey());
-            }
-
-            if (StringUtils.isBlank(entry.getValue())) {
-                group.setGroupOwner(null);
-                group.setUserOwner(null);
-            } else {
-                Long userKey = syncUtils.findMatchingAnyKey(
-                        anyTypeDAO.findUser(),
-                        entry.getValue(),
-                        ghandler.getProfile().getTask().getResource(),
-                        ghandler.getProfile().getConnector());
-
-                if (userKey == null) {
-                    Long groupKey = syncUtils.findMatchingAnyKey(
-                            anyTypeDAO.findGroup(),
-                            entry.getValue(),
-                            ghandler.getProfile().getTask().getResource(),
-                            ghandler.getProfile().getConnector());
-
-                    if (groupKey != null) {
-                        group.setGroupOwner(groupDAO.find(groupKey));
-                    }
-                } else {
-                    group.setUserOwner(userDAO.find(userKey));
-                }
-            }
-
-            groupDAO.save(group);
-        }
-    }
-
-    @Override
-    protected String doExecuteProvisioning(
-            final SyncTask syncTask,
-            final Connector connector,
-            final boolean dryRun) throws JobExecutionException {
-
-        LOG.debug("Executing sync on {}", syncTask.getResource());
-
-        List<SyncActions> actions = new ArrayList<>();
-        for (String className : syncTask.getActionsClassNames()) {
-            try {
-                Class<?> actionsClass = Class.forName(className);
-                SyncActions syncActions = (SyncActions) ApplicationContextProvider.getBeanFactory().
-                        createBean(actionsClass, AbstractBeanDefinition.AUTOWIRE_BY_TYPE, true);
-
-                actions.add(syncActions);
-            } catch (Exception e) {
-                LOG.warn("Class '{}' not found", className, e);
-            }
-        }
-
-        ProvisioningProfile<SyncTask, SyncActions> profile = new ProvisioningProfile<>(connector, syncTask);
-        profile.getActions().addAll(actions);
-        profile.setDryRun(dryRun);
-        profile.setResAct(getSyncPolicySpec(syncTask).getConflictResolutionAction());
-
-        // Prepare handler for SyncDelta objects (any objects)
-        AnyObjectSyncResultHandler ahandler = (AnyObjectSyncResultHandler) ApplicationContextProvider.getBeanFactory().
-                createBean(AnyObjectSyncResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
-        ahandler.setProfile(profile);
-
-        // Prepare handler for SyncDelta objects (users)
-        UserSyncResultHandler uhandler = (UserSyncResultHandler) ApplicationContextProvider.getBeanFactory().
-                createBean(UserSyncResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
-        uhandler.setProfile(profile);
-
-        // Prepare handler for SyncDelta objects (groups)
-        GroupSyncResultHandler ghandler = (GroupSyncResultHandler) ApplicationContextProvider.getBeanFactory().
-                createBean(GroupSyncResultHandlerImpl.class, AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
-        ghandler.setProfile(profile);
-
-        if (!profile.isDryRun()) {
-            for (SyncActions action : actions) {
-                action.beforeAll(profile);
-            }
-        }
-
-        for (Provision provision : syncTask.getResource().getProvisions()) {
-            if (provision.getMapping() != null) {
-                SyncResultsHandler handler;
-                switch (provision.getAnyType().getKind()) {
-                    case USER:
-                        handler = uhandler;
-                        break;
-
-                    case GROUP:
-                        handler = ghandler;
-                        break;
-
-                    case ANY_OBJECT:
-                    default:
-                        handler = ahandler;
-                }
-
-                try {
-                    Set<MappingItem> linkinMappingItems = new HashSet<>();
-                    for (VirSchema virSchema : virSchemaDAO.findByProvision(provision)) {
-                        linkinMappingItems.add(virSchema.asLinkingMappingItem());
-                    }
-                    Iterator<MappingItem> mapItems = IteratorUtils.chainedIterator(
-                            provision.getMapping().getItems().iterator(),
-                            linkinMappingItems.iterator());
-
-                    switch (syncTask.getSyncMode()) {
-                        case INCREMENTAL:
-                            SyncToken latestSyncToken = connector.getLatestSyncToken(provision.getObjectClass());
-                            connector.sync(provision.getObjectClass(),
-                                    provision.getSyncToken(),
-                                    handler,
-                                    MappingManagerImpl.buildOperationOptions(mapItems));
-                            if (!dryRun) {
-                                provision.setSyncToken(latestSyncToken);
-                                resourceDAO.save(provision.getResource());
-                            }
-                            break;
-
-                        case FILTERED_RECONCILIATION:
-                            ReconciliationFilterBuilder filterBuilder =
-                                    (ReconciliationFilterBuilder) ApplicationContextProvider.getBeanFactory().
-                                    createBean(Class.forName(syncTask.getReconciliationFilterBuilderClassName()),
-                                            AbstractBeanDefinition.AUTOWIRE_BY_NAME, false);
-                            connector.filteredReconciliation(provision.getObjectClass(),
-                                    filterBuilder,
-                                    handler,
-                                    MappingManagerImpl.buildOperationOptions(mapItems));
-                            break;
-
-                        case FULL_RECONCILIATION:
-                        default:
-                            connector.fullReconciliation(provision.getObjectClass(),
-                                    handler,
-                                    MappingManagerImpl.buildOperationOptions(mapItems));
-                            break;
-                    }
-                } catch (Throwable t) {
-                    throw new JobExecutionException("While syncing from connector", t);
-                }
-            }
-        }
-
-        try {
-            setGroupOwners(ghandler);
-        } catch (Exception e) {
-            LOG.error("While setting group owners", e);
-        }
-
-        if (!profile.isDryRun()) {
-            for (SyncActions action : actions) {
-                action.afterAll(profile);
-            }
-        }
-
-        String result = createReport(profile.getResults(), syncTask.getResource().getSyncTraceLevel(), dryRun);
-
-        LOG.debug("Sync result: {}", result);
-
-        return result;
-    }
-
-    private SyncPolicySpec getSyncPolicySpec(final ProvisioningTask task) {
-        SyncPolicySpec syncPolicySpec;
-
-        if (task instanceof SyncTask) {
-            syncPolicySpec = task.getResource().getSyncPolicy() == null
-                    ? null
-                    : task.getResource().getSyncPolicy().getSpecification();
-        } else {
-            syncPolicySpec = null;
-        }
-
-        // step required because the call <policy>.getSpecification() could return a null value
-        return syncPolicySpec == null ? new SyncPolicySpec() : syncPolicySpec;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/SyncUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/SyncUtils.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/SyncUtils.java
deleted file mode 100644
index 9038b42..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/SyncUtils.java
+++ /dev/null
@@ -1,317 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.provisioning.java.syncpull;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.policy.SyncPolicySpec;
-import org.apache.syncope.core.provisioning.java.MappingManagerImpl;
-import org.apache.syncope.core.provisioning.api.serialization.POJOHelper;
-import org.apache.syncope.core.persistence.api.attrvalue.validation.ParsingValidationException;
-import org.apache.syncope.core.persistence.api.dao.AnyDAO;
-import org.apache.syncope.core.persistence.api.dao.AnyObjectDAO;
-import org.apache.syncope.core.persistence.api.dao.AnySearchDAO;
-import org.apache.syncope.core.persistence.api.dao.PlainSchemaDAO;
-import org.apache.syncope.core.persistence.api.dao.GroupDAO;
-import org.apache.syncope.core.persistence.api.dao.UserDAO;
-import org.apache.syncope.core.persistence.api.entity.Any;
-import org.apache.syncope.core.persistence.api.entity.AnyType;
-import org.apache.syncope.core.persistence.api.entity.AnyUtils;
-import org.apache.syncope.core.persistence.api.entity.AnyUtilsFactory;
-import org.apache.syncope.core.persistence.api.entity.PlainAttrValue;
-import org.apache.syncope.core.persistence.api.entity.PlainSchema;
-import org.apache.syncope.core.persistence.api.entity.group.Group;
-import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
-import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
-import org.apache.syncope.core.persistence.api.entity.resource.Provision;
-import org.apache.syncope.core.persistence.api.entity.task.ProvisioningTask;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.provisioning.api.Connector;
-import org.apache.syncope.core.provisioning.api.data.MappingItemTransformer;
-import org.apache.syncope.core.provisioning.api.syncpull.SyncCorrelationRule;
-import org.identityconnectors.framework.common.objects.Attribute;
-import org.identityconnectors.framework.common.objects.AttributeUtil;
-import org.identityconnectors.framework.common.objects.ConnectorObject;
-import org.identityconnectors.framework.common.objects.Name;
-import org.identityconnectors.framework.common.objects.OperationalAttributes;
-import org.identityconnectors.framework.common.objects.ResultsHandler;
-import org.identityconnectors.framework.common.objects.filter.EqualsFilter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.annotation.Transactional;
-
-@Transactional(readOnly = true)
-@Component
-public class SyncUtils {
-
-    private static final Logger LOG = LoggerFactory.getLogger(SyncUtils.class);
-
-    /**
-     * Schema DAO.
-     */
-    @Autowired
-    private PlainSchemaDAO plainSchemaDAO;
-
-    /**
-     * Any Object DAO.
-     */
-    @Autowired
-    private AnyObjectDAO anyObjectDAO;
-
-    /**
-     * User DAO.
-     */
-    @Autowired
-    private UserDAO userDAO;
-
-    /**
-     * Group DAO.
-     */
-    @Autowired
-    private GroupDAO groupDAO;
-
-    /**
-     * Search DAO.
-     */
-    @Autowired
-    private AnySearchDAO searchDAO;
-
-    @Autowired
-    private AnyUtilsFactory anyUtilsFactory;
-
-    public Long findMatchingAnyKey(
-            final AnyType anyType,
-            final String name,
-            final ExternalResource resource,
-            final Connector connector) {
-
-        Provision provision = resource.getProvision(anyType);
-        if (provision == null) {
-            return null;
-        }
-
-        Long result = null;
-
-        AnyUtils anyUtils = anyUtilsFactory.getInstance(anyType.getKind());
-
-        final List<ConnectorObject> found = new ArrayList<>();
-        connector.search(provision.getObjectClass(),
-                new EqualsFilter(new Name(name)),
-                new ResultsHandler() {
-
-            @Override
-            public boolean handle(final ConnectorObject obj) {
-                return found.add(obj);
-            }
-        },
-                MappingManagerImpl.buildOperationOptions(MappingManagerImpl.getSyncMappingItems(provision).iterator()));
-
-        if (found.isEmpty()) {
-            LOG.debug("No {} found on {} with __NAME__ {}", provision.getObjectClass(), resource, name);
-        } else {
-            if (found.size() > 1) {
-                LOG.warn("More than one {} found on {} with __NAME__ {} - taking first only",
-                        provision.getObjectClass(), resource, name);
-            }
-
-            ConnectorObject connObj = found.iterator().next();
-            try {
-                List<Long> anyKeys = findExisting(connObj.getUid().getUidValue(), connObj, provision, anyUtils);
-                if (anyKeys.isEmpty()) {
-                    LOG.debug("No matching {} found for {}, aborting", anyUtils.getAnyTypeKind(), connObj);
-                } else {
-                    if (anyKeys.size() > 1) {
-                        LOG.warn("More than one {} found {} - taking first only", anyUtils.getAnyTypeKind(), anyKeys);
-                    }
-
-                    result = anyKeys.iterator().next();
-                }
-            } catch (IllegalArgumentException e) {
-                LOG.warn(e.getMessage());
-            }
-        }
-
-        return result;
-    }
-
-    private AnyDAO<?> getAnyDAO(final MappingItem connObjectKeyItem) {
-        return AnyTypeKind.USER == connObjectKeyItem.getIntMappingType().getAnyTypeKind()
-                ? userDAO
-                : AnyTypeKind.ANY_OBJECT == connObjectKeyItem.getIntMappingType().getAnyTypeKind()
-                        ? anyObjectDAO
-                        : groupDAO;
-    }
-
-    private List<Long> findByConnObjectKeyItem(
-            final String uid, final Provision provision, final AnyUtils anyUtils) {
-
-        List<Long> result = new ArrayList<>();
-
-        MappingItem connObjectKeyItem = MappingManagerImpl.getConnObjectKeyItem(provision);
-
-        String transfUid = uid;
-        for (MappingItemTransformer transformer : MappingManagerImpl.getMappingItemTransformers(connObjectKeyItem)) {
-            List<Object> output = transformer.beforeSync(Collections.<Object>singletonList(transfUid));
-            if (output != null && !output.isEmpty()) {
-                transfUid = output.get(0).toString();
-            }
-        }
-
-        switch (connObjectKeyItem.getIntMappingType()) {
-            case UserPlainSchema:
-            case GroupPlainSchema:
-            case AnyObjectPlainSchema:
-                PlainAttrValue value = anyUtils.newPlainAttrValue();
-
-                PlainSchema schema = plainSchemaDAO.find(connObjectKeyItem.getIntAttrName());
-                if (schema == null) {
-                    value.setStringValue(transfUid);
-                } else {
-                    try {
-                        value.parseValue(schema, transfUid);
-                    } catch (ParsingValidationException e) {
-                        LOG.error("While parsing provided __UID__ {}", transfUid, e);
-                        value.setStringValue(transfUid);
-                    }
-                }
-
-                List<? extends Any<?>> anys =
-                        getAnyDAO(connObjectKeyItem).findByAttrValue(connObjectKeyItem.getIntAttrName(), value);
-                for (Any<?> any : anys) {
-                    result.add(any.getKey());
-                }
-                break;
-
-            case UserDerivedSchema:
-            case GroupDerivedSchema:
-            case AnyObjectDerivedSchema:
-                anys = getAnyDAO(connObjectKeyItem).findByDerAttrValue(connObjectKeyItem.getIntAttrName(), transfUid);
-                for (Any<?> any : anys) {
-                    result.add(any.getKey());
-                }
-                break;
-
-            case UserKey:
-            case GroupKey:
-            case AnyObjectKey:
-                Any<?> any = getAnyDAO(connObjectKeyItem).find(Long.parseLong(transfUid));
-                if (any != null) {
-                    result.add(any.getKey());
-                }
-                break;
-
-            case Username:
-                User user = userDAO.find(transfUid);
-                if (user != null) {
-                    result.add(user.getKey());
-                }
-                break;
-
-            case GroupName:
-                Group group = groupDAO.find(transfUid);
-                if (group != null) {
-                    result.add(group.getKey());
-                }
-                break;
-
-            default:
-                LOG.error("Invalid connObjectKey type '{}'", connObjectKeyItem.getIntMappingType());
-        }
-
-        return result;
-    }
-
-    private List<Long> findByCorrelationRule(
-            final ConnectorObject connObj, final SyncCorrelationRule rule, final AnyTypeKind type) {
-
-        List<Long> result = new ArrayList<>();
-        for (Any<?> any : searchDAO.search(rule.getSearchCond(connObj), type)) {
-            result.add(any.getKey());
-        }
-
-        return result;
-    }
-
-    private SyncCorrelationRule getCorrelationRule(final Provision provision, final SyncPolicySpec policySpec) {
-        SyncCorrelationRule result = null;
-
-        String syncCorrelationRule = policySpec.getCorrelationRules().get(provision.getAnyType().getKey());
-        if (StringUtils.isNotBlank(syncCorrelationRule)) {
-            if (syncCorrelationRule.charAt(0) == '[') {
-                result = new PlainAttrsSyncCorrelationRule(
-                        POJOHelper.deserialize(syncCorrelationRule, String[].class), provision);
-            } else {
-                try {
-                    result = (SyncCorrelationRule) Class.forName(syncCorrelationRule).newInstance();
-                } catch (Exception e) {
-                    LOG.error("Failure instantiating correlation rule class '{}'", syncCorrelationRule, e);
-                }
-            }
-        }
-
-        return result;
-    }
-
-    /**
-     * Find any objects based on mapped uid value (or previous uid value, if updated).
-     *
-     * @param uid for finding by connObjectKey
-     * @param connObj for finding by attribute value
-     * @param provision external resource
-     * @param anyUtils any util
-     * @return list of matching users / groups
-     */
-    public List<Long> findExisting(
-            final String uid,
-            final ConnectorObject connObj,
-            final Provision provision,
-            final AnyUtils anyUtils) {
-
-        SyncPolicySpec syncPolicySpec = null;
-        if (provision.getResource().getSyncPolicy() != null) {
-            syncPolicySpec = provision.getResource().getSyncPolicy().getSpecification();
-        }
-
-        SyncCorrelationRule syncRule = null;
-        if (syncPolicySpec != null) {
-            syncRule = getCorrelationRule(provision, syncPolicySpec);
-        }
-
-        return syncRule == null
-                ? findByConnObjectKeyItem(uid, provision, anyUtils)
-                : findByCorrelationRule(connObj, syncRule, anyUtils.getAnyTypeKind());
-    }
-
-    public Boolean readEnabled(final ConnectorObject connectorObject, final ProvisioningTask task) {
-        Boolean enabled = null;
-        if (task.isSyncStatus()) {
-            Attribute status = AttributeUtil.find(OperationalAttributes.ENABLE_NAME, connectorObject.getAttributes());
-            if (status != null && status.getValue() != null && !status.getValue().isEmpty()) {
-                enabled = (Boolean) status.getValue().get(0);
-            }
-        }
-
-        return enabled;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/UserPushResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/UserPushResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/UserPushResultHandlerImpl.java
deleted file mode 100644
index a589416..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/UserPushResultHandlerImpl.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.provisioning.java.syncpull;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.syncope.common.lib.patch.AnyPatch;
-import org.apache.syncope.common.lib.patch.UserPatch;
-import org.apache.syncope.common.lib.to.AnyTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.common.lib.types.PropagationByResource;
-import org.apache.syncope.common.lib.types.ResourceOperation;
-import org.apache.syncope.core.persistence.api.entity.Any;
-import org.apache.syncope.core.persistence.api.entity.AnyUtils;
-import org.apache.syncope.core.persistence.api.entity.user.User;
-import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.syncpull.UserPushResultHandler;
-
-public class UserPushResultHandlerImpl extends AbstractPushResultHandler implements UserPushResultHandler {
-
-    @Override
-    protected AnyUtils getAnyUtils() {
-        return anyUtilsFactory.getInstance(AnyTypeKind.USER);
-    }
-
-    @Override
-    protected void provision(final Any<?> any, final Boolean enabled) {
-        AnyTO before = getAnyTO(any.getKey());
-
-        List<String> noPropResources = new ArrayList<>(before.getResources());
-        noPropResources.remove(profile.getTask().getResource().getKey());
-
-        PropagationByResource propByRes = new PropagationByResource();
-        propByRes.add(ResourceOperation.CREATE, profile.getTask().getResource().getKey());
-
-        taskExecutor.execute(propagationManager.getUserCreateTasks(
-                before.getKey(),
-                null,
-                enabled,
-                propByRes,
-                before.getVirAttrs(),
-                noPropResources));
-    }
-
-    @Override
-    protected String getName(final Any<?> any) {
-        return User.class.cast(any).getUsername();
-    }
-
-    @Override
-    protected Any<?> getAny(final long key) {
-        try {
-            return userDAO.authFind(key);
-        } catch (Exception e) {
-            LOG.warn("Error retrieving user {}", key, e);
-            return null;
-        }
-    }
-
-    @Override
-    protected AnyTO getAnyTO(final long key) {
-        return userDataBinder.getUserTO(key);
-    }
-
-    @Override
-    protected AnyPatch newPatch(final long key) {
-        UserPatch patch = new UserPatch();
-        patch.setKey(key);
-        return patch;
-    }
-
-    @Override
-    protected WorkflowResult<Long> update(final AnyPatch patch) {
-        WorkflowResult<Pair<UserPatch, Boolean>> update = uwfAdapter.update((UserPatch) patch);
-        return new WorkflowResult<>(
-                update.getResult().getLeft().getKey(), update.getPropByRes(), update.getPerformedTasks());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/UserSyncResultHandlerImpl.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/UserSyncResultHandlerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/UserSyncResultHandlerImpl.java
deleted file mode 100644
index 92dd5eb..0000000
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/syncpull/UserSyncResultHandlerImpl.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.syncope.core.provisioning.java.syncpull;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import org.apache.commons.lang3.tuple.Pair;
-import org.apache.syncope.common.lib.patch.AnyPatch;
-import org.apache.syncope.common.lib.patch.UserPatch;
-import org.apache.syncope.common.lib.to.AnyTO;
-import org.apache.syncope.common.lib.to.PropagationStatus;
-import org.apache.syncope.common.lib.to.UserTO;
-import org.apache.syncope.common.lib.types.AnyTypeKind;
-import org.apache.syncope.core.persistence.api.entity.Any;
-import org.apache.syncope.core.persistence.api.entity.AnyUtils;
-import org.apache.syncope.core.provisioning.api.ProvisioningManager;
-import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.syncpull.ProvisioningReport;
-import org.apache.syncope.core.provisioning.api.syncpull.UserSyncResultHandler;
-import org.identityconnectors.framework.common.objects.SyncDelta;
-
-public class UserSyncResultHandlerImpl extends AbstractSyncResultHandler implements UserSyncResultHandler {
-
-    @Override
-    protected AnyUtils getAnyUtils() {
-        return anyUtilsFactory.getInstance(AnyTypeKind.USER);
-    }
-
-    @Override
-    protected String getName(final AnyTO anyTO) {
-        return UserTO.class.cast(anyTO).getUsername();
-    }
-
-    @Override
-    protected ProvisioningManager<?, ?> getProvisioningManager() {
-        return userProvisioningManager;
-    }
-
-    @Override
-    protected Any<?> getAny(final long key) {
-        try {
-            return userDAO.authFind(key);
-        } catch (Exception e) {
-            LOG.warn("Error retrieving user {}", key, e);
-            return null;
-        }
-    }
-
-    @Override
-    protected AnyTO getAnyTO(final long key) {
-        return userDataBinder.getUserTO(key);
-    }
-
-    @Override
-    protected AnyPatch newPatch(final long key) {
-        UserPatch patch = new UserPatch();
-        patch.setKey(key);
-        return patch;
-    }
-
-    @Override
-    protected WorkflowResult<Long> update(final AnyPatch patch) {
-        WorkflowResult<Pair<UserPatch, Boolean>> update = uwfAdapter.update((UserPatch) patch);
-        return new WorkflowResult<>(
-                update.getResult().getLeft().getKey(), update.getPropByRes(), update.getPerformedTasks());
-    }
-
-    @Override
-    protected AnyTO doCreate(final AnyTO anyTO, final SyncDelta delta, final ProvisioningReport result) {
-        UserTO userTO = UserTO.class.cast(anyTO);
-
-        Boolean enabled = syncUtilities.readEnabled(delta.getObject(), profile.getTask());
-        Map.Entry<Long, List<PropagationStatus>> created =
-                userProvisioningManager.create(userTO, true, true, enabled,
-                        Collections.singleton(profile.getTask().getResource().getKey()), true);
-
-        result.setKey(created.getKey());
-        result.setName(getName(anyTO));
-
-        return getAnyTO(created.getKey());
-    }
-
-    @Override
-    protected AnyTO doUpdate(
-            final AnyTO before,
-            final AnyPatch anyPatch,
-            final SyncDelta delta,
-            final ProvisioningReport result) {
-
-        UserPatch userPatch = UserPatch.class.cast(anyPatch);
-        Boolean enabled = syncUtilities.readEnabled(delta.getObject(), profile.getTask());
-
-        Map.Entry<Long, List<PropagationStatus>> updated = userProvisioningManager.update(
-                userPatch,
-                result,
-                enabled,
-                Collections.singleton(profile.getTask().getResource().getKey()),
-                true);
-
-        return getAnyTO(updated.getKey());
-    }
-
-    @Override
-    protected void doDelete(final AnyTypeKind kind, final Long key) {
-        try {
-            userProvisioningManager.delete(
-                    key, Collections.<String>singleton(profile.getTask().getResource().getKey()), true);
-        } catch (Exception e) {
-            // A propagation failure doesn't imply a synchronization failure.
-            // The propagation exception status will be reported into the propagation task execution.
-            LOG.error("Could not propagate user " + key, e);
-        }
-
-        uwfAdapter.delete(key);
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java
----------------------------------------------------------------------
diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java
index 703bc49..e5ae650 100644
--- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java
+++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/utils/ConnObjectUtils.java
@@ -36,7 +36,6 @@ import org.apache.syncope.core.persistence.api.dao.UserDAO;
 import org.apache.syncope.core.persistence.api.entity.AnyUtils;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
-import org.apache.syncope.core.persistence.api.entity.task.SyncTask;
 import org.apache.syncope.core.persistence.api.entity.user.User;
 import org.apache.syncope.core.spring.security.Encryptor;
 import org.apache.syncope.core.spring.security.PasswordGenerator;
@@ -44,6 +43,7 @@ import org.apache.syncope.core.spring.security.SecureRandomUtils;
 import org.apache.syncope.core.persistence.api.dao.RealmDAO;
 import org.apache.syncope.core.persistence.api.entity.Realm;
 import org.apache.syncope.core.persistence.api.entity.resource.Provision;
+import org.apache.syncope.core.persistence.api.entity.task.PullTask;
 import org.apache.syncope.core.provisioning.api.MappingManager;
 import org.apache.syncope.core.provisioning.api.utils.policy.InvalidPasswordRuleConf;
 import org.identityconnectors.common.Base64;
@@ -120,7 +120,7 @@ public class ConnObjectUtils {
      * Build a UserTO / GroupTO / AnyObjectTO out of connector object attributes and schema mapping.
      *
      * @param obj connector object
-     * @param syncTask synchronization task
+     * @param pullTask pull task
      * @param provision provision information
      * @param anyUtils utils
      * @param <T> any object
@@ -128,9 +128,9 @@ public class ConnObjectUtils {
      */
     @Transactional(readOnly = true)
     public <T extends AnyTO> T getAnyTO(
-            final ConnectorObject obj, final SyncTask syncTask, final Provision provision, final AnyUtils anyUtils) {
+            final ConnectorObject obj, final PullTask pullTask, final Provision provision, final AnyUtils anyUtils) {
 
-        T anyTO = getAnyTOFromConnObject(obj, syncTask, provision, anyUtils);
+        T anyTO = getAnyTOFromConnObject(obj, pullTask, provision, anyUtils);
 
         // (for users) if password was not set above, generate
         if (anyTO instanceof UserTO && StringUtils.isBlank(((UserTO) anyTO).getPassword())) {
@@ -174,7 +174,7 @@ public class ConnObjectUtils {
      * @param key any object to be updated
      * @param obj connector object
      * @param original any object to get diff from
-     * @param syncTask synchronization task
+     * @param pullTask pull task
      * @param provision provision information
      * @param anyUtils utils
      * @param <T> any object
@@ -183,9 +183,9 @@ public class ConnObjectUtils {
     @SuppressWarnings("unchecked")
     @Transactional(readOnly = true)
     public <T extends AnyPatch> T getAnyPatch(final Long key, final ConnectorObject obj,
-            final AnyTO original, final SyncTask syncTask, final Provision provision, final AnyUtils anyUtils) {
+            final AnyTO original, final PullTask pullTask, final Provision provision, final AnyUtils anyUtils) {
 
-        AnyTO updated = getAnyTOFromConnObject(obj, syncTask, provision, anyUtils);
+        AnyTO updated = getAnyTOFromConnObject(obj, pullTask, provision, anyUtils);
         updated.setKey(key);
 
         if (null != anyUtils.getAnyTypeKind()) {
@@ -215,19 +215,19 @@ public class ConnObjectUtils {
     }
 
     private <T extends AnyTO> T getAnyTOFromConnObject(final ConnectorObject obj,
-            final SyncTask syncTask, final Provision provision, final AnyUtils anyUtils) {
+            final PullTask pullTask, final Provision provision, final AnyUtils anyUtils) {
 
         T anyTO = anyUtils.newAnyTO();
         anyTO.setType(provision.getAnyType().getKey());
 
         // 1. fill with data from connector object
-        anyTO.setRealm(syncTask.getDestinatioRealm().getFullPath());
-        for (MappingItem item : MappingManagerImpl.getSyncMappingItems(provision)) {
+        anyTO.setRealm(pullTask.getDestinatioRealm().getFullPath());
+        for (MappingItem item : MappingManagerImpl.getPullMappingItems(provision)) {
             mappingManager.setIntValues(item, obj.getAttributeByName(item.getExtAttrName()), anyTO, anyUtils);
         }
 
         // 2. add data from defined template (if any)
-        templateUtils.apply(anyTO, syncTask.getTemplate(provision.getAnyType()));
+        templateUtils.apply(anyTO, pullTask.getTemplate(provision.getAnyType()));
 
         return anyTO;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
index 5e81978..2e7be27 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/PolicyServiceImpl.java
@@ -24,7 +24,7 @@ import javax.ws.rs.core.Response;
 import org.apache.syncope.common.lib.policy.AbstractPolicyTO;
 import org.apache.syncope.common.lib.policy.AccountPolicyTO;
 import org.apache.syncope.common.lib.policy.PasswordPolicyTO;
-import org.apache.syncope.common.lib.policy.SyncPolicyTO;
+import org.apache.syncope.common.lib.policy.PullPolicyTO;
 import org.apache.syncope.common.lib.types.PolicyType;
 import org.apache.syncope.common.rest.api.RESTHeaders;
 import org.apache.syncope.common.rest.api.service.PolicyService;
@@ -73,8 +73,8 @@ public class PolicyServiceImpl extends AbstractServiceImpl implements PolicyServ
                 logic.update((PasswordPolicyTO) policyTO);
                 break;
 
-            case SYNC:
-                logic.update((SyncPolicyTO) policyTO);
+            case PULL:
+                logic.update((PullPolicyTO) policyTO);
                 break;
 
             default:

http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
index 54d256f..b6a1cdf 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/TaskServiceImpl.java
@@ -29,7 +29,7 @@ import org.apache.syncope.common.lib.to.JobTO;
 import org.apache.syncope.common.lib.to.PagedResult;
 import org.apache.syncope.common.lib.to.PushTaskTO;
 import org.apache.syncope.common.lib.to.SchedTaskTO;
-import org.apache.syncope.common.lib.to.SyncTaskTO;
+import org.apache.syncope.common.lib.to.PullTaskTO;
 import org.apache.syncope.common.lib.to.ExecTO;
 import org.apache.syncope.common.lib.types.JobAction;
 import org.apache.syncope.common.rest.api.RESTHeaders;
@@ -51,7 +51,7 @@ public class TaskServiceImpl extends AbstractServiceImpl implements TaskService
     @Override
     public Response create(final SchedTaskTO taskTO) {
         SchedTaskTO createdTask;
-        if (taskTO instanceof SyncTaskTO || taskTO instanceof PushTaskTO || taskTO instanceof SchedTaskTO) {
+        if (taskTO instanceof PullTaskTO || taskTO instanceof PushTaskTO || taskTO instanceof SchedTaskTO) {
             createdTask = logic.createSchedTask(taskTO);
         } else {
             throw new BadRequestException();

http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
index 7cdf9d1..0217f17 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelGroupProvisioningManager.java
@@ -70,14 +70,14 @@ public class CamelGroupProvisioningManager
             final Set<String> excludedResources,
             final boolean nullPriorityAsync) {
 
-        PollingConsumer pollingConsumer = getConsumer("direct:createGroupInSyncPort");
+        PollingConsumer pollingConsumer = getConsumer("direct:createGroupInPullPort");
 
         Map<String, Object> props = new HashMap<>();
         props.put("groupOwnerMap", groupOwnerMap);
         props.put("excludedResources", excludedResources);
         props.put("nullPriorityAsync", nullPriorityAsync);
 
-        sendMessage("direct:createGroupInSync", groupTO, props);
+        sendMessage("direct:createGroupInPull", groupTO, props);
 
         Exchange exchange = pollingConsumer.receive();
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
index 2c1fe6d..9a9b1b0 100644
--- a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/CamelUserProvisioningManager.java
@@ -36,7 +36,7 @@ import org.apache.syncope.common.lib.to.UserTO;
 import org.apache.syncope.common.lib.types.PropagationByResource;
 import org.apache.syncope.core.provisioning.api.UserProvisioningManager;
 import org.apache.syncope.core.provisioning.api.WorkflowResult;
-import org.apache.syncope.core.provisioning.api.syncpull.ProvisioningReport;
+import org.apache.syncope.core.provisioning.api.pushpull.ProvisioningReport;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -326,7 +326,7 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
             final Set<String> excludedResources,
             final boolean nullPriorityAsync) {
 
-        PollingConsumer pollingConsumer = getConsumer("direct:updateInSyncPort");
+        PollingConsumer pollingConsumer = getConsumer("direct:updateInPullPort");
 
         Map<String, Object> props = new HashMap<>();
         props.put("key", userPatch.getKey());
@@ -335,22 +335,22 @@ public class CamelUserProvisioningManager extends AbstractCamelProvisioningManag
         props.put("excludedResources", excludedResources);
         props.put("nullPriorityAsync", nullPriorityAsync);
 
-        sendMessage("direct:updateUserInSync", userPatch, props);
+        sendMessage("direct:updateUserInPull", userPatch, props);
 
         Exchange exchange = pollingConsumer.receive();
 
         Exception ex = (Exception) exchange.getProperty(Exchange.EXCEPTION_CAUGHT);
         if (ex != null) {
-            LOG.error("Update of user {} failed, trying to sync its status anyway (if configured)",
+            LOG.error("Update of user {} failed, trying to pull its status anyway (if configured)",
                     nullPriorityAsync, ex);
 
             result.setStatus(ProvisioningReport.Status.FAILURE);
-            result.setMessage("Update failed, trying to sync status anyway (if configured)\n" + ex.getMessage());
+            result.setMessage("Update failed, trying to pull status anyway (if configured)\n" + ex.getMessage());
 
             WorkflowResult<Pair<UserPatch, Boolean>> updated = new WorkflowResult<Pair<UserPatch, Boolean>>(
                     new ImmutablePair<>(userPatch, false), new PropagationByResource(),
                     new HashSet<String>());
-            sendMessage("direct:userInSync", updated, props);
+            sendMessage("direct:userInPull", updated, props);
             exchange = pollingConsumer.receive();
         }
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/61a7fdd3/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInPullProcessor.java
----------------------------------------------------------------------
diff --git a/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInPullProcessor.java b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInPullProcessor.java
new file mode 100644
index 0000000..791b4b3
--- /dev/null
+++ b/ext/camel/provisioning-camel/src/main/java/org/apache/syncope/core/provisioning/camel/processor/GroupCreateInPullProcessor.java
@@ -0,0 +1,76 @@
+package org.apache.syncope.core.provisioning.camel.processor;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.camel.Exchange;
+import org.apache.camel.Processor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.ImmutablePair;
+import org.apache.syncope.common.lib.to.AttrTO;
+import org.apache.syncope.common.lib.to.GroupTO;
+import org.apache.syncope.common.lib.types.AnyTypeKind;
+import org.apache.syncope.core.spring.ApplicationContextProvider;
+import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
+import org.apache.syncope.core.provisioning.api.WorkflowResult;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationManager;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationReporter;
+import org.apache.syncope.core.provisioning.api.propagation.PropagationTaskExecutor;
+import org.springframework.stereotype.Component;
+
+@Component
+public class GroupCreateInPullProcessor implements Processor {
+
+    @Autowired
+    protected PropagationManager propagationManager;
+
+    @Autowired
+    protected PropagationTaskExecutor taskExecutor;
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public void process(final Exchange exchange) {
+        WorkflowResult<Long> created = (WorkflowResult) exchange.getIn().getBody();
+
+        GroupTO groupTO = exchange.getProperty("any", GroupTO.class);
+        Map<Long, String> groupOwnerMap = exchange.getProperty("groupOwnerMap", Map.class);
+        Set<String> excludedResources = exchange.getProperty("excludedResources", Set.class);
+        Boolean nullPriorityAsync = exchange.getProperty("nullPriorityAsync", Boolean.class);
+
+        AttrTO groupOwner = groupTO.getPlainAttrMap().get(StringUtils.EMPTY);
+        if (groupOwner != null) {
+            groupOwnerMap.put(created.getResult(), groupOwner.getValues().iterator().next());
+        }
+
+        List<PropagationTask> tasks = propagationManager.getCreateTasks(
+                AnyTypeKind.GROUP,
+                created.getResult(),
+                created.getPropByRes(),
+                groupTO.getVirAttrs(),
+                excludedResources);
+        PropagationReporter propagationReporter =
+                ApplicationContextProvider.getBeanFactory().getBean(PropagationReporter.class);
+        taskExecutor.execute(tasks, propagationReporter, nullPriorityAsync);
+
+        exchange.getOut().setBody(new ImmutablePair<>(created.getResult(), null));
+    }
+}


Mime
View raw message