c44df6374812015c2bc317cc6b2a14b332c6f5eb
[mir.git] / source / mircoders / servlet / ServletModuleContent.java
1 /*\r
2  * Copyright (C) 2001, 2002  The Mir-coders group\r
3  *\r
4  * This file is part of Mir.\r
5  *\r
6  * Mir is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 2 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Mir is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with Mir; if not, write to the Free Software\r
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
19  *\r
20  * In addition, as a special exception, The Mir-coders gives permission to link\r
21  * the code of this program with the com.oreilly.servlet library, any library\r
22  * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
23  * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
24  * the above that use the same license as the above), and distribute linked\r
25  * combinations including the two.  You must obey the GNU General Public\r
26  * License in all respects for all of the code used other than the above\r
27  * mentioned libraries.  If you modify this file, you may extend this exception\r
28  * to your version of the file, but you are not obligated to do so.  If you do\r
29  * not wish to do so, delete this exception statement from your version.\r
30  */\r
31 \r
32 package mircoders.servlet;\r
33 \r
34 import java.io.IOException;\r
35 import java.util.GregorianCalendar;\r
36 import java.util.HashMap;\r
37 import java.util.Iterator;\r
38 import java.util.List;\r
39 import java.util.Map;\r
40 \r
41 import javax.servlet.http.HttpServletRequest;\r
42 import javax.servlet.http.HttpServletResponse;\r
43 import javax.servlet.http.HttpSession;\r
44 \r
45 import mir.entity.adapter.EntityAdapterModel;\r
46 import mir.entity.adapter.EntityIteratorAdapter;\r
47 import mir.log.LoggerWrapper;\r
48 import mir.misc.StringUtil;\r
49 import mir.module.ModuleException;\r
50 import mir.servlet.ServletModule;\r
51 import mir.servlet.ServletModuleException;\r
52 import mir.storage.StorageObjectFailure;\r
53 import mir.util.CachingRewindableIterator;\r
54 import mir.util.HTTPRequestParser;\r
55 import mir.util.JDBCStringRoutines;\r
56 import mir.util.SQLQueryBuilder;\r
57 import mir.util.URLBuilder;\r
58 import mircoders.entity.EntityContent;\r
59 import mircoders.entity.EntityUsers;\r
60 import mircoders.global.MirGlobal;\r
61 import mircoders.module.ModuleContent;\r
62 import mircoders.search.IndexUtil;\r
63 import mircoders.storage.DatabaseComment;\r
64 import mircoders.storage.DatabaseContent;\r
65 import mircoders.storage.DatabaseContentToTopics;\r
66 \r
67 import org.apache.lucene.index.IndexReader;\r
68 \r
69 import freemarker.template.SimpleHash;\r
70 \r
71 /*\r
72  *  ServletModuleContent -\r
73  *  deliver html for the article admin form.\r
74  *\r
75  * @version $Id: ServletModuleContent.java,v 1.37 2003/03/04 02:04:35 zapata Exp $\r
76  * @author rk, mir-coders\r
77  *\r
78  */\r
79 \r
80 public class ServletModuleContent extends ServletModule\r
81 {\r
82   private String editTemplate = configuration.getString("ServletModule.Content.ObjektTemplate");;\r
83   private String listTemplate = configuration.getString("ServletModule.Content.ListTemplate");\r
84 \r
85   private static ServletModuleContent instance = new ServletModuleContent();\r
86   public static ServletModule getInstance() { return instance; }\r
87 \r
88   private ServletModuleContent() {\r
89     super();\r
90     logger = new LoggerWrapper("ServletModule.Content");\r
91     try {\r
92 \r
93       templateListString = configuration.getString("ServletModule.Content.ListTemplate");\r
94       templateObjektString = configuration.getString("ServletModule.Content.ObjektTemplate");\r
95       templateConfirmString = configuration.getString("ServletModule.Content.ConfirmTemplate");\r
96 \r
97       mainModule = new ModuleContent(DatabaseContent.getInstance());\r
98     }\r
99     catch (StorageObjectFailure e) {\r
100       logger.error("servletmodulecontent konnte nicht initialisiert werden");\r
101     }\r
102   }\r
103 \r
104   public void list(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException\r
105   {\r
106     HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
107 \r
108     String where = requestParser.getParameter("where");\r
109     String order = requestParser.getParameterWithDefault("order", "webdb_create desc");\r
110     int offset = requestParser.getIntegerWithDefault("offset", 0);\r
111     String selectArticleUrl = requestParser.getParameter("selectarticleurl");\r
112 \r
113     returnArticleList(aRequest, aResponse, where, order, offset, selectArticleUrl);\r
114   }\r
115 \r
116   public void search(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException {\r
117     try {\r
118       HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
119       SQLQueryBuilder queryBuilder = new SQLQueryBuilder();\r
120       String searchField = requestParser.getParameterWithDefault("searchfield", "");\r
121       String searchValue = requestParser.getParameterWithDefault("searchvalue", "").trim();\r
122       String searchOrder = requestParser.getParameterWithDefault("searchorder", "");\r
123       String searchispublished = requestParser.getParameterWithDefault("searchispublished", "");\r
124       String searchArticleType = requestParser.getParameterWithDefault("searcharticletype", "");\r
125       String selectArticleUrl = requestParser.getParameter("selectarticleurl");\r
126 \r
127       if (searchValue.length()>0) {\r
128         if (searchField.equals("contents"))\r
129           queryBuilder.appendAndCondition(\r
130             "(lower(content_data) like " + "'%" + JDBCStringRoutines.escapeStringLiteral(searchValue.toLowerCase()) + "%')"+\r
131             " or (lower(description) like " + "'%" + JDBCStringRoutines.escapeStringLiteral(searchValue.toLowerCase()) + "%')");\r
132         else\r
133           queryBuilder.appendAndCondition(\r
134             "lower("+ searchField + ") like " +\r
135             "'%" + JDBCStringRoutines.escapeStringLiteral(searchValue.toLowerCase()) + "%'");\r
136       }\r
137 \r
138       if (searchispublished.length()>0) {\r
139         if (searchispublished.equals("0"))\r
140           queryBuilder.appendAndCondition("is_published='f'");\r
141         else\r
142           queryBuilder.appendAndCondition("is_published='t'");\r
143       }\r
144 \r
145       if (searchArticleType.length()>0) {\r
146         queryBuilder.appendAndCondition("to_article_type="+Integer.parseInt(searchArticleType));\r
147       }\r
148 \r
149       if (searchOrder.length()>0) {\r
150         if (searchOrder.equals("datedesc"))\r
151           queryBuilder.appendAscendingOrder("webdb_create");\r
152         else if (searchOrder.equals("dateasc"))\r
153           queryBuilder.appendDescendingOrder("webdb_create");\r
154         else if (searchOrder.equals("title"))\r
155           queryBuilder.appendDescendingOrder("title");\r
156         else if (searchOrder.equals("creator"))\r
157           queryBuilder.appendDescendingOrder("creator");\r
158       }\r
159 \r
160       returnArticleList(aRequest, aResponse, queryBuilder.getWhereClause(), queryBuilder.getOrderByClause(), 0, selectArticleUrl);\r
161     }\r
162     catch (Throwable e) {\r
163       throw new ServletModuleException(e.toString());\r
164     }\r
165   }\r
166 \r
167   public void add(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException {\r
168     _showObject(null, req, res);\r
169   }\r
170 \r
171 \r
172   public void insert(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException\r
173   {\r
174 //theLog.printDebugInfo(":: content :: trying to insert");\r
175     try {\r
176       EntityUsers   user = _getUser(req);\r
177       HashMap withValues = getIntersectingValues(req, DatabaseContent.getInstance());\r
178 \r
179       String now = StringUtil.date2webdbDate(new GregorianCalendar());\r
180       withValues.put("date", now);\r
181       withValues.put("publish_path", StringUtil.webdbDate2path(now));\r
182       withValues.put("to_publisher", user.getId());\r
183       withValues.put("is_produced", "0");\r
184       if (!withValues.containsKey("is_published"))\r
185         withValues.put("is_published","0");\r
186       if (!withValues.containsKey("is_html"))\r
187         withValues.put("is_html","0");\r
188 \r
189       String id = mainModule.add(withValues);\r
190       DatabaseContentToTopics.getInstance().setTopics(id,req.getParameterValues("to_topic"));\r
191 \r
192       _showObject(id, req, res);\r
193     }\r
194     catch (StorageObjectFailure e) {\r
195       throw new ServletModuleException(e.toString());\r
196     }\r
197     catch (ModuleException e) {\r
198       throw new ServletModuleException(e.toString());\r
199     }\r
200   }\r
201 \r
202   public void delete(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException\r
203   {\r
204     EntityUsers   user = _getUser(req);\r
205 \r
206     String idParam = req.getParameter("id");\r
207     if (idParam == null) throw new ServletModuleException("Invalid call: id missing");\r
208 \r
209     String confirmParam = req.getParameter("confirm");\r
210     String cancelParam = req.getParameter("cancel");\r
211 \r
212     logger.info("where = " + req.getParameter("where"));\r
213 \r
214     if (confirmParam == null && cancelParam == null) {\r
215 \r
216       SimpleHash mergeData = new SimpleHash();\r
217       mergeData.put("module", "Content");\r
218       mergeData.put("infoString", "Content: " + idParam);\r
219       mergeData.put("id", idParam);\r
220       mergeData.put("where", req.getParameter("where"));\r
221       mergeData.put("order", req.getParameter("order"));\r
222       mergeData.put("offset", req.getParameter("offset"));\r
223       deliver(req, res, mergeData, templateConfirmString);\r
224     }\r
225     else {\r
226       if (confirmParam!= null && !confirmParam.equals("")) {\r
227         try {\r
228           mainModule.deleteById(idParam);\r
229 \r
230           /** @todo the following two should be implied in\r
231            *  DatabaseContent */\r
232 \r
233           //delete rows in the content_x_topic-table\r
234           DatabaseContentToTopics.getInstance().deleteByContentId(idParam);\r
235           //delete rows in the comment-table\r
236           DatabaseComment.getInstance().deleteByContentId(idParam);\r
237           //delete from lucene index, if any\r
238           String index = configuration.getString("IndexPath");\r
239           if (IndexReader.indexExists(index)){\r
240             IndexUtil.unindexID(idParam,index);\r
241           }\r
242 \r
243         }\r
244         catch (ModuleException e) {\r
245           throw new ServletModuleException(e.toString());\r
246         }\r
247         catch (StorageObjectFailure e) {\r
248           throw new ServletModuleException(e.toString());\r
249         }\r
250         catch (IOException e) {\r
251           throw new ServletModuleException(e.toString());\r
252         }\r
253         list(req,res);\r
254       }\r
255       else {\r
256         // Datensatz anzeigen\r
257         _showObject(idParam, req, res);\r
258       }\r
259     }\r
260   }\r
261 \r
262   public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException\r
263   {\r
264     String idParam = req.getParameter("id");\r
265     if (idParam == null)\r
266       throw new ServletModuleException("Invalid call: id not supplied ");\r
267     _showObject(idParam, req, res);\r
268   }\r
269 \r
270 // methods for attaching media file\r
271   public void attach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException\r
272   {\r
273     String  mediaIdParam = req.getParameter("mid");\r
274     String  idParam = req.getParameter("cid");\r
275     if (idParam == null||mediaIdParam==null) throw new ServletModuleException("smod content :: attach :: cid/mid missing");\r
276 \r
277     try {\r
278       EntityContent entContent = (EntityContent)mainModule.getById(idParam);\r
279       entContent.attach(mediaIdParam);\r
280     }\r
281     catch(ModuleException e) {\r
282       logger.error("smod content :: attach :: could not get entityContent");\r
283     }\r
284     catch(StorageObjectFailure e) {\r
285       logger.error("smod content :: attach :: could not get entityContent");\r
286     }\r
287 \r
288     _showObject(idParam, req, res);\r
289   }\r
290 \r
291   public void dettach(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException\r
292   {\r
293     String  cidParam = req.getParameter("cid");\r
294     String  midParam = req.getParameter("mid");\r
295     if (cidParam == null) throw new ServletModuleException("smod content :: dettach :: cid missing");\r
296     if (midParam == null) throw new ServletModuleException("smod content :: dettach :: mid missing");\r
297 \r
298     try {\r
299       EntityContent entContent = (EntityContent)mainModule.getById(cidParam);\r
300       entContent.dettach(cidParam,midParam);\r
301     }\r
302     catch(ModuleException e) {\r
303       logger.error("smod content :: dettach :: could not get entityContent");\r
304     }\r
305     catch(StorageObjectFailure e) {\r
306       logger.error("smod content :: dettach :: could not get entityContent");\r
307     }\r
308 \r
309     _showObject(cidParam, req, res);\r
310   }\r
311 \r
312   public void update(HttpServletRequest aRequest, HttpServletResponse aResponse)\r
313       throws ServletModuleException\r
314   {\r
315     try {\r
316       HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
317 \r
318       String returnUrl = requestParser.getParameter("returnurl");\r
319 \r
320       String idParam = aRequest.getParameter("id");\r
321       if (idParam == null) throw new ServletModuleException("Wrong call: (id) is missing");\r
322 \r
323       HashMap withValues = getIntersectingValues(aRequest, DatabaseContent.getInstance());\r
324       String[] topic_id = aRequest.getParameterValues("to_topic");\r
325       String content_id = aRequest.getParameter("id");\r
326 \r
327       withValues.put("is_produced", "0");\r
328       if (!withValues.containsKey("is_published"))\r
329         withValues.put("is_published","0");\r
330       if (!withValues.containsKey("is_html"))\r
331         withValues.put("is_html","0");\r
332 \r
333       String id = mainModule.set(withValues);\r
334       DatabaseContentToTopics.getInstance().setTopics(aRequest.getParameter("id"),topic_id);\r
335 \r
336       String whereParam = aRequest.getParameter("where");\r
337       String orderParam = aRequest.getParameter("order");\r
338 \r
339       if (returnUrl!=null){\r
340         redirect(aResponse, returnUrl);\r
341       }\r
342       else\r
343         _showObject(idParam, aRequest, aResponse);\r
344     }\r
345     catch (Throwable e) {\r
346       throw new ServletModuleException(e.toString());\r
347     }\r
348   }\r
349 \r
350 /*\r
351   * HelperMethod shows the basic article editing form.\r
352   *\r
353   * if the "id" parameter is null, it means show an empty form to add a new\r
354   * article.\r
355 */\r
356   private void _showObject(String id, HttpServletRequest aRequest, HttpServletResponse aResponse)\r
357       throws ServletModuleException {\r
358 \r
359     try {\r
360       HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
361       Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));\r
362       EntityAdapterModel model = MirGlobal.localizer().dataModel().adapterModel();\r
363       Map article;\r
364       URLBuilder urlBuilder = new URLBuilder();\r
365 \r
366       urlBuilder.setValue("module", "Content");\r
367       urlBuilder.setValue("do", "edit");\r
368       urlBuilder.setValue("id", id);\r
369       urlBuilder.setValue("returnurl", requestParser.getParameter("returnurl"));\r
370 \r
371       if (id!=null) {\r
372         responseData.put("new", Boolean.FALSE);\r
373         article = model.makeEntityAdapter("content", mainModule.getById(id));\r
374       }\r
375       else {\r
376         List fields = DatabaseContent.getInstance().getFields();\r
377         responseData.put("new", Boolean.TRUE);\r
378         article = new HashMap();\r
379         Iterator i = fields.iterator();\r
380         while (i.hasNext()) {\r
381           article.put(i.next(), null);\r
382         }\r
383 \r
384         article.put("to_topics", null);\r
385 \r
386         MirGlobal.localizer().adminInterface().initializeArticle(article);\r
387       }\r
388       responseData.put("article", article);\r
389 \r
390       responseData.put("returnurl", requestParser.getParameter("returnurl"));\r
391       responseData.put("thisurl", urlBuilder.getQuery());\r
392 \r
393       ServletHelper.generateResponse(aResponse.getWriter(), responseData, editTemplate);\r
394     }\r
395     catch (Exception e) {\r
396       throw new ServletModuleException(e.toString());\r
397     }\r
398   }\r
399 \r
400   public void returnArticleList(\r
401        HttpServletRequest aRequest,\r
402        HttpServletResponse aResponse,\r
403        String aWhereClause,\r
404        String anOrderByClause,\r
405        int anOffset,\r
406        String aSelectArticleUrl) throws ServletModuleException {\r
407 \r
408     HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
409     URLBuilder urlBuilder = new URLBuilder();\r
410     EntityAdapterModel model;\r
411     int nrArticlesPerPage = 20;\r
412     int count;\r
413 \r
414     try {\r
415       Map responseData = ServletHelper.makeGenerationData(getLocale(aRequest));\r
416       model = MirGlobal.localizer().dataModel().adapterModel();\r
417 \r
418       Object articleList =\r
419           new CachingRewindableIterator(\r
420             new EntityIteratorAdapter( aWhereClause, anOrderByClause, nrArticlesPerPage,\r
421                MirGlobal.localizer().dataModel().adapterModel(), "content", nrArticlesPerPage, anOffset)\r
422       );\r
423 \r
424       responseData.put("nexturl", null);\r
425       responseData.put("prevurl", null);\r
426 \r
427       count=mainModule.getSize(aWhereClause);\r
428 \r
429       urlBuilder.setValue("module", "Content");\r
430       urlBuilder.setValue("do", "list");\r
431       urlBuilder.setValue("where", aWhereClause);\r
432       urlBuilder.setValue("order", anOrderByClause);\r
433 \r
434 \r
435       urlBuilder.setValue("searchfield", requestParser.getParameter("searchfield"));\r
436       urlBuilder.setValue("searchvalue", requestParser.getParameter("searchvalue"));\r
437       urlBuilder.setValue("searchispublished", requestParser.getParameter("searchispublished"));\r
438       urlBuilder.setValue("searchorder", requestParser.getParameter("searchorder"));\r
439       urlBuilder.setValue("searcharticletype", requestParser.getParameter("searcharticletype"));\r
440       urlBuilder.setValue("selectarticleurl", aSelectArticleUrl);\r
441 \r
442       responseData.put("searchfield", requestParser.getParameter("searchfield"));\r
443       responseData.put("searchvalue", requestParser.getParameter("searchvalue"));\r
444       responseData.put("searchispublished", requestParser.getParameter("searchispublished"));\r
445       responseData.put("searchorder", requestParser.getParameter("searchorder"));\r
446       responseData.put("searcharticletype", requestParser.getParameter("searcharticletype"));\r
447       responseData.put("selectarticleurl", aSelectArticleUrl);\r
448 \r
449       urlBuilder.setValue("offset", anOffset);\r
450       responseData.put("offset" , new Integer(anOffset).toString());\r
451       responseData.put("thisurl" , urlBuilder.getQuery());\r
452 \r
453       if (count>=anOffset+nrArticlesPerPage) {\r
454         urlBuilder.setValue("offset", (anOffset + nrArticlesPerPage));\r
455         responseData.put("nexturl" , urlBuilder.getQuery());\r
456       }\r
457 \r
458       if (anOffset>0) {\r
459         urlBuilder.setValue("offset", Math.max(anOffset - nrArticlesPerPage, 0));\r
460         responseData.put("prevurl" , urlBuilder.getQuery());\r
461       }\r
462 \r
463       responseData.put("articles", articleList);\r
464 \r
465       responseData.put("from" , Integer.toString(anOffset+1));\r
466       responseData.put("count", Integer.toString(count));\r
467       responseData.put("to", Integer.toString(Math.min(anOffset+nrArticlesPerPage, count)));\r
468       responseData.put("offset" , Integer.toString(anOffset));\r
469       responseData.put("order", anOrderByClause);\r
470       responseData.put("where" , aWhereClause);\r
471 \r
472       ServletHelper.generateResponse(aResponse.getWriter(), responseData, listTemplate);\r
473     }\r
474     catch (Throwable e) {\r
475       throw new ServletModuleException(e.toString());\r
476     }\r
477   }\r
478 \r
479   public void selectparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException\r
480   {\r
481     try {\r
482       HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
483       URLBuilder urlBuilder = new URLBuilder();\r
484 \r
485       urlBuilder.setValue("module", "Content");\r
486       urlBuilder.setValue("do", "setparent");\r
487       urlBuilder.setValue("childid", requestParser.getParameter("id"));\r
488       urlBuilder.setValue("returnurl", requestParser.getParameter("returnurl"));\r
489 \r
490       returnArticleList(aRequest, aResponse, "", "", 0, urlBuilder.getQuery());\r
491     }\r
492     catch (Throwable e) {\r
493       throw new ServletModuleException(e.getMessage());\r
494     }\r
495   }\r
496 \r
497   public void listchildren(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException\r
498   {\r
499     try {\r
500       HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
501       String articleId = requestParser.getParameter("article_id");\r
502 \r
503       if (articleId == null)\r
504         throw new ServletModuleException("ServletModuleContent.listchildren: article_id not set!");\r
505 \r
506       returnArticleList(aRequest, aResponse, "to_content = " + articleId, "", 0, null);\r
507     }\r
508     catch (Throwable e) {\r
509       throw new ServletModuleException(e.getMessage());\r
510     }\r
511   }\r
512 \r
513   public void setparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException\r
514   {\r
515     HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
516     String articleId = aRequest.getParameter("childid");\r
517     String parentId  = aRequest.getParameter("id");\r
518     String returnUrl = aRequest.getParameter("returnurl");\r
519 \r
520     try {\r
521       EntityContent article = (EntityContent) mainModule.getById(articleId);\r
522       article.setValueForProperty("to_content", parentId);\r
523       article.setProduced(false);\r
524       article.update();\r
525     }\r
526     catch(Throwable e) {\r
527       logger.error("ServletModuleContent.setparent: " + e.getMessage());\r
528       throw new ServletModuleException("ServletModuleContent.setparent: " + e.getMessage());\r
529     }\r
530 \r
531     redirect(aResponse, returnUrl);\r
532   }\r
533 \r
534   public void clearparent(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException\r
535   {\r
536     HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
537     String articleId = requestParser.getParameter("id");\r
538     String returnUrl = requestParser.getParameter("returnurl");\r
539 \r
540     try {\r
541       EntityContent article = (EntityContent) mainModule.getById(articleId);\r
542       article.setValueForProperty("to_content", "");\r
543       article.setProduced(false);\r
544       article.update();\r
545     }\r
546     catch(Throwable e) {\r
547       e.printStackTrace(logger.asPrintWriter(LoggerWrapper.DEBUG_MESSAGE));\r
548       logger.error("ServletModuleContent.clearparent: " + e.getMessage());\r
549 \r
550       throw new ServletModuleException("ServletModuleContent.clearparent: " + e.getMessage());\r
551     }\r
552 \r
553     redirect(aResponse, returnUrl);\r
554   }\r
555 \r
556   private EntityUsers _getUser(HttpServletRequest req)\r
557   {\r
558     HttpSession session=req.getSession(false);\r
559 \r
560     return (EntityUsers)session.getAttribute("login.uid");\r
561   }\r
562 }\r