Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

IPersonEvaluatorFactory

campuspipeline.uportal.dlm.provider.IPersonEvaluatorFactory

This class implements the EvaluatorFactory interface. This factory can produce evaluators that can answer true or false to a user meeting any logical combination of attribute values in the passed in IPerson object. It does so be defining one test element, <attribute>, a logical grouping element, <paren>, and an inverting or negating element, <NOT>. The <dlm:audience> element using this factory must contain at least one and may contain many of these elements in any combination.

<paren> ELEMENT

Like the <dlm:audience> element this element must contain at least one and may contain many <attribute>, <parent>, or <NOT> elements. It has one optional attribute "operation" which can contain one of two values: "OR", which is also the default if not specified, and "AND". "OR" causes the paren element to evaluate all contained tests and if any of them returns true then it too will return true. "AND" only returns true if all contained tests are true.

The <NOT> element can be used to negate from one to many contained tests. If more than one is included the <NOT> element performs an "OR" operation on the contained tests and then inverts the result returning the opposite boolean value.

The <attribute> element can perform five tests on attributes in the passed in IPerson object. The particular attribute to be tested is indicated in the required "name" attribute. The required "mode" attribute indicates the type of test and can be one of the following: "exists", "equals", "contains", "startsWith", and "endsWith". The value to be compared is indicated by the "value" attribute. The "value" attribute is not required and indeed not used for the "exists" mode.

These three elements can be nested to any level as needed.

Example: if the IPerson contained a "role" attribute that were one of three values, "student", "faculty", or "alumni" then to include a layout fragment in the layout for all users having role equal to student the following <dlm:audience> element would suffice.

Sample Audience Declaration
<dlm:audience evaluatorFactory="campuspipeline.uportal.dlm.IPersonEvaluatorFactory">
 <attribute name="role" mode="equals" value="student"/>
</dlm:audience>

Example: if there were a number of roles beyond just these three and a particular layout fragment needed to be included in all roles except for those of faculty and alumni then either of the following <dlm:audience> elements would do the trick although stricly speaking the paren is not needed inside of the <NOT> element.

Sample Audience Declaration
<dlm:audience evaluatorFactory="campuspipeline.uportal.dlm.IPersonEvaluatorFactory">
 <NOT> 
  <attribute name="role" mode="equals" value="faculty"/>
  <attribute name="role" mode="equals" value="alumni"/>
 </NOT>
</dlm:audience>

<dlm:audience evaluatorFactory="campuspipeline.uportal.dlm.IPersonEvaluatorFactory">
 <NOT> 
  <paren operation="OR">
   <attribute name="role" mode="equals" value="faculty"/>
   <attribute name="role" mode="equals" value="alumni"/>
  </paren>
 </NOT>
</dlm:audience>

Example: The following complex rule shows the capabilities of combining these three elements. The layout containing this <dlm:audience> element would be included for all juniors in any chemistry class or any senior in any biology class except biology 101.

Sample Audience Declaration
<dlm:audience evaluatorFactory="campuspipeline.uportal.dlm.IPersonEvaluatorFactory">
 <paren operation="OR"> 
  <paren operation="AND">
   <attribute name="yearLevel" mode="equals" value="junior"/>
   <attribute name="courses" mode="contains" value="Chemistry"/>
  </paren>
  <paren operation="AND">
   <paren operation="AND">
    <attribute name="courses" mode="contains" value="Biology"/>
    <NOT>
     <attribute name="courses" mode="contains" value="101"/>
    </NOT>
   </paren>
   <attribute name="yearLevel" mode="equals" value="senior"/>
  </paren>
 </paren>
</dlm:audience>
  • No labels