9. Rules

[Note]Note

Rules are now deprecated and replaced by the new “ExpressionParser” (Section 10) and should not be used anymore where possible.

9.1. Introduction

Rules are readable logical rulestrings to control portal and modules functionality, as well as filter data from datasource queries, independent of the datasource type.

Example 4.46. Rule examples

Rule within a <visible> of a component: (The component will invisible if 
windowstate is not normal, but e.g. maximized)
<visible><prule>javax.portlet.request.windowstate != "normal"</prule></visible>

More complex rule for a DatasourceListComponent:
<rule><![CDATA[( view.components.fromdate.unixtimestamp == "" 
       || object.edittimestamp >= view.components.fromdate.unixtimestamp ) 
    && ( view.components.untildate.unixtimestamp == "" 
       || object.edittimestamp <= view.components.untildate.unixtimestamp )
]]></rule>
(This example assumes you have two DateComponents, fromdate and untildate
which are used to filter the objects within a DatasourceListComponent)

9.2. Variables

Objects matched against a rule are usually provided through the variable named "object".

9.3. Operators

CONTAINSONEOF, CONTAINSNONE, <, <=, >, >=, ==

To test if a specified value is null or empty you can use: value == "" (Things that will NOT work: value == null, !value)