Skip to content

Commit 5f16afa

Browse files
added in ability to access all process variables through FullKeys which goes beyond the variable container and moves up into the process definition to list runtime constants, definition constants and definition files.
1 parent f31f645 commit 5f16afa

File tree

3 files changed

+74
-0
lines changed

3 files changed

+74
-0
lines changed

BusinessProcess.cs

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,54 @@ public object this[string name]
119119
}
120120
}
121121

122+
internal string[] Keys
123+
{
124+
get
125+
{
126+
List<string> ret = new List<string>();
127+
if (_constants != null)
128+
{
129+
foreach (sProcessRuntimeConstant sprc in _constants)
130+
{
131+
if (!ret.Contains(sprc.Name))
132+
ret.Add(sprc.Name);
133+
}
134+
}
135+
if (_Elements != null)
136+
{
137+
foreach (IElement elem in _Elements)
138+
{
139+
if (elem is Definition)
140+
{
141+
Definition def = (Definition)elem;
142+
if (def.ExtensionElement != null)
143+
{
144+
foreach (IElement e in ((ExtensionElements)def.ExtensionElement).Children)
145+
{
146+
if (e is DefinitionVariable)
147+
{
148+
DefinitionVariable dv = (DefinitionVariable)e;
149+
if (!ret.Contains(dv.Name))
150+
ret.Add(dv.Name);
151+
}
152+
else if (e is DefinitionFile)
153+
{
154+
DefinitionFile df = (DefinitionFile)e;
155+
if (!ret.Contains(string.Format("{0}.{1}", df.Name, df.Extension)))
156+
ret.Add(string.Format("{0}.{1}", df.Name, df.Extension));
157+
if (!ret.Contains(df.Name))
158+
ret.Add(df.Name);
159+
}
160+
}
161+
}
162+
break;
163+
}
164+
}
165+
}
166+
return ret.ToArray();
167+
}
168+
}
169+
122170
[ThreadStatic()]
123171
private static BusinessProcess _current;
124172
public static BusinessProcess Current { get { return _current; } }

ProcessVariablesContainer.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,29 @@ public string[] Keys
8787
return ret.ToArray();
8888
}
8989
}
90+
91+
public string[] FullKeys
92+
{
93+
get
94+
{
95+
List<string> ret = new List<string>(Keys);
96+
if (_process!=null)
97+
{
98+
foreach (string key in _process.Keys)
99+
{
100+
if (!ret.Contains(key))
101+
ret.Add(key);
102+
}
103+
}else if (BusinessProcess.Current != null)
104+
{
105+
foreach (string key in BusinessProcess.Current.Keys)
106+
{
107+
if (!ret.Contains(key))
108+
ret.Add(key);
109+
}
110+
}
111+
return ret.ToArray();
112+
}
113+
}
90114
}
91115
}

ReadOnlyProcessVariablesContainer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ internal ReadOnlyProcessVariablesContainer(ProcessVariablesContainer variables)
2727

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

30+
public string[] FullKeys { get { return _variables.FullKeys; } }
31+
3032
public Exception Error { get { return _error; } }
3133
}
3234
}

0 commit comments

Comments
 (0)