Beispiel #1
0
            private static void DeleteCaseActivities(WorkflowActivityEntity ac, Expression <Func <CaseEntity, bool> > filter)
            {
                if (ac.Type == WorkflowActivityType.DecompositionWorkflow || ac.Type == WorkflowActivityType.CallWorkflow)
                {
                    var sw = ac.SubWorkflow.Workflow;
                    var wb = new WorkflowBuilder(sw);
                    wb.DeleteCases(c => filter.Evaluate(c.ParentCase) && c.ParentCase.Workflow == ac.Lane.Pool.Workflow);
                }

                var caseActivities = ac.CaseActivities().Where(ca => filter.Evaluate(ca.Case));

                if (caseActivities.Any())
                {
                    var notifications = caseActivities.SelectMany(a => a.Notifications());

                    if (notifications.Any())
                    {
                        notifications.UnsafeDelete();
                    }

                    Database.Query <CaseActivityEntity>()
                    .Where(ca => ca.Previous.Entity.WorkflowActivity.Is(ac) && filter.Evaluate(ca.Previous.Entity.Case))
                    .UnsafeUpdate()
                    .Set(ca => ca.Previous, ca => null)
                    .Execute();

                    caseActivities.UnsafeDelete();
                }
            }
Beispiel #2
0
            private static void MoveCasesAndDelete(WorkflowActivityEntity wa, Locator locator)
            {
                if (wa.CaseActivities().Any())
                {
                    if (locator.HasReplacement(wa.ToLite()))
                    {
                        wa.CaseActivities()
                        .UnsafeUpdate()
                        .Set(ca => ca.WorkflowActivity, ca => locator.GetReplacement(wa.ToLite()))
                        .Execute();
                    }
                    else
                    {
                        DeleteCaseActivities(wa, a => true);
                    }
                }

                wa.Delete(WorkflowActivityOperation.Delete);
            }