RM-2130 (Check classification after method execution, filtering results where appropriate)

+review RM-94

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/DEV/ENFORCE@106187 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Tuna Aksoy
2015-06-16 09:12:56 +00:00
parent d975418fa6
commit 4357be8ef4
2 changed files with 59 additions and 51 deletions

View File

@@ -32,6 +32,8 @@ import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationS
import org.alfresco.module.org_alfresco_module_rm.classification.ClassificationServiceException.LevelIdNotFound;
import org.alfresco.module.org_alfresco_module_rm.classification.model.ClassifiedContentModel;
import org.alfresco.module.org_alfresco_module_rm.util.ServiceBaseImpl;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
import org.alfresco.repo.security.authentication.AuthenticationUtil.RunAsWork;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
@@ -66,18 +68,24 @@ public class ContentClassificationServiceImpl extends ServiceBaseImpl implements
}
@Override
public ClassificationLevel getCurrentClassification(NodeRef nodeRef)
public ClassificationLevel getCurrentClassification(final NodeRef nodeRef)
{
// by default everything is unclassified
ClassificationLevel result = ClassificationLevelManager.UNCLASSIFIED;
if (nodeService.hasAspect(nodeRef, ASPECT_CLASSIFIED))
return AuthenticationUtil.runAsSystem(new RunAsWork<ClassificationLevel>()
{
String classificationId = (String)nodeService.getProperty(nodeRef, PROP_CURRENT_CLASSIFICATION);
result = levelManager.findLevelById(classificationId);
}
public ClassificationLevel doWork() throws Exception
{
// by default everything is unclassified
ClassificationLevel result = ClassificationLevelManager.UNCLASSIFIED;
return result;
if (nodeService.hasAspect(nodeRef, ASPECT_CLASSIFIED))
{
String classificationId = (String)nodeService.getProperty(nodeRef, PROP_CURRENT_CLASSIFICATION);
result = levelManager.findLevelById(classificationId);
}
return result;
}
});
};
@Override