Parsing Rules
When a change package is submitted, the server first consults the policy file to determine the reviewer list. Then, the server obtains the reviewers specified in the ChangePackageReviewers.xml file. This file is parsed once and rules are cached and only re-evaluated for different change packages. If the XML file has been modified since it was last parsed, the server re-parses the rules, caches them again and uses the new rules when evaluating change package conditions and reviewers. The XML parser used to parse reviewer rules is a validating parser. Any parsing errors about malformed XML expressions are logged together with the exact path of the file being parsed and the exact line in the XML file where the error was obtained. In addition, a descriptive error message of what is wrong with the syntax in the XML file is logged. You can then correct the error without restarting the server. All reviewers obtained from the XML rules file are unioned with the reviewers obtained from the policy file and duplicates are removed. In addition, all resolved reviewers are validated against the underlying realm. The reviewer list is stored with the change package being reviewed and is used by the change package review process. Once the reviewer list is determined, it cannot be changed unless it is rejected and re-submitted, at which time a new reviewer list is determined.
Example: Parsing Rules
Lisa must review change packages whose item has the project SI/GUI/Diff and one member of the DevManager group must review all changes made by a co-op student. If an item is associated with the change package and workflow and document functionality is not enabled, an error is reported and the submit fails. If the change package does not have an associated item, the condition evaluates to true.
The reviewer rule looks like the following:
<ReviewerRules>
<ReviewerRule>
<Condition>
<And>
<IssueFieldCondition fieldName="Project" operator="Equal">
<FieldValue>
SI/GUI/Diff
</FieldValue>
</IssueFieldValue>
</And>
</Condition>
<reviewerExpression>
<Reviewers>
<User name="lzurch"/>
</Reviewers>
</reviewerExpression>
</ReviewerRule>
<ReviewerRule>
<Condition>
<And>
<ChangePackageFieldCondition fieldName="user" operator="Equal">
<GroupFieldValue>
Coop
</GroupFieldValue>
</And>
</Condition>
<reviewerExpression>
<Reviewers>
<Group name="DevManager"/>
</Reviewers>
</reviewerExpression>
</ReviewerRule>
</ReviewerRules>
All change packages must be reviewed by the value of the custom Reviewer field associated with the item. The expression 'issue.field[Reviewer]' evaluates to a reviewer and is not part of the condition. This "global" rule effectively allows PTC RV&S to decide who the reviewer is for a change package. The editability and visibility rules in PTC RV&S can control who is allowed to change the Reviewer field.
For example:
<ReviewerRules>
<ReviewerRule>
<reviewerExpression>
<Reviewers>
<UserExpression>
<IssueField name="Reviewer"/>
</UserExpression>
</Reviewers>
</reviewerExpression>
</ReviewerRule>
</ReviewerRules>