org.activiti.engine.history.HistoricFormProperty Java Examples

The following examples show how to use org.activiti.engine.history.HistoricFormProperty. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LeaveDynamicFormTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #2
Source File: LeaveDynamicFormTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #3
Source File: LeaveFormKeyTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #4
Source File: LeaveDynamicFormTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #5
Source File: LeaveFormKeyTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #6
Source File: LeaveDynamicFormTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #7
Source File: LeaveFormKeyTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #8
Source File: LeaveDynamicFormTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #9
Source File: LeaveFormKeyTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #10
Source File: LeaveDynamicFormTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #11
Source File: LeaveFormKeyTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #12
Source File: LeaveDynamicFormTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #13
Source File: LeaveFormKeyTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #14
Source File: LeaveFormKeyTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #15
Source File: LeaveDynamicFormTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #16
Source File: LeaveFormKeyTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #17
Source File: LeaveDynamicFormTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #18
Source File: LeaveFormKeyTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #19
Source File: LeaveDynamicFormTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #20
Source File: LeaveFormKeyTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #21
Source File: LeaveDynamicFormTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #22
Source File: LeaveFormKeyTest.java    From activiti-in-action-codes with Apache License 2.0 6 votes vote down vote up
/**
 * 读取历史变量并封装到Map中
 */
private Map<String, Object> packageVariables(ProcessInstance processInstance) {
    Map<String, Object> historyVariables = new HashMap<String, Object>();
    List<HistoricDetail> list = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).list();
    for (HistoricDetail historicDetail : list) {
        if (historicDetail instanceof HistoricFormProperty) {
            // 表单中的字段
            HistoricFormProperty field = (HistoricFormProperty) historicDetail;
            historyVariables.put(field.getPropertyId(), field.getPropertyValue());
            System.out.println("form field: taskId=" + field.getTaskId() + ", " + field.getPropertyId() + " = " + field.getPropertyValue());
        } else if (historicDetail instanceof HistoricVariableUpdate) {
            HistoricVariableUpdate variable = (HistoricVariableUpdate) historicDetail;
            historyVariables.put(variable.getVariableName(), variable.getValue());
            System.out.println("variable: " + variable.getVariableName() + " = " + variable.getValue());
        }
    }
    return historyVariables;
}
 
Example #23
Source File: FullHistoryTest.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
@Deployment
public void testHistoricDetailQueryMixed() throws Exception {

  Map<String, String> formProperties = new HashMap<String, String>();
  formProperties.put("formProp1", "activiti rocks!");
  formProperties.put("formProp2", "12345");

  ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery().processDefinitionKey("historicDetailMixed").singleResult();
  ProcessInstance processInstance = formService.submitStartFormData(procDef.getId(), formProperties);

  List<HistoricDetail> details = historyService.createHistoricDetailQuery().processInstanceId(processInstance.getId()).orderByVariableName().asc().list();

  assertEquals(4, details.size());

  assertTrue(details.get(0) instanceof HistoricFormProperty);
  HistoricFormProperty formProp1 = (HistoricFormProperty) details.get(0);
  assertEquals("formProp1", formProp1.getPropertyId());
  assertEquals("activiti rocks!", formProp1.getPropertyValue());

  assertTrue(details.get(1) instanceof HistoricFormProperty);
  HistoricFormProperty formProp2 = (HistoricFormProperty) details.get(1);
  assertEquals("formProp2", formProp2.getPropertyId());
  assertEquals("12345", formProp2.getPropertyValue());

  assertTrue(details.get(2) instanceof HistoricVariableUpdate);
  HistoricVariableUpdate varUpdate1 = (HistoricVariableUpdate) details.get(2);
  assertEquals("variable1", varUpdate1.getVariableName());
  assertEquals("activiti rocks!", varUpdate1.getValue());

  // This variable should be of type LONG since this is defined in the
  // process-definition
  assertTrue(details.get(3) instanceof HistoricVariableUpdate);
  HistoricVariableUpdate varUpdate2 = (HistoricVariableUpdate) details.get(3);
  assertEquals("variable2", varUpdate2.getVariableName());
  assertEquals(12345L, varUpdate2.getValue());
}
 
Example #24
Source File: RestResponseFactory.java    From activiti6-boot2 with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #25
Source File: FullHistoryTest.java    From activiti6-boot2 with Apache License 2.0 4 votes vote down vote up
@Deployment
public void testHistoricDetailQueryMixed() throws Exception {
  
  Map<String, String> formProperties = new HashMap<String, String>();
  formProperties.put("formProp1", "activiti rocks!");
  formProperties.put("formProp2", "12345");
  
  ProcessDefinition procDef = repositoryService.createProcessDefinitionQuery().processDefinitionKey("historicDetailMixed").singleResult();
  ProcessInstance processInstance = formService.submitStartFormData(procDef.getId() , formProperties);
 
  List<HistoricDetail> details = historyService
    .createHistoricDetailQuery()
    .processInstanceId(processInstance.getId())
    .orderByVariableName().asc()
    .list();
 
  assertEquals(4, details.size());
  
  assertTrue(details.get(0) instanceof HistoricFormProperty);
  HistoricFormProperty formProp1 = (HistoricFormProperty) details.get(0);
  assertEquals("formProp1", formProp1.getPropertyId());
  assertEquals("activiti rocks!", formProp1.getPropertyValue());
  
  assertTrue(details.get(1) instanceof HistoricFormProperty);
  HistoricFormProperty formProp2 = (HistoricFormProperty) details.get(1);
  assertEquals("formProp2", formProp2.getPropertyId());
  assertEquals("12345", formProp2.getPropertyValue());
  
  
  assertTrue(details.get(2) instanceof HistoricVariableUpdate);
  HistoricVariableUpdate varUpdate1 = (HistoricVariableUpdate) details.get(2);
  assertEquals("variable1", varUpdate1.getVariableName());
  assertEquals("activiti rocks!", varUpdate1.getValue());
  
  
  // This variable should be of type LONG since this is defined in the process-definition
  assertTrue(details.get(3) instanceof HistoricVariableUpdate);
  HistoricVariableUpdate varUpdate2 = (HistoricVariableUpdate) details.get(3);
  assertEquals("variable2", varUpdate2.getVariableName());
  assertEquals(12345L, varUpdate2.getValue());
}