Merge r5980 from nihvivo-rel-1.1.-maint: custom sorting and collation.
This commit is contained in:
parent
5bb2fe05b7
commit
a83304b5b8
1 changed files with 42 additions and 35 deletions
|
@ -483,11 +483,17 @@ public class EntityMergedPropertyListController extends VitroHttpServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String,VClass> directClasses = getDirectClasses( getObjectsFromStmts( orgStmtList ) );
|
Map<String,VClass> directClasses = getDirectClasses( getObjectsFromStmts( orgStmtList ) );
|
||||||
|
|
||||||
//don't do collateBySubclass if there is only one class
|
//don't do collateBySubclass if there is only one class
|
||||||
if( directClasses.size() < 2 ) {
|
if( directClasses.size() < 2 ) {
|
||||||
prop.setCollateBySubclass(false); //this overrides the value from the model
|
// rjy7 Removed this, so we still get the heading for the single populated subclass
|
||||||
}
|
//prop.setCollateBySubclass(false); //this overrides the value from the model
|
||||||
else{
|
// Still need to apply custom sort. Since we no longer set collateBySubclass to false,
|
||||||
|
// we won't know in applyCustomSortToUncollatedProperty whether the statements have
|
||||||
|
// been sorted or not, so we must do that now.
|
||||||
|
applyCustomSortToUncollatedStatements(prop, orgStmtList);
|
||||||
|
} else {
|
||||||
|
|
||||||
log.debug("statements for object property: " + orgStmtList.size());
|
log.debug("statements for object property: " + orgStmtList.size());
|
||||||
//get list of direct classes and sort them
|
//get list of direct classes and sort them
|
||||||
List<VClass> vclasses = new LinkedList<VClass>(directClasses.values());
|
List<VClass> vclasses = new LinkedList<VClass>(directClasses.values());
|
||||||
|
@ -624,18 +630,19 @@ public class EntityMergedPropertyListController extends VitroHttpServlet {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void applyCustomSortToUncollatedProperty(ObjectProperty op, List<ObjectPropertyStatement> opStmts) {
|
||||||
|
if (!op.getCollateBySubclass()) {
|
||||||
|
applyCustomSortToUncollatedStatements(op, opStmts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Apply custom sorting to an uncollated property. If the property is collated, the custom sorting has already
|
// Apply custom sorting to an uncollated property. If the property is collated, the custom sorting has already
|
||||||
// been applied to each subclass listing individually.
|
// been applied to each subclass listing individually.
|
||||||
private void applyCustomSortToUncollatedProperty(ObjectProperty op, List<ObjectPropertyStatement> opStmts) {
|
private void applyCustomSortToUncollatedStatements(ObjectProperty op, List<ObjectPropertyStatement> opStmts) {
|
||||||
// This includes the case where the ontology doesn't specify collating, as well as the case
|
|
||||||
// where we don't collate because only one subclass is populated, since then we've set
|
|
||||||
// the collation value to false.
|
|
||||||
if (!op.getCollateBySubclass()) {
|
|
||||||
if (applyCustomSort(op, opStmts)) {
|
if (applyCustomSort(op, opStmts)) {
|
||||||
op.setObjectPropertyStatements(opStmts);
|
op.setObjectPropertyStatements(opStmts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void sortReverseChron(List<ObjectPropertyStatement> statements, String endYearPredicate, String startYearPredicate) {
|
private void sortReverseChron(List<ObjectPropertyStatement> statements, String endYearPredicate, String startYearPredicate) {
|
||||||
// 1. Sort by end year descending, nulls first
|
// 1. Sort by end year descending, nulls first
|
||||||
|
|
Loading…
Add table
Reference in a new issue