Exemple #1
0
 public CallableAnonymousInnerClass(ServiceTaskDelegateExpressionActivityBehavior outerInstance, ActivityExecution execution, string signalName, object signalData)
 {
     this.outerInstance = outerInstance;
     this.execution     = execution;
     this.signalName    = signalName;
     this.signalData    = signalData;
 }
Exemple #2
0
        public virtual void bpmnError(string errorCode, string errorMessage, IDictionary <string, object> variables)
        {
            ensureActive();
            ActivityExecution activityExecution = Execution;
            BpmnError         bpmnError         = null;

            if (!string.ReferenceEquals(errorMessage, null))
            {
                bpmnError = new BpmnError(errorCode, errorMessage);
            }
            else
            {
                bpmnError = new BpmnError(errorCode);
            }
            try
            {
                ExternalTaskActivityBehavior behavior = ((ExternalTaskActivityBehavior)activityExecution.Activity.ActivityBehavior);
                if (variables != null && variables.Count > 0)
                {
                    activityExecution.Variables = variables;
                }
                behavior.propagateBpmnError(bpmnError, activityExecution);
            }
            catch (Exception ex)
            {
                throw ProcessEngineLogger.CMD_LOGGER.exceptionBpmnErrorPropagationFailed(errorCode, ex);
            }
        }
Exemple #3
0
        private static int Main(string[] args)
        {
            try
            {
                GlobalSettings.Clear();
                GlobalSettings.Load(args[1]);
                // Console.WriteLine(args[0]);
                // Console.WriteLine(args[1]);

                string sessionid = args[2];

                using (TraceLogContext context = new TraceLogContext())
                {
                    var activity      = ActivityExecution.SelectBySession(context, sessionid);
                    var activityCount = activity.Count(x => x.ActivityType.Equals("ScanToFolder"));

                    if (activityCount > 0)
                    {
                        string[] files = Directory.GetFiles(args[0], sessionid, SearchOption.AllDirectories);

                        if (activityCount <= files.Count())
                        {
                            return(0);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                //TraceFactory.Logger.Error(ex.Message);
            }
            return(-1);
        }
Exemple #4
0
 public DelegateInvocationAnonymousInnerClass2(CallableElementActivityBehavior outerInstance, ActivityExecution execution, VariableScope subInstance, DelegateVariableMapping varMapping) : base(execution, null)
 {
     this.outerInstance = outerInstance;
     this.execution     = execution;
     this.subInstance   = subInstance;
     this.varMapping    = varMapping;
 }
Exemple #5
0
 protected internal override void eventNotificationsFailed(PvmExecutionImpl execution, Exception exception)
 {
     if (shouldHandleFailureAsBpmnError())
     {
         ActivityExecution activityExecution = (ActivityExecution)execution;
         try
         {
             resetListeners(execution);
             BpmnExceptionHandler.propagateException(activityExecution, exception);
         }
         catch (ErrorPropagationException)
         {
             // exception has been logged by thrower
             // re-throw the original exception so that it is logged
             // and set as cause of the failure
             base.eventNotificationsFailed(execution, exception);
         }
         catch (Exception e)
         {
             base.eventNotificationsFailed(execution, e);
         }
     }
     else
     {
         base.eventNotificationsFailed(execution, exception);
     }
 }
Exemple #6
0
        protected internal virtual bool activatesGateway(ActivityExecution execution, PvmActivity gatewayActivity)
        {
            int numExecutionsGuaranteedToActivate = gatewayActivity.IncomingTransitions.Count;
            ActivityExecution scopeExecution      = execution.Scope ? execution : execution.Parent;

            IList <ActivityExecution> executionsAtGateway = execution.findInactiveConcurrentExecutions(gatewayActivity);

            if (executionsAtGateway.Count >= numExecutionsGuaranteedToActivate)
            {
                return(true);
            }
            else
            {
                ICollection <ActivityExecution> executionsNotAtGateway = getLeafExecutions(scopeExecution);
//JAVA TO C# CONVERTER TODO TASK: There is no .NET equivalent to the java.util.Collection 'removeAll' method:
                executionsNotAtGateway.removeAll(executionsAtGateway);

                foreach (ActivityExecution executionNotAtGateway in executionsNotAtGateway)
                {
                    if (canReachActivity(executionNotAtGateway, gatewayActivity))
                    {
                        return(false);
                    }
                }

                // if no more token may arrive, then activate
                return(true);
            }
        }
Exemple #7
0
        protected internal virtual int?getLoopVariable(ActivityExecution execution, string variableName)
        {
            IntegerValue value = execution.getVariableLocalTyped(variableName);

            ensureNotNull("The variable \"" + variableName + "\" could not be found in execution with id " + execution.Id, "value", value);
            return(value.Value);
        }
Exemple #8
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void execute(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution) throws Exception
        public virtual void execute(ActivityExecution execution)
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.camunda.bpm.engine.impl.pvm.PvmActivity currentActivity = execution.getActivity();
            PvmActivity currentActivity = execution.Activity;

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final EscalationEventDefinitionFinder escalationEventDefinitionFinder = new EscalationEventDefinitionFinder(escalation.getEscalationCode(), currentActivity);
            EscalationEventDefinitionFinder   escalationEventDefinitionFinder   = new EscalationEventDefinitionFinder(this, escalation.EscalationCode, currentActivity);
            ActivityExecutionMappingCollector activityExecutionMappingCollector = new ActivityExecutionMappingCollector(execution);

            ActivityExecutionHierarchyWalker walker = new ActivityExecutionHierarchyWalker(execution);

            walker.addScopePreVisitor(escalationEventDefinitionFinder);
            walker.addExecutionPreVisitor(activityExecutionMappingCollector);
            walker.addExecutionPreVisitor(new OutputVariablesPropagator());

            walker.walkUntil(new WalkConditionAnonymousInnerClass(this, escalationEventDefinitionFinder));

            EscalationEventDefinition escalationEventDefinition = escalationEventDefinitionFinder.EscalationEventDefinition;

            if (escalationEventDefinition != null)
            {
                executeEscalationHandler(escalationEventDefinition, activityExecutionMappingCollector);
            }

            if (escalationEventDefinition == null || !escalationEventDefinition.CancelActivity)
            {
                leaveExecution(execution, currentActivity, escalationEventDefinition);
            }
        }
Exemple #9
0
        /// <summary>
        /// Takes an <seealso cref="ActivityExecution"/> and an <seealso cref="Callable"/> and wraps
        /// the call to the Callable with the proper error propagation. This method
        /// also makes sure that exceptions not caught by following activities in the
        /// process will be thrown and not propagated.
        /// </summary>
        /// <param name="execution"> </param>
        /// <param name="toExecute"> </param>
        /// <exception cref="Exception"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: protected void executeWithErrorPropagation(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution, java.util.concurrent.Callable<Void> toExecute) throws Exception
        protected internal virtual void executeWithErrorPropagation(ActivityExecution execution, Callable <Void> toExecute)
        {
            string activityInstanceId = execution.ActivityInstanceId;

            try
            {
                toExecute.call();
            }
            catch (Exception ex)
            {
                if (activityInstanceId.Equals(execution.ActivityInstanceId))
                {
                    try
                    {
                        BpmnExceptionHandler.propagateException(execution, ex);
                    }
                    catch (ErrorPropagationException)
                    {
                        // exception has been logged by thrower
                        // re-throw the original exception so that it is logged
                        // and set as cause of the failure
                        throw ex;
                    }
                }
                else
                {
                    throw ex;
                }
            }
        }
        private void SetRowInfo(GridViewRowInfo row)
        {
            TriageDataInfo tdi = new TriageDataInfo();

            DbAccess db = new DbAccess(GlobalSettings.Database);

            using (DataLogContext dlc = new DataLogContext(db.getConStrSQL()))
            {
                Guid aeId = (Guid)row.Cells["ActivityExecutionId"].Value;
                tdi.DeviceId = ActivityExecutionAssetUsage.GetByActivityExecutionId(dlc, aeId).AssetId;
                ActivityExecution ae = ActivityExecution.GetById(dlc, aeId);
                SessionDevice     sd = SessionDevice.GetBySessionDeviceId(dlc, cboSessionIds.Text, tdi.DeviceId);

                tdi.ActivityType = ae.ActivityType;
                tdi.ActivityName = ae.ActivityName;
                tdi.UserName     = ae.UserName;

                if (sd != null)
                {
                    tdi.Firmware         = sd.FirmwareRevision;
                    tdi.FirmwareDatecode = sd.FirmwareDatecode;
                    tdi.Model            = sd.DeviceName;
                    tdi.IPAddress        = sd.IpAddress;
                    tdi.Product          = sd.ProductName;
                }

                var aepList = ActivityExecutionPerformance.GetByActivityExecutionId(dlc, aeId);
                tdi.AddPerformanceMarkers(aepList);
                SetPerformanceMarkers(tdi.PerformanceMarkers);

                lblDeviceId.Text         = tdi.DeviceId;
                lblIPAddress.Text        = tdi.IPAddress;
                lblModelInfo.Text        = tdi.Model;
                lblProduct.Text          = tdi.Product;
                lblFirmwareDatecode.Text = tdi.FirmwareDatecode;
                lblFirmwareRevision.Text = tdi.Firmware;
                lblUserId.Text           = tdi.UserName;
                lbActivityType.Text      = tdi.ActivityType;
                lblActivityName.Text     = tdi.ActivityName;
            }

            byte[] thumbnail = (byte[])row.Cells["Thumbnail"].Value;
            if (row.Cells["ControlIds"].Value != null)
            {
                string   regExp = @"[\n\r]+";
                string[] temp   = Regex.Split(row.Cells["ControlIds"].Value.ToString(), regExp);
                for (int ctr = 0; ctr < temp.Length; ctr++)
                {
                    errMessageAndroid.Text += temp[ctr];
                }
            }
            if (row.Cells["Reason"].Value != null)
            {
                rtbErrorMessage.Text = row.Cells["Reason"].Value.ToString();
            }
            tabControlInfo.SelectedIndex = 0;
            SetImage(pbThumbnail, thumbnail);
            pbControlPanel.Image = null;
        }
        protected virtual ActivityExecution GetActivityExecution(IGraphNode <TContext> node)
        {
            var activityExecution = new ActivityExecution(node.Name);

            Execution.ExecutingActivities.Clear();
            Execution.ExecutingActivities.Add(activityExecution);
            return(activityExecution);
        }
Exemple #12
0
        protected internal virtual bool allExecutionsEnded(ActivityExecution scopeExecution, ActivityExecution endedExecution)
        {
            int numberOfInactiveConcurrentExecutions = endedExecution.findInactiveConcurrentExecutions(endedExecution.Activity).Count;
            int concurrentExecutions = scopeExecution.Executions.Count;

            // no active instances exist and all concurrent executions are inactive
            return(getLocalLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES) <= 0 && numberOfInactiveConcurrentExecutions == concurrentExecutions);
        }
Exemple #13
0
 protected internal virtual void performInstance(ActivityExecution execution, PvmActivity activity, int loopCounter)
 {
     setLoopVariable(execution, LOOP_COUNTER, loopCounter);
     evaluateCollectionVariable(execution, loopCounter);
     execution.Ended  = false;
     execution.Active = true;
     execution.executeActivity(activity);
 }
Exemple #14
0
        protected internal virtual void createCompensateEventSubscription(ActivityExecution execution, ActivityImpl compensationHandler)
        {
            // the compensate event subscription is created at subprocess or miBody of the the current activity
            PvmActivity       currentActivity = execution.Activity;
            ActivityExecution scopeExecution  = execution.findExecutionForFlowScope(currentActivity.FlowScope);

            EventSubscriptionEntity.createAndInsert((ExecutionEntity)scopeExecution, EventType.COMPENSATE, compensationHandler);
        }
Exemple #15
0
        public override void destroyInnerInstance(ActivityExecution scopeExecution)
        {
            removeLoopVariable(scopeExecution, LOOP_COUNTER);

            int nrOfActiveInstances = getLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES).Value;

            setLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES, nrOfActiveInstances - 1);
        }
Exemple #16
0
 public CallableAnonymousInnerClass3(ClassDelegateActivityBehavior outerInstance, ActivityExecution execution, string signalName, object signalData, ActivityBehavior activityBehaviorInstance)
 {
     this.outerInstance            = outerInstance;
     this.execution                = execution;
     this.signalName               = signalName;
     this.signalData               = signalData;
     this.activityBehaviorInstance = activityBehaviorInstance;
 }
Exemple #17
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override protected void createInstances(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution, int nrOfInstances) throws Exception
        protected internal override void createInstances(ActivityExecution execution, int nrOfInstances)
        {
            prepareScope(execution, nrOfInstances);
            setLoopVariable(execution, NUMBER_OF_ACTIVE_INSTANCES, 1);

            ActivityImpl innerActivity = getInnerActivity(execution.Activity);

            performInstance(execution, innerActivity, 0);
        }
Exemple #18
0
        public override void doLeave(ActivityExecution execution)
        {
            // continue via the appropriate cancel boundary event
            ScopeImpl eventScope = (ScopeImpl)cancelBoundaryEvent.EventScope;

            ActivityExecution boundaryEventScopeExecution = execution.findExecutionForFlowScope(eventScope);

            boundaryEventScopeExecution.executeActivity(cancelBoundaryEvent);
        }
Exemple #19
0
 protected internal virtual void prepareScopeExecution(ActivityExecution scopeExecution, int nrOfInstances)
 {
     // set the MI-body scoped variables
     setLoopVariable(scopeExecution, NUMBER_OF_INSTANCES, nrOfInstances);
     setLoopVariable(scopeExecution, NUMBER_OF_COMPLETED_INSTANCES, 0);
     setLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES, nrOfInstances);
     scopeExecution.Activity = null;
     scopeExecution.inactivate();
 }
Exemple #20
0
        protected internal virtual ActivityExecution createConcurrentExecution(ActivityExecution scopeExecution)
        {
            ActivityExecution concurrentChild = scopeExecution.createExecution();

            scopeExecution.forceUpdate();
            concurrentChild.Concurrent = true;
            concurrentChild.Scope      = false;
            return(concurrentChild);
        }
Exemple #21
0
//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET:
//ORIGINAL LINE: protected void leaveExecution(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution, final org.camunda.bpm.engine.impl.pvm.PvmActivity currentActivity, org.camunda.bpm.engine.impl.bpmn.parser.EscalationEventDefinition escalationEventDefinition)
        protected internal virtual void leaveExecution(ActivityExecution execution, PvmActivity currentActivity, EscalationEventDefinition escalationEventDefinition)
        {
            // execution tree could have been expanded by triggering a non-interrupting event
            ExecutionEntity replacingExecution = ((ExecutionEntity)execution).ReplacedBy;

            ExecutionEntity leavingExecution = (ExecutionEntity)(replacingExecution != null ? replacingExecution : execution);

            leave(leavingExecution);
        }
Exemple #22
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void execute(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution) throws Exception
        public virtual void execute(ActivityExecution execution)
        {
            execution.inactivate();
            lockConcurrentRoot(execution);

            PvmActivity activity = execution.Activity;

            if (activatesGateway(execution, activity))
            {
                LOG.activityActivation(activity.Id);

                IList <ActivityExecution> joinedExecutions = execution.findInactiveConcurrentExecutions(activity);
                string defaultSequenceFlow = (string)execution.Activity.getProperty("default");
                IList <PvmTransition> transitionsToTake = new List <PvmTransition>();

                // find matching non-default sequence flows
                foreach (PvmTransition outgoingTransition in execution.Activity.OutgoingTransitions)
                {
                    if (string.ReferenceEquals(defaultSequenceFlow, null) || !outgoingTransition.Id.Equals(defaultSequenceFlow))
                    {
                        Condition condition = (Condition)outgoingTransition.getProperty(BpmnParse.PROPERTYNAME_CONDITION);
                        if (condition == null || condition.evaluate(execution))
                        {
                            transitionsToTake.Add(outgoingTransition);
                        }
                    }
                }

                // if none found, add default flow
                if (transitionsToTake.Count == 0)
                {
                    if (!string.ReferenceEquals(defaultSequenceFlow, null))
                    {
                        PvmTransition defaultTransition = execution.Activity.findOutgoingTransition(defaultSequenceFlow);
                        if (defaultTransition == null)
                        {
                            throw LOG.missingDefaultFlowException(execution.Activity.Id, defaultSequenceFlow);
                        }

                        transitionsToTake.Add(defaultTransition);
                    }
                    else
                    {
                        // No sequence flow could be found, not even a default one
                        throw LOG.stuckExecutionException(execution.Activity.Id);
                    }
                }

                // take the flows found
                execution.leaveActivityViaTransitions(transitionsToTake, joinedExecutions);
            }
            else
            {
                LOG.noActivityActivation(activity.Id);
            }
        }
Exemple #23
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void performExecution(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution) throws Exception
        public override void performExecution(ActivityExecution execution)
        {
            TaskEntity task = TaskEntity.createAndInsert(execution);

            taskDecorator.decorate(task, execution);

            Context.CommandContext.HistoricTaskInstanceManager.createHistoricTask(task);

            // All properties set, now firing 'create' event
            task.fireEvent([email protected]_Fields.EVENTNAME_CREATE);
        }
Exemple #24
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: @Override public void signal(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution, String signalName, Object signalData) throws Exception
        public virtual void signal(ActivityExecution execution, string signalName, object signalData)
        {
            if (SIGNAL_COMPENSATION_DONE.Equals(signalName))
            {
                signalCompensationDone(execution);
            }
            else
            {
                base.signal(execution, signalName, signalData);
            }
        }
Exemple #25
0
        public override void destroyInnerInstance(ActivityExecution concurrentExecution)
        {
            ActivityExecution scopeExecution = concurrentExecution.Parent;

            concurrentExecution.remove();
            scopeExecution.forceUpdate();

            int nrOfActiveInstances = getLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES).Value;

            setLoopVariable(scopeExecution, NUMBER_OF_ACTIVE_INSTANCES, nrOfActiveInstances - 1);
        }
Exemple #26
0
 public virtual void migrateScope(ActivityExecution scopeExecution)
 {
     // migrate already completed instances
     foreach (ActivityExecution child in scopeExecution.Executions)
     {
         if (!child.Active)
         {
             ((PvmExecutionImpl)child).ProcessDefinition = ((PvmExecutionImpl)scopeExecution).ProcessDefinition;
         }
     }
 }
Exemple #27
0
        /// <summary>
        /// Subclasses that call leave() will first pass through this method, before
        /// the regular <seealso cref="FlowNodeActivityBehavior.leave(ActivityExecution)"/> is
        /// called.
        /// </summary>
        public override void doLeave(ActivityExecution execution)
        {
            PvmActivity  currentActivity     = execution.Activity;
            ActivityImpl compensationHandler = ((ActivityImpl)currentActivity).findCompensationHandler();

            // subscription for compensation event subprocess is already created
            if (compensationHandler != null && !isCompensationEventSubprocess(compensationHandler))
            {
                createCompensateEventSubscription(execution, compensationHandler);
            }
            base.doLeave(execution);
        }
Exemple #28
0
        // sequential multi instance /////////////////////////////////

        public static bool eventSubprocessComplete(ActivityExecution scopeExecution)
        {
            bool performLegacyBehavior = isLegacyBehaviorRequired(scopeExecution);

            if (performLegacyBehavior)
            {
                LOG.completeNonScopeEventSubprocess();
                scopeExecution.end(false);
            }

            return(performLegacyBehavior);
        }
Exemple #29
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public void signal(org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution execution, String signalName, Object signalData) throws Exception
        public virtual void signal(ActivityExecution execution, string signalName, object signalData)
        {
            // join compensating executions
            if (!execution.hasChildren())
            {
                leave(execution);
            }
            else
            {
                ((ExecutionEntity)execution).forceUpdate();
            }
        }
Exemple #30
0
        protected internal virtual bool canReachActivity(ActivityExecution execution, PvmActivity activity)
        {
            PvmTransition pvmTransition = execution.Transition;

            if (pvmTransition != null)
            {
                return(isReachable(pvmTransition.Destination, activity, new HashSet <PvmActivity>()));
            }
            else
            {
                return(isReachable(execution.Activity, activity, new HashSet <PvmActivity>()));
            }
        }