IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Wildfly/JBoss Java Discussion :

Exemple de workflow avec JBPM


Sujet :

Wildfly/JBoss Java

  1. #1
    Membre à l'essai
    Profil pro
    Inscrit en
    Mars 2006
    Messages
    26
    Détails du profil
    Informations personnelles :
    Localisation : Suisse

    Informations forums :
    Inscription : Mars 2006
    Messages : 26
    Points : 16
    Points
    16
    Par défaut Exemple de workflow avec JBPM
    Bonjour,

    Quelqu'un aurait-il un petit workflow de 3 ou 4 étapes avec la gestion des utilisateurs ou groupes (par exemple un utilisateur a le droit de faire tel ou tel tâche et pas les autres) ?

    J'ai regardé les différents exemples que propose jBPM et j'ai lu la docs sur les autorisations et les authentifications mais c'est un peu maigre...

    Merci d'avance pour votre aide.

  2. #2
    Membre régulier
    Inscrit en
    Janvier 2007
    Messages
    137
    Détails du profil
    Informations personnelles :
    Âge : 40

    Informations forums :
    Inscription : Janvier 2007
    Messages : 137
    Points : 99
    Points
    99
    Par défaut
    Bonjour,

    Je ne comprend pas ta question...

    jBPM est fourni avec plein d'exemples dans tous les sens ! Qu'est ce que tu veux de plus ?

    Il y a plein d'exemples comme celui-là qui montrent l'assignation de tâches
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    package org.jbpm.tutorial.taskmgmt;
     
    import junit.framework.TestCase;
     
    import org.jbpm.graph.def.ProcessDefinition;
    import org.jbpm.graph.exe.ProcessInstance;
    import org.jbpm.graph.exe.Token;
    import org.jbpm.taskmgmt.exe.TaskInstance;
     
    public class TaskAssignmentTest extends TestCase {
     
      public void testTaskAssignment() {
        // The process shown below is based on the hello world process.
        // The state node is replaced by a task-node.  The task-node 
        // is a node in JPDL that represents a wait state and generates 
        // task(s) to be completed before the process can continue to 
        // execute.  
        ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
          "<process-definition name='the baby process'>" +
          "  <start-state>" +
          "    <transition name='baby cries' to='t' />" +
          "  </start-state>" +
          "  <task-node name='t'>" +
          "    <task name='change nappy'>" +
          "      <assignment class='org.jbpm.tutorial.taskmgmt.NappyAssignmentHandler' />" +
          "    </task>" +
          "    <transition to='end' />" +
          "  </task-node>" +
          "  <end-state name='end' />" +
          "</process-definition>"
        );
     
        // Create an execution of the process definition.
        ProcessInstance processInstance = 
            new ProcessInstance(processDefinition);
        Token token = processInstance.getRootToken();
     
        // Let's start the process execution, leaving the start-state 
        // over its default transition.
        token.signal();
        // The signal method will block until the process execution 
        // enters a wait state.   In this case, that is the task-node.
        assertSame(processDefinition.getNode("t"), token.getNode());
     
        // When execution arrived in the task-node, a task 'change nappy'
        // was created and the NappyAssignmentHandler was called to determine
        // to whom the task should be assigned.  The NappyAssignmentHandler 
        // returned 'papa'.
     
        // In a real environment, the tasks would be fetched from the
        // database with the methods in the org.jbpm.db.TaskMgmtSession.
        // Since we don't want to include the persistence complexity in 
        // this example, we just take the first task-instance of this 
        // process instance (we know there is only one in this test
        // scenario.
        TaskInstance taskInstance = (TaskInstance)  
            processInstance
              .getTaskMgmtInstance()
              .getTaskInstances()
              .iterator().next();
     
        // Now, we check if the taskInstance was actually assigned to 'papa'.
        assertEquals("papa", taskInstance.getActorId() );
     
        // Now suppose that 'papa' has done his duties and marks the task 
        // as done. 
        taskInstance.end();
     
        // Since this was the last (only) task to do, the completion of this
        // task triggered the continuation of the process instance execution.    
        assertSame(processDefinition.getNode("end"), token.getNode());
      }
    }
    Et la classe :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    package org.jbpm.tutorial.taskmgmt;
     
    import org.jbpm.graph.exe.*;
    import org.jbpm.taskmgmt.def.*;
    import org.jbpm.taskmgmt.exe.Assignable;
     
    public class NappyAssignmentHandler implements AssignmentHandler {
     
      private static final long serialVersionUID = 1L;
     
      public void assign(Assignable assignable, ExecutionContext executionContext) {
        assignable.setActorId("papa");
      }
    }
    Il y en a plein d'autres avec jBPM...

  3. #3
    Membre régulier Avatar de zambizi
    Inscrit en
    Juin 2007
    Messages
    109
    Détails du profil
    Informations personnelles :
    Âge : 41

    Informations forums :
    Inscription : Juin 2007
    Messages : 109
    Points : 95
    Points
    95
    Par défaut Salut voici un exemple
    Bonjour,

    Voici un exemple d'une application web utilisant le moteur de workflow JBPM http://wiki.jboss.org/wiki/Wiki.jsp?...leApplications
    Ghazi Sabri IT's Fun.

    http://dzit.wordpress.com

Discussions similaires

  1. exemple de workflow avec exoPlatform
    Par geeksDeve dans le forum Portails
    Réponses: 0
    Dernier message: 04/03/2013, 13h53
  2. workflow avec jBPM
    Par sheridan08 dans le forum Wildfly/JBoss
    Réponses: 0
    Dernier message: 11/10/2012, 12h33
  3. ALFRESCO LABS3 - WORKFLOW avec JBPM
    Par henri93 dans le forum Wildfly/JBoss
    Réponses: 3
    Dernier message: 14/12/2010, 16h41
  4. [JBoss JBPM] comment réaliser un workflow avec des cycles ?
    Par biggef dans le forum Wildfly/JBoss
    Réponses: 6
    Dernier message: 27/04/2006, 12h17
  5. exemple de script avec autoloader
    Par djibril dans le forum Modules
    Réponses: 4
    Dernier message: 24/11/2005, 17h53

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo