KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > content > eventhandler > CEIntershopHandler


1 package de.webman.content.eventhandler;
2
3 import com.teamkonzept.web.*;
4 import com.teamkonzept.webman.*;
5 import com.teamkonzept.webman.mainint.*;
6 import com.teamkonzept.webman.mainint.db.queries.*;
7 import com.teamkonzept.webman.mainint.events.*;
8 import com.teamkonzept.lib.*;
9 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 DatabaseDefaults, ParameterTypes, FrameConstants
23 {
24     private CEIntershopHandler()
25     {}
26     
27     private static CEIntershopHandler instance = new CEIntershopHandler();
28     
29     public static CEIntershopHandler getInstance()
30     {
31         return instance;
32     }
33     
34     /**
35     */

36     public void handleEvent(TKEvent evt) throws TKException
37     {
38         try
39         {
40             CEUtils.checkEvent(evt);
41             TKQuery q = TKDBManager.newQuery(TKIntershopContentInstanceGet.class);
42             q.setQueryParams( "CONTENT_NODE_SHORTNAME", evt.getNotNullParameter(PARAMETER, "NEW_GROUP_CONTENT_SHORTNAME") );
43             q.execute();
44             ResultSet rs = q.fetchResultSet();
45             if (rs.next())
46             {
47                 // okay gibt es !
48
// Instanz ID dazu !!
49
String JavaDoc instanceID = rs.getString("INSTANCE_ID");
50                 String JavaDoc nodeID = rs.getString("CONTENT_NODE_ID");
51                 evt.getParams().put(PARAMETER, "INSTANCE_ID", instanceID);
52                 evt.getParams().put(PARAMETER, "CONTENT_NODE_ID", nodeID);
53                 CEEditHandler.getInstance().handleEvent(evt);
54             }
55             else
56             {
57                 // Neues Produkt/Kategorie
58
CEEditHandler.getInstance().handleEvent(evt);
59             }
60         }
61         catch (Throwable JavaDoc e)
62         {
63             // TO DO : Analyze Exception !
64
throw WebmanExceptionHandler.getException(e);
65         }
66     }
67     
68     public boolean isHandler(TKEvent evt)
69     {
70         return (evt.getName().equals("CE_CATFORM") || evt.getName().equals("CE_PRODFORM"));
71         
72     }
73 }
74
Popular Tags