Workflow with process handler sample
The taks will be assigned to an user called "openkm" so you need to create this user and log as him to see the task assignment.
Also you can assing this task to another user from the process instance workflow administration.
Process image
Process definition
<?xml version="1.0" encoding="UTF-8"?>
<process-definition xmlns="urn:jbpm.org:jpdl-3.2" name="phandler">
<start-state name="inicio">
<transition to="entrada de documentos">
<action class="com.openkm.sample.FechaHandler"></action>
</transition>
</start-state>
<task-node name="entrada de documentos">
<task name="Recepcion de Documentos">
<assignment actor-id="openkm"></assignment>
</task>
<event type="node-enter">
<script>
print(" ent_fecha ")
</script>
</event>
<transition to="enviar notificacion">
<action class=""></action>
</transition>
</task-node>
<mail-node name="enviar notificacion">
<transition to="fin"></transition>
</mail-node>
<end-state name="fin"></end-state>
</process-definition>
Process handlers
package com.openkm.sample;
import java.util.Calendar;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
import com.openkm.bean.form.Input;
import com.openkm.util.ISO8601;
public class FechaHandler implements ActionHandler {
private static final long serialVersionUID = 1L;
@Override
public void execute(ExecutionContext context) throws Exception {
Input myFecha = new Input();
myFecha.setName("ent_fecha");
myFecha.setValue(ISO8601.formatBasic(Calendar.getInstance()));
context.getContextInstance().setVariable("ent_fecha", myFecha);
}
}
Form definition
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE workflow-forms PUBLIC "-//OpenKM//DTD Workflow Forms 2.0//EN"
"http://www.openkm.com/dtd/workflow-forms-2.0.dtd">
<workflow-forms>
<workflow-form task="Recepcion de Documentos">
<separator label="REGISTRO DE ENTRADA" name="sep_grp_entrada"/>
<input label="No." name="ent_id"/>
<input label="Fecha" name="ent_fecha" type="date" data="ent_fecha" readonly="true"/>
<select label="Medio" name="ent_medio" type="simple">
<option label="Correo" value="correo" selected="true"/>
<option label="Email" value="email" />
<option label="Fax" value="fax" />
<option label="Mensajeria" value="mensajeria" />
<option label="Propia Mano" value="propia mano" />
</select>
<separator label="DOCUMENTO" name="sep_doc"/>
<input label="No." name="ent_no_doc"/>
<input label="Fecha" name="ent_fecha_doc" type="date"/>
<textarea label="Asunto" name="ent_asunto" value=""/>
<separator label="OBSERVACIONES" name="sep_obs"/>
<textarea label="Observaciones" name="ent_obs" value=""/>
<input label="Capturo" name="ent_capturo"/>
<button label="Aceptar" name="ent_aceptar"/>
</workflow-form>
</workflow-forms>