Код:
public void GetCustomActivities()
{
var processList = PublicAPI.Processes.ProcessHeader.Find("NOT (Published is NULL) AND [Parent] is NULL");
Console.WriteLine(String.Format("\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\"", "hId", "hName", "cId", "cName", "CAName", "elementName"));
foreach(var process in processList)
{
if (process == null || process.Published == null || process.Published.Diagram == null)
{
continue;
}
var diagram = process.Published.Diagram;
foreach (var element in diagram.Elements)
{
if (element.GetType().ToString() == "EleWise.ELMA.Workflow.BPMN.Diagrams.Elements.CustomActivity.CustomActivityElement")
{
Console.WriteLine(String.Format("\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\"", process.Id, process.Name, "", "", element.DefaultName, element.Name));
}
}
var childList = PublicAPI.Processes.ProcessHeader.Find("[Parent] = " + process.Id);
foreach(var child in childList)
{
if (child == null || child.Published == null || child.Published.Diagram == null)
{
continue;
}
diagram = child.Published.Diagram;
foreach (var element in diagram.Elements)
{
if (element.GetType().ToString() == "EleWise.ELMA.Workflow.BPMN.Diagrams.Elements.CustomActivity.CustomActivityElement")
{
Console.WriteLine(String.Format("\"{0}\",\"{1}\",\"{2}\",\"{3}\",\"{4}\",\"{5}\"", process.Id, process.Name, child.Id, child.Name, element.DefaultName, element.Name));
}
}
}
}
}