01: package de.webman.content.eventhandler;
02:
03: import com.teamkonzept.web.*;
04: import com.teamkonzept.webman.*;
05: import com.teamkonzept.webman.mainint.*;
06: import de.webman.content.workflow.db.VersionStatusTransitionDBData;
07: import com.teamkonzept.webman.mainint.db.queries.*;
08: import com.teamkonzept.webman.mainint.events.*;
09: import com.teamkonzept.lib.*;
10: import com.teamkonzept.field.*;
11: import com.teamkonzept.field.db.*;
12: import com.teamkonzept.db.*;
13: import de.webman.content.workflow.*;
14: import de.webman.content.*;
15: import java.sql.*;
16: import java.util.*;
17:
18: /**
19: * Ändern der Version aller ausgewähtlen Contents
20: *
21: * @author $Author: sebastian $
22: * @version $Revision: 1.4 $
23: */
24: public class CESwitchMutipleContentHandler extends DefaultEventHandler
25: implements DatabaseDefaults, ParameterTypes, FrameConstants {
26: private CESwitchMutipleContentHandler() {
27: }
28:
29: private static CESwitchMutipleContentHandler instance = new CESwitchMutipleContentHandler();
30:
31: public static CESwitchMutipleContentHandler getInstance() {
32: return instance;
33: }
34:
35: public void handleEvent(TKEvent evt) throws TKException {
36: try {
37: CEUtils.checkEvent(evt);
38: String newStatus = "";
39: newStatus = evt.getParameter("NEW_STATUS", evt.getName());
40:
41: // HOLE STATUS INFORMATIONEN (BRAUCH ICH DIE NOCH ?)
42: // VersionStatics statics = VersionStatics.getStatics();
43: Integer newStatusInt = new Integer(newStatus);
44: // VersionStatus neuerStatus = (VersionStatus)statics.getStatusPool().get(newStatusInt);
45: Vector instanceIDs = CEUtils.getSelectedContentsList(evt);
46:
47: if (instanceIDs != null) {
48: boolean del;
49: int i = 0;
50: while (i < instanceIDs.size()) {
51: Content content = ContentFactory.getInstance()
52: .getContent(
53: new Integer((String) (instanceIDs
54: .elementAt(i))));
55: // hier muss noch rein ob Statuswechsel okay wenn nicht dann Instanceid nicht löschen
56: del = true;
57: try {
58: content.switchToStatus(newStatusInt, evt
59: .getRemoteUser(), true);
60: } catch (Exception e) {
61: del = false;
62: }
63: if (del)
64: instanceIDs.remove(i);
65: else
66: i++;
67: }
68: // setze Liste der Instancen zurück in den Event
69: evt.getParams().put(
70: PARAMETER,
71: "SELECTED_CONTENTS_LIST",
72: new String(CEUtils
73: .getSelectedContentsString(instanceIDs)
74: + "-"));
75: evt.getParams().put(PARAMETER,
76: "NOT_SELECTED_CONTENTS_LIST", new String(""));
77: }
78:
79: evt.getParams().put(PARAMETER, "RECALCULATE", "a");
80: // Neuaufbau der Seite
81: CEBrowseHandler.getInstance().handleEvent(evt);
82:
83: } catch (Throwable e) {
84: // TO DO : Analyze Exception !
85: throw WebmanExceptionHandler.getException(e);
86: }
87: }
88:
89: public boolean isHandler(TKEvent evt) {
90: return (evt.getName().startsWith("CE_SWITCH_MUTIPLE"));
91: }
92: }
|