Tuesday, August 14, 2007

AOT Find function

"The Find function in the AOT will only retrieve the outer most layer objects. For example if an object has a GLS and VAR layer, Find retrieves the VAR layer. Add an option to the find to retrieve all objects in the specified layer regardless whether another layer is involved. Refer to incident 8945146 if need be."

MS Community Article

I have quickly run some testing and found out the "bug" (maybe it considered as bug). ^^

The SysAOTFind form will only used the outer most layer tree node, so we got to modify and add conditional logic to retrieve code in other layer. Look at the searchNode method, and modify the code accordingly.

Original code:
if (!sysTreeNodeSearch.isNodeInRange(_treeNode))
return;

Modified code:
TreeNode otherLayerTreeNode;
str strlayer;
boolean mustCheckLayer;
UtilEntryLevel uel;


//make sure only compare layer if specified

strLayer = enum2str(applObjectCache.utilLevel);
if (strscan(applObjectLayerRange.text(), strLayer, 0, strlen(applObjectLayerRange.text())))
mustCheckLayer = true;
else
mustCheckLayer = false;

//We change the layer here, in order pass another layer code for validation
uel = applObjectCache.utilLevel;
if (uel != _treeNode.applObjectLayer())
{
otherLayerTreeNode = _treeNode.getNodeInLayer(uel);

if (!sysTreeNodeSearch.isNodeInRange(otherLayerTreeNode))
return;
}
else
{
if (!sysTreeNodeSearch.isNodeInRange(_treeNode))
return;
}

Last thing is to show the source code we have to modify to pass in layer code.

Original code:
if (showSource.value() == true)
{
this.addSourceLines(_treeNode);
}

Modified code:
if (showSource.value() == true)
{
if ((uel != _treeNode.applObjectLayer()) && (mustCheckLayer))
{
this.addSourceLines(otherLayerTreeNode);
}
else
{
this.addSourceLines(_treeNode);
}
}

Note:
  1. The above modification just only able to found the source nodes. When you double click and open the editor, it still show the layer code as you login (e.g: find var layer source but login in usr layer).