Merge branch 'issue-vivo-154' into develop

This commit is contained in:
Brian Caruso 2013-07-17 11:54:11 -04:00
commit 68284acd99
4 changed files with 113 additions and 77 deletions

View file

@ -148,8 +148,9 @@ public class BaseResourceBean implements ResourceBean {
}
public String getLocalNameWithPrefix() {
return localNameWithPrefix==null ? getLocalName()==null ?
(URI==null ? "(no name)" : URI ): getLocalName() : localNameWithPrefix;
return localNameWithPrefix != null ? localNameWithPrefix :
getLocalName() != null ? getLocalName() :
URI != null ? URI : "(no name)" ;
}
public void setLocalNameWithPrefix(String prefixedLocalName) {
this.localNameWithPrefix = prefixedLocalName;

View file

@ -125,10 +125,22 @@ public class IndividualTypeRetryController extends BaseEditController {
// shouldn't be posting to this controller
}
private class OptionCollator implements Comparator {
public int compare (Object o1, Object o2) {
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(":")) );
static class OptionCollator implements Comparator<Option> {
public int compare (Option o1, Option o2) {
// Collator collator = Collator.getInstance();
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;
}
}

View file

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