Traverse the Menu Node in AOT and find AIF menuItems and write to a file.
static void krishh_verifyAifInMenu(Args _args)
{
// Dialog
dialog dialog = new dialog('verifyAifInMenu');
dialogField dlgFileName, dlgAction;
FileName fileName;
int action;
container saved;
// File
#File
TextIo ioData;
FileIOPermission permission;
Treenode treenode = TreeNode::findNode(@'\Menus\KrishhTest\Periodic');
//Treenode treenode = TreeNode::findNode(@'\Menus\KrishhTest\Periodic');
//Treenode treenode = TreeNode::findNode(@'\Menus\KrishhTest\Periodic');
//Treenode treenode = TreeNode::findNode(@'\Menus\KrishhTest\Periodic');
TreeNodeTraverser traverser = new TreeNodeTraverser(treenode);
TreeNode node, menuTypeNode;
UtilElements ue;
MenuItem mi;
DictClass dc;
className cn, scn;
Counter i,j;
SysDictMethod sdm;
Source s;
Str1260 sLable, sClass, sMenuItem, sClassMethodName, sMethod, sAIFPort, sDirection, sEnabled, sActionAddedToPort, sFolderName;
System.Text.RegularExpressions.Match regExMatch;
boolean isValid;
Int position, posStart, posEnd;
DictTable dt;
RecId recId;
boolean aifFound;
AifPort aifPort;
AifChannel aifChannel;
AifPortActionPolicy aifPortActionPolicy;
AifActionId aifActionId;
#Properties
#AOT
#AIF
#localmacro.PortInfo
any2str(%1)
+ ","
+ any2str(%2)
+ ","
+ any2str(%3)
+ ","
+ any2str(%4)
+ ","
+ any2str(%5)
+ ","
+ any2str(%6)
, "Goto method", SysInfoAction_Editor::newOpen(%7)
#EndMacro
saved = xSysLastValue::getValue(curExt(),curUserId(),UtilElementType::Class,'verifyAifInMenu','fileName');
if (saved)
{
fileName = conpeek(saved,1);
}
dlgFileName = dialog.addFieldValue(extendedTypeStr(FilenameOpen),fileName,'Filename','File to save result.');
//dlgAction = dialog.addFieldValue(extendedTypeStr(NumberOf),0,'Action','1=Save, 2=Undeploy, 3=Deploy');
if (dialog.run())
{
fileName = dlgFileName.value();
saved = [fileName];
xSysLastValue::putValue(saved,curExt(),curUserId(),UtilElementType::Class,'verifyAifInMenu','fileName');
permission = new FileIOPermission(fileName, #io_write);
permission.assert();
// Open file for writing
ioData = new TextIo(filename, #io_write);
// Check file open status
if (!ioData)
{
// File '%1' could not be opened.
throw error(strfmt("@SYS19312", filename));
}
// Set file delimiters
ioData.outRecordDelimiter('\r\n');
ioData.outFieldDelimiter(';');
ioData.write(
[
"Menu label"
, "Menu item"
, "Class"
, "AIF Port"
, "Direction"
, "Enabled"
, "Methode"
, "ActionAddedToPort"
, "Folder name"
]);
setPrefix("Services");
while (traverser.next())
{
node = traverser.currentNode();
if (node.AOTgetProperty('MenuItemName')!= '')
{
menuTypeNode = TreeNode::findNode(#MenuItemsPath +"\\Action\\" + findProperty(node.AOTgetProperties(),#PropertyMenuItemName));
mi = traverser.currentNode();
// Is menuitem object a class
if (findProperty(menuTypeNode.AOTgetProperties(),#PropertyObjectType) == enum2Value(MenuItemObjectType::Class))
{
// Find Class
if (findProperty(menuTypeNode.AOTgetProperties(),#PropertyObject) == 'SysOperationServiceController')
{
dc = new DictClass(className2Id(subStr(findProperty(menuTypeNode.AOTgetProperties(),#PropertyParameters), 1, strScan(findProperty(menuTypeNode.AOTgetProperties(),#PropertyParameters), '.', 1, 1000)-1)));
}
else
{
dc = new DictClass(className2Id(findProperty(menuTypeNode.AOTgetProperties(),#PropertyObject)));
}
sLable = mi.label();
sMenuItem = #MenuItemsPath +"\\Action\\" + findProperty(node.AOTgetProperties(),#PropertyMenuItemName);//node.treeNodePath();
sClass = dc.name();
setPrefix(strFmt("%1, %2, %3, %4", node.treeNodePath(), sLable, sMenuItem, sClass));
aifFound = false;
// Find the methode in the class where AxdDocumentParameters is used
for (i=1;i<=dc.objectMethodCnt()+dc.staticMethodCnt();i++)
{
// Instance method else Static method
if (i<=dc.objectMethodCnt())
{
sdm = new SysDictMethod(UtilElementType::ClassInstanceMethod, dc.id(), dc.objectMethod(i));
}
else
{
sdm = new SysDictMethod(UtilElementType::ClassStaticMethod, dc.id(), dc.staticMethod(i-dc.objectMethodCnt()));
}
sMethod = sdm.path();
s = sdm.getSource();
// Find port from AxdDocumentParameters
regExMatch = System.Text.RegularExpressions.Regex::Match(s, @'(?i)AxdDocumentParameters::find\(\).krishh.{1,22}Port');
isValid = regExMatch.get_Success();
regExMatch = System.Text.RegularExpressions.Regex::Match(s, @'(?i)AifSendService::submitFrom');
isValid = isValid && regExMatch.get_Success();
setPrefix("Port");
if (isValid)
{
dt = new DictTable(tableNum(AxdDocumentParameters));
// Get AIFPort from AxdDocumentParameters used in code
for (j=1;j<=dt.fieldCnt();j++)
{
if (strScan(dt.fieldName(dt.fieldCnt2Id(j)), 'krishh', 1, 100) && strScan(dt.fieldName(dt.fieldCnt2Id(j)), 'Port', 1, 100))
{
regExMatch = System.Text.RegularExpressions.Regex::Match(s, strFmt(@'(?i)%1', dt.fieldName(dt.fieldCnt2Id(j))));
isValid = regExMatch.get_Success();
if (isValid)
{
recId = AxdDocumentParameters::find().(dt.fieldCnt2Id(j));
// Find Port
if (recId)
{
select firstOnly aifPort
where aifPort.RecId == recId
join aifChannel
where aifChannel.ChannelId == aifPort.ChannelId;
sDirection = enum2Value(aifChannel.Direction);
sEnabled = enum2Value(aifChannel.Enabled);
sFolderName = aifChannel.TransportAddress;
aifFound = true;
}
if (aifFound)
{
// Find action
sActionAddedToPort = "";
regExMatch = System.Text.RegularExpressions.Regex::Match(s, strFmt(@'(?i)AifSendActionType::'));
isValid = regExMatch.get_Success();
if (isValid)
{
// Calculate position of the portaction
position = regExMatch.get_Index();
posStart = position+1+strLen('AifSendActionType::');
posEnd = strScan(s, ')', position, strLen(s));
// Convet actiontype to actionId-searchstring
switch (subStr(s, posStart, posEnd-posStart))
{
case "SendByQuery":
aifActionId = "*.find";
break;
case "SendByKey":
aifActionId = "*.read";
break;
}
// Find portaction
while select AifPortActionPolicy
where AifPortActionPolicy.ActionId like aifActionId
&& AifPortActionPolicy.Port == recId
{
// Get the serviceclassname
scn = subStr(AifPortActionPolicy.ActionId, 1, strLen(AifPortActionPolicy.ActionId) - (strLen(aifActionId)-1));
regExMatch = System.Text.RegularExpressions.Regex::Match(s, strFmt(@'(?i)classnum\(%1', scn));
isValid = regExMatch.get_Success();
if (isValid)
{
// Create a portaction exm. serviceclassname.action
sActionAddedToPort = scn+subStr(aifActionId, 2, strLen(aifActionId));
break;
}
}
}
}
// Output Port info
if (sEnabled && sActionAddedToPort)
{
info(#PortInfo(aifPort.Name, sDirection, sEnabled, sMethod, sActionAddedToPort, sFolderName, sdm.path()));
}
else
{
error(#PortInfo(aifPort.Name, sDirection, sEnabled, sMethod, sActionAddedToPort, sFolderName, sdm.path()));
}
ioData.write(
[
sLable
, sMenuItem
, sClass
, aifPort.Name
, sDirection
, sEnabled
, sMethod
, sActionAddedToPort, sFolderName
]);
}
}
}
}
// Find port from AifOutboundPort::find
recId = 0;
regExMatch = System.Text.RegularExpressions.Regex::Match(s, @'(?i)AifSendService::submitFrom');
isValid = regExMatch.get_Success();
regExMatch = System.Text.RegularExpressions.Regex::Match(s, @'(?i)AifOutboundPort::find\(');
isValid = isValid && regExMatch.get_Success();
if (isValid)
{
// Calculate position of the portClass
position = regExMatch.get_Index();
posStart = position+2+strLen('AifOutboundPort::find\(');
posEnd = strScan(s, ');', position, strLen(s))-1;
// Convet actiontype to actionId-searchstring
scn = subStr(s, posStart, posEnd-posStart);
// Find Port
if (scn)
{
select firstOnly aifPort
where aifPort.Name == scn
join aifChannel
where aifChannel.ChannelId == aifPort.ChannelId;
sDirection = enum2Value(aifChannel.Direction);
sEnabled = enum2Value(aifChannel.Enabled);
sFolderName = aifChannel.TransportAddress;
recId = aifPort.RecId;
aifFound = true;
}
if (recId)
{
// Find action
sActionAddedToPort = "";
regExMatch = System.Text.RegularExpressions.Regex::Match(s, strFmt(@'(?i)AifSendActionType::'));
isValid = regExMatch.get_Success();
if (isValid)
{
// Calculate position of the portaction
position = regExMatch.get_Index();
posStart = position+1+strLen('AifSendActionType::');
posEnd = strScan(s, ')', position, strLen(s));
// Convet actiontype to actionId-searchstring
switch (subStr(s, posStart, posEnd-posStart))
{
case "SendByQuery":
aifActionId = "*.find";
break;
case "SendByKey":
aifActionId = "*.read";
break;
}
// Find portaction
while select AifPortActionPolicy
where AifPortActionPolicy.ActionId like aifActionId
&& AifPortActionPolicy.Port == recId
{
// Get the serviceclassname
scn = subStr(AifPortActionPolicy.ActionId, 1, strLen(AifPortActionPolicy.ActionId) - (strLen(aifActionId)-1));
regExMatch = System.Text.RegularExpressions.Regex::Match(s, strFmt(@'(?i)classnum\(%1', scn));
isValid = regExMatch.get_Success();
if (isValid)
{
// Create a portaction exm. serviceclassname.action
sActionAddedToPort = scn+subStr(aifActionId, 2, strLen(aifActionId));
break;
}
}
}
}
// Output Port info
if (sEnabled && sActionAddedToPort)
{
info(#PortInfo(aifPort.Name, sDirection, sEnabled, sMethod, sActionAddedToPort, sFolderName, sdm.path()));
}
else
{
error(#PortInfo(aifPort.Name, sDirection, sEnabled, sMethod, sActionAddedToPort, sFolderName, sdm.path()));
}
ioData.write(
[
sLable
, sMenuItem
, sClass
, aifPort.Name
, sDirection
, sEnabled
, sMethod
, sActionAddedToPort, sFolderName
]);
}
// Find port from AifSendService::submitDefault
recId = 0;
sDirection = '';
sEnabled = '';
sFolderName = '';
sActionAddedToPort = '';
regExMatch = System.Text.RegularExpressions.Regex::Match(s, @'(?i)AifSendService::submitDefault\(');
isValid = regExMatch.get_Success();
regExMatch = System.Text.RegularExpressions.Regex::Match(s, @'(?i)classnum\(');
isValid = isValid && regExMatch.get_Success();
if (isValid)
{
// Calculate position of the portClass
position = regExMatch.get_Index();
posStart = position+1+strLen('classnum\(');
posEnd = strScan(s, '),', position, strLen(s));
// Convet actiontype to actionId-searchstring
scn = subStr(s, posStart, posEnd-posStart);
// Find Port
if (scn)
{
select firstOnly AifPortActionPolicy
where AifPortActionPolicy.ActionId == scn + #MethodNameSeparator + #DefaultSendByKeyAction
join aifPort
where aifPort.RecId == AifPortActionPolicy.Port
join aifChannel
where aifChannel.ChannelId == aifPort.ChannelId;
sDirection = enum2Value(aifChannel.Direction);
sEnabled = enum2Value(aifChannel.Enabled);
sFolderName = aifChannel.TransportAddress;
recId = AifPortActionPolicy.Port;
aifFound = true;
}
if (recId)
{
aifActionId = "*.read";
// Find portaction
while select AifPortActionPolicy
where AifPortActionPolicy.ActionId like aifActionId
&& AifPortActionPolicy.Port == recId
{
// Get the serviceclassname
scn = subStr(AifPortActionPolicy.ActionId, 1, strLen(AifPortActionPolicy.ActionId) - (strLen(aifActionId)-1));
regExMatch = System.Text.RegularExpressions.Regex::Match(s, strFmt(@'(?i)classnum\(%1', scn));
isValid = regExMatch.get_Success();
if (isValid)
{
// Create a portaction exm. serviceclassname.action
sActionAddedToPort = scn+subStr(aifActionId, 2, strLen(aifActionId));
break;
}
}
}
// Output Port info
if (sEnabled && sActionAddedToPort)
{
info(#PortInfo(aifPort.Name, sDirection, sEnabled, sMethod, sActionAddedToPort, sFolderName, sdm.path()));
}
else
{
error(#PortInfo(aifPort.Name, sDirection, sEnabled, sMethod, sActionAddedToPort, sFolderName, sdm.path()));
}
ioData.write(
[
sLable
, sMenuItem
, sClass
, aifPort.Name
, sDirection
, sEnabled
, sMethod
, sActionAddedToPort, sFolderName
]);
}
}
if (!aifFound)
{
info(strFmt('%1, %2, %3, %4, %5, %6, %7, %8'
, sLable
, sMenuItem
, sClass
, "Not AIF"
, "No"
, "No"
, "No"
, "No"));
ioData.write(
[
sLable
, sMenuItem
, sClass
, "Not AIF"
, "No"
, "No"
, "No"
, "No"
]);
}
}
}
}
CodeAccessPermission::revertAssert();
}
}
static void krishh_verifyAifInMenu(Args _args)
{
// Dialog
dialog dialog = new dialog('verifyAifInMenu');
dialogField dlgFileName, dlgAction;
FileName fileName;
int action;
container saved;
// File
#File
TextIo ioData;
FileIOPermission permission;
Treenode treenode = TreeNode::findNode(@'\Menus\KrishhTest\Periodic');
//Treenode treenode = TreeNode::findNode(@'\Menus\KrishhTest\Periodic');
//Treenode treenode = TreeNode::findNode(@'\Menus\KrishhTest\Periodic');
//Treenode treenode = TreeNode::findNode(@'\Menus\KrishhTest\Periodic');
TreeNodeTraverser traverser = new TreeNodeTraverser(treenode);
TreeNode node, menuTypeNode;
UtilElements ue;
MenuItem mi;
DictClass dc;
className cn, scn;
Counter i,j;
SysDictMethod sdm;
Source s;
Str1260 sLable, sClass, sMenuItem, sClassMethodName, sMethod, sAIFPort, sDirection, sEnabled, sActionAddedToPort, sFolderName;
System.Text.RegularExpressions.Match regExMatch;
boolean isValid;
Int position, posStart, posEnd;
DictTable dt;
RecId recId;
boolean aifFound;
AifPort aifPort;
AifChannel aifChannel;
AifPortActionPolicy aifPortActionPolicy;
AifActionId aifActionId;
#Properties
#AOT
#AIF
#localmacro.PortInfo
any2str(%1)
+ ","
+ any2str(%2)
+ ","
+ any2str(%3)
+ ","
+ any2str(%4)
+ ","
+ any2str(%5)
+ ","
+ any2str(%6)
, "Goto method", SysInfoAction_Editor::newOpen(%7)
#EndMacro
saved = xSysLastValue::getValue(curExt(),curUserId(),UtilElementType::Class,'verifyAifInMenu','fileName');
if (saved)
{
fileName = conpeek(saved,1);
}
dlgFileName = dialog.addFieldValue(extendedTypeStr(FilenameOpen),fileName,'Filename','File to save result.');
//dlgAction = dialog.addFieldValue(extendedTypeStr(NumberOf),0,'Action','1=Save, 2=Undeploy, 3=Deploy');
if (dialog.run())
{
fileName = dlgFileName.value();
saved = [fileName];
xSysLastValue::putValue(saved,curExt(),curUserId(),UtilElementType::Class,'verifyAifInMenu','fileName');
permission = new FileIOPermission(fileName, #io_write);
permission.assert();
// Open file for writing
ioData = new TextIo(filename, #io_write);
// Check file open status
if (!ioData)
{
// File '%1' could not be opened.
throw error(strfmt("@SYS19312", filename));
}
// Set file delimiters
ioData.outRecordDelimiter('\r\n');
ioData.outFieldDelimiter(';');
ioData.write(
[
"Menu label"
, "Menu item"
, "Class"
, "AIF Port"
, "Direction"
, "Enabled"
, "Methode"
, "ActionAddedToPort"
, "Folder name"
]);
setPrefix("Services");
while (traverser.next())
{
node = traverser.currentNode();
if (node.AOTgetProperty('MenuItemName')!= '')
{
menuTypeNode = TreeNode::findNode(#MenuItemsPath +"\\Action\\" + findProperty(node.AOTgetProperties(),#PropertyMenuItemName));
mi = traverser.currentNode();
// Is menuitem object a class
if (findProperty(menuTypeNode.AOTgetProperties(),#PropertyObjectType) == enum2Value(MenuItemObjectType::Class))
{
// Find Class
if (findProperty(menuTypeNode.AOTgetProperties(),#PropertyObject) == 'SysOperationServiceController')
{
dc = new DictClass(className2Id(subStr(findProperty(menuTypeNode.AOTgetProperties(),#PropertyParameters), 1, strScan(findProperty(menuTypeNode.AOTgetProperties(),#PropertyParameters), '.', 1, 1000)-1)));
}
else
{
dc = new DictClass(className2Id(findProperty(menuTypeNode.AOTgetProperties(),#PropertyObject)));
}
sLable = mi.label();
sMenuItem = #MenuItemsPath +"\\Action\\" + findProperty(node.AOTgetProperties(),#PropertyMenuItemName);//node.treeNodePath();
sClass = dc.name();
setPrefix(strFmt("%1, %2, %3, %4", node.treeNodePath(), sLable, sMenuItem, sClass));
aifFound = false;
// Find the methode in the class where AxdDocumentParameters is used
for (i=1;i<=dc.objectMethodCnt()+dc.staticMethodCnt();i++)
{
// Instance method else Static method
if (i<=dc.objectMethodCnt())
{
sdm = new SysDictMethod(UtilElementType::ClassInstanceMethod, dc.id(), dc.objectMethod(i));
}
else
{
sdm = new SysDictMethod(UtilElementType::ClassStaticMethod, dc.id(), dc.staticMethod(i-dc.objectMethodCnt()));
}
sMethod = sdm.path();
s = sdm.getSource();
// Find port from AxdDocumentParameters
regExMatch = System.Text.RegularExpressions.Regex::Match(s, @'(?i)AxdDocumentParameters::find\(\).krishh.{1,22}Port');
isValid = regExMatch.get_Success();
regExMatch = System.Text.RegularExpressions.Regex::Match(s, @'(?i)AifSendService::submitFrom');
isValid = isValid && regExMatch.get_Success();
setPrefix("Port");
if (isValid)
{
dt = new DictTable(tableNum(AxdDocumentParameters));
// Get AIFPort from AxdDocumentParameters used in code
for (j=1;j<=dt.fieldCnt();j++)
{
if (strScan(dt.fieldName(dt.fieldCnt2Id(j)), 'krishh', 1, 100) && strScan(dt.fieldName(dt.fieldCnt2Id(j)), 'Port', 1, 100))
{
regExMatch = System.Text.RegularExpressions.Regex::Match(s, strFmt(@'(?i)%1', dt.fieldName(dt.fieldCnt2Id(j))));
isValid = regExMatch.get_Success();
if (isValid)
{
recId = AxdDocumentParameters::find().(dt.fieldCnt2Id(j));
// Find Port
if (recId)
{
select firstOnly aifPort
where aifPort.RecId == recId
join aifChannel
where aifChannel.ChannelId == aifPort.ChannelId;
sDirection = enum2Value(aifChannel.Direction);
sEnabled = enum2Value(aifChannel.Enabled);
sFolderName = aifChannel.TransportAddress;
aifFound = true;
}
if (aifFound)
{
// Find action
sActionAddedToPort = "";
regExMatch = System.Text.RegularExpressions.Regex::Match(s, strFmt(@'(?i)AifSendActionType::'));
isValid = regExMatch.get_Success();
if (isValid)
{
// Calculate position of the portaction
position = regExMatch.get_Index();
posStart = position+1+strLen('AifSendActionType::');
posEnd = strScan(s, ')', position, strLen(s));
// Convet actiontype to actionId-searchstring
switch (subStr(s, posStart, posEnd-posStart))
{
case "SendByQuery":
aifActionId = "*.find";
break;
case "SendByKey":
aifActionId = "*.read";
break;
}
// Find portaction
while select AifPortActionPolicy
where AifPortActionPolicy.ActionId like aifActionId
&& AifPortActionPolicy.Port == recId
{
// Get the serviceclassname
scn = subStr(AifPortActionPolicy.ActionId, 1, strLen(AifPortActionPolicy.ActionId) - (strLen(aifActionId)-1));
regExMatch = System.Text.RegularExpressions.Regex::Match(s, strFmt(@'(?i)classnum\(%1', scn));
isValid = regExMatch.get_Success();
if (isValid)
{
// Create a portaction exm. serviceclassname.action
sActionAddedToPort = scn+subStr(aifActionId, 2, strLen(aifActionId));
break;
}
}
}
}
// Output Port info
if (sEnabled && sActionAddedToPort)
{
info(#PortInfo(aifPort.Name, sDirection, sEnabled, sMethod, sActionAddedToPort, sFolderName, sdm.path()));
}
else
{
error(#PortInfo(aifPort.Name, sDirection, sEnabled, sMethod, sActionAddedToPort, sFolderName, sdm.path()));
}
ioData.write(
[
sLable
, sMenuItem
, sClass
, aifPort.Name
, sDirection
, sEnabled
, sMethod
, sActionAddedToPort, sFolderName
]);
}
}
}
}
// Find port from AifOutboundPort::find
recId = 0;
regExMatch = System.Text.RegularExpressions.Regex::Match(s, @'(?i)AifSendService::submitFrom');
isValid = regExMatch.get_Success();
regExMatch = System.Text.RegularExpressions.Regex::Match(s, @'(?i)AifOutboundPort::find\(');
isValid = isValid && regExMatch.get_Success();
if (isValid)
{
// Calculate position of the portClass
position = regExMatch.get_Index();
posStart = position+2+strLen('AifOutboundPort::find\(');
posEnd = strScan(s, ');', position, strLen(s))-1;
// Convet actiontype to actionId-searchstring
scn = subStr(s, posStart, posEnd-posStart);
// Find Port
if (scn)
{
select firstOnly aifPort
where aifPort.Name == scn
join aifChannel
where aifChannel.ChannelId == aifPort.ChannelId;
sDirection = enum2Value(aifChannel.Direction);
sEnabled = enum2Value(aifChannel.Enabled);
sFolderName = aifChannel.TransportAddress;
recId = aifPort.RecId;
aifFound = true;
}
if (recId)
{
// Find action
sActionAddedToPort = "";
regExMatch = System.Text.RegularExpressions.Regex::Match(s, strFmt(@'(?i)AifSendActionType::'));
isValid = regExMatch.get_Success();
if (isValid)
{
// Calculate position of the portaction
position = regExMatch.get_Index();
posStart = position+1+strLen('AifSendActionType::');
posEnd = strScan(s, ')', position, strLen(s));
// Convet actiontype to actionId-searchstring
switch (subStr(s, posStart, posEnd-posStart))
{
case "SendByQuery":
aifActionId = "*.find";
break;
case "SendByKey":
aifActionId = "*.read";
break;
}
// Find portaction
while select AifPortActionPolicy
where AifPortActionPolicy.ActionId like aifActionId
&& AifPortActionPolicy.Port == recId
{
// Get the serviceclassname
scn = subStr(AifPortActionPolicy.ActionId, 1, strLen(AifPortActionPolicy.ActionId) - (strLen(aifActionId)-1));
regExMatch = System.Text.RegularExpressions.Regex::Match(s, strFmt(@'(?i)classnum\(%1', scn));
isValid = regExMatch.get_Success();
if (isValid)
{
// Create a portaction exm. serviceclassname.action
sActionAddedToPort = scn+subStr(aifActionId, 2, strLen(aifActionId));
break;
}
}
}
}
// Output Port info
if (sEnabled && sActionAddedToPort)
{
info(#PortInfo(aifPort.Name, sDirection, sEnabled, sMethod, sActionAddedToPort, sFolderName, sdm.path()));
}
else
{
error(#PortInfo(aifPort.Name, sDirection, sEnabled, sMethod, sActionAddedToPort, sFolderName, sdm.path()));
}
ioData.write(
[
sLable
, sMenuItem
, sClass
, aifPort.Name
, sDirection
, sEnabled
, sMethod
, sActionAddedToPort, sFolderName
]);
}
// Find port from AifSendService::submitDefault
recId = 0;
sDirection = '';
sEnabled = '';
sFolderName = '';
sActionAddedToPort = '';
regExMatch = System.Text.RegularExpressions.Regex::Match(s, @'(?i)AifSendService::submitDefault\(');
isValid = regExMatch.get_Success();
regExMatch = System.Text.RegularExpressions.Regex::Match(s, @'(?i)classnum\(');
isValid = isValid && regExMatch.get_Success();
if (isValid)
{
// Calculate position of the portClass
position = regExMatch.get_Index();
posStart = position+1+strLen('classnum\(');
posEnd = strScan(s, '),', position, strLen(s));
// Convet actiontype to actionId-searchstring
scn = subStr(s, posStart, posEnd-posStart);
// Find Port
if (scn)
{
select firstOnly AifPortActionPolicy
where AifPortActionPolicy.ActionId == scn + #MethodNameSeparator + #DefaultSendByKeyAction
join aifPort
where aifPort.RecId == AifPortActionPolicy.Port
join aifChannel
where aifChannel.ChannelId == aifPort.ChannelId;
sDirection = enum2Value(aifChannel.Direction);
sEnabled = enum2Value(aifChannel.Enabled);
sFolderName = aifChannel.TransportAddress;
recId = AifPortActionPolicy.Port;
aifFound = true;
}
if (recId)
{
aifActionId = "*.read";
// Find portaction
while select AifPortActionPolicy
where AifPortActionPolicy.ActionId like aifActionId
&& AifPortActionPolicy.Port == recId
{
// Get the serviceclassname
scn = subStr(AifPortActionPolicy.ActionId, 1, strLen(AifPortActionPolicy.ActionId) - (strLen(aifActionId)-1));
regExMatch = System.Text.RegularExpressions.Regex::Match(s, strFmt(@'(?i)classnum\(%1', scn));
isValid = regExMatch.get_Success();
if (isValid)
{
// Create a portaction exm. serviceclassname.action
sActionAddedToPort = scn+subStr(aifActionId, 2, strLen(aifActionId));
break;
}
}
}
// Output Port info
if (sEnabled && sActionAddedToPort)
{
info(#PortInfo(aifPort.Name, sDirection, sEnabled, sMethod, sActionAddedToPort, sFolderName, sdm.path()));
}
else
{
error(#PortInfo(aifPort.Name, sDirection, sEnabled, sMethod, sActionAddedToPort, sFolderName, sdm.path()));
}
ioData.write(
[
sLable
, sMenuItem
, sClass
, aifPort.Name
, sDirection
, sEnabled
, sMethod
, sActionAddedToPort, sFolderName
]);
}
}
if (!aifFound)
{
info(strFmt('%1, %2, %3, %4, %5, %6, %7, %8'
, sLable
, sMenuItem
, sClass
, "Not AIF"
, "No"
, "No"
, "No"
, "No"));
ioData.write(
[
sLable
, sMenuItem
, sClass
, "Not AIF"
, "No"
, "No"
, "No"
, "No"
]);
}
}
}
}
CodeAccessPermission::revertAssert();
}
}
No comments:
Post a Comment
Thanks for visiting my blog,
I will reply for your comment within 48 hours.
Thanks,
krishna.