NIHVIVO-3957 fixes exceptions when attempting to edit or delete individuals using the backend editor
This commit is contained in:
parent
2c83351eb6
commit
cf7f25af3b
2 changed files with 17 additions and 7 deletions
|
@ -25,6 +25,7 @@ import edu.cornell.mannlib.vedit.util.FormUtils;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroHttpServlet;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
|
||||||
|
|
||||||
public class BaseEditController extends VitroHttpServlet {
|
public class BaseEditController extends VitroHttpServlet {
|
||||||
|
@ -171,6 +172,20 @@ public class BaseEditController extends VitroHttpServlet {
|
||||||
|
|
||||||
return ontModel;
|
return ontModel;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WebappDaoFactory getWebappDaoFactory(VitroRequest vreq) {
|
||||||
|
WebappDaoFactory wadf = (WebappDaoFactory) getServletContext().getAttribute(
|
||||||
|
"assertionsWebappDaoFactory");
|
||||||
|
if (wadf == null) {
|
||||||
|
log.info("Using vreq.getFullWebappDaoFactory()");
|
||||||
|
wadf = vreq.getFullWebappDaoFactory();
|
||||||
|
}
|
||||||
|
return wadf;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected WebappDaoFactory getWebappDaoFactory(VitroRequest vreq, String userURI) {
|
||||||
|
return getWebappDaoFactory(vreq).getUserAwareDaoFactory(userURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDefaultLandingPage(HttpServletRequest request) {
|
public String getDefaultLandingPage(HttpServletRequest request) {
|
||||||
|
|
|
@ -77,15 +77,10 @@ public class EntityRetryController extends BaseEditController {
|
||||||
} else {
|
} else {
|
||||||
action = epo.getAction();
|
action = epo.getAction();
|
||||||
}
|
}
|
||||||
|
|
||||||
WebappDaoFactory wadf = vreq.getAssertionsWebappDaoFactory();
|
|
||||||
if (wadf == null) {
|
|
||||||
log.info("Using vreq.getFullWebappDaoFactory()");
|
|
||||||
vreq.getFullWebappDaoFactory();
|
|
||||||
}
|
|
||||||
|
|
||||||
LoginStatusBean loginBean = LoginStatusBean.getBean(request);
|
LoginStatusBean loginBean = LoginStatusBean.getBean(request);
|
||||||
WebappDaoFactory myWebappDaoFactory = wadf.getUserAwareDaoFactory(loginBean.getUserURI());
|
WebappDaoFactory myWebappDaoFactory = getWebappDaoFactory(
|
||||||
|
vreq, loginBean.getUserURI());
|
||||||
|
|
||||||
IndividualDao ewDao = myWebappDaoFactory.getIndividualDao();
|
IndividualDao ewDao = myWebappDaoFactory.getIndividualDao();
|
||||||
epo.setDataAccessObject(ewDao);
|
epo.setDataAccessObject(ewDao);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue