Пример #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Before public void setUpHistoricBatchQueryMock()
        public virtual void setUpHistoricBatchQueryMock()
        {
            IList <HistoricBatch> mockHistoricBatches = MockProvider.createMockHistoricBatches();

            queryMock = mock(typeof(HistoricBatchQuery));

            when(queryMock.list()).thenReturn(mockHistoricBatches);
            when(queryMock.count()).thenReturn((long)mockHistoricBatches.Count);

            when(processEngine.HistoryService.createHistoricBatchQuery()).thenReturn(queryMock);
        }
Пример #2
0
        public override Batch execute(CommandContext commandContext)
        {
            ISet <string> historicBatchIds = new HashSet <string>();

            IList <string>     instanceIds   = builder.Ids;
            HistoricBatchQuery instanceQuery = builder.Query;

            if (instanceQuery == null && instanceIds == null)
            {
                throw new BadUserRequestException("Either query nor ids provided.");
            }

            if (instanceQuery != null)
            {
                foreach (HistoricBatch historicBatch in instanceQuery.list())
                {
                    historicBatchIds.Add(historicBatch.Id);
                }
            }

            if (instanceIds != null)
            {
                historicBatchIds.addAll(findHistoricInstanceIds(instanceIds, commandContext));
            }

            ensureNotNull(typeof(BadUserRequestException), "removalTime", builder.getMode());
            ensureNotEmpty(typeof(BadUserRequestException), "historicBatches", historicBatchIds);

            checkAuthorizations(commandContext, BatchPermissions.CREATE_BATCH_SET_REMOVAL_TIME);

            writeUserOperationLog(commandContext, historicBatchIds.Count, builder.getMode(), builder.RemovalTime, true);

            BatchEntity batch = createBatch(commandContext, new List <>(historicBatchIds));

            batch.createSeedJobDefinition();
            batch.createMonitorJobDefinition();
            batch.createBatchJobDefinition();

            batch.fireHistoricStartEvent();

            batch.createSeedJob();

            return(batch);
        }
Пример #3
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @SuppressWarnings("unchecked") @Override public java.util.List<org.camunda.bpm.engine.rest.dto.history.batch.HistoricBatchDto> getHistoricBatches(javax.ws.rs.core.UriInfo uriInfo, System.Nullable<int> firstResult, System.Nullable<int> maxResults)
        public virtual IList <HistoricBatchDto> getHistoricBatches(UriInfo uriInfo, int?firstResult, int?maxResults)
        {
            HistoricBatchQueryDto queryDto = new HistoricBatchQueryDto(objectMapper, uriInfo.QueryParameters);
            HistoricBatchQuery    query    = queryDto.toQuery(processEngine);

            IList <HistoricBatch> matchingBatches;

            if (firstResult != null || maxResults != null)
            {
                matchingBatches = (IList <HistoricBatch>)executePaginatedQuery(query, firstResult, maxResults);
            }
            else
            {
                matchingBatches = query.list();
            }

            IList <HistoricBatchDto> batchResults = new List <HistoricBatchDto>();

            foreach (HistoricBatch matchingBatch in matchingBatches)
            {
                batchResults.Add(HistoricBatchDto.fromBatch(matchingBatch));
            }
            return(batchResults);
        }