Source Code Cross Referenced for CEForwardHandler.java in  » Content-Management-System » webman » de » webman » content » eventhandler » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Content Management System » webman » de.webman.content.eventhandler 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package de.webman.content.eventhandler;
002:
003:        import java.sql.ResultSet;
004:        import com.teamkonzept.db.TKDBManager;
005:        import com.teamkonzept.db.TKQuery;
006:        import com.teamkonzept.db.QueryConstants;
007:        import com.teamkonzept.lib.TKException;
008:        import com.teamkonzept.lib.TKVector;
009:        import com.teamkonzept.web.TKEvent;
010:        import com.teamkonzept.web.TKHTMLTemplate;
011:        import com.teamkonzept.web.TKParams;
012:        import com.teamkonzept.webman.WebManEvent;
013:        import com.teamkonzept.webman.mainint.ContextConstants;
014:        import com.teamkonzept.webman.mainint.DatabaseDefaults;
015:        import com.teamkonzept.webman.mainint.FrameConstants;
016:        import com.teamkonzept.webman.mainint.HTMLUtils;
017:        import com.teamkonzept.webman.mainint.TKStandardIterator;
018:        import com.teamkonzept.webman.mainint.TreeUtils;
019:        import com.teamkonzept.webman.mainint.WebmanExceptionHandler;
020:        import com.teamkonzept.webman.mainint.db.queries.TKDBContentTreeIsChild;
021:        import com.teamkonzept.webman.mainint.db.queries.content.SelectContentTree;
022:        import com.teamkonzept.webman.mainint.events.DefaultEventHandler;
023:        import com.teamkonzept.webman.mainint.events.ParameterTypes;
024:        import de.webman.content.Content;
025:        import de.webman.content.workflow.ContentVersion;
026:        import de.webman.content.workflow.VersionCache;
027:
028:        /**
029:         * Forwards content tree related events.
030:         *
031:         * @author $Author: uli $
032:         * @version $Revision: 1.1 $
033:         */
034:        public class CEForwardHandler extends DefaultEventHandler implements 
035:                ParameterTypes, FrameConstants, DatabaseDefaults {
036:
037:            /**
038:             * The singleton instance.
039:             */
040:            private static final CEForwardHandler INSTANCE = new CEForwardHandler();
041:
042:            /**
043:             * Avoids outside intstantiation.
044:             */
045:            private CEForwardHandler() {
046:                // NOP
047:            }
048:
049:            /**
050:             * Returns the singleton instance.
051:             *
052:             * @return the singleton instance.
053:             */
054:            public static CEForwardHandler getInstance() {
055:                return INSTANCE;
056:            }
057:
058:            /**
059:             * Handles the specified event.
060:             *
061:             * @param event the event to be handled.
062:             * @throws TKException if any error occurred during event handling.
063:             */
064:            public void handleEvent(TKEvent event) throws TKException {
065:                try {
066:                    CEUtils.checkEvent(event);
067:
068:                    String target = event.getParameter(PARAMETER,
069:                            "TARGET_EVENT");
070:                    Integer id = new Integer(event.getParameter(PARAMETER,
071:                            "CONTENT_NODE_ID"));
072:
073:                    ContentContext context = getContentContext(id);
074:                    TKHTMLTemplate frame = event
075:                            .getPrepHTMLTemplate("f_ce.tmpl");
076:
077:                    prepareFrameSet(frame, target, context);
078:
079:                    if (target.equals("CE_GROUP_LIST")) {
080:                        frame.set("NAVIGATION_CONTEXT", context
081:                                .calculateNavContext());
082:                    }
083:
084:                    if (target.equals("CE_EDIT")) {
085:                        // Ich verstehe nicht, warum zum korrekten Editieren eines
086:                        // Single Contents im Template die Id und der Typ des
087:                        // den Content beinhaltenden Verzeichnisses stehen muß, aber
088:                        // es funktioniert leider nur so ... [unl/2002-04-17]
089:                        context.conNodeId = new Integer(event.getParameter(
090:                                PARAMETER, "CONTENT_NODE_PARENT"));
091:                        context.conNodeType = DIRECTORY_NODE_INTEGER;
092:
093:                        frame.set("NAVIGATION_CONTEXT", context
094:                                .calculateNavContext());
095:                    }
096:
097:                    event.finishTemplate(frame);
098:                } catch (Throwable e) {
099:                    // TO DO : Analyze Exception !
100:                    throw WebmanExceptionHandler.getException(e);
101:                }
102:            }
103:
104:            /**
105:             * Checks wether this handler is capable to handle the specified event.
106:             *
107:             * @param event the event to be handled.
108:             * @return <CODE>true</CODE> if this handler is capable to handle the
109:             * specified event, otherwise <CODE>false</CODE>.
110:             */
111:            public boolean isHandler(TKEvent event) {
112:                return event.getName().equalsIgnoreCase("CE_FORWARD");
113:            }
114:
115:            /**
116:             * Prepares a frame set for the event to be forwarded.
117:             *
118:             * @param frame the frame set.
119:             * @param event the event to be forwarded.
120:             * @param context the content context.
121:             * @throws Throwable if an error occurred during preparation.
122:             */
123:            private void prepareFrameSet(TKHTMLTemplate frame, String event,
124:                    ContentContext context) throws Throwable {
125:                HTMLUtils.fillFrameSet(frame, LEFT_FRAME_WIDTH_SMALL,
126:                        "CE_SHOWLIST", event);
127:
128:                context.fillIntoTemplate(frame);
129:
130:                TKVector openNodes = new TKVector();
131:                openNodes.put(0, "-1");
132:                openNodes = TreeUtils.updateOpenNodes(openNodes,
133:                        context.conNodeId.toString(), "-1", context.conNodeId
134:                                .toString(), TKDBContentTreeIsChild.class);
135:
136:                frame.setListIterator(new TKStandardIterator(openNodes, frame
137:                        .getListIterator(), "OPEN_NODES", "OPEN_NODES"));
138:            }
139:
140:            /**
141:             * Returns a context information holder for the specified content.
142:             *
143:             * @param id the content identifier.
144:             * @return a context information holder for the specified content.
145:             * @throws Throwable if an error occurred during retrieval.
146:             */
147:            private ContentContext getContentContext(Integer id)
148:                    throws Throwable {
149:                ContentContext context = new ContentContext(new TKParams());
150:                context.conNodeId = id;
151:
152:                TKQuery query = TKDBManager.newQuery(SelectContentTree.class);
153:                query.setQueryParams("ID", id);
154:                query.execute();
155:
156:                ResultSet result = query.fetchResultSet();
157:
158:                if (result.next()) {
159:                    context.conNodeType = new Integer(result
160:                            .getInt("CONTENT_NODE_TYPE"));
161:                    context.formId = new Integer(result.getInt("CONTENT_FORM"));
162:                    context.conNodeName = result.getString("CONTENT_NODE_NAME");
163:                    context.conNodeShortName = result
164:                            .getString("CONTENT_NODE_SHORTNAME");
165:                }
166:
167:                if (GROUP_INTEGER.equals(context.conNodeType)) {
168:                    context.groupConNodeId = context.conNodeId;
169:                    context.groupConNodeName = context.conNodeName;
170:                    context.groupConNodeShortName = context.conNodeShortName;
171:                }
172:
173:                if (SINGLE_INTEGER.equals(context.conNodeType)) {
174:                    Content content = VersionCache.getContentInfo(id);
175:
176:                    context.instanceId = content.getInstanceId();
177:                    context.versionId = content.getCurrentVersion().getId();
178:                }
179:
180:                return context;
181:            }
182:
183:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.