update to new individual to make sure type of new gets passed

This commit is contained in:
hudajkhan 2013-10-31 15:09:29 -04:00
parent f1587409f2
commit 750e7c3f86
2 changed files with 13 additions and 8 deletions

View file

@ -37,10 +37,13 @@ public class AddConceptThroughObjectPropertyGenerator extends DefaultObjectPrope
public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq,
HttpSession session) throws Exception {
EditConfigurationVTwo editConfig = super.getEditConfiguration(vreq, session);
//return rangetypes in form specific data
editConfig.addFormSpecificData("createNewTypes", getCreateNewTypesOptions(vreq));
//override templates with ones that will override create new types portion
editConfig.setTemplate(getTemplate(vreq));
//If this isn't adding a new individual, then override template/types
if(!DefaultAddMissingIndividualFormGenerator.isCreateNewIndividual(vreq, session)) {
//return rangetypes in form specific data
editConfig.addFormSpecificData("createNewTypes", getCreateNewTypesOptions(vreq));
//override templates with ones that will override create new types portion
editConfig.setTemplate(getTemplate(vreq));
}
return editConfig;
}
@ -117,9 +120,10 @@ public class AddConceptThroughObjectPropertyGenerator extends DefaultObjectPrope
for(VClass v: rangeTypes) {
types.add(v.getURI());
}
String[] typesArray = types.toArray(new String[types.size()]);
field.setOptions( new IndividualsViaSolrQueryOptions(
vreq.getSession().getServletContext(),
types.toArray(new String[types.size()])));
typesArray));
}else{
field.setOptions(null);
}

View file

@ -172,9 +172,10 @@ public class NewIndividualFormGenerator extends BaseEditConfigurationGenerator i
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
Boolean isPersonType = Boolean.FALSE;
String foafPersonType = getFOAFPersonClassURI();
List<String> superTypes = wdf.getVClassDao().getAllSuperClassURIs(getTypeOfNew(vreq));
//add foaf person type too so that can also get checked
superTypes.add(foafPersonType);
String typeOfNew = getTypeOfNew(vreq);
List<String> superTypes = wdf.getVClassDao().getAllSuperClassURIs(typeOfNew);
//add the actual type as well so we can add that for the list to be checked
superTypes.add(typeOfNew);
if( superTypes != null ){
for( String typeUri : superTypes){
if( foafPersonType.equals(typeUri)) {