3 Replies Latest reply on May 10, 2008 7:29 AM by Ronald van Kuijk

    Is it possible???

    radhouan msakni Newbie

      hi for all,
      this a code of a class that i have created (WriteFile.java):

      package com.sample.action;
      import java.io.*;
      import org.jbpm.graph.def.ActionHandler;
      import org.jbpm.graph.exe.ExecutionContext;
      public class WriteFile implements ActionHandler {
       private static final long serialVersionUID = 1L;
       public void execute(ExecutionContext executionContext) throws Exception {
       String message= null;
       executionContext.getContextInstance().setVariable("message", message);
       Object object=new Object();
       // Stream to write file
       FileOutputStream fout;
       // Open an output stream
       fout = new FileOutputStream ("C:\\wamp\\www\\uib-ged\\ref.txt");
       // Print a line of text
       new PrintStream(fout).println (object);
       // Close our output stream
       // Catches any error conditions
       catch (IOException e)
       System.err.println ("Unable to write to file");

      and this is a code of an xhtml file generated and modified:
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
      <style type="text/css">
      .Style1 {
       font-family: "Times New Roman", Times, serif;
       font-style: italic;
       font-weight: bold;
      .Style2 {font-family: "Times New Roman", Times, serif}
       <div style="margin-top:20px;margin-bottom:20px">
       <li><em><strong>Debut de l'etude du dossier.</strong></em></li>
       <div style="margin-top:20px;margin-bottom:20px">
       <li class="Style2"><em><strong>
       <span class="Style1">Vous etes invites a donner la priorite du dossier et a introduire la reference
       de l'hypotheque avec laquelle vous avez realise l'indexation dans la GED</span></strong></em></li>
       <f:facet name="header">
       <h:outputText value="Tache: Saisie de l'hypotheque dans la GED"/>
       <!-- TASKFORM ROWS -->
       <f:facet name="header">
       <h:outputText value="Priorite du credit de 1 a 5 :"/>
       <h:selectOneMenu value="#{var['Priorite']}">
       <f:selectItem itemLabel="1" itemValue="1" />
       <f:selectItem itemLabel="2" itemValue="2" />
       <f:selectItem itemLabel="3" itemValue="3" />
       <f:selectItem itemLabel="4" itemValue="4" />
       <f:selectItem itemLabel="5" itemValue="5" />
       <f:facet name="header">
       <h:outputText value="Date de la saisie de l'hypotheque"/>
       <h:inputText value="#{var['Date_saisie_hypo']}" />
       <f:facet name="header">
       <h:outputText value="Reference de l'hypotheque"/>
       <h:inputText value="#{var['Ref_hypo_GED']}" />
       <f:facet name="header">
       <h:outputText value="Valider votre tache"/>
       <!-- TASKFORM BUTTONS -->
       <tf:transitionButton value="Valider"/>

      i precise i'm not an expert on j2EE so my question is : can i execute the previous class (WriteFile.java) when pressing the transition button!!if it is possible please give me an idea how to do it.

      thanks and sorry if my question seem stupid!!but this what i want to do,
      any help will be appreciated!! i precise that i'm not interessted with the execution of this calss by putting it in an action and use it after or before a signal or when leaving a node !!! i want to execute this calss after pressing the transition button on an xhtml file.

      Really thnaks for all