KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > sitetree > eventhandler > STUpdateRefDocHandler


1 package de.webman.sitetree.eventhandler;
2
3
4 import com.teamkonzept.web.*;
5 import com.teamkonzept.webman.*;
6 import com.teamkonzept.webman.db.TKWebmanDBManager;
7 import com.teamkonzept.webman.mainint.*;
8 import com.teamkonzept.webman.mainint.db.*;
9
10
11 import com.teamkonzept.webman.mainint.db.queries.*;
12 import com.teamkonzept.webman.mainint.events.*;
13 import com.teamkonzept.lib.*;
14 import com.teamkonzept.field.*;
15 import com.teamkonzept.field.db.*;
16 import com.teamkonzept.db.*;
17 import com.teamkonzept.publishing.markups.*;
18
19 import java.sql.*;
20 import java.io.*;
21 import java.util.*;
22
23 /**
24 * Update der Zuordnung einer Referenz-Presentations-Komponente zu einem Document
25 *
26 * @author $Author: alex $
27 * @version $Revision: 1.3 $
28 */

29 public class STUpdateRefDocHandler extends DefaultEventHandler implements ParameterTypes, FrameConstants, DatabaseDefaults
30 {
31     private STUpdateRefDocHandler()
32     {}
33     
34     private static STUpdateRefDocHandler instance = new STUpdateRefDocHandler();
35     
36     public static STUpdateRefDocHandler getInstance()
37     {
38         return instance;
39     }
40     
41     public void handleEvent(TKEvent evt) throws TKException
42     {
43         try
44         {
45             WebManEvent.checkEvent(evt.getRemoteUser(), evt.getName(), ContextConstants.SITE_TREE);
46             int srcSiteNodeId = Integer.parseInt( evt.getParameter( PARAMETER, "SITE_NODE_ID" ) );
47             int srcSiteNodeDocIdx = Integer.parseInt( evt.getParameter( PARAMETER, "SITE_NODE_DOC_IDX" ) );
48             int srcPresCompIdx = Integer.parseInt( evt.getParameter( PARAMETER, "PRESENTATION_COMPONENT_IDX" ) );
49             int refType = Integer.parseInt( evt.getParameter( PARAMETER, "REFERENCE_TYPE" ) );
50             int dstSiteNodeId = Integer.parseInt( evt.getParameter( PARAMETER, "THE_SITE_NODE_ID" ) );
51             String JavaDoc dstSiteNodeDocShortName = evt.getParameter( PARAMETER, "DOC_SEL" );
52             if( dstSiteNodeDocShortName.equals( "FREE" ) ) {
53                 dstSiteNodeDocShortName = evt.getParameter( PARAMETER, "FREE_DOCUMENT_SHORTNAME" );
54             }
55             String JavaDoc selType = evt.getParameter( PARAMETER, "THE_SELECTION_TYPE" );
56             selType = selType.equals( "" )==true?null:selType;
57             String JavaDoc selData = null;
58
59             TKQuery q = TKDBManager.newQuery(TKDBDocReferenceUpdate.class);
60             q.setQueryParams( "SRC_SITE_NODE_ID", new Integer JavaDoc( srcSiteNodeId ) );
61             q.setQueryParams( "SRC_SITE_NODE_DOC_IDX", new Integer JavaDoc( srcSiteNodeDocIdx ) );
62             q.setQueryParams( "SRC_PRESENTATION_COMPONENT_IDX", new Integer JavaDoc( srcPresCompIdx ) );
63             q.setQueryParams( "REFERENCE_TYPE", new Integer JavaDoc( refType ) );
64             q.setQueryParams( "DEST_SITE_NODE_ID", new Integer JavaDoc( dstSiteNodeId ) );
65             q.setQueryParams( "DEST_SITE_NODE_DOC_SHORTNAME", dstSiteNodeDocShortName );
66             q.setQueryParams( "SELECTION_TYPE", selType );
67             q.setQueryParams( "SELECTION_DATA", selData );
68             q.execute();
69             //ResultSet rs = q.fetchResultSet();
70
q.fetchResultSet();
71
72             STEditDocumentHandler.getInstance().handleEvent(evt);
73         }
74         catch (Throwable JavaDoc e)
75         {
76             // TO DO : Analyze Exception !
77
throw WebmanExceptionHandler.getException(e);
78         }
79     }
80     
81     public boolean isHandler(TKEvent evt)
82     {
83         return evt.getName().equalsIgnoreCase("ST_UPDATE_REF_DOC");
84     }
85 }
86
Popular Tags