Esempio n. 1
0
        public static void Start(SchemaBuilder sb)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                sb.Include <ProcessAlgorithmSymbol>()
                .WithQuery(() => pa => new
                {
                    Entity = pa,
                    pa.Id,
                    pa.Key
                });

                sb.Include <ProcessEntity>()
                .WithQuery(() => p => new
                {
                    Entity = p,
                    p.Id,
                    p.Algorithm,
                    p.Data,
                    p.State,
                    p.MachineName,
                    p.ApplicationName,
                    p.CreationDate,
                    p.PlannedDate,
                    p.CancelationDate,
                    p.QueuedDate,
                    p.ExecutionStart,
                    p.ExecutionEnd,
                    p.SuspendDate,
                    p.ExceptionDate,
                });

                sb.Include <ProcessExceptionLineEntity>()
                .WithQuery(() => p => new
                {
                    Entity = p,
                    p.Process,
                    p.Line,
                    p.ElementInfo,
                    p.Exception,
                });

                PermissionAuthLogic.RegisterPermissions(ProcessPermission.ViewProcessPanel);

                SymbolLogic <ProcessAlgorithmSymbol> .Start(sb, () => registeredProcesses.Keys.ToHashSet());

                OperationLogic.AssertStarted(sb);

                ProcessGraph.Register();

                QueryLogic.Expressions.Register((ProcessAlgorithmSymbol p) => p.Processes(), () => typeof(ProcessEntity).NicePluralName());
                QueryLogic.Expressions.Register((ProcessAlgorithmSymbol p) => p.LastProcess(), () => ProcessMessage.LastProcess.NiceToString());

                QueryLogic.Expressions.Register((IProcessDataEntity p) => p.Processes(), () => typeof(ProcessEntity).NicePluralName());
                QueryLogic.Expressions.Register((IProcessDataEntity p) => p.LastProcess(), () => ProcessMessage.LastProcess.NiceToString());

                QueryLogic.Expressions.Register((ProcessEntity p) => p.ExceptionLines(), () => ProcessMessage.ExceptionLines.NiceToString());
                QueryLogic.Expressions.Register((IProcessLineDataEntity p) => p.ExceptionLines(), () => ProcessMessage.ExceptionLines.NiceToString());

                PropertyAuthLogic.SetMaxAutomaticUpgrade(PropertyRoute.Construct((ProcessEntity p) => p.User), PropertyAllowed.Read);

                ExceptionLogic.DeleteLogs += ExceptionLogic_DeleteLogs;
            }
        }