Search in sources :

Example 1 with ProcessVariableIndexer

use of org.kie.internal.process.ProcessVariableIndexer in project jbpm by kiegroup.

the class ProcessIndexerManager method index.

public List<VariableInstanceLog> index(AuditEventBuilder builder, ProcessVariableChangedEvent event) {
    String variableName = event.getVariableId();
    Object variable = event.getNewValue();
    for (ProcessVariableIndexer indexer : indexers) {
        if (indexer.accept(variable)) {
            List<VariableInstanceLog> indexed = indexer.index(variableName, variable);
            if (indexed != null) {
                // populate all indexed variables with task information
                for (VariableInstanceLog processVariable : indexed) {
                    VariableInstanceLog log = (VariableInstanceLog) builder.buildEvent(event);
                    ((org.jbpm.process.audit.VariableInstanceLog) processVariable).setProcessId(log.getProcessId());
                    ((org.jbpm.process.audit.VariableInstanceLog) processVariable).setProcessInstanceId(log.getProcessInstanceId());
                    ((org.jbpm.process.audit.VariableInstanceLog) processVariable).setDate(log.getDate());
                    ((org.jbpm.process.audit.VariableInstanceLog) processVariable).setExternalId(log.getExternalId());
                    ((org.jbpm.process.audit.VariableInstanceLog) processVariable).setOldValue(log.getOldValue());
                    ((org.jbpm.process.audit.VariableInstanceLog) processVariable).setVariableInstanceId(log.getVariableInstanceId());
                }
                return indexed;
            }
        }
    }
    return null;
}
Also used : VariableInstanceLog(org.kie.api.runtime.manager.audit.VariableInstanceLog) ProcessVariableIndexer(org.kie.internal.process.ProcessVariableIndexer)

Aggregations

VariableInstanceLog (org.kie.api.runtime.manager.audit.VariableInstanceLog)1 ProcessVariableIndexer (org.kie.internal.process.ProcessVariableIndexer)1