public void GetProcessInstanceById_主键查找历史实例() { var ex = Record.Exception(() => { IProcessInstanceHistoriceController client = ctx.CreateWorkflowHttpProxy().GetProcessInstanceHistoriceClient(); HistoricInstanceQuery query = new HistoricInstanceQuery(); query.TenantId = ctx.TenantId; query.Pageable = new Pageable { PageNo = 1, PageSize = 1 }; Resources <HistoricInstance> list = client.ProcessInstances(query).GetAwaiter().GetResult(); if (list.TotalCount == 0) { return; } HistoricInstance inst = client.GetProcessInstanceById(list.List.First().Id).GetAwaiter().GetResult(); Assert.NotNull(inst); }); Assert.Null(ex); }
public virtual Task <Resources <HistoricInstance> > ProcessInstances(HistoricInstanceQuery query) { IPage <HistoricInstance> historices = new QueryProcessHistoriecsCmd() .LoadPage(historyService, pageableProcessHistoryService, query); return(Task.FromResult <Resources <HistoricInstance> >(new Resources <HistoricInstance>(historices.GetContent(), historices.GetTotalItems(), query.Pageable.PageNo, query.Pageable.PageSize))); }
public void ProcessInstances_分页获取流程历史实例列表() { var ex = Record.Exception(() => { IProcessInstanceHistoriceController client = ctx.CreateWorkflowHttpProxy().GetProcessInstanceHistoriceClient(); int offset = 1; Resources <HistoricInstance> list = null; while (true) { HistoricInstanceQuery query = new HistoricInstanceQuery(); query.TenantId = ctx.TenantId; query.IsTerminated = true; query.Pageable = new Pageable { PageNo = offset, PageSize = 10, Sort = new Sort(new Sort.Order[] { new Sort.Order { Property = "name", Direction = Sort.Direction.ASC } }) }; list = client.ProcessInstances(query).GetAwaiter().GetResult(); if (list.List.Count() < 10) { break; } offset = offset + 1; } Assert.True(offset == 1 && list.TotalCount <= 0 ? true : list.TotalCount / 10 + 1 == offset); }); Assert.Null(ex); }
/// <inheritdoc /> public async Task <Resources <HistoricInstance> > ProcessInstances(HistoricInstanceQuery query) { return(await httpProxy.PostAsync <Resources <HistoricInstance> >($"{serviceUrl}", query).ConfigureAwait(false)); }
/// <summary> /// 读取分页记录 /// </summary> /// <param name="historyService">历史记录仓储服务</param> /// <param name="pageableRepositoryService">分页仓储服务</param> /// <param name="qo">查询对象</param> /// <returns></returns> public IPage <HistoricInstance> LoadPage(IHistoryService historyService, PageableProcessHistoryRepositoryService pageableRepositoryService, HistoricInstanceQuery qo) { HistoricProcessInstanceQueryImpl query = historyService.CreateHistoricProcessInstanceQuery() as HistoricProcessInstanceQueryImpl; FastCopy.Copy <HistoricInstanceQuery, HistoricProcessInstanceQueryImpl>(qo, query); if (qo.IsTerminated.HasValue) { if (qo.IsTerminated.Value) { query.SetDeleted(); } else { query.SetNotDeleted(); } } pageableRepositoryService.SortApplier.ApplySort(query, qo.Pageable); IPage <HistoricInstance> defs = pageableRepositoryService.PageRetriever.LoadPage(historyService as ServiceImpl, query, qo.Pageable, pageableRepositoryService.ProcessDefinitionConverter, (q, firstResult, pageSize) => { return(new Engine.Impl.Cmd.GetHistoricProcessInstancesCmd(q, firstResult, pageSize)); }); return(defs); }