IPersonEvaluatorFactory
campuspipeline.uportal.dlm.provider.IPersonEvaluatorFactory
This class implements the Sample dlm.xml file EvaluatorFactory interface. factory can produce evaluators that can select a layout based on 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.
...
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.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<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.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<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.
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
<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> |