Source Code Cross Referenced for FlowHelperImpl.java in  » Content-Management-System » apache-lenya-2.0 » org » apache » lenya » cms » cocoon » flow » 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 » apache lenya 2.0 » org.apache.lenya.cms.cocoon.flow 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         *
017:         */
018:
019:        /* $Id: FlowHelperImpl.java 564507 2007-08-10 08:33:31Z andreas $  */
020:
021:        package org.apache.lenya.cms.cocoon.flow;
022:
023:        import java.util.Enumeration;
024:        import java.util.Map;
025:
026:        import org.apache.avalon.framework.logger.AbstractLogEnabled;
027:        import org.apache.avalon.framework.service.ServiceException;
028:        import org.apache.avalon.framework.service.ServiceManager;
029:        import org.apache.avalon.framework.service.Serviceable;
030:        import org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon;
031:        import org.apache.cocoon.environment.Request;
032:        import org.apache.lenya.ac.AccessControlException;
033:        import org.apache.lenya.cms.publication.Document;
034:        import org.apache.lenya.cms.publication.DocumentFactory;
035:        import org.apache.lenya.cms.publication.DocumentUtil;
036:        import org.apache.lenya.cms.publication.PageEnvelope;
037:        import org.apache.lenya.cms.publication.PageEnvelopeException;
038:        import org.apache.lenya.cms.publication.PageEnvelopeFactory;
039:        import org.apache.lenya.cms.publication.Publication;
040:        import org.apache.lenya.cms.publication.PublicationUtil;
041:        import org.apache.lenya.cms.publication.util.DocumentHelper;
042:        import org.apache.lenya.cms.rc.FileReservedCheckInException;
043:        import org.apache.lenya.cms.repository.Node;
044:        import org.apache.lenya.cms.repository.RepositoryUtil;
045:        import org.apache.lenya.cms.repository.Session;
046:        import org.apache.lenya.cms.workflow.WorkflowUtil;
047:        import org.apache.lenya.workflow.WorkflowException;
048:
049:        /**
050:         * Flowscript utility class. The FOM_Cocoon object is not passed in the constructor to avoid errors.
051:         * This way, not the initial, but the current FOM_Cocoon object is used by the methods.
052:         */
053:        public class FlowHelperImpl extends AbstractLogEnabled implements 
054:                FlowHelper, Serviceable {
055:
056:            /**
057:             * Ctor.
058:             */
059:            public FlowHelperImpl() {
060:                // do nothing
061:            }
062:
063:            /**
064:             * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#getPageEnvelope(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon)
065:             */
066:            public PageEnvelope getPageEnvelope(FOM_Cocoon cocoon)
067:                    throws PageEnvelopeException {
068:                Request request = getRequest(cocoon);
069:                try {
070:                    Session session = RepositoryUtil.getSession(this .manager,
071:                            request);
072:                    DocumentFactory map = DocumentUtil.createDocumentFactory(
073:                            this .manager, session);
074:                    PageEnvelopeFactory factory = PageEnvelopeFactory
075:                            .getInstance();
076:                    Publication publication = PublicationUtil.getPublication(
077:                            this .manager, request);
078:                    return factory.getPageEnvelope(map,
079:                            cocoon.getObjectModel(), publication);
080:                } catch (Exception e) {
081:                    throw new PageEnvelopeException(e);
082:                }
083:            }
084:
085:            /**
086:             * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#getRequestURI(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon)
087:             */
088:            public String getRequestURI(FOM_Cocoon cocoon) {
089:                return cocoon.getRequest().getRequestURI();
090:            }
091:
092:            /**
093:             * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#getRequest(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon)
094:             */
095:            public Request getRequest(FOM_Cocoon cocoon) {
096:                return cocoon.getRequest();
097:            }
098:
099:            /**
100:             * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#getObjectModel(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon)
101:             */
102:            public Map getObjectModel(FOM_Cocoon cocoon) {
103:                return cocoon.getObjectModel();
104:            }
105:
106:            /**
107:             * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#getDocumentHelper(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon)
108:             */
109:            public DocumentHelper getDocumentHelper(FOM_Cocoon cocoon) {
110:                return new DocumentHelper(this .manager, cocoon.getObjectModel());
111:            }
112:
113:            /**
114:             * <code>SEPARATOR</code> The separator
115:             */
116:            public static final String SEPARATOR = ":";
117:
118:            /**
119:             * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#getImageParameterValue(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon,
120:             *      java.lang.String)
121:             */
122:            public String getImageParameterValue(FOM_Cocoon cocoon,
123:                    String parameterName) {
124:
125:                getLogger().debug(
126:                        "Resolving parameter value for name [" + parameterName
127:                                + "]");
128:
129:                Request request = cocoon.getRequest();
130:                String value = request.getParameter(parameterName);
131:
132:                if (value == null) {
133:                    String prefix = parameterName + SEPARATOR;
134:                    Enumeration e = request.getParameterNames();
135:                    while (e.hasMoreElements() && value == null) {
136:                        String name = (String) e.nextElement();
137:                        if (name.startsWith(prefix)) {
138:                            getLogger().debug(
139:                                    "Complete parameter name: [" + name + "]");
140:                            value = name.substring(prefix.length(), name
141:                                    .length() - 2);
142:                            getLogger()
143:                                    .debug("Resolved value: [" + value + "]");
144:                        }
145:                    }
146:                }
147:
148:                return value;
149:            }
150:
151:            /**
152:             * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#triggerWorkflow(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon,
153:             *      java.lang.String)
154:             */
155:            public void triggerWorkflow(FOM_Cocoon cocoon, String event)
156:                    throws WorkflowException, PageEnvelopeException,
157:                    AccessControlException {
158:                Document document = getPageEnvelope(cocoon).getDocument();
159:                Request request = getRequest(cocoon);
160:                try {
161:                    Session session = RepositoryUtil.getSession(this .manager,
162:                            request);
163:                    WorkflowUtil.invoke(this .manager, session, getLogger(),
164:                            document, event);
165:                } catch (Exception e) {
166:                    // TODO Auto-generated catch block
167:                    e.printStackTrace();
168:                }
169:            }
170:
171:            /**
172:             * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#reservedCheckIn(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon,
173:             *      boolean)
174:             */
175:            public void reservedCheckIn(FOM_Cocoon cocoon, boolean backup)
176:                    throws FileReservedCheckInException, Exception {
177:                final PageEnvelope pageEnvelope = getPageEnvelope(cocoon);
178:                Node node = pageEnvelope.getDocument().getRepositoryNode();
179:                node.checkin();
180:            }
181:
182:            private ServiceManager manager;
183:
184:            /**
185:             * @see org.apache.avalon.framework.service.Serviceable#service(org.apache.avalon.framework.service.ServiceManager)
186:             */
187:            public void service(ServiceManager manager) throws ServiceException {
188:                this.manager = manager;
189:            }
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.