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("", offset);
58 modelRoot.put("new", "1");
59 modelRoot.put("contentlist",HTMLTemplateProcessor.makeSimpleList(theList));
60 //modelRoot.put("contentlist", DatabaseLinksImcs.getInstance().getHashData());
61 PrintWriter out = res.getWriter();
63 if (theList == null || theList.getCount() == 0 || theList.getCount()>1){
64 //HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateObjektString, theList, out);
65 HTMLTemplateProcessor.process(getLanguage(req)+"/"+templateObjektString, modelRoot, out);
68 //deliver(req, res, theList.elementAt(0), templateObjektString);
69 deliver(req, res, modelRoot, templateObjektString);
72 } catch(ModuleException e) {
73 throw new ServletModuleException(e.toString());
74 } catch (HTMLParseException e) {
75 throw new ServletModuleException(e.toString());
76 } catch (IOException e) {
77 throw new ServletModuleException(e.toString());
78 } catch(StorageObjectException e) {
79 throw new ServletModuleException(e.toString());