RM-1842 (View users security clearance)

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@101590 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2015-04-09 18:14:48 +00:00
parent 200d7c7277
commit 11a515e666
7 changed files with 207 additions and 4 deletions

View File

@@ -18,9 +18,12 @@
*/
package org.alfresco.module.org_alfresco_module_rm.classification;
import static org.apache.commons.lang.StringUtils.isNotBlank;
import java.io.Serializable;
import org.alfresco.module.org_alfresco_module_rm.util.RMParameterCheck;
import org.apache.commons.lang.StringUtils;
import org.springframework.extensions.surf.util.I18NUtil;
/**
@@ -33,7 +36,7 @@ public final class ClassificationLevel implements Serializable
{
/** serial version uid */
private static final long serialVersionUID = -3375064867090476422L;
private final String id;
private final String displayLabelKey;
@@ -49,7 +52,11 @@ public final class ClassificationLevel implements Serializable
public String getId() { return this.id; }
/** Returns the localised (current locale) display label for this classification level. */
public String getDisplayLabel() { return I18NUtil.getMessage(displayLabelKey); }
public String getDisplayLabel()
{
String message = I18NUtil.getMessage(displayLabelKey);
return (isNotBlank(message) ? message : displayLabelKey);
}
@Override public String toString()
{

View File

@@ -0,0 +1,66 @@
/*
* Copyright (C) 2005-2014 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.module.org_alfresco_module_rm.script.classification;
import java.util.HashMap;
import java.util.Map;
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationService;
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.WebScriptRequest;
/**
* Implementation for Java backed webscript to get the classification levels.
*
* @author Tuna Aksoy
* @since 3.0
*/
public class ClassificationLevelsGet extends AbstractRmWebScript
{
/** Constants */
private static final String LEVELS = "levels";
/** Classification service */
private ClassificationService classificationService;
/**
* Sets the classification service
*
* @param classificatonService The classification service
*/
public void setClassificationService(ClassificationService classificationService)
{
this.classificationService = classificationService;
}
/**
* @see org.springframework.extensions.webscripts.DeclarativeWebScript#executeImpl(org.springframework.extensions.webscripts.WebScriptRequest,
* org.springframework.extensions.webscripts.Status,
* org.springframework.extensions.webscripts.Cache)
*/
@Override
protected Map<String, Object> executeImpl(WebScriptRequest req, Status status, Cache cache)
{
Map<String, Object> result = new HashMap<String, Object>();
result.put(LEVELS, classificationService.getClassificationLevels());
return result;
}
}