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:
Tom Page
2015-05-20 15:39:46 +00:00
parent 94c65b83e8
commit 8aa3a6615c
2 changed files with 99 additions and 2 deletions

View File

@@ -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;
}
}