Fixing bug with default object property form generator when editing null range objprop NIHVIVO-3854
This commit is contained in:
parent
19fc1c5efd
commit
0a39165bbf
1 changed files with 24 additions and 15 deletions
|
@ -100,10 +100,29 @@ public class DefaultObjectPropertyFormGenerator implements EditConfigurationGene
|
|||
return getDefaultObjectEditConfiguration(vreq, session);
|
||||
}
|
||||
|
||||
protected List<String> getRangeTypes(VitroRequest vreq) {
|
||||
Individual subject = EditConfigurationUtils.getSubjectIndividual(vreq);
|
||||
String predicateUri = EditConfigurationUtils.getPredicateUri(vreq);
|
||||
WebappDaoFactory wDaoFact = vreq.getWebappDaoFactory();
|
||||
List<String> types = new ArrayList<String>();
|
||||
List <VClass> vclasses = new ArrayList<VClass>();
|
||||
vclasses = wDaoFact.getVClassDao().getVClassesForProperty(subject.getVClassURI(),predicateUri);
|
||||
for(VClass v: vclasses) {
|
||||
types.add(v.getURI());
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
private boolean tooManyRangeOptions(VitroRequest vreq, HttpSession session ) throws SolrServerException {
|
||||
List<String> types = getRangeTypes(vreq);
|
||||
SolrServer solrServer = SolrSetup.getSolrServer(session.getServletContext());
|
||||
|
||||
//empty list means the range is not set to anything, force Thing
|
||||
if(types.size() == 0 ){
|
||||
types = new ArrayList<String>();
|
||||
types.add(VitroVocabulary.OWL_THING);
|
||||
}
|
||||
|
||||
long count = 0;
|
||||
for( String type:types){
|
||||
//solr query for type count.
|
||||
|
@ -126,6 +145,7 @@ public class DefaultObjectPropertyFormGenerator implements EditConfigurationGene
|
|||
return count > maxNonACRangeIndividualCount ;
|
||||
}
|
||||
|
||||
|
||||
private EditConfigurationVTwo getDefaultObjectEditConfiguration(VitroRequest vreq, HttpSession session) throws Exception {
|
||||
EditConfigurationVTwo editConfiguration = new EditConfigurationVTwo();
|
||||
|
||||
|
@ -454,18 +474,7 @@ public class DefaultObjectPropertyFormGenerator implements EditConfigurationGene
|
|||
return rangeIndividualsFound;
|
||||
}
|
||||
|
||||
protected List<String> getRangeTypes(VitroRequest vreq) {
|
||||
Individual subject = EditConfigurationUtils.getSubjectIndividual(vreq);
|
||||
String predicateUri = EditConfigurationUtils.getPredicateUri(vreq);
|
||||
WebappDaoFactory wDaoFact = vreq.getWebappDaoFactory();
|
||||
List<String> types = new ArrayList<String>();
|
||||
List <VClass> vclasses = new ArrayList<VClass>();
|
||||
vclasses = wDaoFact.getVClassDao().getVClassesForProperty(subject.getVClassURI(),predicateUri);
|
||||
for(VClass v: vclasses) {
|
||||
types.add(v.getURI());
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
|
||||
/** get the auto complete edit mode */
|
||||
public EditMode getEditMode(VitroRequest vreq) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue