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

View file

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