Search in sources :

Example 11 with HistoryService

use of org.activiti.engine.HistoryService in project carbon-business-process by wso2.

the class BaseHistoricActivitiInstanceService method getQueryResponse.

protected DataResponse getQueryResponse(HistoricActivityInstanceQueryRequest queryRequest, Map<String, String> allRequestParams, UriInfo uriInfo) {
    HistoryService historyService = BPMNOSGIService.getHistoryService();
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    // Populate query based on request
    if (queryRequest.getActivityId() != null) {
        query.activityId(queryRequest.getActivityId());
    }
    if (queryRequest.getActivityInstanceId() != null) {
        query.activityInstanceId(queryRequest.getActivityInstanceId());
    }
    if (queryRequest.getActivityName() != null) {
        query.activityName(queryRequest.getActivityName());
    }
    if (queryRequest.getActivityType() != null) {
        query.activityType(queryRequest.getActivityType());
    }
    if (queryRequest.getExecutionId() != null) {
        query.executionId(queryRequest.getExecutionId());
    }
    if (queryRequest.getFinished() != null) {
        Boolean finished = queryRequest.getFinished();
        if (finished) {
            query.finished();
        } else {
            query.unfinished();
        }
    }
    if (queryRequest.getTaskAssignee() != null) {
        query.taskAssignee(queryRequest.getTaskAssignee());
    }
    if (queryRequest.getProcessInstanceId() != null) {
        query.processInstanceId(queryRequest.getProcessInstanceId());
    }
    if (queryRequest.getProcessDefinitionId() != null) {
        query.processDefinitionId(queryRequest.getProcessDefinitionId());
    }
    if (queryRequest.getTenantId() != null) {
        query.activityTenantId(queryRequest.getTenantId());
    }
    if (queryRequest.getTenantIdLike() != null) {
        query.activityTenantIdLike(queryRequest.getTenantIdLike());
    }
    if (Boolean.TRUE.equals(queryRequest.getWithoutTenantId())) {
        query.activityWithoutTenantId();
    }
    return new HistoricActivityInstancePaginateList(new RestResponseFactory(), uriInfo).paginateList(allRequestParams, queryRequest, query, "startTime", allowedSortProperties);
}
Also used : HistoricActivityInstancePaginateList(org.wso2.carbon.bpmn.rest.model.history.HistoricActivityInstancePaginateList) HistoricActivityInstanceQuery(org.activiti.engine.history.HistoricActivityInstanceQuery) RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) HistoryService(org.activiti.engine.HistoryService)

Example 12 with HistoryService

use of org.activiti.engine.HistoryService in project carbon-business-process by wso2.

the class BaseHistoricTaskInstanceService method getQueryResponse.

protected DataResponse getQueryResponse(HistoricActivityInstanceQueryRequest queryRequest, Map<String, String> allRequestParams) {
    HistoryService historyService = BPMNOSGIService.getHistoryService();
    HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
    // Populate query based on request
    if (queryRequest.getActivityId() != null) {
        query.activityId(queryRequest.getActivityId());
    }
    if (queryRequest.getActivityInstanceId() != null) {
        query.activityInstanceId(queryRequest.getActivityInstanceId());
    }
    if (queryRequest.getActivityName() != null) {
        query.activityName(queryRequest.getActivityName());
    }
    if (queryRequest.getActivityType() != null) {
        query.activityType(queryRequest.getActivityType());
    }
    if (queryRequest.getExecutionId() != null) {
        query.executionId(queryRequest.getExecutionId());
    }
    if (queryRequest.getFinished() != null) {
        Boolean finished = queryRequest.getFinished();
        if (finished) {
            query.finished();
        } else {
            query.unfinished();
        }
    }
    if (queryRequest.getTaskAssignee() != null) {
        query.taskAssignee(queryRequest.getTaskAssignee());
    }
    if (queryRequest.getProcessInstanceId() != null) {
        query.processInstanceId(queryRequest.getProcessInstanceId());
    }
    if (queryRequest.getProcessDefinitionId() != null) {
        query.processDefinitionId(queryRequest.getProcessDefinitionId());
    }
    if (queryRequest.getTenantId() != null) {
        query.activityTenantId(queryRequest.getTenantId());
    }
    if (queryRequest.getTenantIdLike() != null) {
        query.activityTenantIdLike(queryRequest.getTenantIdLike());
    }
    if (Boolean.TRUE.equals(queryRequest.getWithoutTenantId())) {
        query.activityWithoutTenantId();
    }
    RestResponseFactory restResponseFactory = new RestResponseFactory();
    return new HistoricActivityInstancePaginateList(restResponseFactory, uriInfo).paginateList(allRequestParams, queryRequest, query, "startTime", allowedSortProperties);
}
Also used : HistoricActivityInstancePaginateList(org.wso2.carbon.bpmn.rest.model.history.HistoricActivityInstancePaginateList) HistoricActivityInstanceQuery(org.activiti.engine.history.HistoricActivityInstanceQuery) RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) HistoryService(org.activiti.engine.HistoryService)

Example 13 with HistoryService

use of org.activiti.engine.HistoryService in project carbon-business-process by wso2.

the class BaseHistoricDetailService method getQueryResponse.

protected DataResponse getQueryResponse(HistoricDetailQueryRequest queryRequest, Map<String, String> allRequestParams, UriInfo uriInfo) {
    HistoryService historyService = BPMNOSGIService.getHistoryService();
    HistoricDetailQuery query = historyService.createHistoricDetailQuery();
    // Populate query based on request
    if (queryRequest.getProcessInstanceId() != null) {
        query.processInstanceId(queryRequest.getProcessInstanceId());
    }
    if (queryRequest.getExecutionId() != null) {
        query.executionId(queryRequest.getExecutionId());
    }
    if (queryRequest.getActivityInstanceId() != null) {
        query.activityInstanceId(queryRequest.getActivityInstanceId());
    }
    if (queryRequest.getTaskId() != null) {
        query.taskId(queryRequest.getTaskId());
    }
    if (queryRequest.getSelectOnlyFormProperties() != null) {
        if (queryRequest.getSelectOnlyFormProperties()) {
            query.formProperties();
        }
    }
    if (queryRequest.getSelectOnlyVariableUpdates() != null) {
        if (queryRequest.getSelectOnlyVariableUpdates()) {
            query.variableUpdates();
        }
    }
    return new HistoricDetailPaginateList(new RestResponseFactory(), uriInfo).paginateList(allRequestParams, queryRequest, query, "processInstanceId", allowedSortProperties);
}
Also used : HistoricDetailPaginateList(org.wso2.carbon.bpmn.rest.model.history.HistoricDetailPaginateList) RestResponseFactory(org.wso2.carbon.bpmn.rest.common.RestResponseFactory) HistoryService(org.activiti.engine.HistoryService) HistoricDetailQuery(org.activiti.engine.history.HistoricDetailQuery)

Example 14 with HistoryService

use of org.activiti.engine.HistoryService in project Activiti by Activiti.

the class MyTransactionalOperationTransactionDependentExecutionListener method notify.

@Override
public void notify(String processInstanceId, String executionId, FlowElement currentFlowElement, Map<String, Object> executionVariables, Map<String, Object> customPropertiesMap) {
    super.notify(processInstanceId, executionId, currentFlowElement, executionVariables, customPropertiesMap);
    if (Context.getCommandContext().getProcessEngineConfiguration().getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
        HistoryService historyService = Context.getCommandContext().getProcessEngineConfiguration().getHistoryService();
        // delete first historic instance
        List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery().list();
        historyService.deleteHistoricProcessInstance(historicProcessInstances.get(0).getId());
    }
}
Also used : HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) HistoryService(org.activiti.engine.HistoryService)

Example 15 with HistoryService

use of org.activiti.engine.HistoryService in project Activiti by Activiti.

the class MyTransactionalOperationTransactionDependentExecutionListener method notify.

@Override
public void notify(String processInstanceId, String executionId, FlowElement currentFlowElement, Map<String, Object> executionVariables, Map<String, Object> customPropertiesMap) {
    super.notify(processInstanceId, executionId, currentFlowElement, executionVariables, customPropertiesMap);
    if (Context.getProcessEngineConfiguration().getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
        HistoryService historyService = Context.getProcessEngineConfiguration().getHistoryService();
        // delete first historic instance
        List<HistoricProcessInstance> historicProcessInstances = historyService.createHistoricProcessInstanceQuery().orderByProcessInstanceStartTime().asc().list();
        historyService.deleteHistoricProcessInstance(historicProcessInstances.get(0).getId());
    }
}
Also used : HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) HistoryService(org.activiti.engine.HistoryService)

Aggregations

HistoryService (org.activiti.engine.HistoryService)31 RestResponseFactory (org.wso2.carbon.bpmn.rest.common.RestResponseFactory)11 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)10 ActivitiObjectNotFoundException (org.activiti.engine.ActivitiObjectNotFoundException)6 HistoricProcessInstanceQuery (org.activiti.engine.history.HistoricProcessInstanceQuery)6 HistoricTaskInstance (org.activiti.engine.history.HistoricTaskInstance)5 ProcessInstance (org.activiti.engine.runtime.ProcessInstance)5 ArrayList (java.util.ArrayList)4 Path (javax.ws.rs.Path)4 Produces (javax.ws.rs.Produces)4 RuntimeService (org.activiti.engine.RuntimeService)4 HashMap (java.util.HashMap)3 HistoricVariableInstance (org.activiti.engine.history.HistoricVariableInstance)3 Consumes (javax.ws.rs.Consumes)2 GET (javax.ws.rs.GET)2 POST (javax.ws.rs.POST)2 RepositoryService (org.activiti.engine.RepositoryService)2 HistoricActivityInstanceQuery (org.activiti.engine.history.HistoricActivityInstanceQuery)2 HistoricDetail (org.activiti.engine.history.HistoricDetail)2 HistoricDetailQuery (org.activiti.engine.history.HistoricDetailQuery)2