You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2018/06/15 15:34:28 UTC

[3/4] syncope git commit: [SYNCOPE-470] Implementation and documentation provided

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/client/console/src/main/resources/org/apache/syncope/client/console/policies/PullPolicyModalPanel_ja.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/policies/PullPolicyModalPanel_ja.properties b/client/console/src/main/resources/org/apache/syncope/client/console/policies/PullPolicyModalPanel_ja.properties
deleted file mode 100644
index dd86bc4..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/policies/PullPolicyModalPanel_ja.properties
+++ /dev/null
@@ -1,19 +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.
-rule=\u30eb\u30fc\u30eb
-anyType=\u9069\u7528...
-correlationRules=\u76f8\u95a2\u30eb\u30fc\u30eb

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/client/console/src/main/resources/org/apache/syncope/client/console/policies/PullPolicyModalPanel_pt_BR.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/policies/PullPolicyModalPanel_pt_BR.properties b/client/console/src/main/resources/org/apache/syncope/client/console/policies/PullPolicyModalPanel_pt_BR.properties
deleted file mode 100644
index e8338c2..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/policies/PullPolicyModalPanel_pt_BR.properties
+++ /dev/null
@@ -1,20 +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.
-#
-rule=Rule
-anyType=Applies to
-correlationRules=Correlation Rules

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/client/console/src/main/resources/org/apache/syncope/client/console/policies/PullPolicyModalPanel_ru.properties
----------------------------------------------------------------------
diff --git a/client/console/src/main/resources/org/apache/syncope/client/console/policies/PullPolicyModalPanel_ru.properties b/client/console/src/main/resources/org/apache/syncope/client/console/policies/PullPolicyModalPanel_ru.properties
deleted file mode 100644
index 39701d7..0000000
--- a/client/console/src/main/resources/org/apache/syncope/client/console/policies/PullPolicyModalPanel_ru.properties
+++ /dev/null
@@ -1,20 +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.
-#
-rule=Rule
-anyType=\u041e\u0431\u044a\u0435\u043a\u0442 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0438
-correlationRules=\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043a\u043e\u0440\u0440\u0435\u043b\u044f\u0446\u0438\u0438

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/common/lib/src/main/java/org/apache/syncope/common/lib/LogOutputStream.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/LogOutputStream.java b/common/lib/src/main/java/org/apache/syncope/common/lib/LogOutputStream.java
index 3d5069a..213d170 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/LogOutputStream.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/LogOutputStream.java
@@ -25,7 +25,7 @@ import org.slf4j.Logger;
 
 /**
  * Delegates output stream writing onto an SLF4J logger.
- * Inspired by {@code}org.apache.commons.exec.LogOutputStream{@code}
+ * Inspired by {@code org.apache.commons.exec.LogOutputStream}
  */
 public class LogOutputStream extends OutputStream {
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractCorrelationRuleConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractCorrelationRuleConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractCorrelationRuleConf.java
new file mode 100644
index 0000000..0f7d4d6
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractCorrelationRuleConf.java
@@ -0,0 +1,52 @@
+/*
+ * 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.common.lib.policy;
+
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlType;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.syncope.common.lib.AbstractBaseBean;
+
+@XmlType
+@XmlSeeAlso({ DefaultPullCorrelationRuleConf.class, DefaultPushCorrelationRuleConf.class })
+public abstract class AbstractCorrelationRuleConf extends AbstractBaseBean implements RuleConf {
+
+    private static final long serialVersionUID = -4080475005967851092L;
+
+    private String name;
+
+    public AbstractCorrelationRuleConf() {
+        this(StringUtils.EMPTY);
+        setName(getClass().getName());
+    }
+
+    public AbstractCorrelationRuleConf(final String name) {
+        super();
+        this.name = name;
+    }
+
+    @Override
+    public final String getName() {
+        return name;
+    }
+
+    public final void setName(final String name) {
+        this.name = name;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractPullCorrelationRuleConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractPullCorrelationRuleConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractPullCorrelationRuleConf.java
deleted file mode 100644
index c545b9d..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/AbstractPullCorrelationRuleConf.java
+++ /dev/null
@@ -1,52 +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.common.lib.policy;
-
-import javax.xml.bind.annotation.XmlSeeAlso;
-import javax.xml.bind.annotation.XmlType;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.syncope.common.lib.AbstractBaseBean;
-
-@XmlType
-@XmlSeeAlso({ DefaultPullCorrelationRuleConf.class })
-public abstract class AbstractPullCorrelationRuleConf extends AbstractBaseBean implements PullCorrelationRuleConf {
-
-    private static final long serialVersionUID = -4080475005967851092L;
-
-    private String name;
-
-    public AbstractPullCorrelationRuleConf() {
-        this(StringUtils.EMPTY);
-        setName(getClass().getName());
-    }
-
-    public AbstractPullCorrelationRuleConf(final String name) {
-        super();
-        this.name = name;
-    }
-
-    @Override
-    public final String getName() {
-        return name;
-    }
-
-    public final void setName(final String name) {
-        this.name = name;
-    }
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPullCorrelationRuleConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPullCorrelationRuleConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPullCorrelationRuleConf.java
index 151683c..9bda1a6 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPullCorrelationRuleConf.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPullCorrelationRuleConf.java
@@ -28,17 +28,26 @@ import javax.xml.bind.annotation.XmlType;
 
 @XmlRootElement(name = "defaultPullCorrelationRuleConf")
 @XmlType
-public class DefaultPullCorrelationRuleConf extends AbstractPullCorrelationRuleConf implements PullCorrelationRuleConf {
+public class DefaultPullCorrelationRuleConf extends AbstractCorrelationRuleConf implements PullCorrelationRuleConf {
 
     private static final long serialVersionUID = 429126085793346273L;
 
+    private boolean orSchemas;
+
     private final List<String> schemas = new ArrayList<>();
 
+    public boolean isOrSchemas() {
+        return orSchemas;
+    }
+
+    public void setOrSchemas(final boolean orSchemas) {
+        this.orSchemas = orSchemas;
+    }
+
     @XmlElementWrapper(name = "schemas")
     @XmlElement(name = "schema")
     @JsonProperty("schemas")
     public List<String> getSchemas() {
         return schemas;
     }
-
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPushCorrelationRuleConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPushCorrelationRuleConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPushCorrelationRuleConf.java
new file mode 100644
index 0000000..a909208
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/DefaultPushCorrelationRuleConf.java
@@ -0,0 +1,53 @@
+/*
+ * 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.common.lib.policy;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "defaultPushCorrelationRuleConf")
+@XmlType
+public class DefaultPushCorrelationRuleConf extends AbstractCorrelationRuleConf implements PushCorrelationRuleConf {
+
+    private static final long serialVersionUID = 429126085793346273L;
+
+    private boolean orSchemas;
+
+    private final List<String> schemas = new ArrayList<>();
+
+    public boolean isOrSchemas() {
+        return orSchemas;
+    }
+
+    public void setOrSchemas(final boolean orSchemas) {
+        this.orSchemas = orSchemas;
+    }
+
+    @XmlElementWrapper(name = "schemas")
+    @XmlElement(name = "schema")
+    @JsonProperty("schemas")
+    public List<String> getSchemas() {
+        return schemas;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PolicyTO.java
index eb84fcb..98b79d6 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PolicyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PolicyTO.java
@@ -36,7 +36,7 @@ import org.apache.syncope.common.lib.to.EntityTO;
 
 @XmlRootElement(name = "policy")
 @XmlType
-@XmlSeeAlso({ AccountPolicyTO.class, PasswordPolicyTO.class, PullPolicyTO.class })
+@XmlSeeAlso({ AccountPolicyTO.class, PasswordPolicyTO.class, ProvisioningPolicyTO.class })
 @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.EXISTING_PROPERTY, property = "@class")
 @JsonPropertyOrder(value = { "@class", "key", "description" })
 @Schema(

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/common/lib/src/main/java/org/apache/syncope/common/lib/policy/ProvisioningPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/ProvisioningPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/ProvisioningPolicyTO.java
new file mode 100644
index 0000000..e686223
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/ProvisioningPolicyTO.java
@@ -0,0 +1,57 @@
+/*
+ * 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.common.lib.policy;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
+import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
+import org.apache.syncope.common.lib.types.ConflictResolutionAction;
+
+@XmlType
+@XmlSeeAlso({ PullPolicyTO.class, PushPolicyTO.class })
+@Schema(allOf = { PolicyTO.class })
+public abstract class ProvisioningPolicyTO extends PolicyTO {
+
+    private static final long serialVersionUID = -3786048942148269602L;
+
+    private ConflictResolutionAction conflictResolutionAction;
+
+    @XmlJavaTypeAdapter(XmlGenericMapAdapter.class)
+    private final Map<String, String> correlationRules = new HashMap<>();
+
+    public ConflictResolutionAction getConflictResolutionAction() {
+        return conflictResolutionAction == null
+                ? ConflictResolutionAction.IGNORE
+                : conflictResolutionAction;
+    }
+
+    public void setConflictResolutionAction(final ConflictResolutionAction conflictResolutionAction) {
+        this.conflictResolutionAction = conflictResolutionAction;
+    }
+
+    @JsonProperty
+    public Map<String, String> getCorrelationRules() {
+        return correlationRules;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PullPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PullPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PullPolicyTO.java
index 967f04d..aee16cd 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PullPolicyTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PullPolicyTO.java
@@ -20,24 +20,17 @@ package org.apache.syncope.common.lib.policy;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
 import io.swagger.v3.oas.annotations.media.Schema;
-import java.util.HashMap;
-import java.util.Map;
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlTransient;
 import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
-import org.apache.syncope.common.lib.jaxb.XmlGenericMapAdapter;
-import org.apache.syncope.common.lib.types.ConflictResolutionAction;
 
 @XmlRootElement(name = "pullPolicy")
 @XmlType
-@Schema(allOf = { PolicyTO.class })
-public class PullPolicyTO extends PolicyTO {
+@Schema(allOf = { ProvisioningPolicyTO.class, PolicyTO.class })
+public class PullPolicyTO extends ProvisioningPolicyTO {
 
     private static final long serialVersionUID = 993024634238024242L;
 
-    private ConflictResolutionAction conflictResolutionAction;
-
     @XmlTransient
     @JsonProperty("@class")
     @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.policy.PullPolicyTO")
@@ -45,22 +38,4 @@ public class PullPolicyTO extends PolicyTO {
     public String getDiscriminator() {
         return getClass().getName();
     }
-
-    @XmlJavaTypeAdapter(XmlGenericMapAdapter.class)
-    private final Map<String, String> correlationRules = new HashMap<>();
-
-    public ConflictResolutionAction getConflictResolutionAction() {
-        return conflictResolutionAction == null
-                ? ConflictResolutionAction.IGNORE
-                : conflictResolutionAction;
-    }
-
-    public void setConflictResolutionAction(final ConflictResolutionAction conflictResolutionAction) {
-        this.conflictResolutionAction = conflictResolutionAction;
-    }
-
-    @JsonProperty
-    public Map<String, String> getCorrelationRules() {
-        return correlationRules;
-    }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PushCorrelationRuleConf.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PushCorrelationRuleConf.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PushCorrelationRuleConf.java
new file mode 100644
index 0000000..1791425
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PushCorrelationRuleConf.java
@@ -0,0 +1,23 @@
+/*
+ * 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.common.lib.policy;
+
+public interface PushCorrelationRuleConf extends RuleConf {
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PushPolicySpec.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PushPolicySpec.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PushPolicySpec.java
deleted file mode 100644
index 7cfe621..0000000
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PushPolicySpec.java
+++ /dev/null
@@ -1,29 +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.common.lib.policy;
-
-import javax.xml.bind.annotation.XmlType;
-import org.apache.syncope.common.lib.AbstractBaseBean;
-
-@XmlType
-public class PushPolicySpec extends AbstractBaseBean {
-
-    private static final long serialVersionUID = 3641030189482617497L;
-
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PushPolicyTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PushPolicyTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PushPolicyTO.java
new file mode 100644
index 0000000..a2eca14
--- /dev/null
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/policy/PushPolicyTO.java
@@ -0,0 +1,41 @@
+/*
+ * 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.common.lib.policy;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import io.swagger.v3.oas.annotations.media.Schema;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.bind.annotation.XmlType;
+
+@XmlRootElement(name = "pushPolicy")
+@XmlType
+@Schema(allOf = { ProvisioningPolicyTO.class, PolicyTO.class })
+public class PushPolicyTO extends ProvisioningPolicyTO {
+
+    private static final long serialVersionUID = 993024634238024242L;
+
+    @XmlTransient
+    @JsonProperty("@class")
+    @Schema(name = "@class", required = true, example = "org.apache.syncope.common.lib.policy.PushPolicyTO")
+    @Override
+    public String getDiscriminator() {
+        return getClass().getName();
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
index ab7e0e6..d0061bb 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ResourceTO.java
@@ -77,6 +77,8 @@ public class ResourceTO extends AbstractBaseBean implements EntityTO {
 
     private String pullPolicy;
 
+    private String pushPolicy;
+
     private final List<ConnConfProperty> confOverride = new ArrayList<>();
 
     private boolean overrideCapabilities = false;
@@ -184,6 +186,14 @@ public class ResourceTO extends AbstractBaseBean implements EntityTO {
         this.pullPolicy = pullPolicy;
     }
 
+    public String getPushPolicy() {
+        return pushPolicy;
+    }
+
+    public void setPushPolicy(final String pushPolicy) {
+        this.pushPolicy = pushPolicy;
+    }
+
     @JsonIgnore
     public Optional<ProvisionTO> getProvision(final String anyType) {
         return provisions.stream().filter(

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/common/lib/src/main/java/org/apache/syncope/common/lib/types/ImplementationType.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ImplementationType.java b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ImplementationType.java
index c528274..98e10b7 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/types/ImplementationType.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/types/ImplementationType.java
@@ -35,6 +35,7 @@ public enum ImplementationType {
     PULL_ACTIONS,
     PUSH_ACTIONS,
     PULL_CORRELATION_RULE,
+    PUSH_CORRELATION_RULE,
     VALIDATOR,
     RECIPIENTS_PROVIDER,
     AUDIT_APPENDER;

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/logic/src/main/java/org/apache/syncope/core/logic/ImplementationLogic.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ImplementationLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ImplementationLogic.java
index 3079483..19efd1f 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ImplementationLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ImplementationLogic.java
@@ -189,7 +189,11 @@ public class ImplementationLogic extends AbstractTransactionalLogic<Implementati
                 break;
 
             case PULL_CORRELATION_RULE:
-                inUse = !policyDAO.findByCorrelationRule(implementation).isEmpty();
+                inUse = !policyDAO.findByPullCorrelationRule(implementation).isEmpty();
+                break;
+
+            case PUSH_CORRELATION_RULE:
+                inUse = !policyDAO.findByPushCorrelationRule(implementation).isEmpty();
                 break;
 
             case VALIDATOR:

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/logic/src/main/java/org/apache/syncope/core/logic/init/ClassPathScanImplementationLookup.java
----------------------------------------------------------------------
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/init/ClassPathScanImplementationLookup.java b/core/logic/src/main/java/org/apache/syncope/core/logic/init/ClassPathScanImplementationLookup.java
index 3b824c5..6608f39 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/init/ClassPathScanImplementationLookup.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/init/ClassPathScanImplementationLookup.java
@@ -28,6 +28,7 @@ import java.util.Set;
 import org.apache.syncope.common.lib.policy.AccountRuleConf;
 import org.apache.syncope.common.lib.policy.PasswordRuleConf;
 import org.apache.syncope.common.lib.policy.PullCorrelationRuleConf;
+import org.apache.syncope.common.lib.policy.PushCorrelationRuleConf;
 import org.apache.syncope.common.lib.report.ReportletConf;
 import org.apache.syncope.common.lib.types.ImplementationType;
 import org.apache.syncope.core.logic.audit.AuditAppender;
@@ -47,6 +48,8 @@ import org.apache.syncope.core.provisioning.api.propagation.PropagationActions;
 import org.apache.syncope.core.provisioning.api.pushpull.PullActions;
 import org.apache.syncope.core.persistence.api.dao.PullCorrelationRule;
 import org.apache.syncope.core.persistence.api.dao.PullCorrelationRuleConfClass;
+import org.apache.syncope.core.persistence.api.dao.PushCorrelationRule;
+import org.apache.syncope.core.persistence.api.dao.PushCorrelationRuleConfClass;
 import org.apache.syncope.core.provisioning.api.pushpull.PushActions;
 import org.apache.syncope.core.provisioning.api.pushpull.ReconFilterBuilder;
 import org.apache.syncope.core.provisioning.java.data.JEXLItemTransformerImpl;
@@ -79,7 +82,9 @@ public class ClassPathScanImplementationLookup implements ImplementationLookup {
 
     private Map<Class<? extends PasswordRuleConf>, Class<? extends PasswordRule>> passwordRuleClasses;
 
-    private Map<Class<? extends PullCorrelationRuleConf>, Class<? extends PullCorrelationRule>> correlationRuleClasses;
+    private Map<Class<? extends PullCorrelationRuleConf>, Class<? extends PullCorrelationRule>> pullCRClasses;
+
+    private Map<Class<? extends PushCorrelationRuleConf>, Class<? extends PushCorrelationRule>> pushCRClasses;
 
     private Set<Class<?>> auditAppenderClasses;
 
@@ -109,7 +114,8 @@ public class ClassPathScanImplementationLookup implements ImplementationLookup {
         reportletClasses = new HashMap<>();
         accountRuleClasses = new HashMap<>();
         passwordRuleClasses = new HashMap<>();
-        correlationRuleClasses = new HashMap<>();
+        pullCRClasses = new HashMap<>();
+        pushCRClasses = new HashMap<>();
         auditAppenderClasses = new HashSet<>();
 
         ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(false);
@@ -118,6 +124,7 @@ public class ClassPathScanImplementationLookup implements ImplementationLookup {
         scanner.addIncludeFilter(new AssignableTypeFilter(AccountRule.class));
         scanner.addIncludeFilter(new AssignableTypeFilter(PasswordRule.class));
         scanner.addIncludeFilter(new AssignableTypeFilter(PullCorrelationRule.class));
+        scanner.addIncludeFilter(new AssignableTypeFilter(PushCorrelationRule.class));
         scanner.addIncludeFilter(new AssignableTypeFilter(ItemTransformer.class));
         scanner.addIncludeFilter(new AssignableTypeFilter(SchedTaskJobDelegate.class));
         scanner.addIncludeFilter(new AssignableTypeFilter(ReconFilterBuilder.class));
@@ -176,7 +183,17 @@ public class ClassPathScanImplementationLookup implements ImplementationLookup {
                         LOG.warn("Found pull correlation rule {} without declared configuration", clazz.getName());
                     } else {
                         classNames.get(ImplementationType.ACCOUNT_RULE).add(clazz.getName());
-                        correlationRuleClasses.put(annotation.value(), (Class<? extends PullCorrelationRule>) clazz);
+                        pullCRClasses.put(annotation.value(), (Class<? extends PullCorrelationRule>) clazz);
+                    }
+                }
+
+                if (PushCorrelationRule.class.isAssignableFrom(clazz) && !isAbstractClazz) {
+                    PushCorrelationRuleConfClass annotation = clazz.getAnnotation(PushCorrelationRuleConfClass.class);
+                    if (annotation == null) {
+                        LOG.warn("Found push correlation rule {} without declared configuration", clazz.getName());
+                    } else {
+                        classNames.get(ImplementationType.ACCOUNT_RULE).add(clazz.getName());
+                        pushCRClasses.put(annotation.value(), (Class<? extends PushCorrelationRule>) clazz);
                     }
                 }
 
@@ -238,7 +255,8 @@ public class ClassPathScanImplementationLookup implements ImplementationLookup {
         reportletClasses = Collections.unmodifiableMap(reportletClasses);
         accountRuleClasses = Collections.unmodifiableMap(accountRuleClasses);
         passwordRuleClasses = Collections.unmodifiableMap(passwordRuleClasses);
-        correlationRuleClasses = Collections.unmodifiableMap(correlationRuleClasses);
+        pullCRClasses = Collections.unmodifiableMap(pullCRClasses);
+        pushCRClasses = Collections.unmodifiableMap(pushCRClasses);
         auditAppenderClasses = Collections.unmodifiableSet(auditAppenderClasses);
     }
 
@@ -277,7 +295,14 @@ public class ClassPathScanImplementationLookup implements ImplementationLookup {
     public Class<? extends PullCorrelationRule> getPullCorrelationRuleClass(
             final Class<? extends PullCorrelationRuleConf> correlationRuleConfClass) {
 
-        return correlationRuleClasses.get(correlationRuleConfClass);
+        return pullCRClasses.get(correlationRuleConfClass);
+    }
+
+    @Override
+    public Class<? extends PushCorrelationRule> getPushCorrelationRuleClass(
+            final Class<? extends PushCorrelationRuleConf> correlationRuleConfClass) {
+
+        return pushCRClasses.get(correlationRuleConfClass);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/ImplementationLookup.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/ImplementationLookup.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/ImplementationLookup.java
index fce4be4..4488568 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/ImplementationLookup.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/ImplementationLookup.java
@@ -22,11 +22,13 @@ import java.util.Set;
 import org.apache.syncope.common.lib.policy.AccountRuleConf;
 import org.apache.syncope.common.lib.policy.PasswordRuleConf;
 import org.apache.syncope.common.lib.policy.PullCorrelationRuleConf;
+import org.apache.syncope.common.lib.policy.PushCorrelationRuleConf;
 import org.apache.syncope.common.lib.report.ReportletConf;
 import org.apache.syncope.common.lib.types.ImplementationType;
 import org.apache.syncope.core.persistence.api.dao.AccountRule;
 import org.apache.syncope.core.persistence.api.dao.PasswordRule;
 import org.apache.syncope.core.persistence.api.dao.PullCorrelationRule;
+import org.apache.syncope.core.persistence.api.dao.PushCorrelationRule;
 import org.apache.syncope.core.persistence.api.dao.Reportlet;
 
 public interface ImplementationLookup extends SyncopeLoader {
@@ -47,5 +49,8 @@ public interface ImplementationLookup extends SyncopeLoader {
     Class<? extends PullCorrelationRule> getPullCorrelationRuleClass(
             Class<? extends PullCorrelationRuleConf> pullCorrelationRuleConfClass);
 
+    Class<? extends PushCorrelationRule> getPushCorrelationRuleClass(
+            Class<? extends PushCorrelationRuleConf> pushCorrelationRuleConfClass);
+
     Set<Class<?>> getAuditAppenderClasses();
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
index e841a3c..6765030 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PolicyDAO.java
@@ -24,6 +24,7 @@ import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
 import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
 import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.PushPolicy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 
 public interface PolicyDAO extends DAO<Policy> {
@@ -36,7 +37,9 @@ public interface PolicyDAO extends DAO<Policy> {
 
     List<PasswordPolicy> findByPasswordRule(Implementation passwordRule);
 
-    List<PullPolicy> findByCorrelationRule(Implementation correlationRule);
+    List<PullPolicy> findByPullCorrelationRule(Implementation correlationRule);
+
+    List<PushPolicy> findByPushCorrelationRule(Implementation correlationRule);
 
     List<AccountPolicy> findByResource(ExternalResource resource);
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PushCorrelationRule.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PushCorrelationRule.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PushCorrelationRule.java
new file mode 100644
index 0000000..0b042a5
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PushCorrelationRule.java
@@ -0,0 +1,42 @@
+/*
+ * 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.persistence.api.dao;
+
+import org.apache.syncope.common.lib.policy.PushCorrelationRuleConf;
+import org.apache.syncope.core.persistence.api.entity.Any;
+import org.apache.syncope.core.persistence.api.entity.resource.Provision;
+import org.identityconnectors.framework.common.objects.filter.Filter;
+
+/**
+ * Interface for correlation rule to be evaluated during PushJob execution.
+ */
+public interface PushCorrelationRule {
+
+    default void setConf(PushCorrelationRuleConf conf) {
+    }
+
+    /**
+     * Return a search condition.
+     *
+     * @param any user, group or any object
+     * @param provision resource provision
+     * @return search condition.
+     */
+    Filter getFilter(Any<?> any, Provision provision);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PushCorrelationRuleConfClass.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PushCorrelationRuleConfClass.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PushCorrelationRuleConfClass.java
new file mode 100644
index 0000000..deb1765
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/dao/PushCorrelationRuleConfClass.java
@@ -0,0 +1,33 @@
+/*
+ * 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.persistence.api.dao;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import org.apache.syncope.common.lib.policy.PushCorrelationRuleConf;
+
+@Target({ ElementType.TYPE })
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PushCorrelationRuleConfClass {
+
+    Class<? extends PushCorrelationRuleConf> value();
+
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AnyUtils.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AnyUtils.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AnyUtils.java
index 8544cd4..05bd85a 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AnyUtils.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/AnyUtils.java
@@ -19,6 +19,7 @@
 package org.apache.syncope.core.persistence.api.entity;
 
 import java.util.Set;
+import org.apache.syncope.common.lib.patch.AnyPatch;
 import org.apache.syncope.common.lib.to.AnyTO;
 import org.apache.syncope.common.lib.types.AnyTypeKind;
 import org.apache.syncope.core.persistence.api.dao.AnyDAO;
@@ -48,6 +49,8 @@ public interface AnyUtils {
 
     <T extends AnyTO> T newAnyTO();
 
+    <P extends AnyPatch> P newAnyPatch(String key);
+
     <A extends Any<?>> AnyDAO<A> dao();
 
     Set<ExternalResource> getAllResources(Any<?> any);

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/CorrelationRule.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/CorrelationRule.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/CorrelationRule.java
deleted file mode 100644
index 69ad1de..0000000
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/CorrelationRule.java
+++ /dev/null
@@ -1,38 +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.persistence.api.entity.policy;
-
-import org.apache.syncope.core.persistence.api.entity.AnyType;
-import org.apache.syncope.core.persistence.api.entity.Entity;
-import org.apache.syncope.core.persistence.api.entity.Implementation;
-
-public interface CorrelationRule extends Entity {
-
-    PullPolicy getPullPolicy();
-
-    void setPullPolicy(PullPolicy pullPolicy);
-
-    AnyType getAnyType();
-
-    void setAnyType(AnyType anyType);
-
-    Implementation getImplementation();
-
-    void setImplementation(Implementation implementation);
-}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/CorrelationRuleEntity.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/CorrelationRuleEntity.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/CorrelationRuleEntity.java
new file mode 100644
index 0000000..c98de79
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/CorrelationRuleEntity.java
@@ -0,0 +1,34 @@
+/*
+ * 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.persistence.api.entity.policy;
+
+import org.apache.syncope.core.persistence.api.entity.AnyType;
+import org.apache.syncope.core.persistence.api.entity.Entity;
+import org.apache.syncope.core.persistence.api.entity.Implementation;
+
+public interface CorrelationRuleEntity extends Entity {
+
+    AnyType getAnyType();
+
+    void setAnyType(AnyType anyType);
+
+    Implementation getImplementation();
+
+    void setImplementation(Implementation implementation);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/ProvisioningPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/ProvisioningPolicy.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/ProvisioningPolicy.java
new file mode 100644
index 0000000..b17072d
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/ProvisioningPolicy.java
@@ -0,0 +1,28 @@
+/*
+ * 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.persistence.api.entity.policy;
+
+import org.apache.syncope.common.lib.types.ConflictResolutionAction;
+
+public interface ProvisioningPolicy extends Policy {
+
+    ConflictResolutionAction getConflictResolutionAction();
+
+    void setConflictResolutionAction(ConflictResolutionAction conflictResolutionAction);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullCorrelationRuleEntity.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullCorrelationRuleEntity.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullCorrelationRuleEntity.java
new file mode 100644
index 0000000..fb3f162
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullCorrelationRuleEntity.java
@@ -0,0 +1,26 @@
+/*
+ * 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.persistence.api.entity.policy;
+
+public interface PullCorrelationRuleEntity extends CorrelationRuleEntity {
+
+    PullPolicy getPullPolicy();
+
+    void setPullPolicy(PullPolicy pullPolicy);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullPolicy.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullPolicy.java
index d8d1a69..4faf109 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullPolicy.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PullPolicy.java
@@ -20,18 +20,13 @@ package org.apache.syncope.core.persistence.api.entity.policy;
 
 import java.util.List;
 import java.util.Optional;
-import org.apache.syncope.common.lib.types.ConflictResolutionAction;
 import org.apache.syncope.core.persistence.api.entity.AnyType;
 
-public interface PullPolicy extends Policy {
+public interface PullPolicy extends ProvisioningPolicy {
 
-    ConflictResolutionAction getConflictResolutionAction();
+    boolean add(PullCorrelationRuleEntity rule);
 
-    void setConflictResolutionAction(ConflictResolutionAction conflictResolutionAction);
+    Optional<? extends PullCorrelationRuleEntity> getCorrelationRule(AnyType anyType);
 
-    boolean add(CorrelationRule rule);
-
-    Optional<? extends CorrelationRule> getCorrelationRule(AnyType anyType);
-
-    List<? extends CorrelationRule> getCorrelationRules();
+    List<? extends PullCorrelationRuleEntity> getCorrelationRules();
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushCorrelationRuleEntity.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushCorrelationRuleEntity.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushCorrelationRuleEntity.java
new file mode 100644
index 0000000..766b822
--- /dev/null
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushCorrelationRuleEntity.java
@@ -0,0 +1,26 @@
+/*
+ * 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.persistence.api.entity.policy;
+
+public interface PushCorrelationRuleEntity extends CorrelationRuleEntity {
+
+    PushPolicy getPushPolicy();
+
+    void setPushPolicy(PushPolicy pullPolicy);
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushPolicy.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushPolicy.java
index d6819b7..9480ef5 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushPolicy.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/policy/PushPolicy.java
@@ -18,11 +18,15 @@
  */
 package org.apache.syncope.core.persistence.api.entity.policy;
 
-import org.apache.syncope.common.lib.policy.PushPolicySpec;
+import java.util.List;
+import java.util.Optional;
+import org.apache.syncope.core.persistence.api.entity.AnyType;
 
-public interface PushPolicy extends Policy {
+public interface PushPolicy extends ProvisioningPolicy {
 
-    PushPolicySpec getSpecification();
+    boolean add(PushCorrelationRuleEntity rule);
 
-    void setSpecification(PushPolicySpec spec);
+    Optional<? extends PushCorrelationRuleEntity> getCorrelationRule(AnyType anyType);
+
+    List<? extends PushCorrelationRuleEntity> getCorrelationRules();
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
----------------------------------------------------------------------
diff --git a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
index c817306..0d91ed0 100644
--- a/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
+++ b/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/entity/resource/ExternalResource.java
@@ -31,6 +31,7 @@ import org.apache.syncope.core.persistence.api.entity.Implementation;
 import org.apache.syncope.core.persistence.api.entity.ProvidedKeyEntity;
 import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
 import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.PushPolicy;
 import org.identityconnectors.framework.common.objects.ObjectClass;
 
 public interface ExternalResource extends ProvidedKeyEntity {
@@ -61,6 +62,10 @@ public interface ExternalResource extends ProvidedKeyEntity {
 
     void setPullPolicy(PullPolicy pullPolicy);
 
+    PushPolicy getPushPolicy();
+
+    void setPushPolicy(PushPolicy pushPolicy);
+
     TraceLevel getCreateTraceLevel();
 
     void setCreateTraceLevel(TraceLevel createTraceLevel);

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/DefaultPullCorrelationRule.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/DefaultPullCorrelationRule.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/DefaultPullCorrelationRule.java
index 02cc568..502d1b0 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/DefaultPullCorrelationRule.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/DefaultPullCorrelationRule.java
@@ -18,6 +18,8 @@
  */
 package org.apache.syncope.core.persistence.jpa.dao;
 
+import java.util.ArrayList;
+import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -54,13 +56,13 @@ public class DefaultPullCorrelationRule implements PullCorrelationRule {
                 collect(Collectors.toMap(Item::getIntAttrName, Function.identity()));
 
         // search for anys by attribute(s) specified in the policy
-        SearchCond searchCond = null;
+        List<SearchCond> searchConds = new ArrayList<>();
 
-        for (String schema : conf.getSchemas()) {
-            Item mappingItem = mappingItems.get(schema);
-            Attribute attr = mappingItem == null
+        conf.getSchemas().forEach(schema -> {
+            Item item = mappingItems.get(schema);
+            Attribute attr = item == null
                     ? null
-                    : connObj.getAttributeByName(mappingItem.getExtAttrName());
+                    : connObj.getAttributeByName(item.getExtAttrName());
             if (attr == null) {
                 throw new IllegalArgumentException(
                         "Connector object does not contains the attributes to perform the search: " + schema);
@@ -80,34 +82,19 @@ public class DefaultPullCorrelationRule implements PullCorrelationRule {
                         : attr.getValue().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 or name can be selected
-            if ("key".equalsIgnoreCase(schema)
-                    || "username".equalsIgnoreCase(schema) || "name".equalsIgnoreCase(schema)) {
+            AttributeCond cond = "key".equalsIgnoreCase(schema)
+                    || "username".equalsIgnoreCase(schema) || "name".equalsIgnoreCase(schema)
+                    ? new AnyCond()
+                    : new AttributeCond();
+            cond.setSchema(schema);
+            cond.setType(type);
+            cond.setExpression(expression);
 
-                AnyCond cond = new AnyCond();
-                cond.setSchema(schema);
-                cond.setType(type);
-                cond.setExpression(expression);
+            searchConds.add(SearchCond.getLeafCond(cond));
+        });
 
-                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;
+        return conf.isOrSchemas()
+                ? SearchCond.getOrCond(searchConds)
+                : SearchCond.getAndCond(searchConds);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/DefaultPushCorrelationRule.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/DefaultPushCorrelationRule.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/DefaultPushCorrelationRule.java
new file mode 100644
index 0000000..1583899
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/DefaultPushCorrelationRule.java
@@ -0,0 +1,74 @@
+/*
+ * 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.persistence.jpa.dao;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.commons.lang3.tuple.Pair;
+import org.apache.syncope.common.lib.policy.DefaultPushCorrelationRuleConf;
+import org.apache.syncope.common.lib.policy.PushCorrelationRuleConf;
+import org.apache.syncope.common.lib.types.MappingPurpose;
+import org.apache.syncope.core.persistence.api.entity.resource.Provision;
+import org.identityconnectors.framework.common.objects.Attribute;
+import org.apache.syncope.core.persistence.api.dao.PushCorrelationRule;
+import org.apache.syncope.core.persistence.api.dao.PushCorrelationRuleConfClass;
+import org.apache.syncope.core.persistence.api.entity.Any;
+import org.apache.syncope.core.provisioning.api.MappingManager;
+import org.identityconnectors.framework.common.objects.filter.Filter;
+import org.identityconnectors.framework.common.objects.filter.FilterBuilder;
+import org.springframework.beans.factory.annotation.Autowired;
+
+@PushCorrelationRuleConfClass(DefaultPushCorrelationRuleConf.class)
+public class DefaultPushCorrelationRule implements PushCorrelationRule {
+
+    @Autowired
+    private MappingManager mappingManager;
+
+    private DefaultPushCorrelationRuleConf conf;
+
+    @Override
+    public void setConf(final PushCorrelationRuleConf conf) {
+        if (conf instanceof DefaultPushCorrelationRuleConf) {
+            this.conf = DefaultPushCorrelationRuleConf.class.cast(conf);
+        } else {
+            throw new IllegalArgumentException(
+                    DefaultPushCorrelationRuleConf.class.getName() + " expected, got " + conf.getClass().getName());
+        }
+    }
+
+    @Override
+    public Filter getFilter(final Any<?> any, final Provision provision) {
+        List<Filter> filters = new ArrayList<>();
+
+        provision.getMapping().getItems().stream().filter(
+                item -> item.getPurpose() == MappingPurpose.PROPAGATION || item.getPurpose() == MappingPurpose.BOTH).
+                forEach(item -> {
+                    Pair<String, Attribute> attr = mappingManager.prepareAttr(provision, item, any, null);
+                    if (attr != null && attr.getRight() != null && conf.getSchemas().contains(item.getIntAttrName())) {
+                        filters.add(provision.isIgnoreCaseMatch()
+                                ? FilterBuilder.equalsIgnoreCase(attr.getRight())
+                                : FilterBuilder.equalTo(attr.getRight()));
+                    }
+                });
+
+        return conf.isOrSchemas()
+                ? FilterBuilder.or(filters)
+                : FilterBuilder.and(filters);
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/HaveIBeenPwnedPasswordRule.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/HaveIBeenPwnedPasswordRule.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/HaveIBeenPwnedPasswordRule.java
index cc5bf94..dd839a3 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/HaveIBeenPwnedPasswordRule.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/HaveIBeenPwnedPasswordRule.java
@@ -77,7 +77,7 @@ public class HaveIBeenPwnedPasswordRule implements PasswordRule {
 
         if (password != null && clearPassword != null) {
             try {
-                final String sha1 = ENCRYPTOR.encode(clearPassword, CipherAlgorithm.SHA1);
+                String sha1 = ENCRYPTOR.encode(clearPassword, CipherAlgorithm.SHA1);
 
                 HttpHeaders headers = new HttpHeaders();
                 headers.set(HttpHeaders.USER_AGENT, "Apache Syncope");

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
index efcd24a..9c573fd 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAExternalResourceDAO.java
@@ -45,6 +45,7 @@ import org.apache.syncope.core.persistence.api.entity.resource.MappingItem;
 import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
 import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.PushPolicy;
 import org.apache.syncope.core.persistence.api.entity.resource.Provision;
 import org.apache.syncope.core.persistence.jpa.entity.resource.JPAMappingItem;
 import org.apache.syncope.core.persistence.jpa.entity.resource.JPAExternalResource;
@@ -227,6 +228,8 @@ public class JPAExternalResourceDAO extends AbstractDAO<ExternalResource> implem
             query.append("passwordPolicy");
         } else if (PullPolicy.class.isAssignableFrom(policyClass)) {
             query.append("pullPolicy");
+        } else if (PushPolicy.class.isAssignableFrom(policyClass)) {
+            query.append("pushPolicy");
         }
 
         return query;

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
index 52bca60..495585f 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAPolicyDAO.java
@@ -20,21 +20,22 @@ package org.apache.syncope.core.persistence.jpa.dao;
 
 import java.util.List;
 import javax.persistence.TypedQuery;
+import org.apache.syncope.core.persistence.api.dao.ExternalResourceDAO;
 import org.apache.syncope.core.persistence.api.dao.PolicyDAO;
 import org.apache.syncope.core.persistence.api.dao.RealmDAO;
 import org.apache.syncope.core.persistence.api.entity.Implementation;
 import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
-import org.apache.syncope.core.persistence.api.entity.Realm;
 import org.apache.syncope.core.persistence.api.entity.policy.Policy;
 import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
 import org.apache.syncope.core.persistence.api.entity.policy.PushPolicy;
 import org.apache.syncope.core.persistence.jpa.entity.policy.AbstractPolicy;
 import org.apache.syncope.core.persistence.jpa.entity.policy.JPAAccountPolicy;
-import org.apache.syncope.core.persistence.jpa.entity.policy.JPACorrelationRule;
+import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPullCorrelationRuleEntity;
 import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPasswordPolicy;
 import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPullPolicy;
+import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPushCorrelationRuleEntity;
 import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPushPolicy;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Repository;
@@ -45,6 +46,9 @@ public class JPAPolicyDAO extends AbstractDAO<Policy> implements PolicyDAO {
     @Autowired
     private RealmDAO realmDAO;
 
+    @Autowired
+    private ExternalResourceDAO resourceDAO;
+
     private <T extends Policy> Class<? extends AbstractPolicy> getEntityReference(final Class<T> reference) {
         return AccountPolicy.class.isAssignableFrom(reference)
                 ? JPAAccountPolicy.class
@@ -92,9 +96,9 @@ public class JPAPolicyDAO extends AbstractDAO<Policy> implements PolicyDAO {
     }
 
     @Override
-    public List<PullPolicy> findByCorrelationRule(final Implementation correlationRule) {
+    public List<PullPolicy> findByPullCorrelationRule(final Implementation correlationRule) {
         TypedQuery<PullPolicy> query = entityManager().createQuery(
-                "SELECT DISTINCT e.pullPolicy FROM " + JPACorrelationRule.class.getSimpleName() + " e "
+                "SELECT DISTINCT e.pullPolicy FROM " + JPAPullCorrelationRuleEntity.class.getSimpleName() + " e "
                 + "WHERE e.implementation=:correlationRule", PullPolicy.class);
         query.setParameter("correlationRule", correlationRule);
 
@@ -102,6 +106,16 @@ public class JPAPolicyDAO extends AbstractDAO<Policy> implements PolicyDAO {
     }
 
     @Override
+    public List<PushPolicy> findByPushCorrelationRule(final Implementation correlationRule) {
+        TypedQuery<PushPolicy> query = entityManager().createQuery(
+                "SELECT DISTINCT e.pushPolicy FROM " + JPAPushCorrelationRuleEntity.class.getSimpleName() + " e "
+                + "WHERE e.implementation=:correlationRule", PushPolicy.class);
+        query.setParameter("correlationRule", correlationRule);
+
+        return query.getResultList();
+    }
+
+    @Override
     public List<AccountPolicy> findByResource(final ExternalResource resource) {
         TypedQuery<AccountPolicy> query = entityManager().createQuery(
                 "SELECT e FROM " + JPAAccountPolicy.class.getSimpleName() + " e "
@@ -125,13 +139,25 @@ public class JPAPolicyDAO extends AbstractDAO<Policy> implements PolicyDAO {
 
     @Override
     public <T extends Policy> void delete(final T policy) {
-        for (Realm realm : realmDAO.findByPolicy(policy)) {
+        realmDAO.findByPolicy(policy).forEach(realm -> {
             if (policy instanceof AccountPolicy) {
                 realm.setAccountPolicy(null);
             } else if (policy instanceof PasswordPolicy) {
                 realm.setPasswordPolicy(null);
             }
-        }
+        });
+
+        resourceDAO.findByPolicy(policy).forEach(resource -> {
+            if (policy instanceof AccountPolicy) {
+                resource.setAccountPolicy(null);
+            } else if (policy instanceof PasswordPolicy) {
+                resource.setPasswordPolicy(null);
+            } else if (policy instanceof PullPolicy) {
+                resource.setPullPolicy(null);
+            } else if (policy instanceof PushPolicy) {
+                resource.setPushPolicy(null);
+            }
+        });
 
         entityManager().remove(policy);
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
index 7f90046..b2ad416 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPARealmDAO.java
@@ -34,7 +34,7 @@ import org.apache.syncope.core.persistence.api.entity.policy.AccountPolicy;
 import org.apache.syncope.core.persistence.api.entity.Realm;
 import org.apache.syncope.core.persistence.api.entity.policy.PasswordPolicy;
 import org.apache.syncope.core.persistence.api.entity.policy.Policy;
-import org.apache.syncope.core.persistence.api.entity.policy.PullPolicy;
+import org.apache.syncope.core.persistence.api.entity.policy.ProvisioningPolicy;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource;
 import org.apache.syncope.core.persistence.jpa.entity.JPARealm;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -134,7 +134,7 @@ public class JPARealmDAO extends AbstractDAO<Realm> implements RealmDAO {
 
     @Override
     public <T extends Policy> List<Realm> findByPolicy(final T policy) {
-        if (PullPolicy.class.isAssignableFrom(policy.getClass())) {
+        if (ProvisioningPolicy.class.isAssignableFrom(policy.getClass())) {
             return Collections.<Realm>emptyList();
         }
 
@@ -234,5 +234,4 @@ public class JPARealmDAO extends AbstractDAO<Realm> implements RealmDAO {
 
         delete(realm);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
index 67eda83..5e97993 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAUserDAO.java
@@ -514,7 +514,6 @@ public class JPAUserDAO extends AbstractAnyDAO<User> implements UserDAO {
     @Transactional(readOnly = true)
     @Override
     public Collection<String> findAllResourceKeys(final String key) {
-        return findAllResources(authFind(key)).stream().map(resource -> resource.getKey()).collect(Collectors.toList());
+        return findAllResources(authFind(key)).stream().map(Entity::getKey).collect(Collectors.toList());
     }
-
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtils.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtils.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtils.java
index d4a3f60..70f62c6 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtils.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAAnyUtils.java
@@ -26,6 +26,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import org.apache.commons.lang3.ClassUtils;
+import org.apache.syncope.common.lib.patch.AnyObjectPatch;
+import org.apache.syncope.common.lib.patch.AnyPatch;
+import org.apache.syncope.common.lib.patch.GroupPatch;
+import org.apache.syncope.common.lib.patch.UserPatch;
 import org.apache.syncope.common.lib.to.AnyObjectTO;
 import org.apache.syncope.common.lib.to.AnyTO;
 import org.apache.syncope.common.lib.to.GroupTO;
@@ -344,6 +348,33 @@ public class JPAAnyUtils implements AnyUtils {
     }
 
     @Override
+    public <P extends AnyPatch> P newAnyPatch(final String key) {
+        P result = null;
+
+        switch (anyTypeKind) {
+            case USER:
+                result = (P) new UserPatch();
+                break;
+
+            case GROUP:
+                result = (P) new GroupPatch();
+                break;
+
+            case ANY_OBJECT:
+                result = (P) new AnyObjectPatch();
+                break;
+
+            default:
+        }
+
+        if (result != null) {
+            result.setKey(key);
+        }
+
+        return result;
+    }
+
+    @Override
     public <A extends Any<?>> AnyDAO<A> dao() {
         AnyDAO<A> result = null;
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
index 8de177e..0ec1538 100644
--- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/JPAEntityFactory.java
@@ -131,12 +131,14 @@ import org.apache.syncope.core.persistence.api.entity.DynRealmMembership;
 import org.apache.syncope.core.persistence.api.entity.Implementation;
 import org.apache.syncope.core.persistence.api.entity.Privilege;
 import org.apache.syncope.core.persistence.api.entity.Remediation;
-import org.apache.syncope.core.persistence.api.entity.policy.CorrelationRule;
 import org.apache.syncope.core.persistence.api.entity.resource.ExternalResourceHistoryConf;
 import org.apache.syncope.core.persistence.api.entity.resource.OrgUnitItem;
-import org.apache.syncope.core.persistence.jpa.entity.policy.JPACorrelationRule;
+import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPullCorrelationRuleEntity;
 import org.apache.syncope.core.persistence.jpa.entity.resource.JPAExternalResourceHistoryConf;
 import org.apache.syncope.core.persistence.jpa.entity.resource.JPAOrgUnitItem;
+import org.apache.syncope.core.persistence.api.entity.policy.PullCorrelationRuleEntity;
+import org.apache.syncope.core.persistence.api.entity.policy.PushCorrelationRuleEntity;
+import org.apache.syncope.core.persistence.jpa.entity.policy.JPAPushCorrelationRuleEntity;
 
 @Component
 public class JPAEntityFactory implements EntityFactory {
@@ -164,8 +166,10 @@ public class JPAEntityFactory implements EntityFactory {
             result = (E) new JPAPushPolicy();
         } else if (reference.equals(PullPolicy.class)) {
             result = (E) new JPAPullPolicy();
-        } else if (reference.equals(CorrelationRule.class)) {
-            result = (E) new JPACorrelationRule();
+        } else if (reference.equals(PullCorrelationRuleEntity.class)) {
+            result = (E) new JPAPullCorrelationRuleEntity();
+        } else if (reference.equals(PushCorrelationRuleEntity.class)) {
+            result = (E) new JPAPushCorrelationRuleEntity();
         } else if (reference.equals(AnyTypeClass.class)) {
             result = (E) new JPAAnyTypeClass();
         } else if (reference.equals(AnyType.class)) {

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/AbstractCorrelationRuleEntity.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/AbstractCorrelationRuleEntity.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/AbstractCorrelationRuleEntity.java
new file mode 100644
index 0000000..93b457b
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/AbstractCorrelationRuleEntity.java
@@ -0,0 +1,66 @@
+/*
+ * 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.persistence.jpa.entity.policy;
+
+import javax.persistence.ManyToOne;
+import javax.persistence.MappedSuperclass;
+import org.apache.syncope.common.lib.types.ImplementationType;
+import org.apache.syncope.core.persistence.api.entity.AnyType;
+import org.apache.syncope.core.persistence.api.entity.Implementation;
+import org.apache.syncope.core.persistence.api.entity.policy.CorrelationRuleEntity;
+import org.apache.syncope.core.persistence.jpa.entity.AbstractGeneratedKeyEntity;
+import org.apache.syncope.core.persistence.jpa.entity.JPAAnyType;
+import org.apache.syncope.core.persistence.jpa.entity.JPAImplementation;
+
+@MappedSuperclass
+abstract class AbstractCorrelationRuleEntity extends AbstractGeneratedKeyEntity implements CorrelationRuleEntity {
+
+    private static final long serialVersionUID = 4017405130146577834L;
+
+    @ManyToOne(optional = false)
+    private JPAAnyType anyType;
+
+    @ManyToOne(optional = false)
+    private JPAImplementation implementation;
+
+    @Override
+    public AnyType getAnyType() {
+        return anyType;
+    }
+
+    @Override
+    public void setAnyType(final AnyType anyType) {
+        checkType(anyType, JPAAnyType.class);
+        this.anyType = (JPAAnyType) anyType;
+    }
+
+    @Override
+    public Implementation getImplementation() {
+        return implementation;
+    }
+
+    protected abstract ImplementationType getImplementationType();
+
+    @Override
+    public void setImplementation(final Implementation implementation) {
+        checkType(implementation, JPAImplementation.class);
+        checkImplementationType(implementation, getImplementationType());
+        this.implementation = (JPAImplementation) implementation;
+    }
+}

http://git-wip-us.apache.org/repos/asf/syncope/blob/595a8d15/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/AbstractProvisioningPolicy.java
----------------------------------------------------------------------
diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/AbstractProvisioningPolicy.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/AbstractProvisioningPolicy.java
new file mode 100644
index 0000000..ffdb008
--- /dev/null
+++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/policy/AbstractProvisioningPolicy.java
@@ -0,0 +1,46 @@
+/*
+ * 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.persistence.jpa.entity.policy;
+
+import javax.persistence.EnumType;
+import javax.persistence.Enumerated;
+import javax.persistence.MappedSuperclass;
+import javax.validation.constraints.NotNull;
+import org.apache.syncope.common.lib.types.ConflictResolutionAction;
+import org.apache.syncope.core.persistence.api.entity.policy.ProvisioningPolicy;
+
+@MappedSuperclass
+abstract class AbstractProvisioningPolicy extends AbstractPolicy implements ProvisioningPolicy {
+
+    private static final long serialVersionUID = 3804545832315575686L;
+
+    @Enumerated(EnumType.STRING)
+    @NotNull
+    private ConflictResolutionAction conflictResolutionAction;
+
+    @Override
+    public ConflictResolutionAction getConflictResolutionAction() {
+        return conflictResolutionAction;
+    }
+
+    @Override
+    public void setConflictResolutionAction(final ConflictResolutionAction conflictResolutionAction) {
+        this.conflictResolutionAction = conflictResolutionAction;
+    }
+}