Sungard SCT ALM IPersonEvaluatorFactory
This page is part of the Aggregated Layout Management Convergence 2.x effort that will be added to 3.x.
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 by defining one test element, <attribute>, and a logical grouping element, <paren>. The <dlm:audience> element using this factory must contain at least one and may contain many of these elements in any combination.
Syntactic Configuration Elements
<paren> ELEMENT
Like the <dlm:audience> element this element must contain at least one and may contain many <attribute> or <parent> elements. In fact the implementing class implements the Evaluator interface enabling the implementing class to be passed back from the factory.
The paren element has one optional attribute "mode" which can contain one of three values: "OR", which is also the default if not specified, "AND", or "NOT". "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. "NOT" can be used to negate from one to many contained tests. If more than one is included an "OR" operation is first performed on the contained tests and the result is inverted and returned. For a single test its inverse is returned as expected.
<attribute> ELEMENT
Like the <paren> element the class providing the functionality of the <attribute> element implements the Evaluator interface. The <attribute> element can perform five tests on attributes found in the passed in IPerson object. Its supported xml attributes are as follows.
Attribute Name |
Description |
---|---|
name |
The key of the particular attribute to be tested in the IPerson object. |
mode |
Indicates the type of test and can be one of the following: exists, equals, contains, startsWith, and endsWith. |
value |
The value against which the attribute is to be compared. This attribute is not required and indeed is not used for the "exists" mode. |
These two elements, <paren> and <attribute>, can be nested to any level as needed. The examples below imply that there are attributes on the passed in IPerson object with keys of "role", "courses", and "yearLevel". For the CpPersonEvaluatorFactory that is used in the sample dlm.xml file only a "role" attribute is supported and for its evaluation it uses a multi-valued attribute containing all of the groups to which a user belongs.
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.
<dlm:audience evaluatorFactory="campuspipeline.uportal.dlm.IPersonEvaluatorFactory"> <attribute name="role" mode="contains" 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.
<dlm:audience evaluatorFactory="campuspipeline.uportal.dlm.IPersonEvaluatorFactory"> <parent mode="NOT"> <attribute name="role" mode="contains" value="faculty"/> <attribute name="role" mode="contains" value="alumni"/> </paren> </dlm:audience> <dlm:audience evaluatorFactory="campuspipeline.uportal.dlm.IPersonEvaluatorFactory"> <paren mode="NOT"> <paren mode="OR"> <attribute name="role" mode="contains" value="faculty"/> <attribute name="role" mode="contains" value="alumni"/> </paren> </paren> </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.
<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>