28 require_once
'./Services/WorkflowEngine/classes/parser/class.ilWorkflowScaffold.php';
31 $constructor_method_content =
'';
33 $class_object->setWorkflowName($workflow_name);
35 $hasChildren = (isset($process[
'children']) && is_array($process[
'children']) && count($process[
'children']) > 0);
37 $stashed_sequence_flows = array();
39 $stashed_associations = array();
41 $stashed_process_extensions = array();
43 require_once
'./Services/WorkflowEngine/classes/parser/elements/class.ilBPMN2ElementLoader.php';
47 foreach ($process[
'children'] as $element) {
48 if ($element[
'name'] ==
'ioSpecification') {
49 foreach ($element[
'children'] as $iospec_element) {
50 $element_object = $loader->load($iospec_element[
'name']);
51 $constructor_method_content .= $element_object->getPHP($iospec_element, $class_object);
57 if ($element[
'name'] ==
'sequenceFlow') {
58 $stashed_sequence_flows[] = $element;
59 } elseif ($element[
'name'] ==
'association') {
60 $stashed_associations[] = $element;
61 } elseif ($element[
'name'] ==
'extensionElements') {
62 $stashed_process_extensions[] = $element;
64 $element_object = $loader->load($element[
'name']);
65 $constructor_method_content .= $element_object->getPHP($element, $class_object);
69 foreach ($stashed_sequence_flows as $element) {
70 $element_object = $loader->load($element[
'name']);
71 $constructor_method_content .= $element_object->getPHP($element, $class_object);
74 foreach ($stashed_associations as $element) {
75 $element_object = $loader->load($element[
'name']);
76 $constructor_method_content .= $element_object->getPHP($element, $class_object);
81 $message_definitions = array();
83 $element_object = $loader->load(
'messageDefinition');
84 $message_definitions[] = $element_object->getMessageDefinitionArray($message);
88 public static function getMessageDefinition($id) 90 $definitions = array(' . implode(
',', $message_definitions) .
' 92 return $definitions[$id]; 95 $class_object->addAuxilliaryMethod(
$code);
98 $class_object->setConstructorMethodContent($constructor_method_content);
101 if (strlen($constructor_method_content)) {
102 $class_source .= $class_object->getPHP();
105 return "<?php\n" . $class_source .
"\n?>";
115 require_once
'./Services/WorkflowEngine/classes/parser/class.ilBPMN2ParserUtils.php';
117 $bpmn2 = $xml_to_array_parser->load_string(
$xml);
129 foreach ((array) @$bpmn2[
'children'] as $bpmn2_part) {
130 if ($bpmn2_part[
'name'] ==
'process') {
131 $process = $bpmn2_part;
146 foreach ((array) @$bpmn2[
'children'] as $bpmn2_part) {
147 if ($bpmn2_part[
'name'] ==
'message') {
164 $hasChildren = (isset($bpmn2_array[
'children']) && is_array($bpmn2_array[
'children']) && count($bpmn2_array[
'children']) > 0);
165 if (!$workflow_name && !$hasChildren) {
166 $workflow_name = $bpmn2_array[
'attributes'][
'id'];
169 if (!$workflow_name) {
170 $workflow_name = $process[
'attributes'][
'id'];
171 return $workflow_name;
174 if ($workflow_name) {
175 $workflow_name = substr($workflow_name, 0, strpos($workflow_name,
'.'));
177 return $workflow_name;
Class ilBPMN2ElementLoader.
Class ilWorkflowScaffold.
getMessageNodesFromArray($bpmn2)
determineWorkflowClassName($workflow_name, $bpmn2_array, $process)
Class ilBPMN2ParserUtils.
getProcessNodeFromArray($bpmn2)
catch(Exception $e) $message
parseBPMN2XML($bpmn2_xml, $workflow_name=null)