mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-10-08 14:51:49 +00:00
RM-3963: throw an exception if permanent parameter is passed for delete
This commit is contained in:
@@ -30,6 +30,7 @@ package org.alfresco.rm.rest.api.nodes;
|
||||
import org.alfresco.rest.api.model.Node;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.WebApiParam;
|
||||
import org.alfresco.rest.framework.core.exceptions.InvalidArgumentException;
|
||||
import org.alfresco.rest.framework.resource.EntityResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.EntityResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
@@ -48,6 +49,7 @@ public class FileplanComponentsEntityResource implements
|
||||
EntityResourceAction.Update<Node>
|
||||
{
|
||||
private RMNodes nodes;
|
||||
private String PARAM_PERMANENT = "permanent";
|
||||
|
||||
public void setNodes(RMNodes nodes)
|
||||
{
|
||||
@@ -70,6 +72,11 @@ public class FileplanComponentsEntityResource implements
|
||||
@Override
|
||||
public void delete(String nodeId, Parameters parameters)
|
||||
{
|
||||
String permanentParameter = parameters.getParameter(PARAM_PERMANENT);
|
||||
if(permanentParameter != null)
|
||||
{
|
||||
throw new InvalidArgumentException("Delete does not support parameter: permanent");
|
||||
}
|
||||
nodes.deleteNode(nodeId, parameters);
|
||||
}
|
||||
}
|
||||
|
@@ -53,6 +53,7 @@ public class RMSiteEntityResource implements EntityResourceAction.Delete, Entity
|
||||
{
|
||||
private static final String RM_SITE_ID = "rm";
|
||||
private RMSites sites;
|
||||
private String PARAM_PERMANENT = "permanent";
|
||||
|
||||
public void setSites(RMSites sites)
|
||||
{
|
||||
@@ -74,6 +75,11 @@ public class RMSiteEntityResource implements EntityResourceAction.Delete, Entity
|
||||
{
|
||||
throw new InvalidParameterException("The Deletion is supported only for siteId = rm.");
|
||||
}
|
||||
String permanentParameter = parameters.getParameter(PARAM_PERMANENT);
|
||||
if(permanentParameter != null)
|
||||
{
|
||||
throw new InvalidArgumentException("Delete does not support parameter: permanent");
|
||||
}
|
||||
sites.deleteSite(siteId, parameters);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user