Esempio n. 1
0
        public virtual IList <HistoricActivityStatisticsDto> getHistoricActivityStatistics(UriInfo uriInfo, string processDefinitionId, bool?includeCanceled, bool?includeFinished, bool?includeCompleteScope, string sortBy, string sortOrder)
        {
            HistoryService historyService = processEngine.HistoryService;

            HistoricActivityStatisticsQuery query = historyService.createHistoricActivityStatisticsQuery(processDefinitionId);

            if (includeCanceled != null && includeCanceled)
            {
                query.includeCanceled();
            }

            if (includeFinished != null && includeFinished)
            {
                query.includeFinished();
            }

            if (includeCompleteScope != null && includeCompleteScope)
            {
                query.includeCompleteScope();
            }

//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final javax.ws.rs.core.MultivaluedMap<String, String> queryParameters = uriInfo.getQueryParameters();
            MultivaluedMap <string, string> queryParameters = uriInfo.QueryParameters;

            DateConverter dateConverter = new DateConverter();

            dateConverter.ObjectMapper = objectMapper;

            if (queryParameters.getFirst(QUERY_PARAM_STARTED_AFTER) != null)
            {
                DateTime startedAfter = dateConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_STARTED_AFTER));
                query.startedAfter(startedAfter);
            }

            if (queryParameters.getFirst(QUERY_PARAM_STARTED_BEFORE) != null)
            {
                DateTime startedBefore = dateConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_STARTED_BEFORE));
                query.startedBefore(startedBefore);
            }

            if (queryParameters.getFirst(QUERY_PARAM_FINISHED_AFTER) != null)
            {
                DateTime finishedAfter = dateConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_FINISHED_AFTER));
                query.finishedAfter(finishedAfter);
            }

            if (queryParameters.getFirst(QUERY_PARAM_FINISHED_BEFORE) != null)
            {
                DateTime finishedBefore = dateConverter.convertQueryParameterToType(queryParameters.getFirst(QUERY_PARAM_FINISHED_BEFORE));
                query.finishedBefore(finishedBefore);
            }

            setSortOptions(query, sortOrder, sortBy);

            IList <HistoricActivityStatisticsDto> result = new List <HistoricActivityStatisticsDto>();

            IList <HistoricActivityStatistics> statistics = query.list();

            foreach (HistoricActivityStatistics currentStatistics in statistics)
            {
                result.Add(HistoricActivityStatisticsDto.fromHistoricActivityStatistics(currentStatistics));
            }

            return(result);
        }