Source Code Cross Referenced for HarmoniseOutput.java in  » Content-Management-System » harmonise » org » openharmonise » rm » publishing » 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 » harmonise » org.openharmonise.rm.publishing 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the 
003:         * Mozilla Public License Version 1.1 (the "License"); 
004:         * you may not use this file except in compliance with the License. 
005:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006:         *
007:         * Software distributed under the License is distributed on an "AS IS"
008:         * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. 
009:         * See the License for the specific language governing rights and 
010:         * limitations under the License.
011:         *
012:         * The Initial Developer of the Original Code is Simulacra Media Ltd.
013:         * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014:         *
015:         * All Rights Reserved.
016:         *
017:         * Contributor(s):
018:         */
019:        package org.openharmonise.rm.publishing;
020:
021:        import java.util.logging.*;
022:
023:        import org.openharmonise.commons.dsi.*;
024:        import org.openharmonise.commons.xml.*;
025:        import org.openharmonise.rm.factory.*;
026:        import org.openharmonise.rm.resources.*;
027:        import org.openharmonise.rm.resources.publishing.*;
028:        import org.openharmonise.rm.resources.users.*;
029:        import org.openharmonise.rm.security.authorization.*;
030:        import org.w3c.dom.*;
031:
032:        /**
033:         * An extension to <code>XMLDocument</code> which can hold the output
034:         * of the publication of resources specified by input HaRP and provides
035:         * some utility methods relevant to HaRP output.
036:         * 
037:         * @author Michael Bell
038:         * @version $Revision: 1.2 $
039:         *
040:         */
041:        public class HarmoniseOutput extends XMLDocument {
042:
043:            AbstractDataStoreInterface m_dsi = null;
044:
045:            /**
046:             * Logger for this class
047:             */
048:            private static final Logger m_logger = Logger
049:                    .getLogger(HarmoniseOutput.class.getName());
050:
051:            public HarmoniseOutput(AbstractDataStoreInterface dsi) {
052:                super ();
053:                m_dsi = dsi;
054:            }
055:
056:            public HarmoniseOutput(org.w3c.dom.Document document,
057:                    AbstractDataStoreInterface dsi) {
058:                super (document);
059:                m_dsi = dsi;
060:            }
061:
062:            /**
063:             * Utility method to ease processing of Submit buttons.
064:             *
065:             * @exception Exception
066:             * @param submit Submit element from input XML
067:             * @param state State XML document
068:             * @param output Output XML document, passed because Xerces requires
069:             *     Nodes to be owned by Document
070:             * @return Output Submit element, null if failed FilterConditions
071:             */
072:            public Element processSubmitTag(Element submit, State state) {
073:                Element newSubmit = null;
074:
075:                newSubmit = (Element) copyNode(submit);
076:
077:                return newSubmit;
078:            }
079:
080:            /** Adds a Page element under the link node found under el with the given page id.
081:             *
082:             * @param el Element with descendant Link element
083:             * @param output Output document
084:             * @param nPageId Page id of page element to be added
085:             */
086:            public void addPageIdToLinkNode(User usr, Element el, int nPageId) {
087:                NodeList linkNodes = el
088:                        .getElementsByTagName(AbstractObject.TAG_LINK);
089:
090:                try {
091:                    WebPage page = (WebPage) HarmoniseObjectFactory
092:                            .instantiateHarmoniseObject(this .m_dsi,
093:                                    WebPage.class.getName(), nPageId);
094:
095:                    boolean bIsVisible = AuthorizationValidator.isVisible(usr,
096:                            page);
097:
098:                    for (int i = 0; i < linkNodes.getLength(); i++) {
099:                        Element linkNode = (Element) linkNodes.item(i);
100:                        if (bIsVisible == false) {
101:                            linkNode.setAttribute(
102:                                    AuthorizationValidator.ATTRIB_IS_VIEWABLE,
103:                                    "false");
104:                        }
105:
106:                        NodeList pageNodes = linkNode
107:                                .getElementsByTagName(WebPage.TAG_PAGE);
108:
109:                        if (pageNodes.getLength() == 0) {
110:                            Node pageNode = createElement(WebPage.TAG_PAGE);
111:                            ((Element) pageNode).setAttribute(
112:                                    AbstractObject.ATTRIB_ID, Integer
113:                                            .toString(nPageId));
114:
115:                            linkNode.appendChild(pageNode);
116:                        }
117:
118:                    }
119:                } catch (Exception e) {
120:                    m_logger.log(Level.WARNING, e.getLocalizedMessage(), e);
121:                }
122:            }
123:
124:            /** Create an error XML element in the document.
125:             *
126:             * @param error_code Code of the error to create
127:             * @param form that has set the error, if one exists
128:             */
129:            public Element createErrorElement(String error_code,
130:                    Element form_element) {
131:                NodeList nodes = form_element
132:                        .getElementsByTagName(XMLFormErrorCodes.TAG_ERRORTEXT);
133:                Element error_element = createElement(AbstractObject.TAG_ERROR);
134:
135:                String error_text = null;
136:
137:                for (int i = 0; i < nodes.getLength(); i++) {
138:                    Element form_error_element = (Element) nodes.item(i);
139:
140:                    if (((String) form_error_element
141:                            .getAttribute(XMLFormErrorCodes.ATTRIB_ERRORCODE))
142:                            .equals(error_code)) {
143:                        Text txt = (Text) form_error_element.getFirstChild();
144:                        error_text = txt.getNodeValue();
145:                    }
146:                }
147:
148:                if (error_text == null) {
149:                    //wasn't set from form
150:                    error_text = XMLFormErrorCodes.getInstance().getErrorText(
151:                            error_code);
152:                }
153:
154:                Node txt;
155:
156:                if (error_text != null) {
157:                    txt = createTextNode(error_text);
158:                } else {
159:                    throw new RuntimeException("Error code unknown :"
160:                            + error_code);
161:                }
162:
163:                error_element.appendChild(txt);
164:                error_element.setAttribute(XMLFormErrorCodes.ATTRIB_ERRORCODE,
165:                        error_code);
166:
167:                return error_element;
168:            }
169:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.