001: package de.webman.config.eventhandler;
002:
003: import com.teamkonzept.web.*;
004: import com.teamkonzept.webman.*;
005: import com.teamkonzept.webman.db.TKWebmanDBManager;
006: import com.teamkonzept.webman.mainint.*;
007: import com.teamkonzept.webman.mainint.db.*;
008:
009: import de.webman.content.workflow.*;
010: import com.teamkonzept.webman.mainint.db.queries.*;
011: import com.teamkonzept.webman.mainint.events.*;
012: import com.teamkonzept.lib.*;
013: import com.teamkonzept.field.*;
014: import com.teamkonzept.field.db.*;
015: import com.teamkonzept.db.*;
016: import com.teamkonzept.publishing.markups.*;
017:
018: import java.sql.*;
019: import java.io.*;
020:
021: /**
022: * Anzeige aller Status-Transitionen von Contents:
023: *
024: *
025: * @author $Author: alex $
026: * @version $Revision: 1.5 $
027: */
028: public class COWorkflowListHandler extends DefaultEventHandler
029: implements ParameterTypes, FrameConstants, DatabaseDefaults {
030: private COWorkflowListHandler() {
031: }
032:
033: private static COWorkflowListHandler instance = new COWorkflowListHandler();
034:
035: public static COWorkflowListHandler getInstance() {
036: return instance;
037: }
038:
039: public void handleEvent(TKEvent evt) throws TKException {
040: try {
041: WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(),
042: ContextConstants.CUSTOMIZE_PROPERTIES);
043: TKHTMLTemplate t = evt
044: .getPrepHTMLTemplate("co_workflow.tmpl");
045: String event = evt.toString();
046: String action = event == null ? null : evt.getParameter(
047: ACTION, event);
048:
049: // statische Daten der Versionsverwaltung abrufen
050: VersionStatics statics = VersionStatics.setup();
051: VersionStatics newStatics = null;
052:
053: if (action == null || action.length() == 0
054: || action.equalsIgnoreCase("GET")) {
055: // einfach nur zurueck - was soll das zweite Laden ???
056: newStatics = new VersionStatics(statics);
057: newStatics.load();
058: } else if (action.equalsIgnoreCase("UPDATE")) {
059: newStatics = new VersionStatics(statics);
060: newStatics.load();
061: VersionStatics.putStatics(newStatics);
062: } else if (action.equalsIgnoreCase("SAVE")) {
063: newStatics = new VersionStatics(statics);
064: newStatics.scanFields(evt.getParams().getClass(
065: PARAMETER));
066: statics.saveTransitions(newStatics);
067: newStatics.load();
068: } else if (action.equalsIgnoreCase("SCRIPT")) {
069: newStatics = new VersionStatics(statics);
070: newStatics.scanFields(evt.getParams().getClass(
071: PARAMETER));
072: newStatics.script(evt.getHttpInterface()
073: .getDocumentRoot());
074: } else {
075: // wahrscheinlich CHECK
076: newStatics = new VersionStatics(statics);
077: newStatics.scanFields(evt.getParams().getClass(
078: PARAMETER));
079: }
080: t.setListIterator(new TKStandardPluginIterator(
081: "VERSION_STATUS", "STATUS", VersionStatus
082: .filterComments(newStatics), true, t
083: .getListIterator()));
084:
085: t.setListIterator(new TKStandardPluginIterator(
086: "TRANSITION_MODES", "MODE", newStatics.getModes(),
087: false, t.getListIterator()));
088:
089: t.setListIterator(new TKStandardPluginIterator(
090: "TRANSITION_ATTRIBUTES", "ATTR",
091: newStatics.attributes, false, t.getListIterator()));
092:
093: t.setListIterator(new TKStandardPluginIterator(
094: "VERSION_TRANSITIONS", "TRANS", newStatics
095: .getTransitions(), true, t
096: .getListIterator()));
097:
098: // Iterator über vordefinierte Filterübergeben
099: t.setListIterator(new TKStandardPluginIterator(
100: "PREDEFINED_FILTERS", null, statics
101: .getInternationalFilters(), true, t
102: .getListIterator()));
103:
104: evt.finishTemplate(t);
105: } catch (Throwable e) {
106: throw WebmanExceptionHandler.getException(e);
107: }
108: }
109:
110: public boolean isHandler(TKEvent evt) {
111: return evt.getName().equalsIgnoreCase("CO_WORKFLOW_LIST");
112: }
113: }
|