mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-2120: Add error handling (and test) as suggested by Neil during + review RM-46
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@104157 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -18,11 +18,13 @@
|
||||
*/
|
||||
package org.alfresco.module.org_alfresco_module_rm.script.classification;
|
||||
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException;
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearance;
|
||||
import org.alfresco.module.org_alfresco_module_rm.classification.SecurityClearanceService;
|
||||
import org.alfresco.module.org_alfresco_module_rm.script.AbstractRmWebScript;
|
||||
import org.springframework.extensions.webscripts.Cache;
|
||||
import org.springframework.extensions.webscripts.Status;
|
||||
import org.springframework.extensions.webscripts.WebScriptException;
|
||||
import org.springframework.extensions.webscripts.WebScriptRequest;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -63,8 +65,17 @@ public class UserSecurityClearancePut extends AbstractRmWebScript
|
||||
{
|
||||
String username = req.getParameter(USERNAME);
|
||||
String clearanceId = req.getParameter(CLEARANCE_ID);
|
||||
SecurityClearance securityClearance;
|
||||
|
||||
SecurityClearance securityClearance = securityClearanceService.setUserSecurityClearance(username, clearanceId);
|
||||
try
|
||||
{
|
||||
securityClearance = securityClearanceService.setUserSecurityClearance(username,
|
||||
clearanceId);
|
||||
}
|
||||
catch (ClassificationServiceException.LevelIdNotFound exception)
|
||||
{
|
||||
throw new WebScriptException(Status.STATUS_BAD_REQUEST, "Unable to find clearance level");
|
||||
}
|
||||
|
||||
Map<String, Object> model = new HashMap<>();
|
||||
model.put(ITEM, securityClearance);
|
||||
|
Reference in New Issue
Block a user