NIHVIVO-746 Handle unranked authorships in add authors to publication form.
This commit is contained in:
parent
d3737502c9
commit
36f0714549
1 changed files with 24 additions and 17 deletions
|
@ -15,26 +15,33 @@ public class DataPropertyComparator implements Comparator<Individual> {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int compare(Individual ind1, Individual ind2) {
|
public int compare(Individual ind1, Individual ind2) {
|
||||||
DataPropertyStatement s1 = ind1.getDataPropertyStatement(dataPropertyUri);
|
DataPropertyStatement dps1 = ind1.getDataPropertyStatement(dataPropertyUri);
|
||||||
DataPropertyStatement s2 = ind2.getDataPropertyStatement(dataPropertyUri);
|
DataPropertyStatement dps2 = ind2.getDataPropertyStatement(dataPropertyUri);
|
||||||
|
|
||||||
String datatype = s1.getDatatypeURI();
|
|
||||||
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (datatype.equals(XSD.xint.toString())) {
|
// This pushes null values to the end of the list
|
||||||
int i1 = Integer.valueOf(s1.getData());
|
if (dps1 == null) {
|
||||||
int i2 = Integer.valueOf(s2.getData());
|
result = (dps2 == null) ? 0 : 1;
|
||||||
result = ((Integer) i1).compareTo(i2);
|
} else if (dps2 == null) {
|
||||||
}
|
result = -1;
|
||||||
else if (datatype.equals(XSD.xstring.toString())) {
|
} else {
|
||||||
result = s1.getData().compareTo(s2.getData());
|
|
||||||
}
|
|
||||||
// Fill in other types here
|
|
||||||
else {
|
|
||||||
throw new ClassCastException("Unsupported datatype");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
String datatype = dps1.getDatatypeURI();
|
||||||
|
|
||||||
|
if (datatype.equals(XSD.xint.toString())) {
|
||||||
|
int i1 = Integer.valueOf(dps1.getData());
|
||||||
|
int i2 = Integer.valueOf(dps2.getData());
|
||||||
|
result = ((Integer) i1).compareTo(i2);
|
||||||
|
}
|
||||||
|
else if (datatype.equals(XSD.xstring.toString())) {
|
||||||
|
result = dps1.getData().compareTo(dps2.getData());
|
||||||
|
}
|
||||||
|
// Fill in other types here
|
||||||
|
else {
|
||||||
|
throw new ClassCastException("Unsupported datatype");
|
||||||
|
}
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue