NIHVIVO-1603 Forgot to include this crucial piece with my last commit (r7357)

This commit is contained in:
nac26 2011-02-06 01:48:33 +00:00
parent 38f021251a
commit 573aaf3488

View file

@ -1,56 +1,56 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */ /* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller.edit; package edu.cornell.mannlib.vitro.webapp.controller.edit;
import java.io.IOException; import java.io.IOException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.text.DateFormat; import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.TimeZone; import java.util.TimeZone;
import javax.servlet.RequestDispatcher; import javax.servlet.RequestDispatcher;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import org.apache.commons.collections.map.ListOrderedMap; import org.apache.commons.collections.map.ListOrderedMap;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vedit.beans.DynamicField; import edu.cornell.mannlib.vedit.beans.DynamicField;
import edu.cornell.mannlib.vedit.beans.DynamicFieldRow; import edu.cornell.mannlib.vedit.beans.DynamicFieldRow;
import edu.cornell.mannlib.vedit.beans.EditProcessObject; import edu.cornell.mannlib.vedit.beans.EditProcessObject;
import edu.cornell.mannlib.vedit.beans.FormObject; import edu.cornell.mannlib.vedit.beans.FormObject;
import edu.cornell.mannlib.vedit.beans.LoginStatusBean; import edu.cornell.mannlib.vedit.beans.LoginStatusBean;
import edu.cornell.mannlib.vedit.beans.Option; import edu.cornell.mannlib.vedit.beans.Option;
import edu.cornell.mannlib.vedit.controller.BaseEditController; import edu.cornell.mannlib.vedit.controller.BaseEditController;
import edu.cornell.mannlib.vedit.forwarder.PageForwarder; import edu.cornell.mannlib.vedit.forwarder.PageForwarder;
import edu.cornell.mannlib.vedit.forwarder.impl.UrlForwarder; import edu.cornell.mannlib.vedit.forwarder.impl.UrlForwarder;
import edu.cornell.mannlib.vedit.util.FormUtils; import edu.cornell.mannlib.vedit.util.FormUtils;
import edu.cornell.mannlib.vedit.validator.impl.RequiredFieldValidator; import edu.cornell.mannlib.vedit.validator.impl.RequiredFieldValidator;
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty; import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement; import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl; import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
import edu.cornell.mannlib.vitro.webapp.beans.Portal; import edu.cornell.mannlib.vitro.webapp.beans.Portal;
import edu.cornell.mannlib.vitro.webapp.beans.VClass; import edu.cornell.mannlib.vitro.webapp.beans.VClass;
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup; import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
import edu.cornell.mannlib.vitro.webapp.controller.Controllers; import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.edit.utils.RoleLevelOptionsSetup; import edu.cornell.mannlib.vitro.webapp.controller.edit.utils.RoleLevelOptionsSetup;
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao; import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao; import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao; import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
import edu.cornell.mannlib.vitro.webapp.edit.listener.impl.IndividualDataPropertyStatementProcessor; import edu.cornell.mannlib.vitro.webapp.edit.listener.impl.IndividualDataPropertyStatementProcessor;
public class EntityRetryController extends BaseEditController { public class EntityRetryController extends BaseEditController {
@ -86,7 +86,7 @@ public class EntityRetryController extends BaseEditController {
WebappDaoFactory wadf = (vreq.getAssertionsWebappDaoFactory()!=null) ? vreq.getAssertionsWebappDaoFactory() : vreq.getFullWebappDaoFactory(); WebappDaoFactory wadf = (vreq.getAssertionsWebappDaoFactory()!=null) ? vreq.getAssertionsWebappDaoFactory() : vreq.getFullWebappDaoFactory();
LoginStatusBean loginBean = LoginStatusBean.getBean(request); LoginStatusBean loginBean = LoginStatusBean.getBean(request);
WebappDaoFactory myWebappDaoFactory = wadf.getUserAwareDaoFactory(loginBean.getUserURI()); WebappDaoFactory myWebappDaoFactory = wadf.getUserAwareDaoFactory(loginBean.getUserURI());
IndividualDao ewDao = myWebappDaoFactory.getIndividualDao(); IndividualDao ewDao = myWebappDaoFactory.getIndividualDao();
@ -326,7 +326,8 @@ public class EntityRetryController extends BaseEditController {
request.setAttribute("title","Individual Editing Form"); request.setAttribute("title","Individual Editing Form");
request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>"); request.setAttribute("css", "<link rel=\"stylesheet\" type=\"text/css\" href=\""+portal.getThemeDir()+"css/edit.css\"/>");
request.setAttribute("scripts", "/js/edit/entityRetry.js"); request.setAttribute("scripts", "/js/edit/entityRetry.js");
request.setAttribute("bodyAttr"," onLoad=\"monikerInit()\""); // NC Commenting this out for now. Going to pass on DWR for moniker and use jQuery instead
// request.setAttribute("bodyAttr"," onLoad=\"monikerInit()\"");
request.setAttribute("_action",action); request.setAttribute("_action",action);
request.setAttribute("unqualifiedClassName","Individual"); request.setAttribute("unqualifiedClassName","Individual");
setRequestAttributes(request,epo); setRequestAttributes(request,epo);
@ -339,24 +340,24 @@ public class EntityRetryController extends BaseEditController {
log.error(e.getStackTrace()); log.error(e.getStackTrace());
} }
} }
private List<Option> getMonikerOptionsList(Individual entity, private List<Option> getMonikerOptionsList(Individual entity,
IndividualDao indDao) { IndividualDao indDao) {
ArrayList<Option> monikerOpts = new ArrayList<Option>(); ArrayList<Option> monikerOpts = new ArrayList<Option>();
monikerOpts.add(new Option("", "none", (entity.getMoniker() == null))); monikerOpts.add(new Option("", "none", (entity.getMoniker() == null)));
if (entity.getVClassURI() != null) { if (entity.getVClassURI() != null) {
List<String> monikers = indDao.monikers(entity.getVClassURI()); List<String> monikers = indDao.monikers(entity.getVClassURI());
if (monikers != null) { if (monikers != null) {
for (String moniker : monikers) { for (String moniker : monikers) {
monikerOpts.add(new Option( monikerOpts.add(new Option(
moniker, moniker, moniker, moniker,
moniker.equals(entity.getMoniker()))); moniker.equals(entity.getMoniker())));
} }
} }
} }
monikerOpts.add(new Option("", "[new moniker]")); monikerOpts.add(new Option("", "[new moniker]"));
return monikerOpts; return monikerOpts;
} }
public void doGet (HttpServletRequest request, HttpServletResponse response) { public void doGet (HttpServletRequest request, HttpServletResponse response) {