Rename the Class
What is refactor in Pega?
“Mistakes are, after all, the foundations of truth, and if a man does not know what a thing is, it is at least an increase in knowledge if he knows what it is not. ”
― Carl G. Jung
Many a time we create classes unknowing with random class name or hierarchy. In this part, we going to learn about how to rename the class of the existing class.
Rename The Existing Class Using Wizard
Here we have a class name called Star Link Project in our application, due to certain reasons we need to change the name of the class for better understanding. Let's see how it can be done.
1. Select Designer Studio > System > Refactor > Classes to start the wizard
2. Click Rename a class and the actual wizard will open for processing
3. In this step, enter the Old Class name which has to be modified and New the Class name.
While renaming classes a few things have to be kept in mind, With the same class we can create "n" number of rules in different RuleSets. We need to modify those rules with the updated class name. This can be done by selecting the rulesets by enabling the checkboxes.
Click next when you are done.
Note: If there are any rules which were created in old class name in checkout, make sure to check them in or discarding them before you change the class name.
4. Pega will show you the rules which belong to this class, Select the radio button to confirm the rename process.
5. In this step, the wizard searches for the applies-to class rule in all the ruleset which were selected in step 3, and also rules which were created in the old class. Click next to modify these rules.
6. The system will change the old class name to new class name for all the rules, For example, If we have a Data Transform rule in a different class but in the Pages and Classes we have mentioned the old class name, it is also changed with the new class name.
We can also view the rules in excel by clicking Export To Excel button.
7. The below screen shows that the rule list which mentions the old class name
8. If any rules where the name couldn't be changed exists, it will appear here. We can also see details in the logs.
9. After Finishing the process we will be able to see the modified Class name in App explorer Wizard.