mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-31 17:39:05 +00:00
RM-2123 Fix comparator to be the correct way around.
Also add application context tests to cover this case. +review RM-58 git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@104700 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -21,7 +21,7 @@ package org.alfresco.module.org_alfresco_module_rm.classification;
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* A class to compare classification levels.
|
||||
* A class to compare classification levels. More secure classification levels are "higher" than less secure levels.
|
||||
*
|
||||
* @author tpage
|
||||
* @since 3.0
|
||||
@@ -35,11 +35,15 @@ public class ClassificationLevelComparator implements Comparator<ClassificationL
|
||||
this.classificationLevelManager = classificationLevelManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a positive number if the first classification level is more secure than the second. {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public int compare(ClassificationLevel oneLevel, ClassificationLevel otherLevel)
|
||||
{
|
||||
int oneIndex = classificationLevelManager.getClassificationLevels().indexOf(oneLevel);
|
||||
int otherIndex = classificationLevelManager.getClassificationLevels().indexOf(otherLevel);
|
||||
return oneIndex - otherIndex;
|
||||
// Smaller indexes are more secure.
|
||||
return otherIndex - oneIndex;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user