Source Code Cross Referenced for ShowIfAllowedTag.java in  » Portal » stringbeans-3.5 » com » nabhinc » portlet » mvcportlet » taglib » 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 » Portal » stringbeans 3.5 » com.nabhinc.portlet.mvcportlet.taglib 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* 
002:         * (C) Copyright 2004 Nabh Information Systems, Inc. 
003:         * 
004:         * All copyright notices regarding Nabh's products MUST remain
005:         * intact in the scripts and in the outputted HTML.
006:         * This program is free software; you can redistribute it and/or
007:         * modify it under the terms of the GNU Lesser General Public License
008:         * as published by the Free Software Foundation; either version 2.1 
009:         * of the License, or (at your option) any later version.
010:         * 
011:         * This program is distributed in the hope that it will be useful,
012:         * but WITHOUT ANY WARRANTY; without even the implied warranty of 
013:         * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
014:         * GNU Lesser General Public License for more details.
015:         * 
016:         * You should have received a copy of the GNU Lesser General Public License
017:         * along with this program; if not, write to the Free Software 
018:         * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
019:         * 
020:         */
021:        package com.nabhinc.portlet.mvcportlet.taglib;
022:
023:        import javax.portlet.RenderRequest;
024:        import javax.servlet.jsp.JspException;
025:        import javax.servlet.jsp.tagext.TagSupport;
026:
027:        import com.nabhinc.condition.Condition;
028:        import com.nabhinc.portlet.mvcportlet.core.ActionConfig;
029:        import com.nabhinc.portlet.mvcportlet.core.Constants;
030:        import com.nabhinc.portlet.mvcportlet.core.ControllerPortletConfig;
031:        import com.nabhinc.portlet.mvcportlet.core.RenderConfig;
032:
033:        /**
034:         * This tag is used to enclose other tags which access need to be controlled.
035:         * The access or visibility of the enclosed controls is determined by the 
036:         * pre-condition rule defined by the specified request type (<code>actionType</code> 
037:         * or <code>renderType</code>). Note that, the request type must a valid action-type 
038:         * or render-type defined in configuration.  
039:         * 
040:         * @author Padmanabh Dabke
041:         * (c) 2004 Nabh Information Systems, Inc. All Rights Reserved.
042:         * @since MVCPortlet 0.8
043:         */
044:        public class ShowIfAllowedTag extends TagSupport {
045:            /**
046:             * 
047:             */
048:            private static final long serialVersionUID = 4634581304927196853L;
049:            private String siatActionType = null;
050:            private String siatRenderType = null;
051:
052:            public void release() {
053:                super .release();
054:                siatActionType = null;
055:                siatRenderType = null;
056:            }
057:
058:            /**
059:             * Returns the render type.
060:             * @return
061:             */
062:            public String getRenderType() {
063:                return siatRenderType;
064:            }
065:
066:            /**
067:             * Sets the render type.
068:             * @param name
069:             */
070:            public void setRenderType(String name) {
071:                siatRenderType = name;
072:            }
073:
074:            /**
075:             * Returns the action type.
076:             * @return
077:             */
078:            public String getActionType() {
079:                return siatActionType;
080:            }
081:
082:            /**
083:             * Sets the action type.
084:             * @param name
085:             */
086:            public void setActionType(String name) {
087:                siatActionType = name;
088:            }
089:
090:            public int doStartTag() throws JspException {
091:
092:                try {
093:                    RenderRequest request = (RenderRequest) pageContext
094:                            .getRequest().getAttribute("javax.portlet.request");
095:                    ControllerPortletConfig cPortlet = (ControllerPortletConfig) request
096:                            .getAttribute(Constants.PORTLET_CONFIG_ATTRIB);
097:
098:                    if (cPortlet == null) {
099:                        throw new JspException(
100:                                "MVCPortlet tag used without a Controller portlet.");
101:                    }
102:
103:                    Condition preCon = null;
104:                    String actionType = null;
105:                    if (siatActionType != null) {
106:                        ActionConfig aConfig = (ActionConfig) cPortlet
107:                                .getActionConfigMap().get(siatActionType);
108:                        if (aConfig == null) {
109:                            throw new JspException("No such action type: "
110:                                    + siatActionType);
111:                        }
112:                        preCon = aConfig.getPrecondition();
113:                        actionType = siatActionType;
114:                    } else if (siatRenderType != null) {
115:                        RenderConfig rConfig = (RenderConfig) cPortlet
116:                                .getRenderConfigMap().get(siatRenderType);
117:                        if (rConfig == null) {
118:                            throw new JspException("No such render type: "
119:                                    + siatRenderType);
120:                        }
121:                        preCon = rConfig.getPrecondition();
122:                        actionType = siatRenderType;
123:
124:                    } else {
125:                        throw new JspException(
126:                                "Either actiontype or rendertype must be specified.");
127:                    }
128:
129:                    if (preCon == null)
130:                        return EVAL_BODY_INCLUDE;
131:
132:                    if (preCon.isSatisfied(request, actionType)) {
133:                        return EVAL_BODY_INCLUDE;
134:                    } else {
135:                        return SKIP_BODY;
136:                    }
137:
138:                } catch (Exception ex) {
139:                    throw new JspException(ex);
140:                }
141:            }
142:
143:            public int doEndTag() throws JspException {
144:                return EVAL_PAGE;
145:            }
146:
147:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.