Fixing null in DWR for entity back end editing NIHVIVO-1939
This commit is contained in:
parent
347c09ef51
commit
5a65e97daf
1 changed files with 6 additions and 18 deletions
|
@ -36,16 +36,6 @@ public class PropertyDWR {
|
||||||
public PropertyDWR(){
|
public PropertyDWR(){
|
||||||
}
|
}
|
||||||
|
|
||||||
private WebappDaoFactory getUnfilteredWebappDaoFactory(VitroRequest vreq) {
|
|
||||||
try {
|
|
||||||
return (WebappDaoFactory) vreq.getSession().getServletContext().getAttribute("webappDaoFactory");
|
|
||||||
} catch (ClassCastException e) {
|
|
||||||
log.warn("Could not find unfiltered WebappDaoFactory in getServletContext().getAttribute(\"webappDaoFactory\"). " +
|
|
||||||
"Using vreq.getWebappDaoFactory() instead.");
|
|
||||||
return vreq.getWebappDaoFactory();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object test(){
|
public Object test(){
|
||||||
WebContext ctx = WebContextFactory.get();
|
WebContext ctx = WebContextFactory.get();
|
||||||
HttpServletRequest req = ctx.getHttpServletRequest();
|
HttpServletRequest req = ctx.getHttpServletRequest();
|
||||||
|
@ -65,7 +55,7 @@ public class PropertyDWR {
|
||||||
WebContext ctx = WebContextFactory.get();
|
WebContext ctx = WebContextFactory.get();
|
||||||
HttpServletRequest req = ctx.getHttpServletRequest();
|
HttpServletRequest req = ctx.getHttpServletRequest();
|
||||||
VitroRequest vreq = new VitroRequest(req);
|
VitroRequest vreq = new VitroRequest(req);
|
||||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
WebappDaoFactory wdf = vreq.getFullWebappDaoFactory();
|
||||||
|
|
||||||
Collection c =
|
Collection c =
|
||||||
wdf.getPropertyInstanceDao().getAllPropInstByVClass(classURI);
|
wdf.getPropertyInstanceDao().getAllPropInstByVClass(classURI);
|
||||||
|
@ -76,7 +66,7 @@ public class PropertyDWR {
|
||||||
WebContext ctx = WebContextFactory.get();
|
WebContext ctx = WebContextFactory.get();
|
||||||
HttpServletRequest req = ctx.getHttpServletRequest();
|
HttpServletRequest req = ctx.getHttpServletRequest();
|
||||||
VitroRequest vreq = new VitroRequest(req);
|
VitroRequest vreq = new VitroRequest(req);
|
||||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
WebappDaoFactory wdf = vreq.getFullWebappDaoFactory();
|
||||||
|
|
||||||
Collection c =
|
Collection c =
|
||||||
wdf.getPropertyInstanceDao().getAllPossiblePropInstForIndividual(individualURI);
|
wdf.getPropertyInstanceDao().getAllPossiblePropInstForIndividual(individualURI);
|
||||||
|
@ -87,7 +77,7 @@ public class PropertyDWR {
|
||||||
WebContext ctx = WebContextFactory.get();
|
WebContext ctx = WebContextFactory.get();
|
||||||
HttpServletRequest req = ctx.getHttpServletRequest();
|
HttpServletRequest req = ctx.getHttpServletRequest();
|
||||||
VitroRequest vreq = new VitroRequest(req);
|
VitroRequest vreq = new VitroRequest(req);
|
||||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
WebappDaoFactory wdf = vreq.getFullWebappDaoFactory();
|
||||||
|
|
||||||
return wdf.getPropertyInstanceDao().getProperty(subjectURI, predicateURI, objectURI);
|
return wdf.getPropertyInstanceDao().getProperty(subjectURI, predicateURI, objectURI);
|
||||||
}
|
}
|
||||||
|
@ -121,16 +111,14 @@ public class PropertyDWR {
|
||||||
WebContext ctx = WebContextFactory.get();
|
WebContext ctx = WebContextFactory.get();
|
||||||
HttpServletRequest req = ctx.getHttpServletRequest();
|
HttpServletRequest req = ctx.getHttpServletRequest();
|
||||||
VitroRequest vreq = new VitroRequest(req);
|
VitroRequest vreq = new VitroRequest(req);
|
||||||
|
return vreq.getFullWebappDaoFactory().getPropertyInstanceDao().insertProp(prop);
|
||||||
return getUnfilteredWebappDaoFactory(vreq).getPropertyInstanceDao().insertProp(prop);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int deleteProp(String subjectUri, String predicateUri, String objectUri){
|
public int deleteProp(String subjectUri, String predicateUri, String objectUri){
|
||||||
WebContext ctx = WebContextFactory.get();
|
WebContext ctx = WebContextFactory.get();
|
||||||
HttpServletRequest req = ctx.getHttpServletRequest();
|
HttpServletRequest req = ctx.getHttpServletRequest();
|
||||||
VitroRequest vreq = new VitroRequest(req);
|
VitroRequest vreq = new VitroRequest(req);
|
||||||
|
vreq.getFullWebappDaoFactory().getPropertyInstanceDao().deleteObjectPropertyStatement(subjectUri, predicateUri, objectUri);
|
||||||
getUnfilteredWebappDaoFactory(vreq).getPropertyInstanceDao().deleteObjectPropertyStatement(subjectUri, predicateUri, objectUri);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,7 +142,7 @@ public class PropertyDWR {
|
||||||
WebContext ctx = WebContextFactory.get();
|
WebContext ctx = WebContextFactory.get();
|
||||||
HttpServletRequest req = ctx.getHttpServletRequest();
|
HttpServletRequest req = ctx.getHttpServletRequest();
|
||||||
VitroRequest vreq = new VitroRequest(req);
|
VitroRequest vreq = new VitroRequest(req);
|
||||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
WebappDaoFactory wdf = vreq.getFullWebappDaoFactory();
|
||||||
|
|
||||||
return wdf.getPropertyInstanceDao().getExistingProperties(entityURI, null);
|
return wdf.getPropertyInstanceDao().getExistingProperties(entityURI, null);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue