Source Code Cross Referenced for PriorityRestriction.java in  » Portal » uPortal_rel-2-6-1-GA » org » jasig » portal » layout » restrictions » alm » 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 » uPortal_rel 2 6 1 GA » org.jasig.portal.layout.restrictions.alm 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /* Copyright 2002 The JA-SIG Collaborative.  All rights reserved.
002:         *  See license distributed with this file and
003:         *  available online at http://www.uportal.org/license.html
004:         */
005:
006:        package org.jasig.portal.layout.restrictions.alm;
007:
008:        import java.util.StringTokenizer;
009:
010:        import org.jasig.portal.PortalException;
011:        import org.jasig.portal.layout.alm.ALNode;
012:        import org.jasig.portal.layout.node.ILayoutNode;
013:        import org.jasig.portal.utils.CommonUtils;
014:
015:        /**
016:         * PriorityRestriction checks the priority restriction for a given ALNode object.
017:         * 
018:         * Prior to uPortal 2.5, this class existed in the package org.jasig.portal.layout.restrictions.
019:         * It was moved to its present package to reflect that it is part of Aggregated Layouts.
020:         *
021:         * @author <a href="mailto:mvi@immagic.com">Michael Ivanov</a>
022:         * @version $Revision: 35731 $
023:         */
024:        public class PriorityRestriction extends ALRestriction {
025:
026:            private int minPriority, maxPriority;
027:
028:            public PriorityRestriction(String name, String nodePath) {
029:                super (name, nodePath);
030:            }
031:
032:            public PriorityRestriction(String name) {
033:                super (name);
034:            }
035:
036:            public PriorityRestriction() {
037:                super ();
038:            }
039:
040:            /**
041:             * Returns the maximum value of the given restriction
042:             * @return a maxPriority
043:             */
044:            public int getMaxValue() {
045:                return maxPriority;
046:            }
047:
048:            /**
049:             * Returns the minimum value of the given restriction
050:             * @return a minPriority
051:             */
052:            public int getMinValue() {
053:                return minPriority;
054:            }
055:
056:            /**
057:             * Returns the minimum and maximum values of the given restriction as an integer array
058:             * @return an integer array
059:             */
060:            public int[] getRange() {
061:                return new int[] { minPriority, maxPriority };
062:            }
063:
064:            /**
065:             * Parses the restriction expression of the current node
066:             * @exception PortalException
067:             */
068:            protected void parseRestrictionExpression() throws PortalException {
069:                try {
070:                    String restrictionExp = getRestrictionExpression();
071:                    if (restrictionExp.indexOf('-') > 0) {
072:                        StringTokenizer st = new StringTokenizer(
073:                                restrictionExp, "-");
074:                        String min = st.nextToken();
075:                        String max = st.nextToken();
076:                        minPriority = CommonUtils.parseInt(min, 0);
077:                        maxPriority = CommonUtils.parseInt(max,
078:                                Integer.MAX_VALUE);
079:                    } else {
080:                        minPriority = CommonUtils.parseInt(restrictionExp, 0);
081:                        maxPriority = minPriority;
082:                    }
083:                } catch (Exception e) {
084:                    throw new PortalException(e);
085:                }
086:            }
087:
088:            /**
089:             * Checks the restriction for the specified node
090:             * @param propertyValue a <code>String</code> property value to be checked
091:             * @exception PortalException
092:             */
093:            public boolean checkRestriction(String propertyValue)
094:                    throws PortalException {
095:                int priority = CommonUtils.parseInt(propertyValue, 0);
096:                if (priority <= maxPriority && priority >= minPriority)
097:                    return true;
098:                return false;
099:            }
100:
101:            /**
102:             * Checks the restriction for the current node
103:             * @exception PortalException
104:             */
105:            public boolean checkRestriction(ILayoutNode node)
106:                    throws PortalException {
107:
108:                if (!(node instanceof  ALNode))
109:                    throw new PortalException("The node must be ALNode type!");
110:                ALNode alNode = (ALNode) node;
111:
112:                // if we have a related priority restriction we should check the priority ranges
113:                if (nodePath != null
114:                        && !nodePath.equals(LOCAL_RESTRICTION_PATH)) {
115:                    PriorityRestriction restriction = (PriorityRestriction) alNode
116:                            .getRestriction(getUniqueKey(RestrictionTypes.PRIORITY_RESTRICTION));
117:                    if (restriction != null) {
118:                        int[] range = restriction.getRange();
119:                        if (minPriority > range[1] || maxPriority < range[0])
120:                            return false;
121:                    }
122:                    return true;
123:                }
124:
125:                int priority = alNode.getPriority();
126:                if (priority <= maxPriority && priority >= minPriority)
127:                    return true;
128:                return false;
129:            }
130:
131:            public void setRestriction(int minPriority, int maxPriority) {
132:                this .minPriority = minPriority;
133:                this .maxPriority = maxPriority;
134:                setRestrictionExpression(new String(minPriority + "-"
135:                        + maxPriority));
136:            }
137:
138:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.