Search in sources :

Example 1 with HistoricProcessInstanceResponse

use of org.activiti.rest.service.api.history.HistoricProcessInstanceResponse in project Activiti by Activiti.

the class RestResponseFactory method createHistoricProcessInstanceResponseList.

public List<HistoricProcessInstanceResponse> createHistoricProcessInstanceResponseList(List<HistoricProcessInstance> processInstances) {
    RestUrlBuilder urlBuilder = createUrlBuilder();
    List<HistoricProcessInstanceResponse> responseList = new ArrayList<HistoricProcessInstanceResponse>();
    for (HistoricProcessInstance instance : processInstances) {
        responseList.add(createHistoricProcessInstanceResponse(instance, urlBuilder));
    }
    return responseList;
}
Also used : HistoricProcessInstance(org.activiti.engine.history.HistoricProcessInstance) ArrayList(java.util.ArrayList) HistoricProcessInstanceResponse(org.activiti.rest.service.api.history.HistoricProcessInstanceResponse)

Example 2 with HistoricProcessInstanceResponse

use of org.activiti.rest.service.api.history.HistoricProcessInstanceResponse in project Activiti by Activiti.

the class RestResponseFactory method createHistoricProcessInstanceResponse.

@SuppressWarnings("deprecation")
public HistoricProcessInstanceResponse createHistoricProcessInstanceResponse(HistoricProcessInstance processInstance, RestUrlBuilder urlBuilder) {
    HistoricProcessInstanceResponse result = new HistoricProcessInstanceResponse();
    result.setBusinessKey(processInstance.getBusinessKey());
    result.setDeleteReason(processInstance.getDeleteReason());
    result.setDurationInMillis(processInstance.getDurationInMillis());
    result.setEndActivityId(processInstance.getEndActivityId());
    result.setEndTime(processInstance.getEndTime());
    result.setId(processInstance.getId());
    result.setName(processInstance.getName());
    result.setProcessDefinitionId(processInstance.getProcessDefinitionId());
    result.setProcessDefinitionUrl(urlBuilder.buildUrl(RestUrls.URL_PROCESS_DEFINITION, processInstance.getProcessDefinitionId()));
    result.setStartActivityId(processInstance.getStartActivityId());
    result.setStartTime(processInstance.getStartTime());
    result.setStartUserId(processInstance.getStartUserId());
    result.setSuperProcessInstanceId(processInstance.getSuperProcessInstanceId());
    result.setUrl(urlBuilder.buildUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE, processInstance.getId()));
    if (processInstance.getProcessVariables() != null) {
        Map<String, Object> variableMap = processInstance.getProcessVariables();
        for (String name : variableMap.keySet()) {
            result.addVariable(createRestVariable(name, variableMap.get(name), RestVariableScope.LOCAL, processInstance.getId(), VARIABLE_HISTORY_PROCESS, false, urlBuilder));
        }
    }
    result.setTenantId(processInstance.getTenantId());
    return result;
}
Also used : HistoricProcessInstanceResponse(org.activiti.rest.service.api.history.HistoricProcessInstanceResponse)

Aggregations

HistoricProcessInstanceResponse (org.activiti.rest.service.api.history.HistoricProcessInstanceResponse)2 ArrayList (java.util.ArrayList)1 HistoricProcessInstance (org.activiti.engine.history.HistoricProcessInstance)1