01: package de.webman.config.eventhandler;
02:
03: import com.teamkonzept.web.*;
04: import com.teamkonzept.webman.*;
05: import com.teamkonzept.webman.db.TKWebmanDBManager;
06: import com.teamkonzept.webman.mainint.*;
07: import com.teamkonzept.webman.mainint.db.*;
08:
09: import de.webman.content.workflow.*;
10: import com.teamkonzept.webman.mainint.db.queries.*;
11: import com.teamkonzept.webman.mainint.events.*;
12: import com.teamkonzept.lib.*;
13: import com.teamkonzept.field.*;
14: import com.teamkonzept.field.db.*;
15: import com.teamkonzept.db.*;
16: import com.teamkonzept.publishing.markups.*;
17:
18: import java.sql.*;
19: import java.io.*;
20:
21: /**
22: * Abpeichern eines Status
23: *
24: * @author $Author: alex $
25: * @version $Revision: 1.4 $
26: */
27: public class COSaveStatusHandler extends DefaultEventHandler implements
28: ParameterTypes, FrameConstants, DatabaseDefaults {
29: private COSaveStatusHandler() {
30: }
31:
32: private static COSaveStatusHandler instance = new COSaveStatusHandler();
33:
34: public static COSaveStatusHandler getInstance() {
35: return instance;
36: }
37:
38: public void handleEvent(TKEvent evt) throws TKException {
39: try {
40: WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(),
41: ContextConstants.CUSTOMIZE_PROPERTIES);
42:
43: String statusID = evt.getParameter(PARAMETER, "STATUS_ID");
44: // statische Daten der Versionsverwaltung abrufen
45: VersionStatics statics = VersionStatics.setup();
46: VersionStatus status;
47: TKHashtable params = (TKHashtable) evt.getParams().get(
48: PARAMETER);
49:
50: if (statusID != null) {
51: // Aenderung eines existierenden Status
52: status = (VersionStatus) statics.getStatusPool().get(
53: new Integer(statusID));
54:
55: status.getFromEvent(params);
56: status.saveToDB();
57: } else {
58: // neuer Status
59: status = new VersionStatus();
60: status.getFromEvent(params);
61: status.saveToDB();
62: VersionStatics.reFresh();
63: }
64:
65: /* alte version - ruft die selbe eingabemaske wieder auf
66:
67: TKHTMLTemplate t = evt.getPrepHTMLTemplate( "co_statusedit.tmpl" );
68:
69: TKHashtable attr = status.toHashtable();
70: t.set(attr);
71: evt.finishTemplate(t);
72: */
73:
74: // neue version - ruft die übersicht auf
75: COWorkflowListHandler.getInstance().handleEvent(evt);
76: } catch (Throwable e) {
77: // TO DO : Analyze Exception !
78: throw WebmanExceptionHandler.getException(e);
79: }
80: }
81:
82: public boolean isHandler(TKEvent evt) {
83: return evt.getName().equalsIgnoreCase("CO_SAVE_STATUS");
84: }
85: }
|