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 2020/08/21 15:34:48 UTC

[syncope] branch 2_1_X updated (75d2064 -> d170b05)

This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a change to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git.


    from 75d2064  [SYNCOPE-1575] For suspend / reactivate, pass PropagationByResource instance from workflow execution back to ProvisioningManager
     new 1bcaff5  Upgrading PDFBox
     new d170b05  Small improvement: allow to specify more attrs to get when reading from External Resources

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../common/rest/api/beans/ConnObjectTOQuery.java   | 35 +++++++++++++++++++
 .../syncope/common/rest/api/beans/ReconQuery.java  | 40 +++++++++++++++++++++-
 .../syncope/core/logic/ReconciliationLogic.java    |  7 +++-
 .../core/rest/cxf/service/ResourceServiceImpl.java |  9 +++--
 pom.xml                                            |  2 +-
 5 files changed, 87 insertions(+), 6 deletions(-)


[syncope] 02/02: Small improvement: allow to specify more attrs to get when reading from External Resources

Posted by il...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit d170b0574e10339b2e48a104c47d0ca1fca35509
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Fri Aug 21 17:32:56 2020 +0200

    Small improvement: allow to specify more attrs to get when reading from External Resources
---
 .../common/rest/api/beans/ConnObjectTOQuery.java   | 35 +++++++++++++++++++
 .../syncope/common/rest/api/beans/ReconQuery.java  | 40 +++++++++++++++++++++-
 .../syncope/core/logic/ReconciliationLogic.java    |  7 +++-
 .../core/rest/cxf/service/ResourceServiceImpl.java |  9 +++--
 4 files changed, 86 insertions(+), 5 deletions(-)

diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOQuery.java
index db874ce..dd86b2f 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOQuery.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ConnObjectTOQuery.java
@@ -19,6 +19,12 @@
 package org.apache.syncope.common.rest.api.beans;
 
 import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import javax.validation.constraints.Max;
 import javax.validation.constraints.Min;
 import javax.ws.rs.DefaultValue;
@@ -55,6 +61,24 @@ public class ConnObjectTOQuery implements Serializable {
             return this;
         }
 
+        public Builder moreAttrsToGet(final String... moreAttrsToGet) {
+            if (moreAttrsToGet != null) {
+                Set<String> matg = Optional.ofNullable(instance.getMoreAttrsToGet()).orElseGet(() -> new HashSet<>());
+                matg.addAll(Stream.of(moreAttrsToGet).collect(Collectors.toSet()));
+                instance.setMoreAttrsToGet(matg);
+            }
+            return this;
+        }
+
+        public Builder moreAttrsToGet(final Collection<String> moreAttrsToGet) {
+            if (moreAttrsToGet != null) {
+                Set<String> matg = Optional.ofNullable(instance.getMoreAttrsToGet()).orElseGet(() -> new HashSet<>());
+                matg.addAll(moreAttrsToGet);
+                instance.setMoreAttrsToGet(matg);
+            }
+            return this;
+        }
+
         public ConnObjectTOQuery build() {
             return instance;
         }
@@ -68,6 +92,8 @@ public class ConnObjectTOQuery implements Serializable {
 
     private String fiql;
 
+    private Set<String> moreAttrsToGet;
+
     public Integer getSize() {
         return size == null
                 ? 25
@@ -110,4 +136,13 @@ public class ConnObjectTOQuery implements Serializable {
     public void setFiql(final String fiql) {
         this.fiql = fiql;
     }
+
+    public Set<String> getMoreAttrsToGet() {
+        return moreAttrsToGet;
+    }
+
+    @QueryParam("moreAttrsToGet")
+    public void setMoreAttrsToGet(final Set<String> moreAttrsToGet) {
+        this.moreAttrsToGet = moreAttrsToGet;
+    }
 }
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ReconQuery.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ReconQuery.java
index c4b91d5..bc44695 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ReconQuery.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/beans/ReconQuery.java
@@ -18,11 +18,20 @@
  */
 package org.apache.syncope.common.rest.api.beans;
 
+import java.io.Serializable;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import javax.validation.constraints.NotNull;
 import javax.ws.rs.QueryParam;
 import org.apache.syncope.common.rest.api.service.JAXRSService;
 
-public class ReconQuery {
+public class ReconQuery implements Serializable {
+
+    private static final long serialVersionUID = 8330786326713860657L;
 
     public static class Builder {
 
@@ -44,6 +53,24 @@ public class ReconQuery {
             return this;
         }
 
+        public Builder moreAttrsToGet(final String... moreAttrsToGet) {
+            if (moreAttrsToGet != null) {
+                Set<String> matg = Optional.ofNullable(instance.getMoreAttrsToGet()).orElseGet(() -> new HashSet<>());
+                matg.addAll(Stream.of(moreAttrsToGet).collect(Collectors.toSet()));
+                instance.setMoreAttrsToGet(matg);
+            }
+            return this;
+        }
+
+        public Builder moreAttrsToGet(final Collection<String> moreAttrsToGet) {
+            if (moreAttrsToGet != null) {
+                Set<String> matg = Optional.ofNullable(instance.getMoreAttrsToGet()).orElseGet(() -> new HashSet<>());
+                matg.addAll(moreAttrsToGet);
+                instance.setMoreAttrsToGet(matg);
+            }
+            return this;
+        }
+
         public ReconQuery build() {
             return instance;
         }
@@ -57,6 +84,8 @@ public class ReconQuery {
 
     private String connObjectKeyValue;
 
+    private Set<String> moreAttrsToGet;
+
     public String getAnyTypeKey() {
         return anyTypeKey;
     }
@@ -94,4 +123,13 @@ public class ReconQuery {
     public void setConnObjectKeyValue(final String connObjectKeyValue) {
         this.connObjectKeyValue = connObjectKeyValue;
     }
+
+    public Set<String> getMoreAttrsToGet() {
+        return moreAttrsToGet;
+    }
+
+    @QueryParam("moreAttrsToGet")
+    public void setMoreAttrsToGet(final Set<String> moreAttrsToGet) {
+        this.moreAttrsToGet = moreAttrsToGet;
+    }
 }
diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ReconciliationLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ReconciliationLogic.java
index f0739b5..50daf7f 100644
--- a/core/logic/src/main/java/org/apache/syncope/core/logic/ReconciliationLogic.java
+++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ReconciliationLogic.java
@@ -82,6 +82,7 @@ import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
 import org.apache.syncope.core.provisioning.api.pushpull.stream.SyncopeStreamPullExecutor;
 import org.apache.syncope.core.provisioning.api.pushpull.stream.SyncopeStreamPushExecutor;
 import org.apache.syncope.core.provisioning.api.utils.RealmUtils;
@@ -235,12 +236,16 @@ public class ReconciliationLogic extends AbstractTransactionalLogic<EntityTO> {
                         }
                     });
 
+            Optional<String[]> moreAttrsToGet = CollectionUtils.isEmpty(query.getMoreAttrsToGet())
+                    ? Optional.empty()
+                    : Optional.of(query.getMoreAttrsToGet().toArray(new String[0]));
+
             outboundMatcher.matchByConnObjectKeyValue(
                     connFactory.getConnector(provision.getResource()),
                     connObjectKeyItem,
                     query.getConnObjectKeyValue(),
                     provision,
-                    Optional.empty(),
+                    moreAttrsToGet,
                     Optional.empty()).
                     ifPresent(connObj -> {
                         status.setOnResource(ConnObjectUtils.getConnObjectTO(connObj.getAttributes()));
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
index 5197c82..9b80531 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
@@ -19,7 +19,7 @@
 package org.apache.syncope.core.rest.cxf.service;
 
 import java.net.URI;
-import java.util.Collections;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -110,7 +110,10 @@ public class ResourceServiceImpl extends AbstractServiceImpl implements Resource
             final String key, final String anyTypeKey, final ConnObjectTOQuery query) {
 
         Filter filter = null;
-        Set<String> moreAttrsToGet = Collections.emptySet();
+        Set<String> moreAttrsToGet = new HashSet<>();
+        if (query.getMoreAttrsToGet() != null) {
+            moreAttrsToGet.addAll(query.getMoreAttrsToGet());
+        }
         if (StringUtils.isNotBlank(query.getFiql())) {
             try {
                 FilterVisitor visitor = new FilterVisitor();
@@ -118,7 +121,7 @@ public class ResourceServiceImpl extends AbstractServiceImpl implements Resource
                 sc.accept(visitor);
 
                 filter = visitor.getQuery();
-                moreAttrsToGet = visitor.getAttrs();
+                moreAttrsToGet.addAll(visitor.getAttrs());
             } catch (Exception e) {
                 LOG.error("Invalid FIQL expression: {}", query.getFiql(), e);
 


[syncope] 01/02: Upgrading PDFBox

Posted by il...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ilgrosso pushed a commit to branch 2_1_X
in repository https://gitbox.apache.org/repos/asf/syncope.git

commit 1bcaff59881eb62a40af603d22cf3a5f3d275333
Author: Francesco Chicchiriccò <il...@apache.org>
AuthorDate: Fri Aug 21 17:14:21 2020 +0200

    Upgrading PDFBox
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index f848cce..2b22466 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1398,7 +1398,7 @@ under the License.
       <dependency>
         <groupId>org.apache.pdfbox</groupId>
         <artifactId>pdfbox</artifactId>
-        <version>2.0.20</version>
+        <version>2.0.21</version>
       </dependency>
       
       <dependency>