protected internal virtual ICollection <string> collectProcessInstanceIds() { HashSet <string> allProcessInstanceIds = new HashSet <string>(); IList <string> processInstanceIds = builder.ProcessInstanceIds; if (processInstanceIds != null) { allProcessInstanceIds.addAll(processInstanceIds); } ProcessInstanceQueryImpl processInstanceQuery = (ProcessInstanceQueryImpl)builder.ProcessInstanceQuery; if (processInstanceQuery != null) { allProcessInstanceIds.addAll(processInstanceQuery.listIds()); } HistoricProcessInstanceQueryImpl historicProcessInstanceQuery = (HistoricProcessInstanceQueryImpl)builder.HistoricProcessInstanceQuery; if (historicProcessInstanceQuery != null) { allProcessInstanceIds.addAll(historicProcessInstanceQuery.listIds()); } return(allProcessInstanceIds); }
protected internal virtual IList <string> collectProcessInstanceIds() { ISet <string> collectedProcessInstanceIds = new HashSet <string>(); IList <string> processInstanceIds = builder.ProcessInstanceIds; if (processInstanceIds != null && processInstanceIds.Count > 0) { collectedProcessInstanceIds.addAll(processInstanceIds); } ProcessInstanceQueryImpl processInstanceQuery = (ProcessInstanceQueryImpl)builder.ProcessInstanceQuery; if (processInstanceQuery != null) { collectedProcessInstanceIds.addAll(processInstanceQuery.listIds()); } HistoricProcessInstanceQueryImpl historicProcessInstanceQuery = (HistoricProcessInstanceQueryImpl)builder.HistoricProcessInstanceQuery; if (historicProcessInstanceQuery != null) { collectedProcessInstanceIds.addAll(historicProcessInstanceQuery.listIds()); } return(new List <string>(collectedProcessInstanceIds)); }
protected internal virtual IList <ProcessInstance> obtainProcessInstances(CommandContext commandContext) { ProcessInstanceQueryImpl query = new ProcessInstanceQueryImpl(); if (!string.ReferenceEquals(processInstanceId, null)) { query.processInstanceId(processInstanceId); } else if (!string.ReferenceEquals(processDefinitionId, null)) { query.processDefinitionId(processDefinitionId); } else if (isProcessDefinitionTenantIdSet) { query.processDefinitionKey(processDefinitionKey); if (!string.ReferenceEquals(processDefinitionTenantId, null)) { query.tenantIdIn(processDefinitionTenantId); } else { query.withoutTenantId(); } } else { query.processDefinitionKey(processDefinitionKey); } IList <ProcessInstance> result = new List <ProcessInstance>(); ((IList <ProcessInstance>)result).AddRange(commandContext.ExecutionManager.findProcessInstancesByQueryCriteria(query, null)); return(result); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: @Override public java.util.List<String> call() throws Exception public override IList <string> call() { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl processInstanceQueryToBeProcess = new org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl(); ProcessInstanceQueryImpl processInstanceQueryToBeProcess = new ProcessInstanceQueryImpl(); processInstanceQueryToBeProcess.processInstanceIds(new HashSet <string>(processIds)).deploymentId(deploymentId); return(commandContext.ExecutionManager.findProcessInstancesIdsByQueryCriteria(processInstanceQueryToBeProcess)); }
public virtual IList <IProcessInstance> FindProcessInstanceAndVariablesByQueryCriteria(IProcessInstanceQuery query) { ProcessInstanceQueryImpl executionQuery = query as ProcessInstanceQueryImpl; // paging doesn't work for combining process instances and variables due // to an outer join, so doing it in-memory if (executionQuery.FirstResult < 0 || executionQuery.MaxResults <= 0) { return(new List <IProcessInstance>()); } int firstResult = executionQuery.FirstResult; int maxResults = executionQuery.MaxResults; // setting max results, limit to 20000 results for performance reasons if (executionQuery.ProcessInstanceVariablesLimit != null) { executionQuery.MaxResults = executionQuery.ProcessInstanceVariablesLimit.GetValueOrDefault(); } else { executionQuery.MaxResults = ProcessEngineConfiguration.ExecutionQueryLimit; } executionQuery.FirstResult = 0; IList <IProcessInstance> instanceList = DbSqlSession.SelectListWithRawParameterWithoutFilter <ExecutionEntityImpl, IProcessInstance>("selectProcessInstanceWithVariablesByQueryCriteria", executionQuery, executionQuery.FirstResult, executionQuery.MaxResults); if (instanceList != null && instanceList.Count > 0) { if (firstResult > 0) { if (firstResult <= instanceList.Count) { int toIndex = firstResult + Math.Min(maxResults, instanceList.Count - firstResult); return(instanceList.Skip(firstResult).Take(toIndex).ToList()); } else { return(new List <IProcessInstance>()); } } else { int toIndex = Math.Min(maxResults, instanceList.Count); return(instanceList.Skip(0).Take(toIndex).ToList()); } } return(new List <IProcessInstance>()); }
/// <summary> /// 读取分页记录 /// </summary> /// <param name="runtimeService">运行时仓储服务</param> /// <param name="pageableRepositoryService">分页仓储服务</param> /// <param name="qo">查询对象</param> /// <returns></returns> public IPage <ProcessInstance> LoadPage(IRuntimeService runtimeService, PageableProcessInstanceRepositoryService pageableRepositoryService, ProcessInstanceQuery qo) { ProcessInstanceQueryImpl query = runtimeService.CreateProcessInstanceQuery() as ProcessInstanceQueryImpl; FastCopy.Copy <ProcessInstanceQuery, ProcessInstanceQueryImpl>(qo, query); query.OnlyProcessInstances = true; pageableRepositoryService.SortApplier.ApplySort(query, qo.Pageable); IPage <ProcessInstance> defs = pageableRepositoryService.PageRetriever.LoadPage(runtimeService as ServiceImpl, query, qo.Pageable, pageableRepositoryService.ProcessDefinitionConverter, (q, firstResult, pageSize) => { return(new GetProcessInstancesCmd(q, firstResult, pageSize)); }); return(defs); }
protected internal virtual IList<string> collectProcessInstanceIds() { ISet<string> collectedProcessInstanceIds = new HashSet<string>(); IList<string> processInstanceIds = this.ProcessInstanceIds; if (processInstanceIds != null) { collectedProcessInstanceIds.addAll(processInstanceIds); } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl processInstanceQuery = (org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl) this.processInstanceQuery; ProcessInstanceQueryImpl processInstanceQuery = (ProcessInstanceQueryImpl) this.processInstanceQuery; if (processInstanceQuery != null) { collectedProcessInstanceIds.addAll(processInstanceQuery.listIds()); } return new List<string>(collectedProcessInstanceIds); }
protected internal virtual ICollection <string> collectProcessInstanceIds(CommandContext commandContext) { ISet <string> collectedProcessInstanceIds = new HashSet <string>(); IList <string> processInstanceIds = executionBuilder.ProcessInstanceIds; if (processInstanceIds != null) { collectedProcessInstanceIds.addAll(processInstanceIds); } //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl processInstanceQuery = (org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl) executionBuilder.getProcessInstanceQuery(); ProcessInstanceQueryImpl processInstanceQuery = (ProcessInstanceQueryImpl)executionBuilder.ProcessInstanceQuery; if (processInstanceQuery != null) { collectedProcessInstanceIds.addAll(processInstanceQuery.listIds()); } return(collectedProcessInstanceIds); }
/// <summary> /// Deletes the given process definition from the database and cache. /// If cascadeToHistory and cascadeToInstances is set to true it deletes /// the history and the process instances. /// /// *Note*: If more than one process definition, from one deployment, is deleted in /// a single transaction and the cascadeToHistory and cascadeToInstances flag was set to true it /// can cause a dirty deployment cache. The process instances of ALL process definitions must be deleted, /// before every process definition can be deleted! In such cases the cascadeToInstances flag /// have to set to false! /// /// On deletion of all process instances, the task listeners will be deleted as well. /// Deletion of tasks and listeners needs the redeployment of deployments. /// It can cause to problems if is done sequential with the deletion of process definition /// in a single transaction. /// /// *For example*: /// Deployment contains two process definition. First process definition /// and instances will be removed, also cleared from the cache. /// Second process definition will be removed and his instances. /// Deletion of instances will cause redeployment this deploys again /// first into the cache. Only the second will be removed from cache and /// first remains in the cache after the deletion process. /// </summary> /// <param name="processDefinition"> the process definition which should be deleted </param> /// <param name="processDefinitionId"> the id of the process definition </param> /// <param name="cascadeToHistory"> if true the history will deleted as well </param> /// <param name="cascadeToInstances"> if true the process instances are deleted as well </param> /// <param name="skipCustomListeners"> if true skips the custom listeners on deletion of instances </param> /// <param name="skipIoMappings"> specifies whether input/output mappings for tasks should be invoked </param> public virtual void deleteProcessDefinition(ProcessDefinition processDefinition, string processDefinitionId, bool cascadeToHistory, bool cascadeToInstances, bool skipCustomListeners, bool skipIoMappings) { if (cascadeToHistory) { cascadeDeleteHistoryForProcessDefinition(processDefinitionId); if (cascadeToInstances) { cascadeDeleteProcessInstancesForProcessDefinition(processDefinitionId, skipCustomListeners, skipIoMappings); } } else { ProcessInstanceQueryImpl procInstQuery = (new ProcessInstanceQueryImpl()).processDefinitionId(processDefinitionId); long processInstanceCount = ProcessInstanceManager.findProcessInstanceCountByQueryCriteria(procInstQuery); if (processInstanceCount != 0) { throw LOG.deleteProcessDefinitionWithProcessInstancesException(processDefinitionId, processInstanceCount); } } // remove related authorization parameters in IdentityLink table IdentityLinkManager.deleteIdentityLinksByProcDef(processDefinitionId); // remove timer start events: deleteTimerStartEventsForProcessDefinition(processDefinition); //delete process definition from database DbEntityManager.delete(typeof(ProcessDefinitionEntity), "deleteProcessDefinitionsById", processDefinitionId); // remove process definition from cache: Context.ProcessEngineConfiguration.DeploymentCache.removeProcessDefinition(processDefinitionId); deleteSubscriptionsForProcessDefinition(processDefinitionId); // delete job definitions JobDefinitionManager.deleteJobDefinitionsByProcessDefinitionId(processDefinition.Id); }
public virtual IList <IProcessInstance> FindProcessInstanceAndVariablesByQueryCriteria(ProcessInstanceQueryImpl executionQuery) { return(executionDataManager.FindProcessInstanceAndVariablesByQueryCriteria(executionQuery)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") public java.util.List<String> findProcessInstancesIdsByQueryCriteria(org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl processInstanceQuery) public virtual IList <string> findProcessInstancesIdsByQueryCriteria(ProcessInstanceQueryImpl processInstanceQuery) { configureQuery(processInstanceQuery); return(DbEntityManager.selectList("selectProcessInstanceIdsByQueryCriteria", processInstanceQuery)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") public java.util.List<org.camunda.bpm.engine.runtime.ProcessInstance> findProcessInstancesByQueryCriteria(org.camunda.bpm.engine.impl.ProcessInstanceQueryImpl processInstanceQuery, org.camunda.bpm.engine.impl.Page page) public virtual IList <ProcessInstance> findProcessInstancesByQueryCriteria(ProcessInstanceQueryImpl processInstanceQuery, Page page) { configureQuery(processInstanceQuery); return(DbEntityManager.selectList("selectProcessInstanceByQueryCriteria", processInstanceQuery, page)); }
public virtual long findProcessInstanceCountByQueryCriteria(ProcessInstanceQueryImpl processInstanceQuery) { configureQuery(processInstanceQuery); return((long?)DbEntityManager.selectOne("selectProcessInstanceCountByQueryCriteria", processInstanceQuery).Value); }