mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
122594 jvonka: REST api fwk: pass through query params for DELETE method - also update REST api test fwk RA-837 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@126483 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -37,6 +37,7 @@ public class ResourceWebScriptDelete extends AbstractResourceWebScript implement
|
|||||||
{
|
{
|
||||||
String entityId = req.getServiceMatch().getTemplateVars().get(ResourceLocator.ENTITY_ID);
|
String entityId = req.getServiceMatch().getTemplateVars().get(ResourceLocator.ENTITY_ID);
|
||||||
String relationshipId = req.getServiceMatch().getTemplateVars().get(ResourceLocator.RELATIONSHIP_ID);
|
String relationshipId = req.getServiceMatch().getTemplateVars().get(ResourceLocator.RELATIONSHIP_ID);
|
||||||
|
final Params.RecognizedParams params = ResourceWebScriptHelper.getRecognizedParams(req);
|
||||||
|
|
||||||
switch (resourceMeta.getType())
|
switch (resourceMeta.getType())
|
||||||
{
|
{
|
||||||
@@ -47,7 +48,7 @@ public class ResourceWebScriptDelete extends AbstractResourceWebScript implement
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Params.valueOf(entityId, relationshipId, req);
|
return Params.valueOf(params, entityId, relationshipId, req);
|
||||||
|
|
||||||
}
|
}
|
||||||
case RELATIONSHIP:
|
case RELATIONSHIP:
|
||||||
@@ -58,7 +59,7 @@ public class ResourceWebScriptDelete extends AbstractResourceWebScript implement
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Params.valueOf(entityId, relationshipId, req);
|
return Params.valueOf(params, entityId, relationshipId, req);
|
||||||
}
|
}
|
||||||
case PROPERTY:
|
case PROPERTY:
|
||||||
final String resourceName = req.getServiceMatch().getTemplateVars().get(ResourceLocator.RELATIONSHIP_RESOURCE);
|
final String resourceName = req.getServiceMatch().getTemplateVars().get(ResourceLocator.RELATIONSHIP_RESOURCE);
|
||||||
@@ -68,11 +69,11 @@ public class ResourceWebScriptDelete extends AbstractResourceWebScript implement
|
|||||||
{
|
{
|
||||||
if (StringUtils.isNotBlank(propertyName))
|
if (StringUtils.isNotBlank(propertyName))
|
||||||
{
|
{
|
||||||
return Params.valueOf(entityId, relationshipId, null, null, propertyName, null, null, req);
|
return Params.valueOf(entityId, relationshipId, null, null, propertyName, params, null, req);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return Params.valueOf(entityId, null, null, null, resourceName, null, null, req);
|
return Params.valueOf(entityId, null, null, null, resourceName, params, null, req);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Fall through to unsupported.
|
//Fall through to unsupported.
|
||||||
|
@@ -194,10 +194,15 @@ public abstract class AbstractBaseApiTest extends EnterpriseTestApi
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected HttpResponse delete(String url, String runAsUser, String entityId, int expectedStatus) throws Exception
|
protected HttpResponse delete(String url, String runAsUser, String entityId, int expectedStatus) throws Exception
|
||||||
|
{
|
||||||
|
return delete(url, runAsUser, entityId, null, expectedStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected HttpResponse delete(String url, String runAsUser, String entityId, Map<String, String> params, int expectedStatus) throws Exception
|
||||||
{
|
{
|
||||||
publicApiClient.setRequestContext(new RequestContext(runAsUser));
|
publicApiClient.setRequestContext(new RequestContext(runAsUser));
|
||||||
|
|
||||||
HttpResponse response = publicApiClient.delete(getScope(), url, entityId, null, null);
|
HttpResponse response = publicApiClient.delete(getScope(), 1, url, entityId, null, null, params);
|
||||||
checkStatus(expectedStatus, response.getStatusCode());
|
checkStatus(expectedStatus, response.getStatusCode());
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
|
@@ -1,3 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2016 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
package org.alfresco.rest.api.tests.client;
|
package org.alfresco.rest.api.tests.client;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
import static org.junit.Assert.assertNotNull;
|
||||||
@@ -552,7 +570,12 @@ public class PublicApiClient
|
|||||||
|
|
||||||
public HttpResponse delete(String scope, String entityCollectionName, Object entityId, String relationCollectionName, Object relationshipEntityId) throws IOException
|
public HttpResponse delete(String scope, String entityCollectionName, Object entityId, String relationCollectionName, Object relationshipEntityId) throws IOException
|
||||||
{
|
{
|
||||||
HttpResponse response = client.delete(getRequestContext(), scope, entityCollectionName, entityId, relationCollectionName, relationshipEntityId);
|
return delete(scope, 1, entityCollectionName, entityId, relationCollectionName, relationshipEntityId, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public HttpResponse delete(String scope, int version, String entityCollectionName, Object entityId, String relationCollectionName, Object relationshipEntityId, Map<String, String> params) throws IOException
|
||||||
|
{
|
||||||
|
HttpResponse response = client.delete(getRequestContext(), scope, version, entityCollectionName, entityId, relationCollectionName, relationshipEntityId, params);
|
||||||
|
|
||||||
logger.debug(response.toString());
|
logger.debug(response.toString());
|
||||||
|
|
||||||
|
@@ -16,7 +16,6 @@
|
|||||||
* You should have received a copy of the GNU Lesser General Public License
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.alfresco.rest.api.tests.client;
|
package org.alfresco.rest.api.tests.client;
|
||||||
|
|
||||||
import java.io.BufferedInputStream;
|
import java.io.BufferedInputStream;
|
||||||
@@ -545,14 +544,14 @@ public class PublicApiHttpClient
|
|||||||
public HttpResponse delete(final RequestContext rq, final String scope, final String entityCollectionName, final Object entityId,
|
public HttpResponse delete(final RequestContext rq, final String scope, final String entityCollectionName, final Object entityId,
|
||||||
final String relationCollectionName, final Object relationshipEntityId) throws IOException
|
final String relationCollectionName, final Object relationshipEntityId) throws IOException
|
||||||
{
|
{
|
||||||
return delete(rq, scope, 1, entityCollectionName, entityId, relationCollectionName, relationshipEntityId);
|
return delete(rq, scope, 1, entityCollectionName, entityId, relationCollectionName, relationshipEntityId, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpResponse delete(final RequestContext rq, final String scope, final int version, final String entityCollectionName, final Object entityId,
|
public HttpResponse delete(final RequestContext rq, final String scope, final int version, final String entityCollectionName, final Object entityId,
|
||||||
final String relationCollectionName, final Object relationshipEntityId) throws IOException
|
final String relationCollectionName, final Object relationshipEntityId, final Map<String, String> params) throws IOException
|
||||||
{
|
{
|
||||||
RestApiEndpoint endpoint = new RestApiEndpoint(rq.getNetworkId(), scope, version, entityCollectionName, entityId, relationCollectionName,
|
RestApiEndpoint endpoint = new RestApiEndpoint(rq.getNetworkId(), scope, version, entityCollectionName, entityId, relationCollectionName,
|
||||||
relationshipEntityId, null);
|
relationshipEntityId, params);
|
||||||
String url = endpoint.getUrl();
|
String url = endpoint.getUrl();
|
||||||
|
|
||||||
DeleteMethod req = new DeleteMethod(url);
|
DeleteMethod req = new DeleteMethod(url);
|
||||||
|
Reference in New Issue
Block a user