<commit_before>﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Signum.Engine.Authorization;
using Signum.Entities;
using Signum.Entities.Authorization;
using Signum.Services;
using Signum.Utilities;
using Signum.React.Facades;
using Signum.React.Authorization;
using Signum.Engine.Cache;
using Signum.Engine;
using Signum.Entities.Cache;
using Signum.Utilities.ExpressionTrees;
using Signum.Entities.Processes;
using Signum.Engine.Processes;
using System.Threading;
using Signum.React.ApiControllers;
using Signum.Engine.Basics;
using Signum.React.Filters;

namespace Signum.React.Processes
{
    public class ProcessController : ApiController
    {
        [Route("api/processes/constructFromMany"), HttpPost, ValidateModelFilter]
        public EntityPackTS ConstructFromMany(OperationController.MultiOperationRequest request)
        {
            var operation = OperationController.ParseOperationAssert(request.operationKey);

            var type = request.type == null ? null : TypeLogic.GetType(request.type);

            var entity = PackageLogic.CreatePackageOperation(request.lites, operation, request.args);

            return SignumServer.GetEntityPack(entity);
        }

        [Route("api/processes/view"), HttpGet]
        public ProcessLogicState View()
        {
            ProcessLogicState state = ProcessRunnerLogic.ExecutionState();

            return state;
        }

        [Route("api/processes/start"), HttpPost]
        public void Start()
        {
            ProcessPermission.ViewProcessPanel.AssertAuthorized();

            ProcessRunnerLogic.StartRunningProcesses();

            Thread.Sleep(1000);
        }

        [Route("api/processes/stop"), HttpPost]
        public void Stop()
        {
            ProcessPermission.ViewProcessPanel.AssertAuthorized();

            ProcessRunnerLogic.Stop();

            Thread.Sleep(1000);
        }<commit_msg>Adapt ProcessController for ArgsJsonConverter extension.<commit_after>﻿using Signum.Engine.Authorization;
using Signum.Engine.Basics;
using Signum.Engine.Processes;
using Signum.Entities.Processes;
using Signum.React.ApiControllers;
using Signum.React.Facades;
using Signum.React.Filters;
using System.Threading;
using System.Web.Http;

namespace Signum.React.Processes
{
    public class ProcessController : ApiController
    {
        [Route("api/processes/constructFromMany"), HttpPost, ValidateModelFilter]
        public EntityPackTS ConstructFromMany(OperationController.MultiOperationRequest request)
        {
            var type = request.type == null ? null : TypeLogic.GetType(request.type);

            var entity = PackageLogic.CreatePackageOperation(request.lites, request.operarionSymbol, request.args);

            return SignumServer.GetEntityPack(entity);
        }

        [Route("api/processes/view"), HttpGet]
        public ProcessLogicState View()
        {
            ProcessLogicState state = ProcessRunnerLogic.ExecutionState();

            return state;
        }

        [Route("api/processes/start"), HttpPost]
        public void Start()
        {
            ProcessPermission.ViewProcessPanel.AssertAuthorized();

            ProcessRunnerLogic.StartRunningProcesses();

            Thread.Sleep(1000);
        }

        [Route("api/processes/stop"), HttpPost]
        public void Stop()
        {
            ProcessPermission.ViewProcessPanel.AssertAuthorized();

            ProcessRunnerLogic.Stop();

            Thread.Sleep(1000);
        }
{'fraction_non_alphanumeric': 0.09251587959127312, 'fraction_numerical': 0.004418668876001105, 'mean_word_length': 3.0424107142857144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '132156', 'n_tokens_mistral': 963, 'n_tokens_neox': 957, 'n_words': 177}