当前位置: 首页>>代码示例>>Java>>正文


Java HistoryService类代码示例

本文整理汇总了Java中org.activiti.engine.HistoryService的典型用法代码示例。如果您正苦于以下问题:Java HistoryService类的具体用法?Java HistoryService怎么用?Java HistoryService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HistoryService类属于org.activiti.engine包,在下文中一共展示了HistoryService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findCompletedProcessInstances

import org.activiti.engine.HistoryService; //导入依赖的package包/类
/**
 * 已结流程.
 */
public Page findCompletedProcessInstances(String userId, String tenantId,
        Page page) {
    HistoryService historyService = processEngine.getHistoryService();

    long count = historyService.createHistoricProcessInstanceQuery()
            .processInstanceTenantId(tenantId).startedBy(userId).finished()
            .count();
    List<HistoricProcessInstance> historicProcessInstances = historyService
            .createHistoricProcessInstanceQuery().startedBy(userId)
            .processInstanceTenantId(tenantId).finished()
            .listPage((int) page.getStart(), page.getPageSize());

    page.setResult(historicProcessInstances);
    page.setTotalCount(count);

    return page;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:21,代码来源:ProcessConnectorImpl.java

示例2: findInvolvedProcessInstances

import org.activiti.engine.HistoryService; //导入依赖的package包/类
/**
 * 参与流程.
 */
public Page findInvolvedProcessInstances(String userId, String tenantId,
        Page page) {
    HistoryService historyService = processEngine.getHistoryService();

    // TODO: finished(), unfinished()
    long count = historyService.createHistoricProcessInstanceQuery()
            .processInstanceTenantId(tenantId).involvedUser(userId).count();
    List<HistoricProcessInstance> historicProcessInstances = historyService
            .createHistoricProcessInstanceQuery()
            .processInstanceTenantId(tenantId).involvedUser(userId)
            .listPage((int) page.getStart(), page.getPageSize());

    page.setResult(historicProcessInstances);
    page.setTotalCount(count);

    return page;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:21,代码来源:ProcessConnectorImpl.java

示例3: deleteAllocatedRoutes

import org.activiti.engine.HistoryService; //导入依赖的package包/类
protected void deleteAllocatedRoutes(HistoryService historyService, String processInstanceId) throws SLException {
    HistoricVariableInstance allocatedPortsInstance = getHistoricVarInstanceValue(historyService, processInstanceId,
        Constants.VAR_ALLOCATED_PORTS);
    if (allocatedPortsInstance == null) {
        return;
    }
    CloudFoundryOperations client = getCloudFoundryClient(historyService, processInstanceId);
    String defaultDomain = client.getDefaultDomain() != null ? client.getDefaultDomain().getName() : null;
    if (defaultDomain == null) {
        LOGGER.warn(Messages.COULD_NOT_COMPUTE_DEFAULT_DOMAIN);
        return;
    }
    Integer[] allocatedPorts = JsonUtil.getFromBinaryJson((byte[]) allocatedPortsInstance.getValue(), Integer[].class);
    for (Integer port : allocatedPorts) {
        try {
            client.deleteRoute(port.toString(), defaultDomain);
        } catch (CloudFoundryException e) {
            LOGGER.warn(format(Messages.COULD_NOT_DELETE_ROUTE_FOR_PORT, port));
        }
    }
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:22,代码来源:AbortProcessListener.java

示例4: deleteDeploymentFiles

import org.activiti.engine.HistoryService; //导入依赖的package包/类
protected void deleteDeploymentFiles(HistoryService historyService, String processInstanceId) throws FileStorageException {
    HistoricVariableInstance keepFiles = getHistoricVarInstanceValue(historyService, processInstanceId, Constants.PARAM_KEEP_FILES);
    if (shouldKeepFiles(keepFiles)) {
        return;
    }
    HistoricVariableInstance extensionDescriptorFileIds = getHistoricVarInstanceValue(historyService, processInstanceId,
        Constants.PARAM_EXT_DESCRIPTOR_FILE_ID);
    HistoricVariableInstance appArchiveFileIds = getHistoricVarInstanceValue(historyService, processInstanceId,
        Constants.PARAM_APP_ARCHIVE_ID);

    String spaceId = (String) getHistoricVarInstanceValue(historyService, processInstanceId,
        com.sap.cloud.lm.sl.persistence.message.Constants.VARIABLE_NAME_SPACE_ID).getValue();

    FileSweeper fileSweeper = new FileSweeper(spaceId, getBeanProvider().getFileService());
    fileSweeper.sweep(extensionDescriptorFileIds);
    fileSweeper.sweep(appArchiveFileIds);
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:18,代码来源:AbortProcessListener.java

示例5: getEngineServices

import org.activiti.engine.HistoryService; //导入依赖的package包/类
@Override
public EngineServices getEngineServices() {
    if (this.engineServicesMock != null) {
        return this.engineServicesMock;
    }

    this.engineServicesMock = mock(EngineServices.class);
    when(engineServicesMock.getFormService()).thenReturn(mock(FormService.class));
    when(engineServicesMock.getHistoryService()).thenReturn(mock(HistoryService.class));
    when(engineServicesMock.getIdentityService()).thenReturn(mock(IdentityService.class));
    when(engineServicesMock.getManagementService()).thenReturn(mock(ManagementService.class));
    when(engineServicesMock.getRepositoryService()).thenReturn(mock(RepositoryService.class));
    when(engineServicesMock.getRuntimeService()).thenReturn(mock(RuntimeService.class));
    when(engineServicesMock.getTaskService()).thenReturn(mock(TaskService.class));

    return engineServicesMock;
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:18,代码来源:MockDelegateExecution.java

示例6: getHistoricVarInstanceValue

import org.activiti.engine.HistoryService; //导入依赖的package包/类
@Override
protected HistoricVariableInstance getHistoricVarInstanceValue(HistoryService historyService, String processInstanceId,
    String parameter) {
    switch (parameter) {
        case com.sap.cloud.lm.sl.persistence.message.Constants.VARIABLE_NAME_SPACE_ID:
            return createInstanceMock(SPACE_ID);
        case Constants.PARAM_EXT_DESCRIPTOR_FILE_ID:
            return createInstanceMock(extensionDescriptorIds);
        case Constants.PARAM_APP_ARCHIVE_ID:
            return createInstanceMock(archiveIds);
        case Constants.PARAM_KEEP_FILES:
            return createInstanceMock(shouldKeepFiles);
        default:
            return null;
    }
}
 
开发者ID:SAP,项目名称:cf-mta-deploy-service,代码行数:17,代码来源:AbortProcessListenerTest.java

示例7: getStatus

import org.activiti.engine.HistoryService; //导入依赖的package包/类
public String getStatus(){
    
    HistoryService historyService = processEngine.getHistoryService();
    
    //Get all variables of process generated during execution (data objects and inputs/outputs)
    List<HistoricVariableInstance> outVariables = historyService.createHistoricVariableInstanceQuery().processInstanceId(processInstance.getId()).list();
        
    //For each variable of process
    for (HistoricVariableInstance historicVariableInstance : outVariables)
        if(historicVariableInstance.getVariableName().equals("status")){
            if(historicVariableInstance.getValue() != null)
                return (String) historicVariableInstance.getValue();
        }
    
    return "failure";
}
 
开发者ID:usplssb,项目名称:SemanticSCo,代码行数:17,代码来源:Activiti.java

示例8: main

import org.activiti.engine.HistoryService; //导入依赖的package包/类
public static void main(String[] args) {
    AnnotationConfigApplicationContext ctx =
            new AnnotationConfigApplicationContext();
    ctx.register(SpringAnnotationConfiguration.class);
    ctx.refresh();

    assertNotNull(ctx.getBean(ProcessEngine.class));
    assertNotNull(ctx.getBean(RuntimeService.class));
    TaskService bean = ctx.getBean(TaskService.class);
    assertNotNull(bean);
    assertNotNull(ctx.getBean(HistoryService.class));
    assertNotNull(ctx.getBean(RepositoryService.class));
    assertNotNull(ctx.getBean(ManagementService.class));
    assertNotNull(ctx.getBean(FormService.class));
    Task task = bean.newTask();
    task.setName("哈哈");
    bean.saveTask(task);
}
 
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:19,代码来源:InitProcessEngineBySpringAnnotation.java

示例9: notify

import org.activiti.engine.HistoryService; //导入依赖的package包/类
@Override
public void notify(DelegateExecution delegateExecution) throws Exception {

    // Process instance details have to be fetched from history service as some information such as process start time is not available from
    // runtime service or delegate execution.
    HistoryService historyService = delegateExecution.getEngineServices().getHistoryService();
    List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery().
            processInstanceId(delegateExecution.getProcessInstanceId()).list();
    if (historicProcessInstances.size() == 1) {
        HistoricProcessInstance instance = historicProcessInstances.get(0);
        BPMNAnalyticsHolder.getInstance().getBpmnDataPublisher().publishProcessEvent(instance);

        //publishing analytics data of service tasks in the process
        if(BPMNAnalyticsHolder.getInstance().getAsyncDataPublishingEnabled()){
        BPMNAnalyticsHolder.getInstance().getBpmnDataPublisher().publishServiceTaskEvent(historyService.
                createHistoricActivityInstanceQuery().processInstanceId(delegateExecution.getProcessInstanceId()));
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:20,代码来源:ProcessTerminationListener.java

示例10: getPaginatedHistoryInstances

import org.activiti.engine.HistoryService; //导入依赖的package包/类
/**
 * Get paginated history instances
 *
 * @param start
 * @param size
 * @return list of BPMNInstances
 */
public BPMNInstance[] getPaginatedHistoryInstances(int start, int size){
    BPMNInstance bpmnInstance;
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    List<BPMNInstance> bpmnInstances = new ArrayList<>();
    HistoryService historyService = BPMNServerHolder.getInstance().getEngine().getHistoryService();
    HistoricProcessInstanceQuery query =
            historyService.createHistoricProcessInstanceQuery().processInstanceTenantId(tenantId.toString())
                    .finished().includeProcessVariables();
    historyInstanceCount = (int) query.count();
    List<HistoricProcessInstance> historicProcessInstances = query.listPage(start, size);
    for(HistoricProcessInstance instance: historicProcessInstances){
        bpmnInstance = new BPMNInstance();
        bpmnInstance.setInstanceId(instance.getId());
        bpmnInstance.setProcessId(instance.getProcessDefinitionId());
        bpmnInstance.setStartTime(instance.getStartTime());
        bpmnInstance.setEndTime(instance.getEndTime());
        bpmnInstance.setVariables(formatVariables(instance.getProcessVariables()));
        bpmnInstances.add(bpmnInstance);
    }
    return bpmnInstances.toArray(new BPMNInstance[bpmnInstances.size()]);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:29,代码来源:BPMNInstanceService.java

示例11: deleteProcessInstance

import org.activiti.engine.HistoryService; //导入依赖的package包/类
/**
 * Delete process instance by passing instance ID
 *
 * @param instanceId
 * @throws BPSFault
 */
public void deleteProcessInstance(String instanceId) throws BPSFault {
    Integer tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
    RuntimeService runtimeService = BPMNServerHolder.getInstance().getEngine().getRuntimeService();
    List<ProcessInstance> processInstances = runtimeService.createProcessInstanceQuery()
            .processInstanceTenantId(tenantId.toString()).processInstanceId(instanceId).list();
    if (processInstances.isEmpty()) {
        HistoryService historyService = BPMNServerHolder.getInstance().getEngine().getHistoryService();
        List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery()
                .processInstanceTenantId(tenantId.toString()).processInstanceId(instanceId).list();
        if (historicProcessInstances.isEmpty()) {
            String msg = "No process instances with the ID: " + instanceId;
            log.error(msg);
            throw new BPSFault(msg);
        }
        historyService.deleteHistoricProcessInstance(instanceId);
        return;
    }
    runtimeService.deleteProcessInstance(instanceId, "Deleted by user: " + tenantId);
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:26,代码来源:BPMNInstanceService.java

示例12: getTaskIdentityLinks

import org.activiti.engine.HistoryService; //导入依赖的package包/类
@GET
@Path("/{taskId}/identitylinks")
@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
public Response getTaskIdentityLinks(@PathParam("taskId") String taskId) {
    HistoryService historyService = BPMNOSGIService.getHistoryService();
    List<HistoricIdentityLink> identityLinks = historyService.getHistoricIdentityLinksForTask(taskId);

    List<HistoricIdentityLinkResponse> historicIdentityLinkResponseList = new ArrayList<>();
    if (identityLinks != null) {

        historicIdentityLinkResponseList =  new RestResponseFactory().createHistoricIdentityLinkResponseList
                (identityLinks, uriInfo.getBaseUri
                ().toString());
    }

    HistoricIdentityLinkResponseCollection historicIdentityLinkResponseCollection = new
            HistoricIdentityLinkResponseCollection();
    historicIdentityLinkResponseCollection.setHistoricIdentityLinkResponses(historicIdentityLinkResponseList);

    return Response.ok().entity(historicIdentityLinkResponseCollection).build();
}
 
开发者ID:wso2,项目名称:carbon-business-process,代码行数:22,代码来源:HistoricTaskInstanceService.java

示例13: cleanProcessDefinitionHistory

import org.activiti.engine.HistoryService; //导入依赖的package包/类
private void cleanProcessDefinitionHistory(HistoryService hs, String... definitions) {

        for (String definitionId : definitions) {
            List<HistoricProcessInstance> hpiList = hs.createHistoricProcessInstanceQuery()
                .processDefinitionId(definitionId)
                .orderByProcessDefinitionId().asc().list();
            if (hpiList == null || hpiList.size() == 0) {
                out().printf("No History found for process definition %s %n", definitionId);
                break;
            }
            for (HistoricProcessInstance hpi : hpiList) {
                String processId = hpi.getId();
                hs.deleteHistoricProcessInstance(hpi.getId());
                out().printf("History removed for process instance %s with definition %s%n", processId,
                    definitionId);
            }
        }
    }
 
开发者ID:apache,项目名称:incubator-provisionr,代码行数:19,代码来源:CleanHistoryActivitiCommand.java

示例14: printHistoricProcessInstances

import org.activiti.engine.HistoryService; //导入依赖的package包/类
private void printHistoricProcessInstances(PrintWriter out, HistoryService his, boolean printActive) {

        List<HistoricProcessInstance> hpiList = his.createHistoricProcessInstanceQuery()
            .orderByProcessDefinitionId().asc().list();

        out.println();
        out.println("History of Activiti Process Instances");
        out.println("-------------------------------------");
        if (hpiList.isEmpty()) {
            out.println("No History on Activiti Processes.");
            return;
        }

        TextTable txtTable = new TextTable(4);

        txtTable.addHeaders("Definition ID", "Instance ID", "Start Time", "End Time");
        for (HistoricProcessInstance hpi : hpiList) {
            Date endTime = hpi.getEndTime();
            if (endTime == null && !printActive) {
                continue;  // don't print active instance history if printActive is false - default.
            }
            txtTable.addRow(hpi.getProcessDefinitionId(), hpi.getId(),
                formatDate(hpi.getStartTime()), formatDate(hpi.getEndTime()));
        }
        txtTable.print(out);
    }
 
开发者ID:apache,项目名称:incubator-provisionr,代码行数:27,代码来源:ListActivitiCommand.java

示例15: getHistoryService

import org.activiti.engine.HistoryService; //导入依赖的package包/类
public HistoryService getHistoryService() {
    if (processEngine == null) {
        return null;
    }

    return processEngine.getHistoryService();
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:8,代码来源:ProxyProcessEngine.java


注:本文中的org.activiti.engine.HistoryService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。