NIHVIVO-3042 Remove property group rank comparison from GroupedPropertyList.PropertyRanker
This commit is contained in:
parent
283ab767d9
commit
ee42cad576
1 changed files with 5 additions and 37 deletions
|
@ -354,44 +354,12 @@ public class GroupedPropertyList extends BaseTemplateModel {
|
||||||
|
|
||||||
public int compare(Property p1, Property p2) {
|
public int compare(Property p1, Property p2) {
|
||||||
|
|
||||||
// sort first by property group rank; if the same, then sort by property rank
|
int diff = determineDisplayRank(p1) - determineDisplayRank(p2);
|
||||||
final int MAX_GROUP_RANK=99;
|
|
||||||
|
|
||||||
int p1GroupRank=MAX_GROUP_RANK;
|
|
||||||
try {
|
|
||||||
if (p1.getGroupURI()!=null) {
|
|
||||||
PropertyGroup pg1 = pgDao.getGroupByURI(p1.getGroupURI());
|
|
||||||
if (pg1!=null) {
|
|
||||||
p1GroupRank=pg1.getDisplayRank();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
log.error("Cannot retrieve p1GroupRank for group "+p1.getLabel());
|
|
||||||
}
|
|
||||||
|
|
||||||
int p2GroupRank=MAX_GROUP_RANK;
|
|
||||||
try {
|
|
||||||
if (p2.getGroupURI()!=null) {
|
|
||||||
PropertyGroup pg2 = pgDao.getGroupByURI(p2.getGroupURI());
|
|
||||||
if (pg2!=null) {
|
|
||||||
p2GroupRank=pg2.getDisplayRank();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception ex) {
|
|
||||||
log.error("Cannot retrieve p2GroupRank for group "+p2.getLabel());
|
|
||||||
}
|
|
||||||
|
|
||||||
// int diff = pgDao.getGroupByURI(p1.getGroupURI()).getDisplayRank() - pgDao.getGroupByURI(p2.getGroupURI()).getDisplayRank();
|
|
||||||
int diff=p1GroupRank - p2GroupRank;
|
|
||||||
if (diff==0) {
|
if (diff==0) {
|
||||||
diff = determineDisplayRank(p1) - determineDisplayRank(p2);
|
return getLabel(p1).compareTo(getLabel(p2));
|
||||||
if (diff==0) {
|
} else {
|
||||||
return getLabel(p1).compareTo(getLabel(p2));
|
return diff;
|
||||||
} else {
|
|
||||||
return diff;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return diff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int determineDisplayRank(Property p) {
|
private int determineDisplayRank(Property p) {
|
||||||
|
@ -400,7 +368,7 @@ public class GroupedPropertyList extends BaseTemplateModel {
|
||||||
return dp.getDisplayTier();
|
return dp.getDisplayTier();
|
||||||
} else if (p instanceof ObjectProperty) {
|
} else if (p instanceof ObjectProperty) {
|
||||||
ObjectProperty op = (ObjectProperty)p;
|
ObjectProperty op = (ObjectProperty)p;
|
||||||
String tierStr = op.getDomainDisplayTier(); // no longer used: p.isSubjectSide() ? op.getDomainDisplayTier() : op.getRangeDisplayTier();
|
String tierStr = op.getDomainDisplayTier();
|
||||||
try {
|
try {
|
||||||
return Integer.parseInt(tierStr);
|
return Integer.parseInt(tierStr);
|
||||||
} catch (NumberFormatException ex) {
|
} catch (NumberFormatException ex) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue