Hi all,
I have list of roles some are existing some are new. In case of existing roles I need to duplicate the role and in case of new roles I have to add in roles node. I have created a class for that with a method createduplicaterole() which will do the functionality of creating and duplicating the roles. But I am not able to check all the roles if it is existing or new roles. how do I make my class interactive for checking the roles if it needs to be created or duplicate. Following are the code I have done.
public
class McsSecurityProfileAutomationClass
{
}
public
str label;
TreeNode treeNode,treeNodeNew;
securityRoleName roleName;
#AOT
#Properties
treeNode = TreeNode::findNode(#SecRolesPath + #AOTDelimiter + _roleName);
treeNodeNew = TreeNode::findNode(#SecRolesPath + #AOTDelimiter + roleName);
if
(treeNode )
{
if
(!treeNodeNew)
{
roleName =
“DEL”
- _roleName;
Label =
"Depreceated "
- _label;
treeNodeNew = treeNode.AOTDuplicate();
treeNodeNew.AOTsetProperty(#PropertyName, roleName);
treeNodeNew.AOTsetProperty(#PropertyLabel, Label);
treeNodeNew.AOTsave();
}
}
else
{
treeNode = TreeNode::findNode(#SecRolesPath);
treeNode.AOTadd(_roleName);
treeNode = TreeNode::findNode(#SecRolesPath + #AOTDelimiter + _roleName);
treeNode.AOTsetProperty(#PropertyLabel, _label);
treeNode.AOTsave();
}
return
treeNode ;
staticTreeNode CreateDuplicateRole(UtilElementName _roleName, LabelId _label)
{