<commit_before>define(
		[
				'angular',
				'jquery',
				'/camunda/api/tasklist/plugin/process-tree-plugin/static/lib/jstree.js',
				'/camunda/api/tasklist/plugin/process-tree-plugin/static/lib/ngJsTree.js',
				'/camunda/api/tasklist/plugin/process-tree-plugin/static/app/treeService.js' ],

		function(angular, $, jstree, ngJsTree, treeService) {

			var pluginModule = angular.module(
					'tasklist.plugin.process-tree-plugin', [ 'ngJsTree',
							'treeService' ]);

			var Controller = [
					'$scope',
					'$q',
					'$http',
					'camAPI',
					function($scope, $q, $http, camAPI) {

						var ProcessDefinition = camAPI.resource('process-definition');

						var diagramData = $scope.taskData.newChild($scope);
						
						diagramData.observe('task', function(task) {
							$scope.currentTask = task;
							$scope.processInstanceId = task.processInstanceId;
						});

						diagramData.observe('processDefinition', function(
								processDefinition) {

							assignDiagramToWidget(processDefinition);
						});
						
						$scope.$watch('processDefinition', function(newValue, oldValue) {

							assignDiagramToWidget(newValue);
														
						});

						var assignDiagramToWidget = function(processDefinition) {
							
							$scope.processDefinition = processDefinition;
							
							ProcessDefinition.xml($scope.processDefinition, function(
									err, res) {
								if (err) {
									throw err;
								} else {
									$scope.processXml = res.bpmn20Xml;
								}
							});							
							
						}
						
						diagramData.provide('bpmn20xml', ['processDefinition', function (processDefinition) {
					        var deferred = $q.defer();

					        if (!processDefinition) {
					          return deferred.resolve(null);
					        }

					        ProcessDefinition.xml(processDefinition, function(err, res) {
					          if(err) {
					            deferred.reject(err);
					          }
					          else {
					            deferred.resolve(res);
					          }
					        });

					        return deferred.promise;
					      }]);
						
						diagramData.provide('processDiagram', ['bpmn20xml', 'processDefinition', 'task', function (bpmn20xml, processDefinition, task) {
					      var processDiagram = {};

					      processDiagram.processDefinition = processDefinition;
					      processDiagram.task = task;
					      processDiagram.bpmn20xml = (bpmn20xml || {}).bpmn20Xml;

					      return processDiagram;
					    }]);
					    
					    
					    processDiagramState = diagramData.observe('processDiagram', function (processDiagram) {
					    	$scope.processDiagram = processDiagram;
					    });
					    
					    $scope.highlightTask = function(element) {
			    	
							$http.post('/engine-rest/engine/default/history/activity-instance',
									{processInstanceId: $scope.processInstanceId,
									 position: {bottom: 30, right: -30}})
									 .then(function(successCallback) {
										
										var activities = successCallback.data;
										
										activities.sort(function(a,b) {                         
					                           if (b.startTime < a.startTime) {
					                                  return 1;
					                           } else if (a.startTime == b.startTime) {
					                        	   
					                        	   	  if (a.durationInMillis == null) {
					                        	   		  return 1;
					                        	   	  } else if (b.durationInMillis == null) {
					                        	   		  return -1;
					                        	   	  } else if ( a.durationInMillis && b.durationInMillis ) {
					                                         return b.durationInMillis - a.durationInMillis
					                                  }
					                        	   	  
					                                  return 0; 
					                           } else {
					                                  return -1;
					                           }
					                     });
										
										var running = false;
										activities.forEach(function(entry) {

											$scope.control.highlight(entry.activityId);
											
											// If an element with no end time is present, the instance is still running.
											if (!entry.endTime) {
												running = true;
											}
										});
										
										// Only running instances should have a badge. (current blocking activity)
										if (running) {
											
											$scope.control.createBadge(
													activities[activities.length - 1].activityId,
													{html: '<svg height="30" width="30"><circle cx="13" cy="13" r="10" stroke="black" stroke-width="3" fill="green" /></svg>'});
											
										}
									});
					    };
					}];
			

			var Configuration = function PluginConfiguration(ViewsProvider) {

				ViewsProvider
						.registerDefaultView(
								'tasklist.task.detail',
								{
									id : 'tasklist-plugin',
									label : 'Process Tree',
									url : '/camunda/api/tasklist/plugin/process-tree-plugin/static/app/test.html',
									controller : Controller,
									priority : 200
								});
			};

			Configuration.$inject = [ 'ViewsProvider' ];

			pluginModule.config(Configuration);
			pluginModule.controller(Controller);

			return pluginModule;
		});<commit_msg>cus-362: Ignoring transitional multi instance activity.<commit_after>define(
		[
				'angular',
				'jquery',
				'/camunda/api/tasklist/plugin/process-tree-plugin/static/lib/jstree.js',
				'/camunda/api/tasklist/plugin/process-tree-plugin/static/lib/ngJsTree.js',
				'/camunda/api/tasklist/plugin/process-tree-plugin/static/app/treeService.js' ],

		function(angular, $, jstree, ngJsTree, treeService) {

			var pluginModule = angular.module(
					'tasklist.plugin.process-tree-plugin', [ 'ngJsTree',
							'treeService' ]);

			var Controller = [
					'$scope',
					'$q',
					'$http',
					'camAPI',
					function($scope, $q, $http, camAPI) {

						var ProcessDefinition = camAPI.resource('process-definition');

						var diagramData = $scope.taskData.newChild($scope);
						
						diagramData.observe('task', function(task) {
							$scope.currentTask = task;
							$scope.processInstanceId = task.processInstanceId;
						});

						diagramData.observe('processDefinition', function(
								processDefinition) {

							assignDiagramToWidget(processDefinition);
						});
						
						$scope.$watch('processDefinition', function(newValue, oldValue) {

							assignDiagramToWidget(newValue);
														
						});

						var assignDiagramToWidget = function(processDefinition) {
							
							$scope.processDefinition = processDefinition;
							
							ProcessDefinition.xml($scope.processDefinition, function(
									err, res) {
								if (err) {
									throw err;
								} else {
									$scope.processXml = res.bpmn20Xml;
								}
							});							
							
						}
						
						diagramData.provide('bpmn20xml', ['processDefinition', function (processDefinition) {
					        var deferred = $q.defer();

					        if (!processDefinition) {
					          return deferred.resolve(null);
					        }

					        ProcessDefinition.xml(processDefinition, function(err, res) {
					          if(err) {
					            deferred.reject(err);
					          }
					          else {
					            deferred.resolve(res);
					          }
					        });

					        return deferred.promise;
					      }]);
						
						diagramData.provide('processDiagram', ['bpmn20xml', 'processDefinition', 'task', function (bpmn20xml, processDefinition, task) {
					      var processDiagram = {};

					      processDiagram.processDefinition = processDefinition;
					      processDiagram.task = task;
					      processDiagram.bpmn20xml = (bpmn20xml || {}).bpmn20Xml;

					      return processDiagram;
					    }]);
					    
					    
					    processDiagramState = diagramData.observe('processDiagram', function (processDiagram) {
					    	$scope.processDiagram = processDiagram;
					    });
					    
					    $scope.highlightTask = function(element) {
			    	
							$http.post('/engine-rest/engine/default/history/activity-instance',
									{processInstanceId: $scope.processInstanceId,
									 position: {bottom: 30, right: -30}})
									 .then(function(successCallback) {
										
										var activities = successCallback.data;
										
										activities.sort(function(a,b) {                         
					                           if (b.startTime < a.startTime) {
					                                  return 1;
					                           } else if (a.startTime == b.startTime) {
					                        	   
					                        	   	  if (a.durationInMillis == null) {
					                        	   		  return 1;
					                        	   	  } else if (b.durationInMillis == null) {
					                        	   		  return -1;
					                        	   	  } else if ( a.durationInMillis && b.durationInMillis ) {
					                                         return b.durationInMillis - a.durationInMillis
					                                  }
					                        	   	  
					                                  return 0; 
					                           } else {
					                                  return -1;
					                           }
					                     });
										
										// Element types ignored during marking
										var ignoredElementTypes = ["multiInstanceBody"];
										
										var running = false;
										activities.forEach(function(entry) {
											
											if ($.inArray(entry.activityType, ignoredElementTypes) == -1) {

												$scope.control.highlight(entry.activityId);
												
											}
											
											// If an element with no end time is present, the instance is still running.
												if (!entry.endTime) {
												running = true;
											}
										});
										
										// Only running instances should have a badge. (current blocking activity)
										if (running) {
											
											var lastActivity = activities[activities.length - 1];
											
											if ($.inArray(lastActivity.activityType, ignoredElementTypes) == -1) {
												
												$scope.control.createBadge(
														activities[activities.length - 1].activityId,
														{html: '<svg height="30" width="30"><circle cx="13" cy="13" r="10" stroke="black" stroke-width="3" fill="green" /></svg>'});
												
											}
											
										}
									});
					    };
					}];
			

			var Configuration = function PluginConfiguration(ViewsProvider) {

				ViewsProvider
						.registerDefaultView(
								'tasklist.task.detail',
								{
									id : 'tasklist-plugin',
									label : 'Process Tree',
									url : '/camunda/api/tasklist/plugin/process-tree-plugin/static/app/test.html',
									controller : Controller,
									priority : 200
								});
			};

			Configuration.$inject = [ 'ViewsProvider' ];

			pluginModule.config(Configuration);
			pluginModule.controller(Controller);

			return pluginModule;
		});
{'fraction_non_alphanumeric': 0.10826032540675845, 'fraction_numerical': 0.007330591811192562, 'mean_word_length': 1.4372549019607843, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 14, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4742433', 'n_tokens_mistral': 4759, 'n_tokens_neox': 2840, 'n_words': 479}