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 com.teamkonzept.webman.mainint.db.queries.*;
07: import com.teamkonzept.webman.mainint.events.*;
08: import com.teamkonzept.lib.*;
09: import com.teamkonzept.field.*;
10: import com.teamkonzept.field.db.*;
11: import com.teamkonzept.db.*;
12:
13: import java.sql.*;
14:
15: /**
16: * editieren eines Contents:
17: von Intershop, hier wird festgestellt, ob neuer Content, oder
18: schon vorhandener und an den entsprechenden Evemnt weitergeleitet
19: * @author $Author: alex $
20: * @version $Revision: 1.3 $
21: */
22: public class CEIntershopHandler extends DefaultEventHandler implements
23: DatabaseDefaults, ParameterTypes, FrameConstants {
24: private CEIntershopHandler() {
25: }
26:
27: private static CEIntershopHandler instance = new CEIntershopHandler();
28:
29: public static CEIntershopHandler getInstance() {
30: return instance;
31: }
32:
33: /**
34: */
35: public void handleEvent(TKEvent evt) throws TKException {
36: try {
37: CEUtils.checkEvent(evt);
38: TKQuery q = TKDBManager
39: .newQuery(TKIntershopContentInstanceGet.class);
40: q.setQueryParams("CONTENT_NODE_SHORTNAME", evt
41: .getNotNullParameter(PARAMETER,
42: "NEW_GROUP_CONTENT_SHORTNAME"));
43: q.execute();
44: ResultSet rs = q.fetchResultSet();
45: if (rs.next()) {
46: // okay gibt es !
47: // Instanz ID dazu !!
48: String instanceID = rs.getString("INSTANCE_ID");
49: String nodeID = rs.getString("CONTENT_NODE_ID");
50: evt.getParams().put(PARAMETER, "INSTANCE_ID",
51: instanceID);
52: evt.getParams().put(PARAMETER, "CONTENT_NODE_ID",
53: nodeID);
54: CEEditHandler.getInstance().handleEvent(evt);
55: } else {
56: // Neues Produkt/Kategorie
57: CEEditHandler.getInstance().handleEvent(evt);
58: }
59: } catch (Throwable e) {
60: // TO DO : Analyze Exception !
61: throw WebmanExceptionHandler.getException(e);
62: }
63: }
64:
65: public boolean isHandler(TKEvent evt) {
66: return (evt.getName().equals("CE_CATFORM") || evt.getName()
67: .equals("CE_PRODFORM"));
68:
69: }
70: }
|