Skip to content

Commit

Permalink
added in ability to access all process variables through FullKeys whi…
Browse files Browse the repository at this point in the history
…ch goes beyond the variable container and moves up into the process definition to list runtime constants, definition constants and definition files.
  • Loading branch information
roger-castaldo committed Feb 12, 2018
1 parent f31f645 commit 5f16afa
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
48 changes: 48 additions & 0 deletions BusinessProcess.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,54 @@ public object this[string name]
}
}

internal string[] Keys
{
get
{
List<string> ret = new List<string>();
if (_constants != null)
{
foreach (sProcessRuntimeConstant sprc in _constants)
{
if (!ret.Contains(sprc.Name))
ret.Add(sprc.Name);
}
}
if (_Elements != null)
{
foreach (IElement elem in _Elements)
{
if (elem is Definition)
{
Definition def = (Definition)elem;
if (def.ExtensionElement != null)
{
foreach (IElement e in ((ExtensionElements)def.ExtensionElement).Children)
{
if (e is DefinitionVariable)
{
DefinitionVariable dv = (DefinitionVariable)e;
if (!ret.Contains(dv.Name))
ret.Add(dv.Name);
}
else if (e is DefinitionFile)
{
DefinitionFile df = (DefinitionFile)e;
if (!ret.Contains(string.Format("{0}.{1}", df.Name, df.Extension)))
ret.Add(string.Format("{0}.{1}", df.Name, df.Extension));
if (!ret.Contains(df.Name))
ret.Add(df.Name);
}
}
}
break;
}
}
}
return ret.ToArray();
}
}

[ThreadStatic()]
private static BusinessProcess _current;
public static BusinessProcess Current { get { return _current; } }
Expand Down
24 changes: 24 additions & 0 deletions ProcessVariablesContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,29 @@ public string[] Keys
return ret.ToArray();
}
}

public string[] FullKeys
{
get
{
List<string> ret = new List<string>(Keys);
if (_process!=null)
{
foreach (string key in _process.Keys)
{
if (!ret.Contains(key))
ret.Add(key);
}
}else if (BusinessProcess.Current != null)
{
foreach (string key in BusinessProcess.Current.Keys)
{
if (!ret.Contains(key))
ret.Add(key);
}
}
return ret.ToArray();
}
}
}
}
2 changes: 2 additions & 0 deletions ReadOnlyProcessVariablesContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ internal ReadOnlyProcessVariablesContainer(ProcessVariablesContainer variables)

public string[] Keys { get { return _variables.Keys; } }

public string[] FullKeys { get { return _variables.FullKeys; } }

public Exception Error { get { return _error; } }
}
}

0 comments on commit 5f16afa

Please sign in to comment.