You are here: Reference > Tools, accelerators, and wizards > Use the Ruleset Maintenance wizard

  About the RuleSet Maintenance wizard

The RuleSet Maintenance wizard helps you copy RuleSets and RuleSet versions into new versions, merge several RuleSet versions into one version, move rules out of one RuleSet into another, or change a RuleSet version's number. Select the Designer Studio> System >Refactor > RuleSets menu item, then click Copy/Merge RuleSet to start the wizard.

Operations of this wizard depend on the Pega-RuleRefactoring agents. If you use this wizard, confirm that the Pega-RuleRefactoring agents are enabled on at least one node of your system.

Functions of the wizard

Moving a RuleSet

To move a RuleSet, select an existing RuleSet and specify a target name and, optionally, a version. The wizard processes the source rules in each RuleSet Version in the RuleSet and any non-versioned rules associated with the RuleSet. The RuleSet and RuleSet Version fields of each rule are updated to the values specified as the target. The result is that the rule appears to have been deleted from its source RuleSet and copied into the target RuleSet. The value of the rule's pzInsKey does not change.

The handling of multiple RuleSet Versions in the RuleSet depends on whether you specify a target version:

For example, if you move a RuleSet containing rules with RuleSet versions 01-01-01, 01-01-02 and 01-01-03 into a new target RuleSet and specify a version of 01-02-01, the target RuleSet version will contain the highest version of all the source rules contained in versions 01-01-01, 01-01-02 and 01-01-03 with lower-versioned duplicates dropped. In this example, if a rule is duplicated in both 01-01-01 and 01-01-02, the rule will be moved from 01-01-02 to the new RuleSet name with RuleSet Version 01-02-01, and the duplicate rule in 01-01-01 will be dropped.

When you move a RuleSet, the wizard also updates the references to affected RuleSet versions in the following rules or data instances anywhere in the system, so they reference correctly the versions that exist after the move:

  • Rule-Obj-Class
  • Rule-Access-Deny-Obj
  • Rule-Access-Role-Name
  • Rule-Access-Role-Obj
  • Rule-Application-Requirement
  • Rule-Application
  • Rule-Application-UseCase
  • Rule-Connect-SOAP
  • Rule-Declare-Pages
  • Rule-RuleSet-Name
  • Rule-RuleSet-Version

You cannot copy a RuleSet.

Copying or moving a RuleSet version

Copying a RuleSet Version performs the same function as the Save As toolbar action. The original source RuleSet Version does not change. Each target rule that is created is identical to the original source rule with the following exceptions:

  1. You must specify a RuleSet Version for the target rules that is different than that of the source rules.
  2. The wizard creates a new pzInsKey field value for the target rules using the actual create date/time as one of the values in the construction the new target pzInsKey. The create date/time value is the only difference between the data that makes up the source and target pzInsKey values.

As with moving a RuleSet, moving a RuleSet Version changes the source rules. The wizard updates the RuleSet Version fields of each Rule to the values specified as the target. The result is that the rule appears to have been deleted from its source RuleSet Version, and copied into the target RuleSet Version. In a move, the value of the rule's pzInsKey does not change.

Merging RuleSets and RuleSet versions

You can merge multiple source RuleSet Versions belonging to the same or different RuleSets. For example, you can "skim" the RuleSet by collecting only the highest version of every rule in the RuleSet Versions into the target, or you can compress the RuleSets down to a lower level (01-01-01) or another designated level. You control the merge by specifying the target version and the order in which the RuleSet versions will be processed.

When you select the RuleSet Versions, you establish the order of precedence by the order in which you list them in the wizard interface. The wizard processes the rules in the order listed, top-to-bottom, collects the first version of every rule it finds, and drops other duplicate rules:

Note: Compress RuleSets with prerequisites beginning with the RuleSet of least dependency. For example, if RuleSet A requires RuleSet B as a prerequisite, and RuleSet B requires RuleSet C as a prerequisite, then you should compress the RuleSet A first, then B, and finally C. If you compress the RuleSets in the order C, B, and A, you risk losing some rules that you expected to retain.

When you merge RuleSets or RuleSet Versions, you have the option of deleting the sources once the merge is complete. However, if you merge RuleSet versions and opt to delete the sources, the source versions are deleted, but not their RuleSet(s).

For an example of the merge operation, see PDN article How to merge RuleSets using the RuleSet Maintenance wizard.

Changing a RuleSet version number

You can change the version number for a particular RuleSet Version, whether or not the version which you designate as the new number already exists. The target version belongs to the same RuleSet as the source version. All rules, including non-resolved rules, from the source RuleSet Version become part of the target version. All rules retain their original pzInsKey values, and therefore retain their History.

When the change is complete, the wizard deletes all rules in the source version.

Rule conflicts

For move, copy, and change operations, you can specify how to handle conflicts if the same rules are found in both the source and the target. You can choose to overwrite the target rules with the source rules, or to not move or copy the source rules that conflict, leaving the target rules unchanged. If you choose not to overwrite the rules, the Summary page of the wizard lists the rules in the source that were skipped because they were in conflict with the target.

Locked RuleSet versions

The wizard does not change rules that belong to locked RuleSet versions. If a RuleSet version that will be changed by the wizard operation is locked, you are prompted for the password to unlock the Version before proceeding. To copy a RuleSet Version the target rules cannot be locked. The source rules can be locked, since they are not changed by the copy operation. To move a RuleSet or RuleSet Version, both the source and target rules must be unlocked.

Checked-out Rules

As a best practice, make sure that all rules are checked in before you move or copy a RuleSet or RuleSet Version. Select Designer Studio> Application > Development > Checked Out Rules. Complete the parameters and click Run. Review the resulting report to confirm that no rules from that RuleSet version are checked out.

If the wizard encounters rules to be modified that are checked out, it displays a warning page and provides a report of the checked-out rules. From the report window you can open the rules and check in the ones for which you have permission, or save a list of the rules in a spreadsheet.

You must check in any rules you have checked out or arrange for any rules in the report that are checked out by other users to be checked in before you can complete the wizard. If you exit the wizard to arrange for rules to be checked in, you must restart the wizard from the beginning.

Affected Rules and data instances

The wizard automatically adjusts any references to RuleSet versions in the following rules or data instances, system wide, to match the versions that exist after a merge or move:

Prerequisites and preparations

Before running the RuleSet Maintenance wizard, consider the following guidelines:

Note When you are working with RuleSet Versions, the Copy missing RuleSet Prerequisites check box appears at the bottom of the first form of the wizard. Check this check box to have the wizard copy any prerequisite RuleSets that the RuleSet version that results from your process will require.

Starting the wizard

Select the Designer Studio >System > Refactor >RuleSets menu item, then click Copy/Merge RuleSet to start the wizard. Then select the operation you wish to execute.

For help in completing the first form, see RuleSet Maintenance wizard.

Follow-up tasks

Recommended next steps

This wizard does not modify references to RuleSets that are deleted or modified. Repair any references to rules that have been moved by the wizard by replacing references to the source RuleSet with the target or another RuleSet. In particular,

Recovering merged RuleSets

Before merging the RuleSets, the tool creates a backup of each rule named Bkup_SourceRuleSet.zip and Bkup_TargetRuleSet.zip. If needed, you can use the Import ZIP facilities to recover the original RuleSets.

Logging

Each execution of this wizard creates an instance of the Log-Merge-RuleSet class, including error messages or other results. The key to this instance is the date and time the wizard was started.

Notes:

Class rules do not have a version. Do not delete Class rules (or other rules that have no version) if any version of the RuleSet remains in use.

In some organizations, audit or compliance policies may prohibit deleting old rules, even if they are not in use.

 

Related Topics IconRelated Topics

UpTools — System