I am trying to write some informational data to a log so we can easily track a workflows progress without having to log into Bonita. Since we share the connector that we write with many workflows I need to know what process name, version, and instance (case) id is writing to the log file.
I can easily do this using a Groovy script connector with code like this:
*import org.bonitasoft.engine.bpm.process.ProcessDefinition;
import org.bonitasoft.engine.api.ProcessAPI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
ProcessAPI processApi = apiAccessor.getProcessAPI();
ProcessDefinition process = processApi.getProcessDefinition(processDefinitionId);
Logger logger = LoggerFactory.getLogger(“org.bonitasoft.groovy.script.logNoMetadataNothingToDo”);
logger.error(“processName=” + process.name + " processVersion=" + process.version + " processInstanceId=" + processInstanceId.toString() +
" has no metadata so there is nothing for it to do.");*
I am trying to do the same thing in a java connector implementation (not groovy) but I do not see how I can get the processDefinitionId and processInstanceId variables that are provided to a groovy script. Can someone share an example of how to get this data in a java connector?