Merge branch 'issue-vivo-154' into develop
This commit is contained in:
commit
68284acd99
4 changed files with 113 additions and 77 deletions
|
@ -148,8 +148,9 @@ public class BaseResourceBean implements ResourceBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getLocalNameWithPrefix() {
|
public String getLocalNameWithPrefix() {
|
||||||
return localNameWithPrefix==null ? getLocalName()==null ?
|
return localNameWithPrefix != null ? localNameWithPrefix :
|
||||||
(URI==null ? "(no name)" : URI ): getLocalName() : localNameWithPrefix;
|
getLocalName() != null ? getLocalName() :
|
||||||
|
URI != null ? URI : "(no name)" ;
|
||||||
}
|
}
|
||||||
public void setLocalNameWithPrefix(String prefixedLocalName) {
|
public void setLocalNameWithPrefix(String prefixedLocalName) {
|
||||||
this.localNameWithPrefix = prefixedLocalName;
|
this.localNameWithPrefix = prefixedLocalName;
|
||||||
|
|
|
@ -125,10 +125,22 @@ public class IndividualTypeRetryController extends BaseEditController {
|
||||||
// shouldn't be posting to this controller
|
// shouldn't be posting to this controller
|
||||||
}
|
}
|
||||||
|
|
||||||
private class OptionCollator implements Comparator {
|
static class OptionCollator implements Comparator<Option> {
|
||||||
public int compare (Object o1, Object o2) {
|
public int compare (Option o1, Option o2) {
|
||||||
Collator collator = Collator.getInstance();
|
// Collator collator = Collator.getInstance();
|
||||||
return collator.compare( ((Option)o1).getBody().toString().substring(((Option)o1).getBody().toString().indexOf(":")) , ((Option)o2).getBody().toString().substring(((Option)o2).getBody().toString().indexOf(":")) );
|
return getLocalName ( o1.getBody().toString() )
|
||||||
|
.compareTo(
|
||||||
|
getLocalName ( o2.getBody().toString() ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getLocalName( String in ){
|
||||||
|
if( in == null )
|
||||||
|
return "";
|
||||||
|
int i = in.indexOf(':');
|
||||||
|
if( i >= 0 )
|
||||||
|
return in.substring( i );
|
||||||
|
else
|
||||||
|
return in;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||||
|
|
||||||
|
import junit.framework.Assert;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vedit.beans.Option;
|
||||||
|
import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
|
||||||
|
|
||||||
|
|
||||||
|
public class IndividualTypeRetryControllerTest extends AbstractTestClass {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void optionCollator(){
|
||||||
|
IndividualTypeRetryController.OptionCollator oc = new IndividualTypeRetryController.OptionCollator();
|
||||||
|
int comp = oc.compare(
|
||||||
|
new Option("foo", "foo"),
|
||||||
|
new Option("Person", "foaf:Person") );
|
||||||
|
//we just want compare() to not throw an exception
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue