Sunteți pe pagina 1din 108

1

JBPM5
1. Introduccin

Oscar Vsquez Flores


eoscarvf@gmail.com
2013-03-28

Objetivos
Presentar al producto JBPM5 y su contexto.

JBPM5

Acerca de jBPM
* jBPM is a flexible Business Process Management (BPM)
Suite.
* It's light-weight, fully open-source
(distributed under Apache license) and written in Java.
* It allows you to model, execute and monitor business
processes, throughout their life cycle.

JBPM5

Caractersticas de jBPM
* The core of jBPM is a light-weight, extensible workflow
engine written in pure Java that allows you to execute
business processes using the latest BPMN 2.0
specification. It can run in any Java environment,
embedded in your application or as a service.
* Eclipse-based and web-based editor to support the
graphical creation of your business processes
(drag and drop)
* Pluggable persistence and transactions based on
JPA / JTA.
* History logging (for querying / monitoring / analysis)
JBPM5

Caractersticas de jBPM
* Pluggable human task service based on WS-HumanTask
for including tasks that need to be performed by
human actors
* Management console supporting process instance
management, task lists and task form management,
and reporting
* Task for builder to create, generate and/or edit task forms
Optional process repository to deploy your process
(and other related knowledge)
* Integration with Maven, Spring, OSGi, etc.
JBPM5

jBPM de JBoss

JBPM5

Soluciones de Red Hat

JBPM5

Componentes de JBPM
Core engine
Eclipse plugins
Web Designer
Console
Otros

JBPM5

jBPM Core engine.


* Solid, stable core engine for executing your process
instances
* Native support for the latest BPMN 2.0 specification for
modeling and executing business processes
* Strong focus on performance and scalability

* Light-weight (can be deployed on almost any device that


supports a simple Java Runtime Environment,
does not require any web container at all)
* (Optional) pluggable persistence with a default JPA
implementation.
JBPM5

10

jBPM Core engine.


* Pluggable transaction support with a default JTA
implementation.
* Implemented as a generic process engine, so it can be
extended to support new node types or
other process languages.

* Listeners to be notified of various events


* Ability to migrate running process instances to a new
version of their process definition.

JBPM5

11

jBPM Eclipse plugin.

Solo sirve como herramienta BPMN2


No sirve como herramienta a JBPM5
JBPM5

12

jBPM Web Designer.

Herramienta de diseo de procesos recomendada


por JBPM5
JBPM5

13

jBPM Console

JBPM5

14

Otros componentes de jBPM.


* Human task service.
* Process repository.
* History log.
* Form builder. *

JBPM5

15

Arquitectura de jBPM

JBPM5

16

Actividades
Realizar el Laboratorio 1:
Conceptos relacionados a JBPM.

JBPM5

17

JBPM5
2. Preparando el ambiente

Oscar Vsquez Flores


eoscarvf@gmail.com
2013-03-28

18

Objetivos
Preparar el ambiente de trabajo con JBPM5

JBPM5

19

Instalador de JBPM5

http://sourceforge.net/projects/jbpm/files/

JBPM5

20

JBPM5 versin 5.4

JBPM5

21

Archivos de instalacin de JBPM5

JBPM5

22

Instalador del JBPM5 Web Process Designer


http://sourceforge.net/projects/jbpm/files/

JBPM5

23

Instalador del JBPM5 Web Process Designer

JBPM5

24

Ejemplo de ambiente en desarrollo

JBPM5
JBOSS7

Local file

Repositorio de
usuarios

JBPM5

BD Repositorio
(H2)

Repositorio
interno

25

Ejemplo de ambiente en produccin

JBPM5
JBOSS7
LDAP
(Apache DS)

Repositorio de
usuarios

JBPM5

BD Repositorio
(Postgresql)

Repositorio
interno

26

Actividades
Realizar el Laboratorio 2:
Preparando el ambiente de desarrollo

JBPM5

27

JBPM5
3. Plugins de Eclipse para JBPM

Oscar Vsquez Flores


eoscarvf@gmail.com
2013-03-28

28

Objetivos
Mostrar las opciones de integracin de JBPM con Eclipse.

JBPM5

29

Opciones de Plugin para Eclipse


I. JBPM Eclipse plugin
II. Eclipse BPMN 2.0 plugin

JBPM5

30

I. JBPM Eclipse plugin


* El primer plugin para disear procesos de JBPM.
* Soporta un pequea parte de BPMN2.
* Incluye diversos utilitarios para trabajar con JBPM.
* Ya se descontinuo por parte de JBoss, pero sigue
siendo muy til.

JBPM5

31

I. JBPM Eclipse plugin

JBPM5

32

I. JBPM Eclipse plugin Integracin con Drools Guvnor

JBPM5

33

I. JBPM Eclipse plugin Integracin con Drools Guvnor

JBPM5

34

Drools Guvnor
Tambin conocido como Guvnor BRMS
Se instala con drools-guvnor.war
Parte del Drools Business Logic Integration Platform
(BLIP)

Objetivos:
Herramienta orienta al negocio para la gestion de
assets de negocio.
Repositorio de assets, puede ser accedido por
aplicaciones externas
JBPM5

35

Drools Guvnor
Soporta diferente tipos de assets:
Reglas de negocio
Tablas de decisin
Procesos de negocio
Etc.
Solo para el caso de la edicion de procesos de negocio
requiere al jBPM Web Process Designer(designer.war)

http://localhost:8080/drools-guvnor/

JBPM5

36

Drools Guvnor Gestin de assets

JBPM5

37

Drools Guvnor Exploracin de assets

JBPM5

38

II. Eclipse BPMN 2.0 plugin


* Soporta gran parte de la especificacin BPMN2.
* Creado para atender la necesidad de programar en Java
y disear procesos desde un solo IDE.
* Hasta el momento es un proyecto en
estado de incubacin.

JBPM5

39

II. Eclipse BPMN 2.0 plugin

JBPM5

40

Soporte a BPMN2 durante el diseo de procesos

Especificacin BPMN2

Eclipse BPMN2 Plugin


JBPM Web Designer

JBPM Eclipse
Plugin

JBPM5

41

Actividades
Realizar el Laboratorio 3:
Plugins de Eclipse para JBPM

JBPM5

42

JBPM5
4. Web Process Designer

Oscar Vsquez Flores


eoscarvf@gmail.com
2013-04-02

43

Objetivos
Conocer al jBPM Web Process Designer

JBPM5

44

jBPM5 Web Process Designer

http://localhost:8080/drools-guvnor
JBPM5

45

jBPM5 Web Process Designer


Construido sobre la aplicacion web Oryx
Oryx representa el diseo en formato JSON
Web Process Designer representa el diseo en formato
XML segn la especificacin BPMN2

Web Process Designer es la herramienta oficial de


diseo BPMN de jBPM5
Necesita una instancia de Drools Guvnor

JBPM5

46

Drools Guvnor Creacin de un proceso de negocio

JBPM5

47

Drools Guvnor Creacin de un proceso de negocio

JBPM5

48

Drools Guvnor Edicin de proceso de negocio

JBPM5

49

Drools Guvnor Servicio de repositorio para nodos

JBPM5

50

Drools Guvnor Organizacin de assets

JBPM5

51

Drools Guvnor Atributos del asset

JBPM5

52

Drools Guvnor Versionamiento del asset

JBPM5

53

Drools Guvnor Eliminar un asset

JBPM5

54

Drools Guvnor Subir definicin de clases

JBPM5

55

Drools Guvnor Subir definicin de clases

JBPM5

56

Drools Guvnor Creacin de paquetes

JBPM5

57

Actividades
Realizar el Laboratorio 4:
Web Process Designer

JBPM5

58

JBPM5
5. El API Java para JBPM

Oscar Vsquez Flores


eoscarvf@gmail.com
2013-03-28

59

Objetivos
Conocer el API Java para JBPM

JBPM5

60

El Java API.
http://docs.jboss.org/jbpm/v5.4/javadocs/
Algunos paquetes importantes:
org.drools.*.*
org.jbpm.bpmn2.*.*
org.jbpm.compiler.*.*
org.jbpm.persistence.*.*
org.jbpm.process.*.*
org.jbpm.ruleflow.*.*
org.jbpm.task.*.*
org.jbpm.workflow.*.*

JBPM5

61

Clase KnowledgeBase
The jBPM API allows you to first create a knowledge base.
The Knowledge Base is a repository of all the applications
knowledge definitions. It may contain rules, processes,
functions etc. The Knowledge Base itself does not
contain instance data, known as facts; instead, sessions
are created from the Knowledge Base into which data can
be inserted and where process instances may be started.
The following code snippet shows how to create a
knowledge base consisting of only one process definition.

JBPM5

62

Clase KnowledgeBase - Ejemplo


KnowledgeBuilder kbuilder =
KnowledgeBuilderFactory.newKnowledgeBuilder();

kbuilder.add(ResourceFactory.newClassPathResource("TestProcess.bpmn"),
ResourceType.BPMN2);
KnowledgeBase kbase = kbuilder.newKnowledgeBase();

JBPM5

63

Clase KnowledgeSession
Next step is to start a session to interact with created knowledge base.
The following code snippet shows how easy it is to create a session based on
the earlier created knowledge base, and to start a process.
Ejemplo:
StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
ProcessInstance processInstance = ksession.startProcess("first_test");

JBPM5

64

Parametros de entrada al proceso


You can also provide some input parameters to help you executing your
business logic meanwhile the process is executing. Following code sample
shows how to provide input parameters to a process execution.
Ejemplo:
Map<String, Object> inputParams = new HashMap<String, Object>();
inputParams.put("name", "i am an input parameter.");
ProcessInstance processInstance = ksession.startProcess("first_test",
inputParams

JBPM5

65

Eventos
JBPM API allows you to listens to some events during process execution to
interact with JBPM runtime. A ProcessEventListener can be used to listen
to process-related events, like starting or completing a process, entering and
leaving a node, etc. You can set your listener class using following line of code.
Ejemplo:
ksession.addEventListener(new TestEventListener());

JBPM5

66

Eventos - Implementacin
import org.drools.event.process.*;
public class TestEventListener implements ProcessEventListener {
@Override
public void beforeNodeTriggered(ProcessNodeTriggeredEvent event) {
System.out.println("Before Node triggered. "+
event.getNodeInstance().getNodeName());
Object obj = event.getNodeInstance().getVariable("name");
System.out.println("Input Parameter of ProcessInstance: "+obj.toString());
}
@Override
public void afterNodeLeft(ProcessNodeLeftEvent arg0) {}
@Override
public void afterNodeTriggered(ProcessNodeTriggeredEvent arg0) {}

JBPM5

67

Eventos - Implementacin
@Override
public void afterProcessCompleted(ProcessCompletedEvent arg0) {}
@Override
public void afterProcessStarted(ProcessStartedEvent arg0) {}
@Override
public void afterVariableChanged(ProcessVariableChangedEvent arg0) {}
@Override
public void beforeNodeLeft(ProcessNodeLeftEvent arg0) {}
@Override
public void beforeProcessCompleted(ProcessCompletedEvent arg0) {}
@Override
public void beforeProcessStarted(ProcessStartedEvent arg0) {}
@Override
public void beforeVariableChanged(ProcessVariableChangedEvent arg0) {}
}

JBPM5

68

Eventos Descripcin de algunos mtodos.


* beforeNodeLeft(): Antes de ejecutar un nodo, por ejemplo una actividad.
* afterNodeLeft(): Luego de ejecutarse un nodo.
* beforeProcessCompleted(): Antes de terminar la instancia del proceso.
* beforeProcessStarted(): Antes de iniciar la ejecucin de una instancia.
* beforeVariableChanged(): Antes de cambiar una variable de proceso.

JBPM5

69

Invocacin a un proceso Diseo de proceso local

JBPM5

70

Invocacin a un proceso Proceso en Guvnor

http://localhost:8080/drools-guvnor/
org.drools.guvnor.Guvnor/webdav/packages/com.procesos/PruebaProceso.bpmn2

JBPM5

71

Invocacin a un proceso Proceso en Guvnor

JBPM5

72

Invocacin a un proceso Paquete en Guvnor

JBPM5

73

Jars necesarios Propios de JBPM

JBPM5

74

Jars necesarios Externos a JBPM

...
JBPM5

75

Actividades
Realizar el Laboratorio 5:
El API Java para JBPM

JBPM5

76

JBPM5
6. JBPM Console

Oscar Vsquez Flores


eoscarvf@gmail.com
2013-04-02

77

Objetivos
Conocer el JBPM Console.

JBPM5

78

Acerca de JBPM Console


* Business processes can be managed through a
web console.
* This includes features like managing your process
instances (starting/stopping/inspecting),
inspecting your (human) task list and executing those
tasks, and generating reports.
* The jBPM console consists of two wars that must be
deployed in your application server and contains the
necessary libraries, the actual application, etc.
One jar contains the server application, the other
one the client.
JBPM5

79

JBPM Console

JBPM Console
Server

jbpm-gwt-console-server.war

JBPM Console

jbpm-gwt-console.war
Task Server
Drools Guvnor

Usuario

JBPM5

80

JBPM Console - Procesos

JBPM5

81

JBPM Console - Tareas

JBPM5

82

JBPM Console - Reportes

JBPM5

83

Configuracin del JBPM Console


* jbpm-gwt-console-server.war
* jbpm.console.properties

JBPM5

84

Gestin de seguridad
* {Path}\jboss-as-7.1.1.Final\standalone\configuration
* users.properties

* roles.properties

JBPM5

85

Interface REST de la JBPM Console


* The console also offers a REST interface for the
functionality it exposes.
This for example allows easy integration with the process
engine for features like starting process instances,
retrieving task lists, etc.
* The list URLS that the REST interface exposes can be
inspected if you navigate to the following URL
(after installing and starting the console):
http://localhost:8080/gwt-console-server/rs/server/resources/jbpm

JBPM5

86

Interface REST de la JBPM Console


* For example, this allows you to close a task using
/gwt-console-server/rs/task/{taskId}/close
* or starting a new process instance using
/gwt-console-server/rs/process/definition/{id}/new_instance

JBPM5

87

Interface REST de la JBPM Console

JBPM5

88

Actividades
Realizar el Laboratorio JBPM Console

JBPM5

89

JBPM5
7. Human task

Oscar Vsquez Flores


eoscarvf@gmail.com
2013-03-28

90

Objetivos
Revisar los temas relacionados a las tareas humanas.

JBPM5

91

kcontext

JBPM5

92

Propiedades del User Task

JBPM5

93

Propiedades del User Task - Content

map

map = new java.util.HashMap();


map.put("namez","John Doe");
map.put("phoneNumber","123456789");

JBPM5

94

Propiedades del User Task Formulario asociado

JBPM5

95

Propiedades del User Task - Assignments

Variables

JBPM5

96

Actividades
Realizar el Laboratorio 07:
Tareas humanas

JBPM5

97

JBPM5
8. Business Activity Monitoring

Oscar Vsquez Flores


eoscarvf@gmail.com
2013-03-28

98

Objetivos
Business Activity Monitoring

JBPM5

99

Business Activity Monitoring


The jbpm-bam module contains an event listener that
stores process-related information in a database using JPA
or Hibernate directly.
The data model itself contains three entities, one for
process instance information, one for node instance
information, and one for (process) variable instance
information.

JBPM5

100

Modelo de datos del BAM

JBPM5

101

BAM Tabla ProcessInstanceLog

JBPM5

102

BAM Tabla NodeInstanceLog

JBPM5

103

BAM Tabla VariableInstanceLog

JBPM5

104

Actividades
No existen.

JBPM5

105

JBPM5
9. Conclusiones

Oscar Vsquez Flores


eoscarvf@gmail.com
2013-03-28

106

Objetivos
Conclusiones

JBPM5

107

Soporte
http://docs.jboss.org/jbpm/v5.4/userguide/
http://docs.jboss.org/jbpm/v5.4/javadocs/

http://www.jboss.org/jbpm/

JBPM5

108

S-ar putea să vă placă și