syncope-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ilgro...@apache.org
Subject [2/3] syncope git commit: [SYNCOPE-1299] Small cleanup
Date Wed, 18 Apr 2018 08:50:19 GMT
[SYNCOPE-1299] Small cleanup


Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/8e7bf8a4
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/8e7bf8a4
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/8e7bf8a4

Branch: refs/heads/master
Commit: 8e7bf8a499609c9b9c12119e90258c41f65f46eb
Parents: 4da5dcc
Author: Francesco Chicchiriccò <ilgrosso@apache.org>
Authored: Wed Apr 18 10:21:26 2018 +0200
Committer: Francesco Chicchiriccò <ilgrosso@apache.org>
Committed: Wed Apr 18 10:26:37 2018 +0200

----------------------------------------------------------------------
 .../client/console/commons/status/StatusUtils.java     |  5 +++--
 .../client/console/status/AnyStatusDirectoryPanel.java |  5 +++--
 .../client/console/status/ReconStatusPanel.java        |  6 ++++--
 .../client/console/wizards/any/StatusPanel.java        |  4 ++--
 .../org/apache/syncope/common/lib/to/ReconStatus.java  | 13 +------------
 .../apache/syncope/core/logic/ReconciliationLogic.java |  1 -
 6 files changed, 13 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/syncope/blob/8e7bf8a4/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusUtils.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusUtils.java
b/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusUtils.java
index 7ba310e..85df442 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusUtils.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/commons/status/StatusUtils.java
@@ -25,6 +25,7 @@ import java.util.Objects;
 import java.util.Optional;
 import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.client.console.commons.ConnIdSpecialName;
 import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.panels.LabelPanel;
@@ -52,12 +53,12 @@ public final class StatusUtils implements Serializable {
 
     private static final ReconciliationRestClient RECONCILIATION_REST_CLIENT = new ReconciliationRestClient();
 
-    public static List<ReconStatus> getReconStatuses(
+    public static List<Pair<String, ReconStatus>> getReconStatuses(
             final AnyTypeKind anyTypeKind, final String anyKey, final Collection<String>
resources) {
 
         return resources.stream().map(resource -> {
             try {
-                return RECONCILIATION_REST_CLIENT.status(anyTypeKind, anyKey, resource);
+                return Pair.of(resource, RECONCILIATION_REST_CLIENT.status(anyTypeKind, anyKey,
resource));
             } catch (Exception e) {
                 LOG.warn("Unexpected error for {} {} on {}", anyTypeKind, anyKey, resource,
e);
                 return null;

http://git-wip-us.apache.org/repos/asf/syncope/blob/8e7bf8a4/client/console/src/main/java/org/apache/syncope/client/console/status/AnyStatusDirectoryPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/status/AnyStatusDirectoryPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/status/AnyStatusDirectoryPanel.java
index f39e823..bd54f00 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/status/AnyStatusDirectoryPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/status/AnyStatusDirectoryPanel.java
@@ -25,6 +25,7 @@ import java.util.Collections;
 import java.util.List;
 import java.util.stream.Collectors;
 import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.tuple.Pair;
 import org.apache.syncope.client.console.commons.Constants;
 import org.apache.syncope.client.console.commons.DirectoryDataProvider;
 import org.apache.syncope.client.console.commons.status.AbstractStatusBeanProvider;
@@ -286,7 +287,7 @@ public class AnyStatusDirectoryPanel
             final AnyTO actual = restClient.read(anyTO.getKey());
 
             List<StatusBean> statusBeans = actual.getResources().stream().map(resource
-> {
-                List<ReconStatus> statuses = Collections.emptyList();
+                List<Pair<String, ReconStatus>> statuses = Collections.emptyList();
                 if (statusOnly) {
                     statuses = StatusUtils.
                             getReconStatuses(anyTypeKind, anyTO.getKey(), Arrays.asList(resource));
@@ -295,7 +296,7 @@ public class AnyStatusDirectoryPanel
                 return StatusUtils.getStatusBean(
                         actual,
                         resource,
-                        statuses.isEmpty() ? null : statuses.get(0).getOnResource(),
+                        statuses.isEmpty() ? null : statuses.get(0).getRight().getOnResource(),
                         actual instanceof GroupTO);
             }).collect(Collectors.toList());
 

http://git-wip-us.apache.org/repos/asf/syncope/blob/8e7bf8a4/client/console/src/main/java/org/apache/syncope/client/console/status/ReconStatusPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/status/ReconStatusPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/status/ReconStatusPanel.java
index 91dc9ac..2f05ce7 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/status/ReconStatusPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/status/ReconStatusPanel.java
@@ -60,9 +60,11 @@ public class ReconStatusPanel extends RemoteObjectPanel {
 
     @Override
     protected Pair<ConnObjectTO, ConnObjectTO> getConnObjectTOs() {
-        List<ReconStatus> statuses =
+        List<Pair<String, ReconStatus>> statuses =
                 StatusUtils.getReconStatuses(anyTypeKind, anyKey, Arrays.asList(resource));
 
-        return statuses.isEmpty() ? null : Pair.of(statuses.get(0).getOnSyncope(), statuses.get(0).getOnResource());
+        return statuses.isEmpty()
+                ? null
+                : Pair.of(statuses.get(0).getRight().getOnSyncope(), statuses.get(0).getRight().getOnResource());
     }
 }

http://git-wip-us.apache.org/repos/asf/syncope/blob/8e7bf8a4/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/StatusPanel.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/StatusPanel.java
b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/StatusPanel.java
index 93a338a..41ba1e3 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/StatusPanel.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/StatusPanel.java
@@ -72,8 +72,8 @@ public class StatusPanel extends Panel {
         init(any, model, StatusUtils.getReconStatuses(
                 AnyTypeKind.fromTOClass(any.getClass()), any.getKey(), any.getResources()).stream().
                 map(status -> Triple.<ConnObjectTO, ConnObjectWrapper, String>of(
-                status.getOnSyncope(),
-                new ConnObjectWrapper(any, status.getResource(), status.getOnResource()),
+                status.getRight().getOnSyncope(),
+                new ConnObjectWrapper(any, status.getLeft(), status.getRight().getOnResource()),
                 null)).
                 collect(Collectors.toList()), pageRef, false);
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/8e7bf8a4/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReconStatus.java
----------------------------------------------------------------------
diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReconStatus.java b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReconStatus.java
index de48cac..da601c0 100644
--- a/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReconStatus.java
+++ b/common/lib/src/main/java/org/apache/syncope/common/lib/to/ReconStatus.java
@@ -26,28 +26,17 @@ import javax.xml.bind.annotation.XmlType;
 /**
  * Reconciliation status.
  */
-@XmlRootElement(name = "reconciliationStatus")
+@XmlRootElement(name = "reconStatus")
 @XmlType
 public class ReconStatus extends AbstractBaseBean {
 
     private static final long serialVersionUID = -8516345256596521490L;
 
-    private String resource;
-
     private ConnObjectTO onSyncope;
 
     private ConnObjectTO onResource;
 
     @Schema(accessMode = Schema.AccessMode.READ_ONLY)
-    public String getResource() {
-        return resource;
-    }
-
-    public void setResource(final String resource) {
-        this.resource = resource;
-    }
-
-    @Schema(accessMode = Schema.AccessMode.READ_ONLY)
     public ConnObjectTO getOnSyncope() {
         return onSyncope;
     }

http://git-wip-us.apache.org/repos/asf/syncope/blob/8e7bf8a4/core/logic/src/main/java/org/apache/syncope/core/logic/ReconciliationLogic.java
----------------------------------------------------------------------
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 d2315c5..88adeaa 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
@@ -171,7 +171,6 @@ public class ReconciliationLogic extends AbstractTransactionalLogic<AbstractBase
         Pair<Any<?>, Provision> init = init(anyTypeKind, anyKey, resourceKey);
 
         ReconStatus status = new ReconStatus();
-        status.setResource(resourceKey);
         status.setOnSyncope(getOnSyncope(init.getLeft(), init.getRight(), resourceKey));
         status.setOnResource(getOnResource(init.getLeft(), init.getRight()));
 


Mime
View raw message