Merge branch 'develop' of https://github.com/vivo-project/Vitro into develop
This commit is contained in:
commit
781c5105f1
56 changed files with 388 additions and 504 deletions
|
@ -2,13 +2,19 @@
|
|||
|
||||
package edu.cornell.mannlib.vedit.controller;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.ListIterator;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -21,6 +27,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
|
||||
import edu.cornell.mannlib.vedit.beans.Option;
|
||||
import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
||||
|
@ -155,6 +162,41 @@ public class BaseEditController extends VitroHttpServlet {
|
|||
}
|
||||
}
|
||||
|
||||
public List<Option> getSortedList(HashMap<String,Option> hashMap, List<Option> optionList, VitroRequest vreq){
|
||||
|
||||
class ListComparator implements Comparator<String>{
|
||||
|
||||
Collator collator;
|
||||
|
||||
public ListComparator(Collator collator) {
|
||||
this.collator = collator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(String str1, String str2) {
|
||||
return collator.compare(str1, str2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<String> bodyVal = new ArrayList<String>();
|
||||
List<Option> options = new ArrayList<Option>();
|
||||
Iterator<Option> itr = optionList.iterator();
|
||||
while(itr.hasNext()){
|
||||
Option option = itr.next();
|
||||
hashMap.put(option.getBody(),option);
|
||||
bodyVal.add(option.getBody());
|
||||
}
|
||||
|
||||
|
||||
Collections.sort(bodyVal, new ListComparator(vreq.getCollator()));
|
||||
ListIterator<String> itrStr = bodyVal.listIterator();
|
||||
while(itrStr.hasNext()){
|
||||
options.add(hashMap.get(itrStr.next()));
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
protected WebappDaoFactory getWebappDaoFactory() {
|
||||
return ModelAccess.on(getServletContext()).getBaseWebappDaoFactory();
|
||||
}
|
||||
|
|
|
@ -239,27 +239,7 @@ public class FormUtils {
|
|||
for (VClass vclass : wadf.getVClassDao().getAllVclasses()) {
|
||||
Option option = new Option();
|
||||
option.setValue(vclass.getURI());
|
||||
if ( (selectedVClassURI != null)
|
||||
&& (vclass.getURI() != null)
|
||||
&& (selectedVClassURI.equals(vclass.getURI())) ) {
|
||||
option.setSelected(true);
|
||||
}
|
||||
String ontologyPrefix = null;
|
||||
if (vclass.getNamespace() != null) {
|
||||
Ontology ont = wadf.getOntologyDao().getOntologyByURI(
|
||||
vclass.getNamespace());
|
||||
if ( (ont != null) && (ont.getPrefix() != null) ) {
|
||||
ontologyPrefix = ont.getPrefix();
|
||||
}
|
||||
}
|
||||
StringBuffer classNameBuffer = new StringBuffer();
|
||||
if (ontologyPrefix != null) {
|
||||
classNameBuffer.append(ontologyPrefix).append(":");
|
||||
}
|
||||
if (vclass.getName() != null) {
|
||||
classNameBuffer.append(vclass.getName());
|
||||
}
|
||||
option.setBody(classNameBuffer.toString());
|
||||
option.setBody(vclass.getPickListName());
|
||||
vclassOptionList.add(option);
|
||||
}
|
||||
return vclassOptionList;
|
||||
|
|
|
@ -134,6 +134,10 @@ public class BaseResourceBean implements ResourceBean {
|
|||
}
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return getLocalName();
|
||||
}
|
||||
|
||||
public String getLocalName() {
|
||||
if( localName == null && this.URI != null)
|
||||
buildLocalAndNS(this.URI);
|
||||
|
|
|
@ -12,7 +12,7 @@ import java.util.LinkedList;
|
|||
* @author bjl23
|
||||
*
|
||||
*/
|
||||
public class DataProperty extends Property implements Comparable<DataProperty> {
|
||||
public class DataProperty extends Property implements Comparable<DataProperty>, ResourceBean {
|
||||
|
||||
private String name = null;
|
||||
private String publicName = null;
|
||||
|
@ -63,6 +63,10 @@ public class DataProperty extends Property implements Comparable<DataProperty> {
|
|||
this.publicName = publicName;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return getPublicName();
|
||||
}
|
||||
|
||||
public String getDomainClassURI() {
|
||||
return domainClassURI;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
|
|||
* a class representing an object property
|
||||
*
|
||||
*/
|
||||
public class ObjectProperty extends Property implements Comparable<ObjectProperty>
|
||||
public class ObjectProperty extends Property implements Comparable<ObjectProperty>, ResourceBean
|
||||
{
|
||||
private static final Log log = LogFactory.getLog(ObjectProperty.class.getName());
|
||||
|
||||
|
@ -95,6 +95,10 @@ public class ObjectProperty extends Property implements Comparable<ObjectPropert
|
|||
this.domainEntityURI = domainEntityURI;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return getDomainPublic();
|
||||
}
|
||||
|
||||
public String getDomainPublic() {
|
||||
return domainPublic;
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.Comparator;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
public class Property extends BaseResourceBean {
|
||||
public class Property extends BaseResourceBean implements ResourceBean {
|
||||
|
||||
private static Log log = LogFactory.getLog( Property.class );
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean.RoleLevel;
|
|||
* Time: 3:41:23 PM
|
||||
*/
|
||||
public interface ResourceBean {
|
||||
|
||||
String getURI();
|
||||
|
||||
boolean isAnonymous();
|
||||
|
@ -24,28 +25,20 @@ public interface ResourceBean {
|
|||
|
||||
void setLocalName(String localName);
|
||||
|
||||
String getLabel();
|
||||
|
||||
public RoleLevel getHiddenFromDisplayBelowRoleLevel() ;
|
||||
|
||||
public void setHiddenFromDisplayBelowRoleLevel(RoleLevel eR) ;
|
||||
|
||||
public void setHiddenFromDisplayBelowRoleLevelUsingRoleUri(String roleUri) ;
|
||||
/*
|
||||
public RoleLevel getProhibitedFromCreateBelowRoleLevel() ;
|
||||
|
||||
public void setProhibitedFromCreateBelowRoleLevel(RoleLevel eR) ;
|
||||
|
||||
public void setProhibitedFromCreateBelowRoleLevelUsingRoleUri(String roleUri) ;
|
||||
*/
|
||||
public RoleLevel getProhibitedFromUpdateBelowRoleLevel() ;
|
||||
|
||||
public void setProhibitedFromUpdateBelowRoleLevel(RoleLevel eR) ;
|
||||
|
||||
public void setProhibitedFromUpdateBelowRoleLevelUsingRoleUri(String roleUri) ;
|
||||
/*
|
||||
public RoleLevel getProhibitedFromDeleteBelowRoleLevel() ;
|
||||
|
||||
public void setProhibitedFromDeleteBelowRoleLevel(RoleLevel eR) ;
|
||||
public String getPickListName();
|
||||
|
||||
public void setProhibitedFromDeleteBelowRoleLevelUsingRoleUri(String roleUri) ;
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -5,10 +5,13 @@ package edu.cornell.mannlib.vitro.webapp.controller;
|
|||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.Collator;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -27,7 +30,9 @@ import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.policy.PolicyHelper;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
|
||||
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestedAction;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.BaseResourceBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.DisplayMessage;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ResourceBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.authenticate.LogoutRedirector;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
|
@ -187,6 +192,25 @@ public class VitroHttpServlet extends HttpServlet {
|
|||
+ "?afterLogin=" + encodedAfterLoginUrl;
|
||||
}
|
||||
|
||||
protected void sortForPickList(List<? extends ResourceBean> beans,
|
||||
VitroRequest vreq) {
|
||||
Collections.sort(beans, new PickListSorter(vreq));
|
||||
}
|
||||
|
||||
protected class PickListSorter implements Comparator<ResourceBean> {
|
||||
|
||||
Collator collator;
|
||||
|
||||
public PickListSorter(VitroRequest vreq) {
|
||||
this.collator = vreq.getCollator();
|
||||
}
|
||||
|
||||
public int compare(ResourceBean b1, ResourceBean b2) {
|
||||
return collator.compare(b1.getPickListName(), b2.getPickListName());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* If logging on the subclass is set to the TRACE level, dump the HTTP
|
||||
* headers on the request.
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.controller;
|
||||
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
@ -215,6 +216,14 @@ public class VitroRequest extends HttpServletRequestWrapper {
|
|||
return (OntModel) getAttribute("languageNeutralUnionFullModel");
|
||||
}
|
||||
|
||||
public void setCollator(Collator collator) {
|
||||
setAttribute("collator", collator);
|
||||
}
|
||||
|
||||
public Collator getCollator() {
|
||||
return (Collator) getAttribute("collator");
|
||||
}
|
||||
|
||||
public void setLanguageNeutralWebappDaoFactory(WebappDaoFactory wadf) {
|
||||
setAttribute("languageNeutralWebappDaoFactory", wadf);
|
||||
}
|
||||
|
|
|
@ -60,8 +60,8 @@ public class Classes2ClassesRetryController extends BaseEditController {
|
|||
populateBeanFromParams(objectForEditing, request);
|
||||
|
||||
HashMap hash = new HashMap();
|
||||
hash.put("SuperclassURI", FormUtils.makeOptionListFromBeans(vcDao.getAllVclasses(),"URI","LocalNameWithPrefix",objectForEditing.getSuperclassURI(),null));
|
||||
hash.put("SubclassURI", FormUtils.makeOptionListFromBeans(vcDao.getAllVclasses(),"URI","LocalNameWithPrefix",objectForEditing.getSubclassURI(),null));
|
||||
hash.put("SuperclassURI", FormUtils.makeOptionListFromBeans(vcDao.getAllVclasses(),"URI","PickListName",objectForEditing.getSuperclassURI(),null));
|
||||
hash.put("SubclassURI", FormUtils.makeOptionListFromBeans(vcDao.getAllVclasses(),"URI","PickListName",objectForEditing.getSubclassURI(),null));
|
||||
|
||||
FormObject foo = new FormObject();
|
||||
foo.setOptionLists(hash);
|
||||
|
|
|
@ -24,6 +24,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.ApplicationBean;
|
|||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||
|
@ -101,7 +102,9 @@ public class DatapropEditController extends BaseEditController {
|
|||
// TODO - need unionOf/intersectionOf-style domains for domain class
|
||||
String domainStr="";
|
||||
try {
|
||||
domainStr = (dp.getDomainClassURI() == null) ? "" : "<a href=\"vclassEdit?uri="+URLEncoder.encode(dp.getDomainClassURI(),"UTF-8")+"\">"+dp.getDomainClassURI()+"</a>";
|
||||
VClass domainClass = getWebappDaoFactory().getVClassDao().getVClassByURI(dp.getDomainClassURI());
|
||||
String domainLinkAnchor = (domainClass != null) ? domainClass.getPickListName() : dp.getDomainClassURI();
|
||||
domainStr = (dp.getDomainClassURI() == null) ? "" : "<a href=\"vclassEdit?uri="+URLEncoder.encode(dp.getDomainClassURI(),"UTF-8")+"\">"+domainLinkAnchor+"</a>";
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error(e, e);
|
||||
}
|
||||
|
|
|
@ -64,11 +64,12 @@ public class IndividualTypeRetryController extends BaseEditController {
|
|||
request.setAttribute("individual", ind);
|
||||
|
||||
List<VClass> allVClasses = vcDao.getAllVclasses();
|
||||
sortForPickList(allVClasses, vreq);
|
||||
Set<String> allClassURISet = new HashSet<String>();
|
||||
Map<String,String> classNameMap = new HashMap<String,String>();
|
||||
for (Iterator allClassIt = allVClasses.iterator(); allClassIt.hasNext(); ) {
|
||||
VClass vc = (VClass) allClassIt.next();
|
||||
classNameMap.put(vc.getURI(),vc.getLocalNameWithPrefix());
|
||||
classNameMap.put(vc.getURI(),vc.getPickListName());
|
||||
allClassURISet.add(vc.getURI());
|
||||
}
|
||||
|
||||
|
@ -98,7 +99,6 @@ public class IndividualTypeRetryController extends BaseEditController {
|
|||
typeOptionList.add(opt);
|
||||
}
|
||||
|
||||
Collections.sort(typeOptionList,new OptionCollator());
|
||||
optionMap.put("types",typeOptionList);
|
||||
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
|
@ -124,23 +124,4 @@ public class IndividualTypeRetryController extends BaseEditController {
|
|||
// shouldn't be posting to this controller
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ public class ObjectPropertyStatementRetryController extends BaseEditController {
|
|||
}
|
||||
List<Individual> indList = new LinkedList();
|
||||
indList.addAll(possIndSet);
|
||||
Collections.sort(indList, new IndComparator());
|
||||
sortForPickList(indList, vreq);
|
||||
List objectEntOptionList = new LinkedList();
|
||||
Iterator<Individual> indIt = indList.iterator();
|
||||
while (indIt.hasNext()) {
|
||||
|
@ -168,12 +168,4 @@ public class ObjectPropertyStatementRetryController extends BaseEditController {
|
|||
doPost(request, response);
|
||||
}
|
||||
|
||||
private class IndComparator implements Comparator {
|
||||
public int compare(Object o1, Object o2) {
|
||||
Collator collator = Collator.getInstance();
|
||||
return collator.compare(((Individual)o1).getName() , ((Individual)o2).getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -59,16 +59,16 @@ public class Properties2PropertiesRetryController extends BaseEditController {
|
|||
? dpDao.getAllDataProperties()
|
||||
: opDao.getAllObjectProperties();
|
||||
|
||||
Collections.sort(propList);
|
||||
sortForPickList(propList, request);
|
||||
|
||||
String superpropertyURIstr = request.getParameter("SuperpropertyURI");
|
||||
String subpropertyURIstr = request.getParameter("SubpropertyURI");
|
||||
|
||||
HashMap<String,Option> hashMap = new HashMap<String,Option>();
|
||||
List<Option> optionList = FormUtils.makeOptionListFromBeans(propList,"URI","LocalNameWithPrefix",superpropertyURIstr,null);
|
||||
List<Option> superPropertyOptions = getSortedList(hashMap,optionList);
|
||||
optionList = FormUtils.makeOptionListFromBeans(propList,"URI","LocalNameWithPrefix",subpropertyURIstr,null);
|
||||
List<Option> subPropertyOptions = getSortedList(hashMap, optionList);
|
||||
List<Option> optionList = FormUtils.makeOptionListFromBeans(propList,"URI","PickListName",superpropertyURIstr,null);
|
||||
List<Option> superPropertyOptions = getSortedList(hashMap, optionList, request);
|
||||
optionList = FormUtils.makeOptionListFromBeans(propList,"URI","PickListName",subpropertyURIstr,null);
|
||||
List<Option> subPropertyOptions = getSortedList(hashMap, optionList, request);
|
||||
|
||||
HashMap hash = new HashMap();
|
||||
hash.put("SuperpropertyURI", superPropertyOptions);
|
||||
|
@ -105,34 +105,4 @@ public class Properties2PropertiesRetryController extends BaseEditController {
|
|||
|
||||
}
|
||||
|
||||
public List<Option> getSortedList(HashMap<String,Option> hashMap, List<Option> optionList){
|
||||
|
||||
class ListComparator implements Comparator<String>{
|
||||
@Override
|
||||
public int compare(String str1, String str2) {
|
||||
// TODO Auto-generated method stub
|
||||
Collator collator = Collator.getInstance();
|
||||
return collator.compare(str1, str2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<String> bodyVal = new ArrayList<String>();
|
||||
List<Option> options = new ArrayList<Option>();
|
||||
Iterator<Option> itr = optionList.iterator();
|
||||
while(itr.hasNext()){
|
||||
Option option = itr.next();
|
||||
hashMap.put(option.getBody(),option);
|
||||
bodyVal.add(option.getBody());
|
||||
}
|
||||
|
||||
|
||||
Collections.sort(bodyVal, new ListComparator());
|
||||
ListIterator<String> itrStr = bodyVal.listIterator();
|
||||
while(itrStr.hasNext()){
|
||||
options.add(hashMap.get(itrStr.next()));
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ public class PropertyEditController extends BaseEditController {
|
|||
ObjectProperty parent = propDao.getObjectPropertyByURI(p.getParentURI());
|
||||
if (parent != null && parent.getURI() != null) {
|
||||
try {
|
||||
parentPropertyStr = "<a href=\"propertyEdit?uri="+URLEncoder.encode(parent.getURI(),"UTF-8")+"\">"+parent.getLocalNameWithPrefix()+"</a>";
|
||||
parentPropertyStr = "<a href=\"propertyEdit?uri="+URLEncoder.encode(parent.getURI(),"UTF-8")+"\">"+parent.getPickListName()+"</a>";
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error(e, e);
|
||||
}
|
||||
|
@ -121,12 +121,12 @@ public class PropertyEditController extends BaseEditController {
|
|||
String domainStr = "";
|
||||
if (p.getDomainVClassURI() != null) {
|
||||
VClass domainClass = vcDao.getVClassByURI(p.getDomainVClassURI());
|
||||
if (domainClass != null && domainClass.getURI() != null && domainClass.getLocalNameWithPrefix() != null) {
|
||||
if (domainClass != null && domainClass.getURI() != null && domainClass.getPickListName() != null) {
|
||||
try {
|
||||
if (domainClass.isAnonymous()) {
|
||||
domainStr = domainClass.getLocalNameWithPrefix();
|
||||
domainStr = domainClass.getPickListName();
|
||||
} else {
|
||||
domainStr = "<a href=\"vclassEdit?uri="+URLEncoder.encode(domainClass.getURI(),"UTF-8")+"\">"+domainClass.getLocalNameWithPrefix()+"</a>";
|
||||
domainStr = "<a href=\"vclassEdit?uri="+URLEncoder.encode(domainClass.getURI(),"UTF-8")+"\">"+domainClass.getPickListName()+"</a>";
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error(e, e);
|
||||
|
@ -138,12 +138,12 @@ public class PropertyEditController extends BaseEditController {
|
|||
String rangeStr = "";
|
||||
if (p.getRangeVClassURI() != null) {
|
||||
VClass rangeClass = vcDao.getVClassByURI(p.getRangeVClassURI());
|
||||
if (rangeClass != null && rangeClass.getURI() != null && rangeClass.getLocalNameWithPrefix() != null) {
|
||||
if (rangeClass != null && rangeClass.getURI() != null && rangeClass.getPickListName() != null) {
|
||||
try {
|
||||
if (rangeClass.isAnonymous()) {
|
||||
rangeStr = rangeClass.getLocalNameWithPrefix();
|
||||
rangeStr = rangeClass.getPickListName();
|
||||
} else {
|
||||
rangeStr = "<a href=\"vclassEdit?uri="+URLEncoder.encode(rangeClass.getURI(),"UTF-8")+"\">"+rangeClass.getLocalNameWithPrefix()+"</a>";
|
||||
rangeStr = "<a href=\"vclassEdit?uri="+URLEncoder.encode(rangeClass.getURI(),"UTF-8")+"\">"+rangeClass.getPickListName()+"</a>";
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
log.error(e, e);
|
||||
|
@ -175,22 +175,6 @@ public class PropertyEditController extends BaseEditController {
|
|||
results.add(p.getSelectFromExisting() ? "true" : "false"); // column 21
|
||||
results.add(p.getOfferCreateNewOption() ? "true" : "false"); // column 22
|
||||
|
||||
/*
|
||||
String datapropStr = "";
|
||||
if (p.getObjectIndividualSortPropertyURI() != null) {
|
||||
DataProperty dProp = dpDao.getDataPropertyByURI(p.getObjectIndividualSortPropertyURI());
|
||||
if (dProp != null && dProp.getURI() != null && dProp.getLocalNameWithPrefix() != null) {
|
||||
try {
|
||||
datapropStr = "<a href=\"datapropEdit?uri="+URLEncoder.encode(dProp.getURI(),"UTF-8")+"\">"+dProp.getLocalNameWithPrefix()+"</a>";
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
results.add(datapropStr); // column 16
|
||||
} else {
|
||||
results.add("name (rdfs:label)"); // column 16
|
||||
}
|
||||
*/
|
||||
results.add(p.getDomainEntitySortDirection() == null ? "ascending" : p.getDomainEntitySortDirection()); // column 23
|
||||
|
||||
results.add(p.getURI()); // column 24
|
||||
|
|
|
@ -154,7 +154,7 @@ public class PropertyRetryController extends BaseEditController {
|
|||
|
||||
List groupOptList = FormUtils.makeOptionListFromBeans(request.getUnfilteredWebappDaoFactory().getPropertyGroupDao().getPublicGroups(true),"URI","Name", ((propertyForEditing.getGroupURI()==null) ? "" : propertyForEditing.getGroupURI()), null, (propertyForEditing.getGroupURI()!=null));
|
||||
HashMap<String,Option> hashMap = new HashMap<String,Option>();
|
||||
groupOptList = getSortedList(hashMap,groupOptList);
|
||||
groupOptList = getSortedList(hashMap,groupOptList,request);
|
||||
groupOptList.add(0,new Option("","none"));
|
||||
optionMap.put("GroupURI", groupOptList);
|
||||
|
||||
|
@ -241,24 +241,10 @@ public class PropertyRetryController extends BaseEditController {
|
|||
List<Option> parentIdList = FormUtils.makeOptionListFromBeans(
|
||||
objPropList,"URI","PickListName",propertyForEditing.getParentURI(),null);
|
||||
HashMap<String,Option> hashMap = new HashMap<String,Option>();
|
||||
parentIdList = getSortedList(hashMap,parentIdList);
|
||||
parentIdList = getSortedList(hashMap,parentIdList,request);
|
||||
parentIdList.add(0,new Option("-1","none (root property)", false));
|
||||
optionMap.put("ParentURI", parentIdList);
|
||||
|
||||
/*
|
||||
List<DataProperty> dpList = dpDao.getAllDataProperties();
|
||||
Collections.sort(dpList);
|
||||
List<Option> objectIndividualSortPropertyList =
|
||||
FormUtils.makeOptionListFromBeans(
|
||||
dpList, "URI", "Name",
|
||||
propertyForEditing.getObjectIndividualSortPropertyURI(),
|
||||
null);
|
||||
objectIndividualSortPropertyList.add(0, new Option(
|
||||
"","- name (rdfs:label) -"));
|
||||
optionMap.put("ObjectIndividualSortPropertyURI",
|
||||
objectIndividualSortPropertyList);
|
||||
*/
|
||||
|
||||
List<Option> domainOptionList = FormUtils.makeVClassOptionList(
|
||||
request.getUnfilteredWebappDaoFactory(),
|
||||
propertyForEditing.getDomainVClassURI());
|
||||
|
@ -266,7 +252,7 @@ public class PropertyRetryController extends BaseEditController {
|
|||
&& propertyForEditing.getDomainVClass().isAnonymous()) {
|
||||
domainOptionList.add(0, new Option(
|
||||
propertyForEditing.getDomainVClass().getURI(),
|
||||
propertyForEditing.getDomainVClass().getName(),
|
||||
propertyForEditing.getDomainVClass().getPickListName(),
|
||||
true));
|
||||
}
|
||||
domainOptionList.add(0, new Option("","(none specified)"));
|
||||
|
@ -279,7 +265,7 @@ public class PropertyRetryController extends BaseEditController {
|
|||
&& propertyForEditing.getRangeVClass().isAnonymous()) {
|
||||
rangeOptionList.add(0, new Option(
|
||||
propertyForEditing.getRangeVClass().getURI(),
|
||||
propertyForEditing.getRangeVClass().getName(),
|
||||
propertyForEditing.getRangeVClass().getPickListName(),
|
||||
true));
|
||||
}
|
||||
rangeOptionList.add(0, new Option("","(none specified)"));
|
||||
|
@ -316,33 +302,5 @@ public class PropertyRetryController extends BaseEditController {
|
|||
}
|
||||
}
|
||||
|
||||
public List<Option> getSortedList(HashMap<String,Option> hashMap, List<Option> optionList){
|
||||
|
||||
class ListComparator implements Comparator<String>{
|
||||
@Override
|
||||
public int compare(String str1, String str2) {
|
||||
// TODO Auto-generated method stub
|
||||
Collator collator = Collator.getInstance();
|
||||
return collator.compare(str1, str2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<String> bodyVal = new ArrayList<String>();
|
||||
List<Option> options = new ArrayList<Option>();
|
||||
Iterator<Option> itr = optionList.iterator();
|
||||
while(itr.hasNext()){
|
||||
Option option = itr.next();
|
||||
hashMap.put(option.getBody(),option);
|
||||
bodyVal.add(option.getBody());
|
||||
}
|
||||
|
||||
|
||||
Collections.sort(bodyVal, new ListComparator());
|
||||
ListIterator<String> itrStr = bodyVal.listIterator();
|
||||
while(itrStr.hasNext()){
|
||||
options.add(hashMap.get(itrStr.next()));
|
||||
}
|
||||
return options;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ public class RefactorRetryController extends BaseEditController {
|
|||
epo.setFormObject(foo);
|
||||
HashMap<String,List<Option>> optMap = new HashMap<String,List<Option>>();
|
||||
foo.setOptionLists(optMap);
|
||||
List<Option> subjectClassOpts = FormUtils.makeOptionListFromBeans(request.getUnfilteredWebappDaoFactory().getVClassDao().getAllVclasses(),"URI","Name", null, null);
|
||||
List<Option> subjectClassOpts = FormUtils.makeOptionListFromBeans(request.getUnfilteredWebappDaoFactory().getVClassDao().getAllVclasses(),"URI","PickListName", null, null);
|
||||
subjectClassOpts.add(0,new Option("","? wildcard",true));
|
||||
optMap.put("SubjectClassURI", subjectClassOpts);
|
||||
optMap.put("ObjectClassURI", subjectClassOpts);
|
||||
|
@ -63,14 +63,14 @@ public class RefactorRetryController extends BaseEditController {
|
|||
if (epo.getAttribute("propertyType").equals("ObjectProperty")) {
|
||||
List<ObjectProperty> opList = request.getUnfilteredWebappDaoFactory().getObjectPropertyDao().getAllObjectProperties();
|
||||
Collections.sort(opList);
|
||||
newPropertyOpts = FormUtils.makeOptionListFromBeans(opList,"URI","LocalNameWithPrefix", null, null);
|
||||
newPropertyOpts = FormUtils.makeOptionListFromBeans(opList,"URI","PickListName", null, null);
|
||||
} else {
|
||||
List<DataProperty> dpList = request.getUnfilteredWebappDaoFactory().getDataPropertyDao().getAllDataProperties();
|
||||
Collections.sort(dpList);
|
||||
newPropertyOpts = FormUtils.makeOptionListFromBeans(dpList,"URI","Name", null, null);
|
||||
newPropertyOpts = FormUtils.makeOptionListFromBeans(dpList,"URI","PickListName", null, null);
|
||||
}
|
||||
HashMap<String,Option> hashMap = new HashMap<String,Option>();
|
||||
newPropertyOpts = getSortedList(hashMap,newPropertyOpts);
|
||||
newPropertyOpts = getSortedList(hashMap,newPropertyOpts,request);
|
||||
newPropertyOpts.add(new Option("","(move to trash)"));
|
||||
optMap.put("NewPropertyURI", newPropertyOpts);
|
||||
|
||||
|
@ -90,7 +90,7 @@ public class RefactorRetryController extends BaseEditController {
|
|||
epo.setFormObject(foo);
|
||||
HashMap<String,List<Option>> optMap = new HashMap<String,List<Option>>();
|
||||
foo.setOptionLists(optMap);
|
||||
List<Option> newClassURIopts = FormUtils.makeOptionListFromBeans(request.getUnfilteredWebappDaoFactory().getVClassDao().getAllVclasses(),"URI","LocalNameWithPrefix", null, null);
|
||||
List<Option> newClassURIopts = FormUtils.makeOptionListFromBeans(request.getUnfilteredWebappDaoFactory().getVClassDao().getAllVclasses(),"URI","PickListName", null, null);
|
||||
newClassURIopts.add(new Option ("","move to trash"));
|
||||
optMap.put("NewVClassURI", newClassURIopts);
|
||||
request.setAttribute("editAction","refactorOp");
|
||||
|
@ -137,34 +137,6 @@ public class RefactorRetryController extends BaseEditController {
|
|||
|
||||
}
|
||||
|
||||
public List<Option> getSortedList(HashMap<String,Option> hashMap, List<Option> optionList){
|
||||
|
||||
class ListComparator implements Comparator<String>{
|
||||
@Override
|
||||
public int compare(String str1, String str2) {
|
||||
// TODO Auto-generated method stub
|
||||
Collator collator = Collator.getInstance();
|
||||
return collator.compare(str1, str2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
List<String> bodyVal = new ArrayList<String>();
|
||||
List<Option> options = new ArrayList<Option>();
|
||||
Iterator<Option> itr = optionList.iterator();
|
||||
while(itr.hasNext()){
|
||||
Option option = itr.next();
|
||||
hashMap.put(option.getBody(),option);
|
||||
bodyVal.add(option.getBody());
|
||||
}
|
||||
|
||||
|
||||
Collections.sort(bodyVal, new ListComparator());
|
||||
ListIterator<String> itrStr = bodyVal.listIterator();
|
||||
while(itrStr.hasNext()){
|
||||
options.add(hashMap.get(itrStr.next()));
|
||||
}
|
||||
return options;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
package edu.cornell.mannlib.vitro.webapp.controller.edit;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -16,7 +15,6 @@ import org.apache.commons.logging.LogFactory;
|
|||
|
||||
import com.hp.hpl.jena.vocabulary.OWL;
|
||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||
import com.ibm.icu.text.Collator;
|
||||
|
||||
import edu.cornell.mannlib.vedit.beans.EditProcessObject;
|
||||
import edu.cornell.mannlib.vedit.beans.FormObject;
|
||||
|
@ -25,6 +23,7 @@ import edu.cornell.mannlib.vedit.controller.BaseEditController;
|
|||
import edu.cornell.mannlib.vitro.webapp.auth.permissions.SimplePermission;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Datatype;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Property;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ResourceBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
|
@ -58,12 +57,12 @@ public class RestrictionRetryController extends BaseEditController {
|
|||
// default to object property restriction
|
||||
boolean propertyType = ("data".equals(request.getParameter("propertyType"))) ? DATA : OBJECT ;
|
||||
|
||||
List<? extends Property> pList = (propertyType == OBJECT)
|
||||
List<? extends ResourceBean> pList = (propertyType == OBJECT)
|
||||
? request.getUnfilteredWebappDaoFactory().getObjectPropertyDao().getAllObjectProperties()
|
||||
: request.getUnfilteredWebappDaoFactory().getDataPropertyDao().getAllDataProperties();
|
||||
List<Option> onPropertyList = new LinkedList<Option>();
|
||||
Collections.sort(pList, new PropSorter());
|
||||
for (Property p: pList) {
|
||||
sortForPickList(pList, request);
|
||||
for (ResourceBean p: pList) {
|
||||
onPropertyList.add( new Option(p.getURI(),p.getPickListName()));
|
||||
}
|
||||
|
||||
|
@ -146,14 +145,5 @@ public class RestrictionRetryController extends BaseEditController {
|
|||
return valueDatatypeOptionList;
|
||||
}
|
||||
|
||||
private class PropSorter implements Comparator<Property> {
|
||||
|
||||
public int compare(Property p1, Property p2) {
|
||||
if (p1.getLocalNameWithPrefix() == null) return 1;
|
||||
if (p2.getLocalNameWithPrefix() == null) return -1;
|
||||
return Collator.getInstance().compare(p1.getLocalNameWithPrefix(), p2.getLocalNameWithPrefix());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -201,9 +201,9 @@ public class ClassHierarchyListingController extends BaseEditController {
|
|||
Integer numCols = (NUM_COLS-1)-position;
|
||||
|
||||
try {
|
||||
numCols = addColToResults(((vcw.getLocalNameWithPrefix() == null) ? "" : "<a href=\"vclassEdit?uri="+URLEncoder.encode(vcw.getURI(),"UTF-8")+"\">"+vcw.getLocalNameWithPrefix()+"</a>"), results, numCols);
|
||||
numCols = addColToResults(((vcw.getPickListName() == null) ? "" : "<a href=\"vclassEdit?uri="+URLEncoder.encode(vcw.getURI(),"UTF-8")+"\">"+vcw.getPickListName()+"</a>"), results, numCols);
|
||||
} catch (Exception e) {
|
||||
numCols = addColToResults(((vcw.getLocalNameWithPrefix() == null) ? "" : vcw.getLocalNameWithPrefix()), results, numCols); // column 2
|
||||
numCols = addColToResults(((vcw.getPickListName() == null) ? "" : vcw.getPickListName()), results, numCols); // column 2
|
||||
}
|
||||
numCols = addColToResults(((vcw.getShortDef() == null) ? "" : vcw.getShortDef()), results, numCols); // column 3
|
||||
numCols = addColToResults(((vcw.getExample() == null) ? "" : vcw.getExample()), results, numCols); // column 4
|
||||
|
|
|
@ -187,13 +187,13 @@ public class DataPropertyHierarchyListingController extends BaseEditController {
|
|||
|
||||
String nameStr = dp.getPublicName()==null ? dp.getName()==null ? dp.getURI()==null ? "(no name)" : dp.getURI() : dp.getName() : dp.getPublicName();
|
||||
try {
|
||||
numCols=addColToResults("<a href=\"datapropEdit?uri="+URLEncoder.encode(dp.getURI(),"UTF-8")+"\">"+nameStr+"</a> <span style='font-style:italic; color:\"grey\";'>"+dp.getLocalNameWithPrefix()+"</span>",results,numCols); // column 2
|
||||
numCols=addColToResults("<a href=\"datapropEdit?uri="+URLEncoder.encode(dp.getURI(),"UTF-8")+"\">"+nameStr+"</a> <span style='font-style:italic; color:\"grey\";'>"+dp.getPickListName()+"</span>",results,numCols); // column 2
|
||||
} catch (Exception e) {
|
||||
numCols=addColToResults(nameStr + " <i>" + dp.getLocalNameWithPrefix() + "</i>",results,numCols); // column 2
|
||||
numCols=addColToResults(nameStr + " <i>" + dp.getPickListName() + "</i>",results,numCols); // column 2
|
||||
}
|
||||
VClass tmp = null;
|
||||
try {
|
||||
numCols = addColToResults((((tmp = vcDao.getVClassByURI(dp.getDomainClassURI())) != null && (tmp.getLocalNameWithPrefix() == null)) ? "" : vcDao.getVClassByURI(dp.getDomainClassURI()).getLocalNameWithPrefix()), results, numCols); // column 3
|
||||
numCols = addColToResults((((tmp = vcDao.getVClassByURI(dp.getDomainClassURI())) != null && (tmp.getPickListName() == null)) ? "" : vcDao.getVClassByURI(dp.getDomainClassURI()).getPickListName()), results, numCols); // column 3
|
||||
} catch (NullPointerException e) {
|
||||
numCols = addColToResults("-",results,numCols);
|
||||
}
|
||||
|
@ -237,10 +237,4 @@ public class DataPropertyHierarchyListingController extends BaseEditController {
|
|||
return colIndex-1;
|
||||
}
|
||||
|
||||
private class DataPropertyAlphaComparator implements Comparator {
|
||||
public int compare(Object o1, Object o2) {
|
||||
return Collator.getInstance().compare( ((DataProperty)o1).getName(), ((DataProperty)o2).getName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -111,9 +111,9 @@ public class DatatypePropertiesListingController extends BaseEditController {
|
|||
results.add("XX"); // column 1
|
||||
String nameStr = prop.getPublicName()==null ? prop.getName()==null ? prop.getURI()==null ? "(no name)" : prop.getURI() : prop.getName() : prop.getPublicName();
|
||||
try {
|
||||
results.add("<a href=\"datapropEdit?uri="+URLEncoder.encode(prop.getURI(),"UTF-8")+"\">"+nameStr+"</a> <span style='font-style:italic; color:\"grey\";'>"+prop.getLocalNameWithPrefix()+"</span>"); // column 2
|
||||
results.add("<a href=\"datapropEdit?uri="+URLEncoder.encode(prop.getURI(),"UTF-8")+"\">"+nameStr+"</a> <span style='font-style:italic; color:\"grey\";'>"+prop.getPickListName()+"</span>"); // column 2
|
||||
} catch (Exception e) {
|
||||
results.add(nameStr + " <span style='font-style:italic; color:\"grey\";'>" + prop.getLocalNameWithPrefix() + "</span>"); // column 2
|
||||
results.add(nameStr + " <span style='font-style:italic; color:\"grey\";'>" + prop.getPickListName() + "</span>"); // column 2
|
||||
}
|
||||
VClass vc = null;
|
||||
String domainStr="";
|
||||
|
@ -170,19 +170,4 @@ public class DatatypePropertiesListingController extends BaseEditController {
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
private class DatatypePropertyAlphaComparator implements Comparator {
|
||||
public int compare (Object o1, Object o2) {
|
||||
Collator collator = Collator.getInstance();
|
||||
DataProperty dp1 = (DataProperty) o1;
|
||||
DataProperty dp2 = (DataProperty) o2;
|
||||
String dp1Str = (dp1.getPublicName()==null) ? dp1.getName() : dp1.getPublicName();
|
||||
dp1Str = (dp1Str == null) ? "" : dp1Str;
|
||||
String dp2Str = (dp2.getPublicName()==null) ? dp2.getName() : dp2.getPublicName();
|
||||
dp2Str = (dp2Str == null) ? "" : dp2Str;
|
||||
return collator.compare(dp1Str,dp2Str);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ public class ObjectPropertyHierarchyListingController extends BaseEditController
|
|||
} else {
|
||||
roots = opDao.getRootObjectProperties();
|
||||
if (roots!=null){
|
||||
Collections.sort(roots, new ObjectPropertyAlphaComparator()); // sorts by domain public
|
||||
Collections.sort(roots, new ObjectPropertyAlphaComparator(vrequest.getCollator())); // sorts by domain public
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,16 +187,16 @@ public class ObjectPropertyHierarchyListingController extends BaseEditController
|
|||
}
|
||||
|
||||
numCols = addColToResults( ((hyperlink != null) ? hyperlink : getDisplayLabel(op))
|
||||
+ "<br/><span style='font-style:italic; color:\"grey\";'>"+op.getLocalNameWithPrefix()+"</span>", results, numCols); // column 2
|
||||
+ "<br/><span style='font-style:italic; color:\"grey\";'>"+op.getPickListName()+"</span>", results, numCols); // column 2
|
||||
|
||||
VClass tmp = null;
|
||||
try {
|
||||
numCols = addColToResults((((tmp = vcDao.getVClassByURI(op.getDomainVClassURI())) != null && (tmp.getLocalNameWithPrefix() == null)) ? "" : vcDao.getVClassByURI(op.getDomainVClassURI()).getLocalNameWithPrefix()), results, numCols); // column 3
|
||||
numCols = addColToResults((((tmp = vcDao.getVClassByURI(op.getDomainVClassURI())) != null && (tmp.getPickListName() == null)) ? "" : vcDao.getVClassByURI(op.getDomainVClassURI()).getPickListName()), results, numCols); // column 3
|
||||
} catch (NullPointerException e) {
|
||||
numCols = addColToResults("",results,numCols);
|
||||
}
|
||||
try {
|
||||
numCols = addColToResults((((tmp = vcDao.getVClassByURI(op.getRangeVClassURI())) != null && (tmp.getLocalNameWithPrefix() == null)) ? "" : vcDao.getVClassByURI(op.getRangeVClassURI()).getLocalNameWithPrefix()), results, numCols); // column 4
|
||||
numCols = addColToResults((((tmp = vcDao.getVClassByURI(op.getRangeVClassURI())) != null && (tmp.getPickListName() == null)) ? "" : vcDao.getVClassByURI(op.getRangeVClassURI()).getPickListName()), results, numCols); // column 4
|
||||
} catch (NullPointerException e) {
|
||||
numCols = addColToResults("",results,numCols);
|
||||
}
|
||||
|
@ -237,6 +237,13 @@ public class ObjectPropertyHierarchyListingController extends BaseEditController
|
|||
}
|
||||
|
||||
public static class ObjectPropertyAlphaComparator implements Comparator<ObjectProperty> {
|
||||
|
||||
Collator collator;
|
||||
|
||||
public ObjectPropertyAlphaComparator(Collator collator) {
|
||||
this.collator = collator;
|
||||
}
|
||||
|
||||
public int compare(ObjectProperty op1, ObjectProperty op2) {
|
||||
if (op1 == null) {
|
||||
return 1;
|
||||
|
@ -250,7 +257,7 @@ public class ObjectPropertyHierarchyListingController extends BaseEditController
|
|||
} else if (propLabel2 == null) {
|
||||
return -1;
|
||||
} else {
|
||||
return Collator.getInstance().compare( propLabel1, propLabel2 );
|
||||
return collator.compare( propLabel1, propLabel2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ public class ObjectPropertyStatementListingController extends
|
|||
|
||||
if (count == 0) {
|
||||
results.add("XX");
|
||||
results.add("No statements found for property \""+op.getLocalNameWithPrefix()+"\"");
|
||||
results.add("No statements found for property \""+op.getPickListName()+"\"");
|
||||
results.add("");
|
||||
results.add("");
|
||||
if (showVClasses) {
|
||||
|
|
|
@ -47,7 +47,7 @@ public class PropertyGroupsListingController extends BaseEditController {
|
|||
|
||||
List<PropertyGroup> groups = dao.getPublicGroups(WITH_PROPERTIES);
|
||||
|
||||
Comparator<Property> comparator = new PropertySorter();
|
||||
Comparator<Property> comparator = new PropertySorter(vreq.getCollator());
|
||||
|
||||
List<String> results = new ArrayList<String>();
|
||||
results.add("XX");
|
||||
|
@ -138,7 +138,11 @@ public class PropertyGroupsListingController extends BaseEditController {
|
|||
|
||||
private class PropertySorter implements Comparator<Property> {
|
||||
|
||||
private Collator coll = Collator.getInstance();
|
||||
Collator collator;
|
||||
|
||||
public PropertySorter(Collator collator) {
|
||||
this.collator = collator;
|
||||
}
|
||||
|
||||
public int compare(Property p1, Property p2) {
|
||||
String name1 = getName(p1);
|
||||
|
@ -150,7 +154,7 @@ public class PropertyGroupsListingController extends BaseEditController {
|
|||
} else if (name1 == null && name2 == null) {
|
||||
return 0;
|
||||
}
|
||||
return coll.compare(name1, name2);
|
||||
return collator.compare(name1, name2);
|
||||
}
|
||||
|
||||
private String getName(Property prop) {
|
||||
|
|
|
@ -125,7 +125,9 @@ public class PropertyWebappsListingController extends BaseEditController {
|
|||
}
|
||||
|
||||
if (props != null) {
|
||||
Collections.sort(props, new ObjectPropertyHierarchyListingController.ObjectPropertyAlphaComparator());
|
||||
Collections.sort(
|
||||
props, new ObjectPropertyHierarchyListingController
|
||||
.ObjectPropertyAlphaComparator(vrequest.getCollator()));
|
||||
}
|
||||
|
||||
ArrayList results = new ArrayList();
|
||||
|
@ -163,16 +165,16 @@ public class PropertyWebappsListingController extends BaseEditController {
|
|||
results.add(propNameStr); // column 2
|
||||
}
|
||||
|
||||
results.add(prop.getLocalNameWithPrefix()); // column 3
|
||||
results.add(prop.getPickListName()); // column 3
|
||||
|
||||
VClass vc = (prop.getDomainVClassURI() != null) ?
|
||||
vcDao.getVClassByURI(prop.getDomainVClassURI()) : null;
|
||||
String domainStr = (vc != null) ? vc.getLocalNameWithPrefix() : "";
|
||||
String domainStr = (vc != null) ? vc.getPickListName() : "";
|
||||
results.add(domainStr); // column 4
|
||||
|
||||
vc = (prop.getRangeVClassURI() != null) ?
|
||||
vcDao.getVClassByURI(prop.getRangeVClassURI()) : null;
|
||||
String rangeStr = (vc != null) ? vc.getLocalNameWithPrefix() : "";
|
||||
String rangeStr = (vc != null) ? vc.getPickListName() : "";
|
||||
results.add(rangeStr); // column 5
|
||||
|
||||
if (prop.getGroupURI() != null) {
|
||||
|
|
|
@ -115,11 +115,4 @@ public class VClassWebappWithInstancesListingController extends BaseEditControll
|
|||
|
||||
}
|
||||
|
||||
private class EntityWebappAlphaComparator implements Comparator {
|
||||
public int compare (Object o1, Object o2) {
|
||||
Collator collator = Collator.getInstance();
|
||||
return collator.compare(((ObjectProperty)o1).getLocalName(),((ObjectProperty)o2).getLocalName());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -79,9 +79,9 @@ public class VClassWebappsListingController extends BaseEditController {
|
|||
if (cls.getName() != null)
|
||||
try {
|
||||
//String className = (cls.getName()==null || cls.getName().length()==0) ? cls.getURI() : cls.getName();
|
||||
results.add("<a href=\"./vclassEdit?uri="+URLEncoder.encode(cls.getURI(),"UTF-8")+"\">"+cls.getLocalNameWithPrefix()+"</a>");
|
||||
results.add("<a href=\"./vclassEdit?uri="+URLEncoder.encode(cls.getURI(),"UTF-8")+"\">"+cls.getPickListName()+"</a>");
|
||||
} catch (Exception e) {
|
||||
results.add(cls.getLocalNameWithPrefix());
|
||||
results.add(cls.getPickListName());
|
||||
}
|
||||
else
|
||||
results.add("");
|
||||
|
|
|
@ -124,7 +124,7 @@ public class RestrictionsListingController extends BaseEditController {
|
|||
results.add("XX");
|
||||
Property onProperty = rest.getOnProperty();
|
||||
ObjectProperty op = opDao.getObjectPropertyByURI(onProperty.getURI());
|
||||
results.add(op.getLocalNameWithPrefix());
|
||||
results.add(op.getPickListName());
|
||||
if (rest.isAllValuesFromRestriction()) {
|
||||
results.add("all values from");
|
||||
AllValuesFromRestriction avfrest = (AllValuesFromRestriction) rest.as(AllValuesFromRestriction.class);
|
||||
|
|
|
@ -92,7 +92,7 @@ public class ListDatatypePropertiesController extends FreemarkerHttpServlet {
|
|||
}
|
||||
|
||||
if (props != null) {
|
||||
Collections.sort(props);
|
||||
sortForPickList(props, vreq);
|
||||
}
|
||||
|
||||
String json = new String();
|
||||
|
@ -107,7 +107,7 @@ public class ListDatatypePropertiesController extends FreemarkerHttpServlet {
|
|||
json += ", ";
|
||||
}
|
||||
|
||||
String nameStr = prop.getPublicName()==null ? prop.getName()==null ? prop.getURI()==null ? "(no name)" : prop.getURI() : prop.getName() : prop.getPublicName();
|
||||
String nameStr = prop.getPickListName()==null ? prop.getName()==null ? prop.getURI()==null ? "(no name)" : prop.getURI() : prop.getName() : prop.getPublicName();
|
||||
|
||||
try {
|
||||
json += "{ \"name\": " + JSONUtils.quote("<a href='datapropEdit?uri="+ URLEncoder.encode(prop.getURI())+"'>" + nameStr + "</a>") + ", ";
|
||||
|
@ -115,7 +115,7 @@ public class ListDatatypePropertiesController extends FreemarkerHttpServlet {
|
|||
json += "{ \"name\": " + JSONUtils.quote(nameStr) + ", ";
|
||||
}
|
||||
|
||||
json += "\"data\": { \"internalName\": " + JSONUtils.quote(prop.getLocalNameWithPrefix()) + ", ";
|
||||
json += "\"data\": { \"internalName\": " + JSONUtils.quote(prop.getPickListName()) + ", ";
|
||||
|
||||
/* VClass vc = null;
|
||||
String domainStr="";
|
||||
|
@ -131,7 +131,7 @@ public class ListDatatypePropertiesController extends FreemarkerHttpServlet {
|
|||
}
|
||||
*/
|
||||
VClass vc = (prop.getDomainClassURI() != null) ? vcDao.getVClassByURI(prop.getDomainClassURI()) : null;
|
||||
String domainStr = (vc != null) ? vc.getLocalNameWithPrefix() : "";
|
||||
String domainStr = (vc != null) ? vc.getPickListName() : "";
|
||||
json += "\"domainVClass\": " + JSONUtils.quote(domainStr) + ", " ;
|
||||
|
||||
Datatype rangeDatatype = dDao.getDatatypeByURI(prop.getRangeDatatypeURI());
|
||||
|
|
|
@ -49,8 +49,7 @@ public class ListPropertyGroupsController extends FreemarkerHttpServlet {
|
|||
PropertyGroupDao dao = vreq.getUnfilteredWebappDaoFactory().getPropertyGroupDao();
|
||||
|
||||
List<PropertyGroup> groups = dao.getPublicGroups(WITH_PROPERTIES);
|
||||
|
||||
// Comparator<Property> comparator = new PropertySorter();
|
||||
sortForPickList(groups, vreq);
|
||||
|
||||
String json = new String();
|
||||
int counter = 0;
|
||||
|
@ -125,33 +124,4 @@ public class ListPropertyGroupsController extends FreemarkerHttpServlet {
|
|||
return new TemplateResponseValues(TEMPLATE_NAME, body);
|
||||
}
|
||||
|
||||
/*
|
||||
private class PropertySorter implements Comparator<Property> {
|
||||
|
||||
private Collator coll = Collator.getInstance();
|
||||
|
||||
public int compare(Property p1, Property p2) {
|
||||
String name1 = getName(p1);
|
||||
String name2 = getName(p2);
|
||||
if (name1 == null && name2 != null) {
|
||||
return 1;
|
||||
} else if (name2 == null && name1 != null) {
|
||||
return -1;
|
||||
} else if (name1 == null && name2 == null) {
|
||||
return 0;
|
||||
}
|
||||
return coll.compare(name1, name2);
|
||||
}
|
||||
|
||||
private String getName(Property prop) {
|
||||
if (prop instanceof ObjectProperty) {
|
||||
return ((ObjectProperty) prop).getDomainPublic();
|
||||
} else if (prop instanceof DataProperty) {
|
||||
return ((DataProperty) prop).getName();
|
||||
} else {
|
||||
return prop.getLabel();
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ public class ListPropertyWebappsController extends FreemarkerHttpServlet {
|
|||
}
|
||||
|
||||
if (props != null) {
|
||||
Collections.sort(props, new ShowObjectPropertyHierarchyController.ObjectPropertyAlphaComparator());
|
||||
sortForPickList(props, vreq);
|
||||
}
|
||||
|
||||
String json = new String();
|
||||
|
@ -161,11 +161,11 @@ public class ListPropertyWebappsController extends FreemarkerHttpServlet {
|
|||
json += "\"data\": { \"internalName\": " + JSONUtils.quote(prop.getLocalNameWithPrefix()) + ", ";
|
||||
|
||||
VClass vc = (prop.getDomainVClassURI() != null) ? vcDao.getVClassByURI(prop.getDomainVClassURI()) : null;
|
||||
String domainStr = (vc != null) ? vc.getLocalNameWithPrefix() : "";
|
||||
String domainStr = (vc != null) ? vc.getPickListName() : "";
|
||||
json += "\"domainVClass\": " + JSONUtils.quote(domainStr) + ", " ;
|
||||
|
||||
vc = (prop.getRangeVClassURI() != null) ? vcDao.getVClassByURI(prop.getRangeVClassURI()) : null;
|
||||
String rangeStr = (vc != null) ? vc.getLocalNameWithPrefix() : "";
|
||||
String rangeStr = (vc != null) ? vc.getPickListName() : "";
|
||||
json += "\"rangeVClass\": " + JSONUtils.quote(rangeStr) + ", " ;
|
||||
|
||||
if (prop.getGroupURI() != null) {
|
||||
|
|
|
@ -69,7 +69,7 @@ public class ListVClassWebappsController extends FreemarkerHttpServlet {
|
|||
String ontologyURI = vreq.getParameter("ontologyUri");
|
||||
|
||||
if (classes != null) {
|
||||
Collections.sort(classes);
|
||||
sortForPickList(classes, vreq);
|
||||
Iterator<VClass> classesIt = classes.iterator();
|
||||
while (classesIt.hasNext()) {
|
||||
if ( counter > 0 ) {
|
||||
|
@ -79,9 +79,9 @@ public class ListVClassWebappsController extends FreemarkerHttpServlet {
|
|||
if ( (ontologyURI==null) || ( (ontologyURI != null) && (cls.getNamespace()!=null) && (ontologyURI.equals(cls.getNamespace())) ) ) {
|
||||
if (cls.getName() != null)
|
||||
try {
|
||||
json += "{ \"name\": " + JSONUtils.quote("<a href='./vclassEdit?uri="+URLEncoder.encode(cls.getURI(),"UTF-8")+"'>"+cls.getLocalNameWithPrefix()+"</a>") + ", ";
|
||||
json += "{ \"name\": " + JSONUtils.quote("<a href='./vclassEdit?uri="+URLEncoder.encode(cls.getURI(),"UTF-8")+"'>"+cls.getPickListName()+"</a>") + ", ";
|
||||
} catch (Exception e) {
|
||||
json += "{ \"name\": " + JSONUtils.quote(cls.getLocalNameWithPrefix()) + ", ";
|
||||
json += "{ \"name\": " + JSONUtils.quote(cls.getPickListName()) + ", ";
|
||||
}
|
||||
else
|
||||
json += "{ \"name\": \"\"";
|
||||
|
|
|
@ -97,7 +97,7 @@ public class ShowClassHierarchyController extends FreemarkerHttpServlet {
|
|||
roots.add(vreq.getUnfilteredWebappDaoFactory().getVClassDao()
|
||||
.getTopConcept());
|
||||
}
|
||||
Collections.sort(roots);
|
||||
sortForPickList(roots, vreq);
|
||||
int counter = 0;
|
||||
|
||||
Iterator<VClass> rootIt = roots.iterator();
|
||||
|
@ -109,7 +109,8 @@ public class ShowClassHierarchyController extends FreemarkerHttpServlet {
|
|||
while (rootIt.hasNext()) {
|
||||
VClass root = (VClass) rootIt.next();
|
||||
if (root != null) {
|
||||
json += addChildren(vreq.getUnfilteredWebappDaoFactory(), root, 0, ontologyUri,counter);
|
||||
json += addChildren(vreq.getUnfilteredWebappDaoFactory(),
|
||||
root, 0, ontologyUri, counter, vreq);
|
||||
counter += 1;
|
||||
}
|
||||
}
|
||||
|
@ -123,7 +124,8 @@ public class ShowClassHierarchyController extends FreemarkerHttpServlet {
|
|||
return new TemplateResponseValues(TEMPLATE_NAME, body);
|
||||
}
|
||||
|
||||
private String addChildren(WebappDaoFactory wadf, VClass parent, int position, String ontologyUri, int counter) {
|
||||
private String addChildren(WebappDaoFactory wadf, VClass parent, int position,
|
||||
String ontologyUri, int counter, VitroRequest vreq) {
|
||||
String rowElts = addVClassDataToResultsList(wadf, parent, position, ontologyUri, counter);
|
||||
int childShift = (rowElts.length() > 0) ? 1 : 0; // if addVClassDataToResultsList filtered out the result, don't shift the children over
|
||||
int length = rowElts.length();
|
||||
|
@ -142,11 +144,11 @@ public class ShowClassHierarchyController extends FreemarkerHttpServlet {
|
|||
}
|
||||
} catch (Exception e) {}
|
||||
}
|
||||
Collections.sort(childClasses);
|
||||
sortForPickList(childClasses, vreq);
|
||||
Iterator<VClass> childClassIt = childClasses.iterator();
|
||||
while (childClassIt.hasNext()) {
|
||||
VClass child = (VClass) childClassIt.next();
|
||||
leaves += addChildren(wadf, child, position + childShift, ontologyUri, counter);
|
||||
leaves += addChildren(wadf, child, position + childShift, ontologyUri, counter, vreq);
|
||||
if (!childClassIt.hasNext()) {
|
||||
if ( ontologyUri == null ) {
|
||||
leaves += " }] ";
|
||||
|
@ -197,10 +199,10 @@ public class ShowClassHierarchyController extends FreemarkerHttpServlet {
|
|||
try {
|
||||
tempString += JSONUtils.quote("<a href='vclassEdit?uri=" +
|
||||
URLEncoder.encode(vcw.getURI(),"UTF-8") + "'>" +
|
||||
vcw.getLocalNameWithPrefix() + "</a>") +", ";
|
||||
vcw.getPickListName() + "</a>") +", ";
|
||||
} catch (Exception e) {
|
||||
tempString += JSONUtils.quote(((vcw.getLocalNameWithPrefix() == null)
|
||||
? "" : vcw.getLocalNameWithPrefix())) + ", ";
|
||||
tempString += JSONUtils.quote(((vcw.getPickListName() == null)
|
||||
? "" : vcw.getPickListName())) + ", ";
|
||||
}
|
||||
|
||||
String shortDef = ((vcw.getShortDef() == null) ? "" : vcw.getShortDef()) ;
|
||||
|
|
|
@ -94,7 +94,7 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet {
|
|||
} else {
|
||||
roots = dpDao.getRootDataProperties();
|
||||
if (roots!=null){
|
||||
Collections.sort(roots);
|
||||
sortForPickList(roots, vreq);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet {
|
|||
while (rootIt.hasNext()) {
|
||||
DataProperty root = rootIt.next();
|
||||
if ( (ontologyUri==null) || ( (ontologyUri!=null) && (root.getNamespace()!=null) && (ontologyUri.equals(root.getNamespace())) ) ) {
|
||||
json += addChildren(root, 0, ontologyUri, counter);
|
||||
json += addChildren(root, 0, ontologyUri, counter, vreq);
|
||||
counter += 1;
|
||||
}
|
||||
}
|
||||
|
@ -132,7 +132,8 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet {
|
|||
return new TemplateResponseValues(TEMPLATE_NAME, body);
|
||||
}
|
||||
|
||||
private String addChildren(DataProperty parent, int position, String ontologyUri, int counter) {
|
||||
private String addChildren(DataProperty parent, int position, String ontologyUri,
|
||||
int counter, VitroRequest vreq) {
|
||||
if (parent == null) {
|
||||
return "";
|
||||
}
|
||||
|
@ -149,11 +150,11 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet {
|
|||
DataProperty child = dpDao.getDataPropertyByURI(URIstr);
|
||||
childProps.add(child);
|
||||
}
|
||||
Collections.sort(childProps);
|
||||
sortForPickList(childProps, vreq);
|
||||
Iterator<DataProperty> childPropIt = childProps.iterator();
|
||||
while (childPropIt.hasNext()) {
|
||||
DataProperty child = childPropIt.next();
|
||||
leaves += addChildren(child, position+1, ontologyUri, counter);
|
||||
leaves += addChildren(child, position+1, ontologyUri, counter, vreq);
|
||||
if (!childPropIt.hasNext()) {
|
||||
if ( ontologyUri == null ) {
|
||||
leaves += " }] ";
|
||||
|
@ -204,7 +205,7 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet {
|
|||
tempString += "}, { \"name\": ";
|
||||
}
|
||||
|
||||
String nameStr = dp.getPublicName() == null
|
||||
String nameStr = dp.getPickListName() == null
|
||||
? dp.getName() == null
|
||||
? dp.getURI() == null
|
||||
? "(no name)" : dp.getURI() : dp.getName() : dp.getPublicName();
|
||||
|
@ -214,17 +215,17 @@ public class ShowDataPropertyHierarchyController extends FreemarkerHttpServlet {
|
|||
dp.getURI()) + "'>" + nameStr + "</a>") + ", ";
|
||||
|
||||
tempString += "\"data\": { \"internalName\": " + JSONUtils.quote(
|
||||
dp.getLocalNameWithPrefix()) + ", ";
|
||||
dp.getPickListName()) + ", ";
|
||||
|
||||
VClass tmp = null;
|
||||
try {
|
||||
tempString += "\"domainVClass\": " + JSONUtils.quote(
|
||||
((tmp = vcDao.getVClassByURI(dp.getDomainClassURI())) != null
|
||||
&& (tmp.getLocalNameWithPrefix() == null))
|
||||
&& (tmp.getPickListName() == null))
|
||||
? ""
|
||||
: vcDao.getVClassByURI(
|
||||
dp.getDomainClassURI())
|
||||
.getLocalNameWithPrefix()) + ", " ;
|
||||
.getPickListName()) + ", " ;
|
||||
} catch (NullPointerException e) {
|
||||
tempString += "\"domainVClass\": \"\",";
|
||||
}
|
||||
|
|
|
@ -96,7 +96,7 @@ public class ShowObjectPropertyHierarchyController extends FreemarkerHttpServlet
|
|||
} else {
|
||||
roots = opDao.getRootObjectProperties();
|
||||
if (roots!=null){
|
||||
Collections.sort(roots, new ObjectPropertyAlphaComparator()); // sorts by domain public
|
||||
Collections.sort(roots, new ObjectPropertyAlphaComparator(vreq)); // sorts by domain public
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,11 +219,11 @@ public class ShowObjectPropertyHierarchyController extends FreemarkerHttpServlet
|
|||
tempString += "\"domainVClass\": " + JSONUtils.quote(
|
||||
((tmp = vcDao.getVClassByURI(
|
||||
op.getDomainVClassURI())) != null
|
||||
&& (tmp.getLocalNameWithPrefix() == null))
|
||||
&& (tmp.getPickListName() == null))
|
||||
? ""
|
||||
: vcDao.getVClassByURI(
|
||||
op.getDomainVClassURI())
|
||||
.getLocalNameWithPrefix()) + ", " ;
|
||||
.getPickListName()) + ", " ;
|
||||
} catch (NullPointerException e) {
|
||||
tempString += "\"domainVClass\": \"\",";
|
||||
}
|
||||
|
@ -231,11 +231,11 @@ public class ShowObjectPropertyHierarchyController extends FreemarkerHttpServlet
|
|||
tempString += "\"rangeVClass\": " + JSONUtils.quote(
|
||||
((tmp = vcDao.getVClassByURI(
|
||||
op.getRangeVClassURI())) != null
|
||||
&& (tmp.getLocalNameWithPrefix() == null))
|
||||
&& (tmp.getPickListName() == null))
|
||||
? ""
|
||||
: vcDao.getVClassByURI(
|
||||
op.getRangeVClassURI())
|
||||
.getLocalNameWithPrefix()) + ", " ;
|
||||
.getPickListName()) + ", " ;
|
||||
} catch (NullPointerException e) {
|
||||
tempString += "\"rangeVClass\": \"\",";
|
||||
}
|
||||
|
@ -254,20 +254,27 @@ public class ShowObjectPropertyHierarchyController extends FreemarkerHttpServlet
|
|||
}
|
||||
|
||||
public static class ObjectPropertyAlphaComparator implements Comparator<ObjectProperty> {
|
||||
|
||||
Collator collator;
|
||||
|
||||
public ObjectPropertyAlphaComparator(VitroRequest vreq) {
|
||||
this.collator = vreq.getCollator();
|
||||
}
|
||||
|
||||
public int compare(ObjectProperty op1, ObjectProperty op2) {
|
||||
if (op1 == null) {
|
||||
return 1;
|
||||
} else if (op2 == null) {
|
||||
return -1;
|
||||
}
|
||||
String propLabel1 = getDisplayLabel(op1);
|
||||
String propLabel2 = getDisplayLabel(op2);
|
||||
String propLabel1 = op1.getPickListName();
|
||||
String propLabel2 = op2.getPickListName();
|
||||
if (propLabel1 == null) {
|
||||
return 1;
|
||||
} else if (propLabel2 == null) {
|
||||
return -1;
|
||||
} else {
|
||||
return Collator.getInstance().compare( propLabel1, propLabel2 );
|
||||
return collator.compare( propLabel1, propLabel2 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -276,9 +283,9 @@ public class ShowObjectPropertyHierarchyController extends FreemarkerHttpServlet
|
|||
* should never be null
|
||||
*/
|
||||
public static String getDisplayLabel(ObjectProperty op) {
|
||||
String domainPublic = op.getDomainPublic();
|
||||
String displayLabel = (domainPublic != null && domainPublic.length() > 0)
|
||||
? domainPublic
|
||||
String displayLabel = op.getPickListName();
|
||||
displayLabel = (displayLabel != null && displayLabel.length() > 0)
|
||||
? displayLabel
|
||||
: op.getLocalName();
|
||||
return (displayLabel != null) ? displayLabel : "[object property]" ;
|
||||
}
|
||||
|
|
|
@ -5,15 +5,12 @@ package edu.cornell.mannlib.vitro.webapp.controller.freemarker;
|
|||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
//import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.openrdf.model.URI;
|
||||
import org.openrdf.model.impl.URIImpl;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
||||
|
@ -33,6 +30,7 @@ public class UrlBuilder {
|
|||
BROWSE("/browse"),
|
||||
CONTACT("/contact"),
|
||||
DATA_PROPERTY_EDIT("/datapropEdit"),
|
||||
DISPLAY("/display"),
|
||||
INDIVIDUAL("/individual"),
|
||||
INDIVIDUAL_EDIT("/entityEdit"),
|
||||
INDIVIDUAL_LIST("/individuallist"),
|
||||
|
@ -250,14 +248,14 @@ public class UrlBuilder {
|
|||
String defaultNamespace = wadf.getDefaultNamespace();
|
||||
|
||||
if (defaultNamespace.equals(namespace)) {
|
||||
profileUrl = getUrl(Route.INDIVIDUAL.path() + "/" + localName);
|
||||
profileUrl = getUrl(Route.DISPLAY.path() + "/" + localName);
|
||||
} else {
|
||||
if (wadf.getApplicationDao().isExternallyLinkedNamespace(namespace)) {
|
||||
log.debug("Found externally linked namespace " + namespace);
|
||||
profileUrl = namespace + localName;
|
||||
} else {
|
||||
ParamMap params = new ParamMap("uri", individual.getURI());
|
||||
profileUrl = getUrl("/individual", params);
|
||||
profileUrl = getUrl(Route.INDIVIDUAL.path(), params);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -284,25 +282,6 @@ public class UrlBuilder {
|
|||
return getIndividualProfileUrl(new IndividualImpl(individualUri), vreq);
|
||||
}
|
||||
|
||||
protected static String getIndividualProfileUrl(
|
||||
String individualUri,
|
||||
String namespace, String localName,
|
||||
String defaultNamespace){
|
||||
String profileUrl = "";
|
||||
try{
|
||||
if ( isUriInDefaultNamespace( individualUri, defaultNamespace) ) {
|
||||
profileUrl = getUrl(Route.INDIVIDUAL.path() + "/" + localName);
|
||||
} else {
|
||||
ParamMap params = new ParamMap("uri", individualUri);
|
||||
profileUrl = getUrl("/individual", params);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.warn(e);
|
||||
return null;
|
||||
}
|
||||
return profileUrl;
|
||||
}
|
||||
|
||||
public static boolean isUriInDefaultNamespace(String individualUri, VitroRequest vreq) {
|
||||
return isUriInDefaultNamespace(individualUri, vreq.getWebappDaoFactory());
|
||||
}
|
||||
|
|
|
@ -162,9 +162,7 @@ class IndividualResponseBuilder {
|
|||
map = new HashMap<String, Object>();
|
||||
map.put("name", relatedSubjectInd.getName());
|
||||
|
||||
// TODO find out which of these values is the correct one
|
||||
map.put("url", UrlBuilder.getIndividualProfileUrl(relatedSubjectInd, vreq));
|
||||
map.put("url", (new ListedIndividual(relatedSubjectInd, vreq)).getProfileUrl());
|
||||
|
||||
String relatingPredicateUri = vreq.getParameter("relatingPredicateUri");
|
||||
if (relatingPredicateUri != null) {
|
||||
|
|
|
@ -450,7 +450,7 @@ public class JenaIngestController extends BaseEditController {
|
|||
vreq.setAttribute("bodyJsp",INGEST_MENU_JSP);
|
||||
} else {
|
||||
List<String> dbTypes = DatabaseType.allNames();
|
||||
Collections.sort(dbTypes, new CollationSort());
|
||||
Collections.sort(dbTypes, new CollationSort(vreq));
|
||||
vreq.setAttribute("dbTypes", dbTypes);
|
||||
vreq.setAttribute("title", "Connect Jena Database");
|
||||
vreq.setAttribute("bodyJsp",CONNECT_DB_JSP);
|
||||
|
@ -1295,7 +1295,11 @@ public class JenaIngestController extends BaseEditController {
|
|||
|
||||
private class CollationSort implements Comparator<String> {
|
||||
|
||||
Collator collator = Collator.getInstance();
|
||||
Collator collator;
|
||||
|
||||
public CollationSort(VitroRequest vreq) {
|
||||
this.collator = vreq.getCollator();
|
||||
}
|
||||
|
||||
public int compare(String s1, String s2) {
|
||||
return collator.compare(s1, s2);
|
||||
|
|
|
@ -259,6 +259,16 @@ public class IndividualFiltering implements Individual {
|
|||
return _innerIndividual.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return _innerIndividual.getLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPickListName() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRdfsLabel(){
|
||||
return _innerIndividual.getRdfsLabel();
|
||||
|
|
|
@ -177,20 +177,10 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
|||
dp.setURI(op.getURI());
|
||||
dp.setNamespace(op.getNameSpace());
|
||||
dp.setLocalName(op.getLocalName());
|
||||
OntologyDao oDao=getWebappDaoFactory().getOntologyDao();
|
||||
Ontology o = oDao.getOntologyByURI(dp.getNamespace());
|
||||
if (o==null) {
|
||||
if (!VitroVocabulary.vitroURI.equals(dp.getNamespace())) {
|
||||
log.debug("datapropFromOntProperty(): no ontology object found for the namespace "+dp.getNamespace());
|
||||
}
|
||||
dp.setLocalNameWithPrefix(dp.getLocalName());
|
||||
dp.setPickListName(getLabelOrId(op));
|
||||
} else {
|
||||
dp.setLocalNameWithPrefix(o.getPrefix()==null?(o.getName()==null?"unspec:"+dp.getLocalName():o.getName()+":"+dp.getLocalName()):o.getPrefix()+":"+dp.getLocalName());
|
||||
dp.setPickListName(getLabelOrId(op)+o.getPrefix()==null?(o.getName()==null?" (unspec:)":" ("+o.getName()+")"):" ("+o.getPrefix()+")");
|
||||
}
|
||||
dp.setLocalNameWithPrefix(getWebappDaoFactory().makeLocalNameWithPrefix(dp));
|
||||
dp.setName(op.getLocalName());
|
||||
dp.setPublicName(getLabelOrId(op));
|
||||
dp.setPickListName(getWebappDaoFactory().makePickListName(dp));
|
||||
Resource dRes = op.getDomain();
|
||||
if (dRes != null) {
|
||||
dp.setDomainClassURI(dRes.getURI());
|
||||
|
|
|
@ -79,6 +79,10 @@ public class IndividualJena extends IndividualImpl implements Individual {
|
|||
}
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return getRdfsLabel();
|
||||
}
|
||||
|
||||
public String getRdfsLabel() {
|
||||
if (this.rdfsLabel != null) {
|
||||
return rdfsLabel;
|
||||
|
|
|
@ -94,27 +94,14 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
|||
p.setURI(op.getURI());
|
||||
p.setNamespace(op.getNameSpace());
|
||||
p.setLocalName(op.getLocalName());
|
||||
OntologyDao oDao=getWebappDaoFactory().getOntologyDao();
|
||||
Ontology o = oDao.getOntologyByURI(p.getNamespace());
|
||||
if (o == null) {
|
||||
if (!VitroVocabulary.vitroURI.equals(p.getNamespace())) {
|
||||
log.debug("propertyFromOntProperty(): no ontology object found for the namespace "+p.getNamespace());
|
||||
}
|
||||
p.setLocalNameWithPrefix(p.getLocalName());
|
||||
p.setPickListName(getLabelOrId(op));
|
||||
} else {
|
||||
String prefix = o.getPrefix()==null?(o.getName()==null?"unspec":o.getName()):o.getPrefix();
|
||||
p.setLocalNameWithPrefix(prefix+":"+p.getLocalName());
|
||||
//log.warn("setting pickListName to: "+p.getLocalName()+" ("+prefix+")");
|
||||
p.setPickListName(getLabelOrId(op) + " ("+prefix+")");
|
||||
}
|
||||
String propertyName = getPropertyStringValue(op,PROPERTY_FULLPROPERTYNAMEANNOT);
|
||||
p.setLocalNameWithPrefix(getWebappDaoFactory().makeLocalNameWithPrefix(p));
|
||||
if (op.getLabel(null) != null)
|
||||
p.setDomainPublic(getLabelOrId(op));
|
||||
else
|
||||
p.setDomainPublic(op.getLocalName());
|
||||
if (p.getDomainPublic() == null)
|
||||
p.setDomainPublic("[related to]");
|
||||
p.setPickListName(getWebappDaoFactory().makePickListName(p));
|
||||
if (op.getDomain() != null)
|
||||
p.setDomainVClassURI( (op.getDomain().isAnon()) ? PSEUDO_BNODE_NS+op.getDomain().getId().toString() : op.getDomain().getURI());
|
||||
if (op.getRange() != null)
|
||||
|
|
|
@ -75,50 +75,27 @@ public class VClassJena extends VClass {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getLocalNameWithPrefix() {
|
||||
public String getLabel() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLocalNameWithPrefix() {
|
||||
if (this.localNameWithPrefix != null) {
|
||||
return localNameWithPrefix;
|
||||
} else {
|
||||
cls.getOntModel().enterCriticalSection(Lock.READ);
|
||||
try {
|
||||
VClassDao vClassDao = webappDaoFactory.getVClassDao();
|
||||
|
||||
if (vClassDao instanceof VClassDaoJena) {
|
||||
this.localNameWithPrefix = ((VClassDaoJena) vClassDao).getLabelForClass(cls,true,false);
|
||||
} else {
|
||||
log.error("WebappDaoFactory returned a type of " + vClassDao.getClass().getName() + ". Expected VClassDaoJena");
|
||||
this.localNameWithPrefix = webappDaoFactory.getJenaBaseDao().getLabelOrId(cls);
|
||||
}
|
||||
|
||||
this.localNameWithPrefix = webappDaoFactory.makeLocalNameWithPrefix(this);
|
||||
return this.localNameWithPrefix;
|
||||
} finally {
|
||||
cls.getOntModel().leaveCriticalSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPickListName() {
|
||||
|
||||
if (this.pickListName != null) {
|
||||
return pickListName;
|
||||
} else {
|
||||
cls.getOntModel().enterCriticalSection(Lock.READ);
|
||||
try {
|
||||
VClassDao vClassDao = webappDaoFactory.getVClassDao();
|
||||
|
||||
if (vClassDao instanceof VClassDaoJena) {
|
||||
this.pickListName = ((VClassDaoJena) vClassDao).getLabelForClass(cls,false,true);
|
||||
} else {
|
||||
log.error("WebappDaoFactory returned a type of " + vClassDao.getClass().getName() + ". Expected VClassDaoJena");
|
||||
this.pickListName = webappDaoFactory.getJenaBaseDao().getLabelOrId(cls);
|
||||
}
|
||||
|
||||
this.pickListName = webappDaoFactory.makePickListName(this);
|
||||
return this.pickListName;
|
||||
} finally {
|
||||
cls.getOntModel().leaveCriticalSection();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,9 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import com.hp.hpl.jena.iri.IRI;
|
||||
import com.hp.hpl.jena.iri.IRIFactory;
|
||||
import com.hp.hpl.jena.ontology.OntModel;
|
||||
|
@ -20,14 +23,12 @@ import com.hp.hpl.jena.query.DatasetFactory;
|
|||
import com.hp.hpl.jena.rdf.model.Literal;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||
import com.hp.hpl.jena.rdf.model.Property;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
import com.hp.hpl.jena.rdf.model.Resource;
|
||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||
import com.hp.hpl.jena.shared.Lock;
|
||||
import com.hp.hpl.jena.util.iterator.ClosableIterator;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||
import edu.cornell.mannlib.vitro.webapp.beans.ResourceBean;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.ApplicationDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao;
|
||||
|
@ -44,6 +45,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao;
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.UserAccountsDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactoryConfig;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener;
|
||||
|
@ -53,6 +55,8 @@ import edu.cornell.mannlib.vitro.webapp.utils.jena.URIUtils;
|
|||
|
||||
public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||
|
||||
private static final Log log = LogFactory.getLog(WebappDaoFactoryJena.class);
|
||||
|
||||
protected IndividualDao entityWebappDao;
|
||||
protected ApplicationDaoJena applicationDao;
|
||||
protected UserAccountsDao userAccountsDao;
|
||||
|
@ -533,4 +537,43 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
|||
|
||||
}
|
||||
|
||||
public String makeLocalNameWithPrefix(ResourceBean bean) {
|
||||
OntologyDao oDao = this.getOntologyDao();
|
||||
Ontology o = oDao.getOntologyByURI(bean.getNamespace());
|
||||
if (o == null) {
|
||||
if (VitroVocabulary.vitroURI.equals(bean.getNamespace())) {
|
||||
return "vitro:" + bean.getLocalName();
|
||||
} else {
|
||||
log.debug("no ontology object found for namespace " + bean.getNamespace());
|
||||
return bean.getLocalName();
|
||||
}
|
||||
} else {
|
||||
String prefix = o.getPrefix() == null ? (
|
||||
o.getName() == null ?
|
||||
"unspec" : o.getName()) : o.getPrefix();
|
||||
return prefix + ":" + bean.getLocalName();
|
||||
}
|
||||
}
|
||||
|
||||
public String makePickListName(ResourceBean bean) {
|
||||
OntologyDao oDao = this.getOntologyDao();
|
||||
Ontology o = oDao.getOntologyByURI(bean.getNamespace());
|
||||
String label = (bean.getLabel() != null) ? bean.getLabel () : bean.getLocalName();
|
||||
label = (label != null) ? label : bean.getURI();
|
||||
if (o == null) {
|
||||
if (VitroVocabulary.vitroURI.equals(bean.getNamespace())) {
|
||||
return label + " (vitro)";
|
||||
} else {
|
||||
log.debug("no ontology object found for namespace " + bean.getNamespace());
|
||||
return label;
|
||||
}
|
||||
} else {
|
||||
String prefix = o.getPrefix() == null ? (
|
||||
o.getName() == null ?
|
||||
"unspec" : o.getName()) : o.getPrefix();
|
||||
return label + " (" + prefix + ")";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ import java.util.Map;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo;
|
||||
|
||||
|
@ -58,7 +60,8 @@ public class SelectListGeneratorVTwo {
|
|||
//Methods to sort the options map
|
||||
// from http://forum.java.sun.com/thread.jspa?threadID=639077&messageID=4250708
|
||||
//Modified to allow for a custom comparator to be sent in, defaults to mapPairsComparator
|
||||
public static Map<String,String> getSortedMap(Map<String,String> hmap, Comparator<String[]> comparator){
|
||||
public static Map<String,String> getSortedMap(Map<String,String> hmap,
|
||||
Comparator<String[]> comparator, VitroRequest vreq){
|
||||
// first make temporary list of String arrays holding both the key and its corresponding value, so that the list can be sorted with a decent comparator
|
||||
List<String[]> objectsToSort = new ArrayList<String[]>(hmap.size());
|
||||
for (String key:hmap.keySet()) {
|
||||
|
@ -70,7 +73,7 @@ public class SelectListGeneratorVTwo {
|
|||
|
||||
//if no comparator is passed in, utilize MapPairsComparator
|
||||
if(comparator == null) {
|
||||
comparator = new MapPairsComparator();
|
||||
comparator = new MapPairsComparator(vreq);
|
||||
}
|
||||
|
||||
Collections.sort(objectsToSort, comparator);
|
||||
|
@ -84,8 +87,13 @@ public class SelectListGeneratorVTwo {
|
|||
|
||||
//Sorts by the value of the 2nd element in each of the arrays
|
||||
private static class MapPairsComparator implements Comparator<String[]> {
|
||||
|
||||
private Collator collator;
|
||||
|
||||
public MapPairsComparator(VitroRequest vreq) {
|
||||
this.collator = vreq.getCollator();
|
||||
}
|
||||
public int compare (String[] s1, String[] s2) {
|
||||
Collator collator = Collator.getInstance();
|
||||
if (s2 == null) {
|
||||
return 1;
|
||||
} else if (s1 == null) {
|
||||
|
|
|
@ -6,7 +6,10 @@ import static edu.cornell.mannlib.vitro.webapp.servlet.setup.JenaDataSourceSetup
|
|||
import static edu.cornell.mannlib.vitro.webapp.servlet.setup.JenaDataSourceSetupBase.JENA_INF_MODEL;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.Collator;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
|
@ -154,6 +157,8 @@ public class RequestModelsPrep implements Filter {
|
|||
|
||||
wrapModelsWithLanguageAwareness(vreq);
|
||||
|
||||
setCollator(vreq);
|
||||
|
||||
setWebappDaoFactories(vreq, rdfService);
|
||||
}
|
||||
|
||||
|
@ -309,9 +314,19 @@ public class RequestModelsPrep implements Filter {
|
|||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is also used by VitroHttpServlet to retrieve the right Collator
|
||||
* instance for picklist sorting
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
public static Enumeration<Locale> getPreferredLocales(HttpServletRequest req) {
|
||||
return req.getLocales();
|
||||
}
|
||||
|
||||
private List<String> getPreferredLanguages(HttpServletRequest req) {
|
||||
log.debug("Accept-Language: " + req.getHeader("Accept-Language"));
|
||||
return LanguageFilteringUtils.localesToLanguages(req.getLocales());
|
||||
return LanguageFilteringUtils.localesToLanguages(getPreferredLocales(req));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -332,6 +347,19 @@ public class RequestModelsPrep implements Filter {
|
|||
}
|
||||
}
|
||||
|
||||
private void setCollator(VitroRequest vreq) {
|
||||
Enumeration<Locale> locales = getPreferredLocales(vreq);
|
||||
while(locales.hasMoreElements()) {
|
||||
Locale locale = locales.nextElement();
|
||||
Collator collator = Collator.getInstance(locale);
|
||||
if(collator != null) {
|
||||
vreq.setCollator(collator);
|
||||
return;
|
||||
}
|
||||
}
|
||||
vreq.setCollator(Collator.getInstance());
|
||||
}
|
||||
|
||||
private boolean isStoreReasoned(ServletRequest req) {
|
||||
String isStoreReasoned = ConfigurationProperties.getBean(req).getProperty(
|
||||
"VitroConnection.DataSource.isStoreReasoned", "true");
|
||||
|
|
|
@ -43,7 +43,9 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem
|
|||
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupsForRequest;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
|
||||
import edu.cornell.mannlib.vitro.webapp.i18n.I18n;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.IndexConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.search.SearchException;
|
||||
|
@ -250,7 +252,7 @@ public class PagedSearchController extends FreemarkerHttpServlet {
|
|||
if( wasHtmlRequested ){
|
||||
if ( !classGroupFilterRequested && !typeFilterRequested ) {
|
||||
// Search request includes no ClassGroup and no type, so add ClassGroup search refinement links.
|
||||
body.put("classGroupLinks", getClassGroupsLinks(grpDao, docs, response, queryText));
|
||||
body.put("classGroupLinks", getClassGroupsLinks(vreq, grpDao, docs, response, queryText));
|
||||
} else if ( classGroupFilterRequested && !typeFilterRequested ) {
|
||||
// Search request is for a ClassGroup, so add rdf:type search refinement links
|
||||
// but try to filter out classes that are subclasses
|
||||
|
@ -354,7 +356,7 @@ public class PagedSearchController extends FreemarkerHttpServlet {
|
|||
* Get the class groups represented for the individuals in the documents.
|
||||
* @param qtxt
|
||||
*/
|
||||
private List<VClassGroupSearchLink> getClassGroupsLinks(VClassGroupDao grpDao, SolrDocumentList docs, QueryResponse rsp, String qtxt) {
|
||||
private List<VClassGroupSearchLink> getClassGroupsLinks(VitroRequest vreq, VClassGroupDao grpDao, SolrDocumentList docs, QueryResponse rsp, String qtxt) {
|
||||
Map<String,Long> cgURItoCount = new HashMap<String,Long>();
|
||||
|
||||
List<VClassGroup> classgroups = new ArrayList<VClassGroup>( );
|
||||
|
@ -376,11 +378,14 @@ public class PagedSearchController extends FreemarkerHttpServlet {
|
|||
|
||||
grpDao.sortGroupList(classgroups);
|
||||
|
||||
VClassGroupsForRequest vcgfr = VClassGroupCache.getVClassGroups(vreq);
|
||||
List<VClassGroupSearchLink> classGroupLinks = new ArrayList<VClassGroupSearchLink>(classgroups.size());
|
||||
for (VClassGroup vcg : classgroups) {
|
||||
long count = cgURItoCount.get( vcg.getURI() );
|
||||
if (vcg.getPublicName() != null && count > 0 ) {
|
||||
classGroupLinks.add(new VClassGroupSearchLink(qtxt, vcg, count));
|
||||
String groupURI = vcg.getURI();
|
||||
VClassGroup localizedVcg = vcgfr.getGroup(groupURI);
|
||||
long count = cgURItoCount.get( groupURI );
|
||||
if (localizedVcg.getPublicName() != null && count > 0 ) {
|
||||
classGroupLinks.add(new VClassGroupSearchLink(qtxt, localizedVcg, count));
|
||||
}
|
||||
}
|
||||
return classGroupLinks;
|
||||
|
@ -507,7 +512,7 @@ public class PagedSearchController extends FreemarkerHttpServlet {
|
|||
return query;
|
||||
}
|
||||
|
||||
public class VClassGroupSearchLink extends LinkTemplateModel {
|
||||
public static class VClassGroupSearchLink extends LinkTemplateModel {
|
||||
long count = 0;
|
||||
VClassGroupSearchLink(String querytext, VClassGroup classgroup, long count) {
|
||||
super(classgroup.getPublicName(), "/search", PARAM_QUERY_TEXT, querytext, PARAM_CLASSGROUP, classgroup.getURI());
|
||||
|
@ -517,7 +522,7 @@ public class PagedSearchController extends FreemarkerHttpServlet {
|
|||
public String getCount() { return Long.toString(count); }
|
||||
}
|
||||
|
||||
public class VClassSearchLink extends LinkTemplateModel {
|
||||
public static class VClassSearchLink extends LinkTemplateModel {
|
||||
long count = 0;
|
||||
VClassSearchLink(String querytext, VClass type, long count) {
|
||||
super(type.getName(), "/search", PARAM_QUERY_TEXT, querytext, PARAM_RDFTYPE, type.getURI());
|
||||
|
|
|
@ -72,7 +72,7 @@ public class GetAllPrefix extends BaseEditController {
|
|||
respo += "<options>";
|
||||
List<String> prefixList = new ArrayList<String>();
|
||||
prefixList.addAll(prefixMap.keySet());
|
||||
Collections.sort(prefixList, Collator.getInstance());
|
||||
Collections.sort(prefixList, vreq.getCollator());
|
||||
for (String prefix : prefixList) {
|
||||
respo += makeOption(prefix, prefixMap.get(prefix));
|
||||
}
|
||||
|
|
|
@ -103,7 +103,7 @@ public class EditConfigurationTemplateModel extends BaseTemplateModel {
|
|||
field.setOptions(new ConstantFieldOptions());
|
||||
}
|
||||
Map<String, String> optionsMap = SelectListGeneratorVTwo.getOptions(editConfig, fieldName, wdf);
|
||||
optionsMap = SelectListGeneratorVTwo.getSortedMap(optionsMap, field.getFieldOptions().getCustomComparator());
|
||||
optionsMap = SelectListGeneratorVTwo.getSortedMap(optionsMap, field.getFieldOptions().getCustomComparator(), vreq);
|
||||
if(pageData.containsKey(fieldName)) {
|
||||
log.error("Check the edit configuration setup as pageData already contains " + fieldName + " and this will be overwritten now with empty collection");
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/* $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
|
||||
}
|
||||
}
|
|
@ -74,14 +74,14 @@ public class UrlBuilderTest extends AbstractTestClass {
|
|||
UrlBuilder.contextPath = "/vivo";
|
||||
String path = "/individual";
|
||||
ParamMap params = new ParamMap();
|
||||
params.put("name", "★Tom★");
|
||||
params.put("name", "\u2605Tom\u2605"); // \u2605 is Unicode for a five-pointed star.
|
||||
Assert.assertEquals("/vivo/individual?name=%E2%98%85Tom%E2%98%85", UrlBuilder.getUrl(path, params));
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDecodeUtf8Url() {
|
||||
String vClassUri = "http://vivoweb.org/ontology/core#FacultyMember★";
|
||||
String vClassUri = "http://vivoweb.org/ontology/core#FacultyMember\u2605"; // \u2605 is Unicode for a five-pointed star.
|
||||
String vClassUriEncoded = "http%3A%2F%2Fvivoweb.org%2Fontology%2Fcore%23FacultyMember%E2%98%85";
|
||||
Assert.assertEquals(vClassUri, UrlBuilder.urlDecode(vClassUriEncoded));
|
||||
}
|
||||
|
@ -94,11 +94,11 @@ public class UrlBuilderTest extends AbstractTestClass {
|
|||
|
||||
String uri = "http://example.com/individual/n2343";
|
||||
String url = UrlBuilder.getIndividualProfileUrl(uri, vreq);
|
||||
Assert.assertEquals("http://example.com/individual/n2343", url);
|
||||
Assert.assertEquals("http://example.com/display/n2343", url);
|
||||
|
||||
uri = "http://example.com/individual/bob";
|
||||
url = UrlBuilder.getIndividualProfileUrl(uri, vreq);
|
||||
Assert.assertEquals("http://example.com/individual/bob",url);
|
||||
Assert.assertEquals("http://example.com/display/bob",url);
|
||||
|
||||
uri = "http://nondefaultNS.com/individual/n2343";
|
||||
url = UrlBuilder.getIndividualProfileUrl(uri, vreq);
|
||||
|
|
|
@ -113,6 +113,7 @@ public class VClassJenaTest {
|
|||
|
||||
Assert.assertEquals(vClassJena.getName(), vClass.getName());
|
||||
Assert.assertEquals(vClassJena.getLocalNameWithPrefix(), vClass.getLocalNameWithPrefix());
|
||||
|
||||
Assert.assertEquals(vClassJena.getPickListName(), vClass.getPickListName());
|
||||
Assert.assertEquals(vClassJena.getExample(), vClass.getExample());
|
||||
Assert.assertEquals(vClassJena.getDescription(), vClass.getDescription());
|
||||
|
@ -162,7 +163,7 @@ public class VClassJenaTest {
|
|||
VClass vcw = new VClass();
|
||||
cls.getModel().enterCriticalSection(Lock.READ);
|
||||
vcw.setName(getLabelForClass(cls,false,false,wadf));
|
||||
vcw.setLocalNameWithPrefix(getLabelForClass(cls,true,false,wadf));
|
||||
vcw.setLocalNameWithPrefix(wadf.makeLocalNameWithPrefix(vcw));
|
||||
vcw.setPickListName(getLabelForClass(cls,false,true,wadf));
|
||||
try {
|
||||
if (cls.isAnon()) {
|
||||
|
@ -233,18 +234,6 @@ public class VClassJenaTest {
|
|||
}
|
||||
vcw.setProhibitedFromUpdateBelowRoleLevel(prohibitedRoleLevel);//this might get set to null
|
||||
|
||||
// We need a better way of caching the counts. For now I'm only setting 0 for the empty classes, to hide them from the DWR editing
|
||||
|
||||
//ClosableIterator typeIt = getOntModel().listStatements(null,RDF.type,cls);
|
||||
//try {
|
||||
// if (!typeIt.hasNext()) {
|
||||
// vcw.setEntityCount(0);
|
||||
// }
|
||||
//} finally {
|
||||
// typeIt.close();
|
||||
//}
|
||||
|
||||
|
||||
} finally {
|
||||
cls.getModel().leaveCriticalSection();
|
||||
}
|
||||
|
|
|
@ -82,6 +82,16 @@ public class IndividualStub implements Individual {
|
|||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPickListName() {
|
||||
return getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DataPropertyStatement> getDataPropertyStatements() {
|
||||
return new ArrayList<DataPropertyStatement>(dpsSet);
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
<input type="hidden" name="VClassName" value="this anonymous class"/>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<input type="hidden" name="VClassName" value="${VClass.localNameWithPrefix}"/>
|
||||
<input type="hidden" name="VClassName" value="${VClass.pickListName}"/>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
<input type="hidden" name="mode" value="moveInstances"/>
|
||||
|
@ -99,10 +99,10 @@
|
|||
<li><input type="checkbox" name="SuperclassURI" value="${superclass.URI}" class="form-item"/>
|
||||
<c:choose>
|
||||
<c:when test="${!superclass.anonymous}">
|
||||
<a href="${superclassURL}">${superclass.localNameWithPrefix}</a>
|
||||
<a href="${superclassURL}">${superclass.pickListName}</a>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
${superclass.localNameWithPrefix}
|
||||
${superclass.pickListName}
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</li>
|
||||
|
@ -137,10 +137,10 @@
|
|||
<li><input type="checkbox" name="SubclassURI" value="${subclass.URI}" class="form-item"/>
|
||||
<c:choose>
|
||||
<c:when test="${!subclass.anonymous}">
|
||||
<a href="${subclassURL}"> ${subclass.localNameWithPrefix} </a>
|
||||
<a href="${subclassURL}"> ${subclass.pickListName} </a>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
${subclass.localNameWithPrefix}
|
||||
${subclass.pickListName}
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</li>
|
||||
|
@ -181,10 +181,10 @@
|
|||
<li><input type="checkbox" name="SubclassURI" value="${subclass.URI}" class="form-item"/>
|
||||
<c:choose>
|
||||
<c:when test="${!subclass.anonymous}">
|
||||
<a href="${subclassURL}"> ${subclass.localNameWithPrefix} </a>
|
||||
<a href="${subclassURL}"> ${subclass.pickListName} </a>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
${subclass.localNameWithPrefix}
|
||||
${subclass.pickListName}
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</li>
|
||||
|
@ -223,10 +223,10 @@
|
|||
<li><input type="checkbox" name="SubclassURI" value="${subclass.URI}" class="form-item"/>
|
||||
<c:choose>
|
||||
<c:when test="${!subclass.anonymous}">
|
||||
<a href="${subclassURL}"> ${subclass.localNameWithPrefix} </a>
|
||||
<a href="${subclassURL}"> ${subclass.pickListName} </a>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
${subclass.localNameWithPrefix}
|
||||
${subclass.pickListName}
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</li>
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
<c:param name="uri" value="${superproperty.URI}"/>
|
||||
</c:url>
|
||||
<li><input type="checkbox" name="SuperpropertyURI" value="${superproperty.URI}" class="form-item"/>
|
||||
<a href="${superpropertyURL}">${superproperty.localNameWithPrefix}</a>
|
||||
<a href="${superpropertyURL}">${superproperty.pickListName}</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
|
@ -114,7 +114,7 @@
|
|||
<c:param name="uri" value="${subproperty.URI}"/>
|
||||
</c:url>
|
||||
<li><input type="checkbox" name="SubpropertyURI" value="${subproperty.URI}" class="form-item"/>
|
||||
<a href="${subpropertyURL}"> ${subproperty.localNameWithPrefix} </a>
|
||||
<a href="${subpropertyURL}"> ${subproperty.pickListName} </a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
|
@ -147,7 +147,7 @@
|
|||
<c:param name="uri" value="${eqproperty.URI}"/>
|
||||
</c:url>
|
||||
<li><input type="checkbox" name="SubpropertyURI" value="${eqproperty.URI}" class="form-item"/>
|
||||
<a href="${eqpropertyURL}"> ${eqproperty.localNameWithPrefix} </a>
|
||||
<a href="${eqpropertyURL}"> ${eqproperty.pickListName} </a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
<c:param name="uri" value="${superproperty.URI}"/>
|
||||
</c:url>
|
||||
<li><input type="checkbox" name="SuperpropertyURI" value="${superproperty.URI}" class="form-item"/>
|
||||
<a href="${superpropertyURL}">${superproperty.localNameWithPrefix}</a>
|
||||
<a href="${superpropertyURL}">${superproperty.pickListName}</a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
|
@ -135,7 +135,7 @@
|
|||
<c:param name="uri" value="${subproperty.URI}"/>
|
||||
</c:url>
|
||||
<li><input type="checkbox" name="SubpropertyURI" value="${subproperty.URI}" class="form-item"/>
|
||||
<a href="${subpropertyURL}"> ${subproperty.localNameWithPrefix} </a>
|
||||
<a href="${subpropertyURL}"> ${subproperty.pickListName} </a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
|
@ -172,7 +172,7 @@
|
|||
<c:param name="uri" value="${eqproperty.URI}"/>
|
||||
</c:url>
|
||||
<li><input type="checkbox" name="SubpropertyURI" value="${eqproperty.URI}" class="form-item"/>
|
||||
<a href="${eqpropertyURL}"> ${eqproperty.localNameWithPrefix} </a>
|
||||
<a href="${eqpropertyURL}"> ${eqproperty.pickListName} </a>
|
||||
</li>
|
||||
</c:forEach>
|
||||
</ul>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue