1 package mircoders.servlet;
6 import javax.servlet.*;
7 import javax.servlet.http.*;
9 import freemarker.template.*;
16 import mir.servlet.ServletModuleException;
18 import mircoders.entity.*;
19 import mircoders.storage.*;
20 import mircoders.module.*;
23 * ServletModuleLinksImcs -
24 * liefert HTML fuer LinksImcs
30 public class ServletModuleLinksImcs extends ServletModule
32 // Singelton / Kontruktor
33 private static ServletModuleLinksImcs instance = new ServletModuleLinksImcs();
34 public static ServletModule getInstance() { return instance; }
37 private ServletModuleLinksImcs() {
38 theLog = Logfile.getInstance(Configuration.getProperty("Home") + Configuration.getProperty("ServletModule.LinksImcs.Logfile"));
39 templateListString = Configuration.getProperty("ServletModule.LinksImcs.ListTemplate");
40 templateObjektString = Configuration.getProperty("ServletModule.LinksImcs.ObjektTemplate");
41 templateConfirmString = Configuration.getProperty("ServletModule.LinksImcs.ConfirmTemplate");
44 mainModule = new ModuleLinksImcs(DatabaseLinksImcs.getInstance());
45 } catch (StorageObjectException e) {
46 theLog.printDebugInfo("ServletModuleLinksImcs konnte nicht initialisiert werden");
50 public void add(HttpServletRequest req, HttpServletResponse res)
51 throws ServletModuleException {
53 SimpleHash modelRoot = new SimpleHash();
57 theList = mainModule.getByWhereClause("to_parent_id=NULL", offset);
58 modelRoot.put("new", "1");
59 modelRoot.put("contentlist",HTMLTemplateProcessor.makeSimpleList(theList));
61 if (theList == null || theList.getCount() == 0 || theList.getCount()>1){
62 HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateObjektString, modelRoot, res.getWriter());
65 deliver(req, res, modelRoot, templateObjektString);
68 } catch(ModuleException e) {
69 throw new ServletModuleException(e.toString());
70 } catch (HTMLParseException e) {
71 throw new ServletModuleException(e.toString());
72 } catch (IOException e) {
73 throw new ServletModuleException(e.toString());
74 } catch(StorageObjectException e) {
75 throw new ServletModuleException(e.toString());