Search in sources :

Example 1 with HistoricDetailResponse

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

the class RestResponseFactory method createHistoricDetailResponse.

public HistoricDetailResponse createHistoricDetailResponse(HistoricDetail detail, RestUrlBuilder urlBuilder) {
    HistoricDetailResponse result = new HistoricDetailResponse();
    result.setId(detail.getId());
    result.setProcessInstanceId(detail.getProcessInstanceId());
    if (StringUtils.isNotEmpty(detail.getProcessInstanceId())) {
        result.setProcessInstanceUrl(urlBuilder.buildUrl(RestUrls.URL_HISTORIC_PROCESS_INSTANCE, detail.getProcessInstanceId()));
    }
    result.setExecutionId(detail.getExecutionId());
    result.setActivityInstanceId(detail.getActivityInstanceId());
    result.setTaskId(detail.getTaskId());
    if (StringUtils.isNotEmpty(detail.getTaskId())) {
        result.setTaskUrl(urlBuilder.buildUrl(RestUrls.URL_HISTORIC_TASK_INSTANCE, detail.getTaskId()));
    }
    result.setTime(detail.getTime());
    if (detail instanceof HistoricFormProperty) {
        HistoricFormProperty formProperty = (HistoricFormProperty) detail;
        result.setDetailType(HistoricDetailResponse.FORM_PROPERTY);
        result.setPropertyId(formProperty.getPropertyId());
        result.setPropertyValue(formProperty.getPropertyValue());
    } else if (detail instanceof HistoricVariableUpdate) {
        HistoricVariableUpdate variableUpdate = (HistoricVariableUpdate) detail;
        result.setDetailType(HistoricDetailResponse.VARIABLE_UPDATE);
        result.setRevision(variableUpdate.getRevision());
        result.setVariable(createRestVariable(variableUpdate.getVariableName(), variableUpdate.getValue(), null, detail.getId(), VARIABLE_HISTORY_DETAIL, false, urlBuilder));
    }
    return result;
}
Also used : HistoricVariableUpdate(org.activiti.engine.history.HistoricVariableUpdate) HistoricFormProperty(org.activiti.engine.history.HistoricFormProperty) HistoricDetailResponse(org.activiti.rest.service.api.history.HistoricDetailResponse)

Example 2 with HistoricDetailResponse

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

the class RestResponseFactory method createHistoricDetailResponse.

public List<HistoricDetailResponse> createHistoricDetailResponse(List<HistoricDetail> detailList) {
    RestUrlBuilder urlBuilder = createUrlBuilder();
    List<HistoricDetailResponse> responseList = new ArrayList<HistoricDetailResponse>();
    for (HistoricDetail instance : detailList) {
        responseList.add(createHistoricDetailResponse(instance, urlBuilder));
    }
    return responseList;
}
Also used : HistoricDetail(org.activiti.engine.history.HistoricDetail) HistoricDetailResponse(org.activiti.rest.service.api.history.HistoricDetailResponse) ArrayList(java.util.ArrayList)

Aggregations

HistoricDetailResponse (org.activiti.rest.service.api.history.HistoricDetailResponse)2 ArrayList (java.util.ArrayList)1 HistoricDetail (org.activiti.engine.history.HistoricDetail)1 HistoricFormProperty (org.activiti.engine.history.HistoricFormProperty)1 HistoricVariableUpdate (org.activiti.engine.history.HistoricVariableUpdate)1