Skip to content

Commit

Permalink
Add support for AE Peoplecode in PPC Objects tab
Browse files Browse the repository at this point in the history
  • Loading branch information
tslater2006 committed Feb 21, 2020
1 parent c946ca7 commit b72a036
Showing 1 changed file with 107 additions and 46 deletions.
153 changes: 107 additions & 46 deletions Trace Wizard/UI/UIBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,13 @@ internal static void BuildPPCObjectList(TraceData traceData, TreeView ppcObjectT
{
ppcObjectTree.Nodes.Clear();
TreeNode AppClassRoot = ppcObjectTree.Nodes.Add("Application Classes");
TreeNode AppEngineRoot = ppcObjectTree.Nodes.Add("Application Engines");
TreeNode PageRoot = null;
TreeNode CompRecFieldRoot = null;
TreeNode CompRecRoot = null;
TreeNode RecFieldRoot = null;
TreeNode RecFuncRoot = null;
Dictionary<string, TreeNode> AENodeRoots = new Dictionary<string, TreeNode>();
Dictionary<string, TreeNode> ClassNodeRoots = new Dictionary<string, TreeNode>();
Dictionary<string, TreeNode> PageNodeRoots = new Dictionary<string, TreeNode>();
Dictionary<string, TreeNode> CompRecNodeRoots = new Dictionary<string, TreeNode>();
Expand All @@ -276,69 +278,128 @@ internal static void BuildPPCObjectList(TraceData traceData, TreeView ppcObjectT
/* App Class method "writeThemeAssignmentCookieForPortal PTBR_BRANDING.BrandingManager.OnExecute" */
if (x.Function.EndsWith(".OnExecute"))
{
var appClassMethodParts = x.Function.Split(' ');
var appClassPackage = appClassMethodParts[1];
var methodName = appClassMethodParts[0];
var packageParts = appClassPackage.Split('.');
/* app class */
var parentNode = AppClassRoot;
/* build out package nodes if needed */
/* have we already built out this whole thing? */
if (ClassNodeRoots.ContainsKey(x.Function) == false)
if (x.Function.Contains((' ')))
{
var appClassMethodParts = x.Function.Split(' ');
var appClassPackage = appClassMethodParts[1];
var methodName = appClassMethodParts[0];
var packageParts = appClassPackage.Split('.');
/* app class */
var parentNode = AppClassRoot;
/* build out package nodes if needed */
/* have we already built out this whole thing? */
if (ClassNodeRoots.ContainsKey(x.Function) == false)
{

for (var y = 0; y < packageParts.Length - 1; y++)
{
var searchString = String.Join(".", packageParts, 0, y + 1);
if (ClassNodeRoots.ContainsKey(searchString) == false)
{
var newNode = new TreeNode(packageParts[y]);
parentNode.Nodes.Add(newNode);
ClassNodeRoots.Add(searchString, newNode);
parentNode = newNode;
}
else
{
parentNode = ClassNodeRoots[searchString];
}
}

for (var y = 0; y < packageParts.Length - 1; y++)
/* we've built all of the packages, now lets add the actual method node */
var method = parentNode.Nodes.Add(methodName);
method.Tag = x;
ClassNodeRoots.Add(x.Function, method);
NodeCounts.Add(method, 1);
}
else
{
var searchString = String.Join(".", packageParts, 0, y + 1);
if (ClassNodeRoots.ContainsKey(searchString) == false)
NodeCounts[ClassNodeRoots[x.Function]] = NodeCounts[ClassNodeRoots[x.Function]] + 1;
}

/* get method node */
var methodNode = ClassNodeRoots[x.Function];

if (x.IsError)
{
methodNode.BackColor = Color.Red;
var methodParent = methodNode.Parent;
while (methodParent != null)
{
var newNode = new TreeNode(packageParts[y]);
parentNode.Nodes.Add(newNode);
ClassNodeRoots.Add(searchString, newNode);
parentNode = newNode;
methodParent.BackColor = Color.Yellow;
methodParent = methodParent.Parent;
}
else
}
else if (x.Duration >= Properties.Settings.Default.LongCall &&
methodNode.BackColor != Color.Yellow)
{
methodNode.BackColor = Color.LightGreen;
var methodParent = methodNode.Parent;
while (methodParent != null)
{
parentNode = ClassNodeRoots[searchString];
methodParent.BackColor = methodNode.BackColor;
methodParent = methodParent.Parent;
}
}

/* we've built all of the packages, now lets add the actual method node */
var method = parentNode.Nodes.Add(methodName);
method.Tag = x;
ClassNodeRoots.Add(x.Function, method);
NodeCounts.Add(method, 1);
}
else
else if (x.Function.Split('.').Length == 7)
{
NodeCounts[ClassNodeRoots[x.Function]] = NodeCounts[ClassNodeRoots[x.Function]] + 1;
}
/* App Engine code */
if (AENodeRoots.ContainsKey(x.Function.Replace(".OnExecute","")) == false)
{
var aeParts = x.Function.Split('.');

/* get method node */
var methodNode = ClassNodeRoots[x.Function];
var parentNode = AppEngineRoot;

if (x.IsError)
{
methodNode.BackColor = Color.Red;
var methodParent = methodNode.Parent;
while (methodParent != null)
{
methodParent.BackColor = Color.Yellow;
methodParent = methodParent.Parent;
for (var y = 0; y < aeParts.Length - 1; y++)
{
var searchString = String.Join(".", aeParts, 0, y + 1);
if (AENodeRoots.ContainsKey(searchString) == false)
{
var newNode = new TreeNode(aeParts[y]);
parentNode.Nodes.Add(newNode);
AENodeRoots.Add(searchString, newNode);
parentNode = newNode;
}
else
{
parentNode = AENodeRoots[searchString];
}
}
NodeCounts.Add(parentNode, 1);
}
}
else if (x.Duration >= Properties.Settings.Default.LongCall && methodNode.BackColor != Color.Yellow)
{
methodNode.BackColor = Color.LightGreen;
var methodParent = methodNode.Parent;
while (methodParent != null)
else
{
methodParent.BackColor = methodNode.BackColor;
methodParent = methodParent.Parent;
/* entry already exists, just increment */
NodeCounts[AENodeRoots[x.Function.Replace(".OnExecute","")]] = NodeCounts[AENodeRoots[x.Function.Replace(".OnExecute","")]]++;

}
}

var stepNode = AENodeRoots[x.Function.Replace(".OnExecute", "")];
if (x.IsError)
{
stepNode.BackColor = Color.Red;
var methodParent = stepNode.Parent;
while (methodParent != null)
{
methodParent.BackColor = Color.Yellow;
methodParent = methodParent.Parent;
}
}
else if (x.Duration >= Properties.Settings.Default.LongCall &&
stepNode.BackColor != Color.Yellow)
{
stepNode.BackColor = Color.LightGreen;
var methodParent = stepNode.Parent;
while (methodParent != null)
{
methodParent.BackColor = stepNode.BackColor;
methodParent = methodParent.Parent;
}
}

}
}
else if (x.Function.EndsWith("Activate"))
{
Expand Down

0 comments on commit b72a036

Please sign in to comment.