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 2016/10/03 15:10:31 UTC
[4/8] syncope git commit: Cleaning up unused bulk REST endpoints +
adding notes about bulk operations into the reference guide
Cleaning up unused bulk REST endpoints + adding notes about bulk operations into the reference guide
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/d8a5918b
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/d8a5918b
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/d8a5918b
Branch: refs/heads/2_0_X
Commit: d8a5918bbe9d89049d6fa38b48cec3728603e1c0
Parents: 6e341c8
Author: Francesco Chicchiricc� <il...@apache.org>
Authored: Mon Oct 3 17:09:32 2016 +0200
Committer: Francesco Chicchiricc� <il...@apache.org>
Committed: Mon Oct 3 17:09:32 2016 +0200
----------------------------------------------------------------------
.../console/rest/ConnectorRestClient.java | 6 ---
.../client/console/rest/ResourceRestClient.java | 5 ---
.../rest/api/service/ConnectorService.java | 14 ------
.../rest/api/service/ResourceService.java | 13 ------
.../rest/cxf/service/ConnectorServiceImpl.java | 20 ---------
.../rest/cxf/service/ResourceServiceImpl.java | 19 ---------
.../syncope/fit/core/ConnectorITCase.java | 45 --------------------
.../apache/syncope/fit/core/ResourceITCase.java | 30 -------------
.../restfulservices.adoc | 31 ++++++++++++++
9 files changed, 31 insertions(+), 152 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/d8a5918b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
index f6df407..e506a77 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ConnectorRestClient.java
@@ -29,8 +29,6 @@ import org.apache.commons.collections4.Predicate;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.BulkAction;
-import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnBundleTO;
import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
@@ -187,8 +185,4 @@ public class ConnectorRestClient extends BaseRestClient {
public void reload() {
getService(ConnectorService.class).reload();
}
-
- public BulkActionResult bulkAction(final BulkAction action) {
- return getService(ConnectorService.class).bulk(action);
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d8a5918b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
----------------------------------------------------------------------
diff --git a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
index b6b8db2..46e7d3e 100644
--- a/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
+++ b/client/console/src/main/java/org/apache/syncope/client/console/rest/ResourceRestClient.java
@@ -26,7 +26,6 @@ import javax.ws.rs.core.Response;
import org.apache.commons.collections4.ComparatorUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.patch.ResourceDeassociationPatch;
-import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.PagedConnObjectTOResult;
@@ -118,10 +117,6 @@ public class ResourceRestClient extends BaseRestClient {
getService(ResourceService.class).delete(name);
}
- public BulkActionResult bulkAction(final BulkAction action) {
- return getService(ResourceService.class).bulk(action);
- }
-
public BulkActionResult bulkAssociationAction(
final String resourceName, final String anyTypeName,
final ResourceDeassociationAction action, final List<String> anyKeys) {
http://git-wip-us.apache.org/repos/asf/syncope/blob/d8a5918b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
index d080648..4c63bd2 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ConnectorService.java
@@ -32,8 +32,6 @@ import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.to.BulkAction;
-import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnBundleTO;
import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
@@ -156,16 +154,4 @@ public interface ConnectorService extends JAXRSService {
@POST
@Path("reload")
void reload();
-
- /**
- * Executes the provided bulk action.
- *
- * @param bulkAction list of connector instance keys against which the bulk action will be performed.
- * @return Bulk action result
- */
- @POST
- @Path("bulk")
- @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
- @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
- BulkActionResult bulk(@NotNull BulkAction bulkAction);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d8a5918b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
----------------------------------------------------------------------
diff --git a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
index 0de2619..1ec1f4f 100644
--- a/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
+++ b/common/rest-api/src/main/java/org/apache/syncope/common/rest/api/service/ResourceService.java
@@ -32,7 +32,6 @@ import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.syncope.common.lib.patch.ResourceDeassociationPatch;
-import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.PagedConnObjectTOResult;
@@ -171,16 +170,4 @@ public interface ResourceService extends JAXRSService {
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
BulkActionResult bulkDeassociation(@NotNull ResourceDeassociationPatch patch);
-
- /**
- * Executes the provided bulk action.
- *
- * @param bulkAction list of resource names against which the bulk action will be performed
- * @return Bulk action result
- */
- @POST
- @Path("bulk")
- @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
- @Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
- BulkActionResult bulk(@NotNull BulkAction bulkAction);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d8a5918b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
----------------------------------------------------------------------
diff --git a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
index a5ebee1..7d1b849 100644
--- a/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
+++ b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ConnectorServiceImpl.java
@@ -21,8 +21,6 @@ package org.apache.syncope.core.rest.cxf.service;
import java.net.URI;
import java.util.List;
import javax.ws.rs.core.Response;
-import org.apache.syncope.common.lib.to.BulkAction;
-import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnBundleTO;
import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
@@ -93,22 +91,4 @@ public class ConnectorServiceImpl extends AbstractServiceImpl implements Connect
public void reload() {
logic.reload();
}
-
- @Override
- public BulkActionResult bulk(final BulkAction bulkAction) {
- BulkActionResult result = new BulkActionResult();
-
- if (bulkAction.getType() == BulkAction.Type.DELETE) {
- for (String key : bulkAction.getTargets()) {
- try {
- result.getResults().put(logic.delete(key).getKey(), BulkActionResult.Status.SUCCESS);
- } catch (Exception e) {
- LOG.error("Error performing delete for connector {}", key, e);
- result.getResults().put(key, BulkActionResult.Status.FAILURE);
- }
- }
- }
-
- return result;
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d8a5918b/core/rest-cxf/src/main/java/org/apache/syncope/core/rest/cxf/service/ResourceServiceImpl.java
----------------------------------------------------------------------
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 2bfba5a..ed0df7c 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
@@ -30,7 +30,6 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.common.lib.patch.ResourceDeassociationPatch;
import org.apache.syncope.common.lib.to.AnyTO;
-import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.BulkActionResult;
import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.PagedConnObjectTOResult;
@@ -181,22 +180,4 @@ public class ResourceServiceImpl extends AbstractServiceImpl implements Resource
return result;
}
-
- @Override
- public BulkActionResult bulk(final BulkAction bulkAction) {
- BulkActionResult result = new BulkActionResult();
-
- if (bulkAction.getType() == BulkAction.Type.DELETE) {
- for (String key : bulkAction.getTargets()) {
- try {
- result.getResults().put(logic.delete(key).getKey(), BulkActionResult.Status.SUCCESS);
- } catch (Exception e) {
- LOG.error("Error performing delete for resource {}", key, e);
- result.getResults().put(key, BulkActionResult.Status.FAILURE);
- }
- }
- }
-
- return result;
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/d8a5918b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java
index cfc2cd1..45616f8 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ConnectorITCase.java
@@ -31,7 +31,6 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.EnumSet;
import java.util.HashSet;
-import java.util.Iterator;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@@ -44,7 +43,6 @@ import org.apache.commons.collections4.Transformer;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.syncope.common.lib.SyncopeClientException;
-import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.ConnBundleTO;
import org.apache.syncope.common.lib.to.ConnIdObjectClassTO;
import org.apache.syncope.common.lib.to.ConnInstanceTO;
@@ -695,49 +693,6 @@ public class ConnectorITCase extends AbstractITCase {
}
@Test
- public void bulkAction() {
- BulkAction bulkAction = new BulkAction();
- bulkAction.setType(BulkAction.Type.DELETE);
-
- ConnInstanceTO conn = connectorService.read(
- "5aa5b8be-7521-481a-9651-c557aea078c1", Locale.ENGLISH.getLanguage());
-
- conn.setKey(null);
- conn.setDisplayName("forBulk1");
-
- bulkAction.getTargets().add(String.valueOf(getObject(
- connectorService.create(conn).getLocation(), ConnectorService.class, ConnInstanceTO.class).getKey()));
-
- conn.setDisplayName("forBulk2");
-
- bulkAction.getTargets().add(String.valueOf(getObject(
- connectorService.create(conn).getLocation(), ConnectorService.class, ConnInstanceTO.class).getKey()));
-
- Iterator<String> itor = bulkAction.getTargets().iterator();
-
- assertNotNull(connectorService.read(itor.next(), Locale.ENGLISH.getLanguage()));
- assertNotNull(connectorService.read(itor.next(), Locale.ENGLISH.getLanguage()));
-
- connectorService.bulk(bulkAction);
-
- itor = bulkAction.getTargets().iterator();
-
- try {
- connectorService.read(itor.next(), Locale.ENGLISH.getLanguage());
- fail();
- } catch (SyncopeClientException e) {
- assertNotNull(e);
- }
-
- try {
- connectorService.read(itor.next(), Locale.ENGLISH.getLanguage());
- fail();
- } catch (SyncopeClientException e) {
- assertNotNull(e);
- }
- }
-
- @Test
public void issueSYNCOPE605() {
ConnInstanceTO connectorInstanceTO = connectorService.read(
"fcf9f2b0-f7d6-42c9-84a6-61b28255a42b", Locale.ENGLISH.getLanguage());
http://git-wip-us.apache.org/repos/asf/syncope/blob/d8a5918b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java
----------------------------------------------------------------------
diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java
index c2d23b8..ca568da 100644
--- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java
+++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/ResourceITCase.java
@@ -37,7 +37,6 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.Transformer;
import org.apache.syncope.common.lib.SyncopeClientException;
import org.apache.syncope.common.lib.to.AnyObjectTO;
-import org.apache.syncope.common.lib.to.BulkAction;
import org.apache.syncope.common.lib.to.ConnObjectTO;
import org.apache.syncope.common.lib.to.GroupTO;
import org.apache.syncope.common.lib.to.MappingItemTO;
@@ -520,35 +519,6 @@ public class ResourceITCase extends AbstractITCase {
}
@Test
- public void bulkAction() {
- resourceService.create(buildResourceTO("forBulk1"));
- resourceService.create(buildResourceTO("forBulk2"));
-
- assertNotNull(resourceService.read("forBulk1"));
- assertNotNull(resourceService.read("forBulk2"));
-
- final BulkAction bulkAction = new BulkAction();
- bulkAction.setType(BulkAction.Type.DELETE);
-
- bulkAction.getTargets().add(String.valueOf("forBulk1"));
- bulkAction.getTargets().add(String.valueOf("forBulk2"));
-
- resourceService.bulk(bulkAction);
-
- try {
- resourceService.read("forBulk1");
- fail();
- } catch (SyncopeClientException e) {
- }
-
- try {
- resourceService.read("forBulk2");
- fail();
- } catch (SyncopeClientException e) {
- }
- }
-
- @Test
public void anonymous() {
ResourceService unauthenticated = clientFactory.create().getService(ResourceService.class);
try {
http://git-wip-us.apache.org/repos/asf/syncope/blob/d8a5918b/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc
----------------------------------------------------------------------
diff --git a/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc b/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc
index 816b912..9663cdb 100644
--- a/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc
+++ b/src/main/asciidoc/reference-guide/workingwithapachesyncope/restfulservices.adoc
@@ -111,6 +111,37 @@ Groups and Any Objects operations.
When invoking the REST endpoint `/users/self` in `GET`, the `X-Syncope-Entitlements` response header will list all
the <<entitlements,entitlements>> owned by the requesting user.
+==== Bulk Operations
+
+Some REST endpoints feature the _bulk mode_, e.g. the capability to perform a given operation onto several items at the
+same time.
+
+The table below shows the bulk operations available.
+
+[cols="1,5a"]
+|===
+
+|Any Objects
+| * `DELETE` - remove several any objects at once
+
+|Groups
+| * `PROVISION` - provision all members of the given group onto all the associated external resources
+ * `DEPROVISION` - deprovision all members of the given group from all the associated external resources
+ * `DELETE` - remove several groups at once
+
+|Users
+| * `SUSPEND` - suspend several users at once
+* `REACTIVATE` - set several users at once back to the active state
+* `MUSTCHANGEPASSWORD` - force several users at once to change their passwords
+* `DELETE` - remove several users at once
+
+| Tasks
+| * `DRYRUN` - executes several tasks at once, with the <<dryrun>> option set
+* `EXECUTE` - executes several tasks at once
+* `DELETE` - remove several tasks at once
+
+|===
+
==== Client Library
The Java client library simplifies the interaction with the <<core>> by hiding the underlying HTTP