Part II : Rename the ABC objects to XYZ objects
To be written.
Code
|
Description
|
---|---|
// Description: This job will find and rename AOT objects from the innermost to outermost // Date: 25.05.2018 // // Parameter // 1) data range --> utilid.recordType == UtilElementType::Table // 2) date range --> utilId.name like 'aaaaaaTable*' // 3) From --> "ABC" // 4) To --> "XYZ" static void Job10(Args _args) { TreeNode treeParentNode; //= TreeNode::findNode(@'\Data Dictionary\Tables\aaaaaaTable'); int i=0; boolean IsParentNeededToSave; UtilIdElements utilId; void saveAndRelease(TreeNode _treeNode) { _treeNode.AOTsave(); _treeNode.treeNodeRelease(); _treeNode = null; } void findAndRenameProperties(str _prefix, TreeNode _treeNode) { str 255 treeNodeName;//TreeNodeName treeNodeName; str strProperties, strNewProperties, path; ; treeNodeName = _treeNode.treeNodeName(); path = _treeNode.treeNodePath(); //info(strfmt("%1%2", _prefix, treeNodeName)); strProperties = _treeNode.AOTgetProperties(); if (strScan(strProperties, "#ABC", 1, strLen(strProperties))) { strNewProperties = strReplace(strProperties, "#ABC", "#XYZ"); while (strScan(strNewProperties, "#ABC", 1, strLen(strNewProperties))) { strNewProperties = strReplace(strNewProperties, "#ABC", "#XYZ"); } _treeNode.AOTsetProperties(strNewProperties); saveAndRelease(_treeNode); IsParentNeededToSave = true; //info(strfmt("%1%2", _prefix, treeNodeName)); //info(strfmt("%1%2", _prefix, strProperties)); //info(strfmt("%1%2", _prefix, strNewProperties)); } } void processChildNode(TreeNode _treeNode) { TreeNode childNode; Str strPrefix = ""; int j; ; // Find first child childNode = _treeNode.AOTfirstChild(); while (childNode) { i++; strPrefix = ""; // Recursive processChildNode(childNode); // Find and rename properties for (j=1; j<=i; j++) strPrefix += "===="; findAndRenameProperties(strPrefix, childNode); i--; // Find next child childNode = childNode.AOTnextSibling(); } } ; // Process while select utilId where utilid.recordType == UtilElementType::Table && utilId.name like 'aaaaaaTable*' { treeParentNode = xUtilIdElements::getNode(utilId); if (treeParentNode) { // Init parent save flag IsParentNeededToSave = false; // Process children processChildNode(treeParentNode); // Find and rename properties findAndRenameProperties("", treeParentNode); // Check if save change is needed if (IsParentNeededToSave) saveAndRelease(treeParentNode); } } info("done"); } |
To be written
|