Java Doc for IfPlugin.java in  » Wiki-Engine » JSPWiki » com » ecyrd » jspwiki » plugin » 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 » Wiki Engine » JSPWiki » com.ecyrd.jspwiki.plugin 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.ecyrd.jspwiki.plugin.IfPlugin

IfPlugin
public class IfPlugin implements WikiPlugin(Code)
The IfPlugin allows parts of a WikiPage to be executed conditionally. You can also use shorthand "If" to run it. Parameters:
  • group - A "|" -separated list of group names.
  • user - A "|" -separated list of user names.
  • ip - A "|" -separated list of ip addresses.
  • var - A wiki variable
  • page - A page name
  • contains - A Perl5 regexp pattern
  • is - A Perl5 regexp pattern
  • exists - "true" or "false".

If any of them match, the body of the plugin is executed. You can negate the content by prefixing it with a "!". For example, to greet all admins, put the following in your LeftMenu:

 [{If group='Admin'
 Hello, Admin, and your mighty powers!}]
 

In order to send a message to everybody except Jack use

 [{If user='!Jack'
 %%warning
 Jack's surprise birthday party at eleven!
 %%}]
 

Note that you can't use "!Jack|!Jill", because for Jack, !Jill matches; and for Jill, !Jack matches. These are not regular expressions (though they might become so in the future).

To check for page content, use

 [{If page='TestPage' contains='xyzzy'
 Page contains the text "xyzzy"}]
 

The difference between "contains" and "is" is that "is" is always an exact match, whereas "contains" just checks if a pattern is available.

To check for page existence, use

 [{If page='TestPage' exists='true'
 Page "TestPage" exists.}]
 

With the same mechanism, it's also possible to test for the existence of a variable - just use "var" instead of "page".

Another caveat is that the plugin body content is not counted towards ReferenceManager links. So any links do not appear on any reference lists. Depending on your position, this may be a good or a bad thing.

Calling Externally

The functional, decision-making part of this plugin may be called from other code (e.g., other plugins) since it is available as a static method IfPlugin.ifInclude(WikiContext,Map) . Note that the plugin body may contain references to other plugins.


author:
   Janne Jalkanen
author:
   Murray Altheim
since:
   2.6


Field Summary
final public static  StringPARAM_CONTAINS
    
final public static  StringPARAM_EXISTS
    
final public static  StringPARAM_GROUP
    
final public static  StringPARAM_IP
    
final public static  StringPARAM_IS
    
final public static  StringPARAM_PAGE
    
final public static  StringPARAM_USER
    
final public static  StringPARAM_VAR
    


Method Summary
public  Stringexecute(WikiContext context, Map params)
    
public static  booleanifInclude(WikiContext context, Map params)
     Returns a boolean result based on processing the WikiContext and parameter Map as according to the rules stated in the IfPlugin documentation.

Field Detail
PARAM_CONTAINS
final public static String PARAM_CONTAINS(Code)



PARAM_EXISTS
final public static String PARAM_EXISTS(Code)



PARAM_GROUP
final public static String PARAM_GROUP(Code)



PARAM_IP
final public static String PARAM_IP(Code)



PARAM_IS
final public static String PARAM_IS(Code)



PARAM_PAGE
final public static String PARAM_PAGE(Code)



PARAM_USER
final public static String PARAM_USER(Code)



PARAM_VAR
final public static String PARAM_VAR(Code)





Method Detail
execute
public String execute(WikiContext context, Map params) throws PluginException(Code)



ifInclude
public static boolean ifInclude(WikiContext context, Map params) throws PluginException(Code)
Returns a boolean result based on processing the WikiContext and parameter Map as according to the rules stated in the IfPlugin documentation. As a static method this may be called by other classes.
Parameters:
  context - The current WikiContext.
Parameters:
  params - The parameter Map which contains key-value pairs.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.