From bee032cb0531ab12f2b964d2fe0e47f5719c7043 Mon Sep 17 00:00:00 2001 From: Oana Nechiforescu Date: Tue, 26 Sep 2017 14:50:28 +0300 Subject: [PATCH 1/2] First commit just the test and new API empty trashcan method. --- .../org/alfresco/rest/v0/UserTrashcanAPI.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/UserTrashcanAPI.java diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/UserTrashcanAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/UserTrashcanAPI.java new file mode 100644 index 0000000000..7179ea71c2 --- /dev/null +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/UserTrashcanAPI.java @@ -0,0 +1,56 @@ +/* + * #%L + * Alfresco Records Management Module + * %% + * Copyright (C) 2005 - 2017 Alfresco Software Limited + * %% + * This file is part of the Alfresco software. + * - + * If the software was purchased under a paid Alfresco license, the terms of + * the paid license agreement will prevail. Otherwise, the software is + * provided under the following open source license terms: + * - + * Alfresco is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * - + * Alfresco is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * - + * You should have received a copy of the GNU Lesser General Public License + * along with Alfresco. If not, see . + * #L% + */ +package org.alfresco.rest.v0; + +import org.alfresco.rest.core.v0.BaseAPI; +import org.springframework.stereotype.Component; + +/** + * Helper methods for performing actions on user trashcan + * + * @author Oana Nechiforescu + * @since 2.6 + */ +@Component +public class UserTrashcanAPI extends BaseAPI +{ + private static final String EMPTY_TRASHCAN = "{0}archive/workspace/SpacesStore"; + + /** + * Clears the trashcan for the current user + * + * @param username the username + * @param password the password + * + * @return true if the request succeeded, false if not + */ + public boolean emptyTrashcan(String username, String password) + { + return doDeleteRequest(username, password, EMPTY_TRASHCAN) != null; + } + +} From 6af7609e7eb10574fad1fcb6ba56d47bd3acc03c Mon Sep 17 00:00:00 2001 From: Oana Nechiforescu Date: Tue, 26 Sep 2017 14:51:13 +0300 Subject: [PATCH 2/2] Commit 2, test changes to use the new API method. --- .../src/main/java/org/alfresco/rest/v0/SearchAPI.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java index 7bcfff7d48..176b51d2d8 100644 --- a/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java +++ b/rm-automation/rm-automation-community-rest-api/src/main/java/org/alfresco/rest/v0/SearchAPI.java @@ -50,7 +50,8 @@ import org.springframework.stereotype.Component; public class SearchAPI extends BaseAPI { /** http client factory */ - @Autowired private AlfrescoHttpClientFactory alfrescoHttpClientFactory; + @Autowired + private AlfrescoHttpClientFactory alfrescoHttpClientFactory; /** faceted search API endpoint */ private static final String FACETED_SEARCH_ENDPOINT = "{0}alfresco/s/slingshot/rmsearch/faceted/rmsearch?{1}";