|
From: Andreas V. <a_...@us...> - 2004-06-06 16:12:58
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/item In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30216/src/org/cobricks/item Modified Files: ItemServlet.java Log Message: Index: ItemServlet.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/item/ItemServlet.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- ItemServlet.java 2 Jun 2004 13:32:56 -0000 1.12 +++ ItemServlet.java 6 Jun 2004 16:12:49 -0000 1.13 @@ -81,6 +81,7 @@ this.addTarget("login", "performLogin", "", false); this.addTarget("createitem", "performCreateItem", "Create a new item"); this.addTarget("updateitem", "performUpdate", "Update an item"); + this.addTarget("deleteitem", "performDeletion", "Delete an item"); this.addTarget("xpathsearchitem", "performXPathSearch", "Search items (XPath)"); @@ -265,6 +266,35 @@ } /** + * This method deletes an item by calling the method deleteItem(int) of the + * itemManager. + * + * @param prequest The portal request this call comes from. + * @param out Not needed. + * @return "error" if there was an error while performing the + * itemdeletion; "success" otherwise + */ + public final String performDeletion(PortalRequest prequest, + PrintWriter out) { + + try { + // Get the itemid of the item to be deleted + String itemid = prequest.getRequestParameter("itemid"); + + prequest.setContextObject("itemid", itemid); + + int id = Integer.parseInt(itemid); + + // Delete the item + this.itemManager.deleteItem(id); + + return "success"; + } catch (Exception e) { + return "error"; + } + } + + /** * This method searches for items by calling the method searchItems(String) * of the itemManager. * The XPath-like query entered by the user is fetched and used as input |