Author: tom.baeyens(a)jboss.com
Date: 2009-05-19 03:26:59 -0400 (Tue, 19 May 2009)
New Revision: 4839
Added:
jbpm4/branches/idm/modules/devguide/src/main/docbook/en/modules/ch08-Persistence.xml
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.mail.properties
jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties
jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml
jbpm4/branches/idm/modules/examples/src/test/resources/jbpm.mail.properties
jbpm4/branches/idm/modules/examples/src/test/resources/jbpm.mail.templates.examples.xml
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupActivity.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ResumeDeploymentCmd.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SuspendDeploymentCmd.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/DefaultAddressResolver.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailTemplateRegistry.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/AddressResolver.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListener.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivity.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivityMessage.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivity.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivityMessage.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTake.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTakeMessage.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AddressResolverBinding.java
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/activities/GroupBasicsTest.java
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/activities/GroupTimersTest.java
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/async/
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/deploy/
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/deploy/SuspendDeploymentTest.java
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/HistoryActivityInstanceQeuryTest.java
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/HistoryTaskAssigneeTest.java
jbpm4/branches/idm/qa/jdbc/
jbpm4/branches/idm/qa/jdbc/hsqldb.properties
jbpm4/branches/idm/qa/jdbc/mysql.properties
jbpm4/branches/idm/qa/jdbc/oracle.properties
jbpm4/branches/idm/qa/jdbc/postgresql.properties
jbpm4/branches/idm/qa/jdbc/sybase.properties
jbpm4/branches/idm/qa/test.demo.setup.bat
jbpm4/branches/idm/qa/test.demo.setup.sh
Removed:
jbpm4/branches/idm/bin/
jbpm4/branches/idm/hudson/
jbpm4/branches/idm/modules/devguide/src/main/docbook/en/modules/chxx-Persistence.xml
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/AddressBuilderImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/resolver/
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/AddressBuilder.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ProceedToDestination.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ProceedToDestinationMessage.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TakeTransition.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TakeTransitionMessage.java
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/deploy/SuspendDeploymentTest.java
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/EventPropagationTest.java
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionBasedConcurrencyTest.java
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/images/gpd.open.in.xml.png
jbpm4/branches/idm/profiles.xml.example
jbpm4/branches/idm/qa/db/
jbpm4/branches/idm/qa/jdbc/hsqldb.properties
jbpm4/branches/idm/qa/jdbc/mysql.properties
jbpm4/branches/idm/qa/jdbc/oracle.properties
jbpm4/branches/idm/qa/jdbc/postgresql.properties
jbpm4/branches/idm/qa/jdbc/sybase.properties
jbpm4/branches/idm/qa/manual.testrun.setup.bat
jbpm4/branches/idm/qa/manual.testrun.setup.sh
Modified:
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/Deployment.java
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/Execution.java
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/IdentityService.java
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/ProcessDefinitionQuery.java
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/ProcessInstanceQuery.java
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/RepositoryService.java
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/activity/ActivityExecution.java
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/history/HistoryActivityInstanceQuery.java
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/identity/User.java
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/job/Job.java
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/model/Activity.java
jbpm4/branches/idm/modules/api/src/main/resources/jpdl-4.0.xsd
jbpm4/branches/idm/modules/devguide/src/main/docbook/en/master.xml
jbpm4/branches/idm/modules/distro/pom.xml
jbpm4/branches/idm/modules/distro/src/main/files/db/build.xml
jbpm4/branches/idm/modules/distro/src/main/files/db/example.identities.sql
jbpm4/branches/idm/modules/distro/src/main/files/db/hibernate.cfg/oracle.hibernate.cfg.xml
jbpm4/branches/idm/modules/distro/src/main/files/examples/build.xml
jbpm4/branches/idm/modules/distro/src/main/files/gpd/build.xml
jbpm4/branches/idm/modules/distro/src/main/files/jboss/build.xml
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-enterprise.jar/META-INF/jbosscmp-jdbc.xml
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/META-INF/jboss-service.xml
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.jboss5/conf/bootstrap/deployers.xml
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.jboss5/deployers/jbpm.deployer/META-INF/jbpm-deployers-jboss-beans.xml
jbpm4/branches/idm/modules/distro/src/main/files/jboss/hibernate.cfg/oracle.hibernate.cfg.xml
jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml
jbpm4/branches/idm/modules/enterprise/pom.xml
jbpm4/branches/idm/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java
jbpm4/branches/idm/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java
jbpm4/branches/idm/modules/examples/pom.xml
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/mail/inline/InlineMailTest.java
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/mail/template/TemplateMailTest.java
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java
jbpm4/branches/idm/modules/examples/src/test/resources/jbpm.cfg.xml
jbpm4/branches/idm/modules/examples/src/test/resources/org/jbpm/examples/mail/inline/process.jpdl.xml
jbpm4/branches/idm/modules/examples/src/test/resources/org/jbpm/examples/mail/template/process.jpdl.xml
jbpm4/branches/idm/modules/examples/src/test/resources/org/jbpm/examples/sql/process.jpdl.xml
jbpm4/branches/idm/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
jbpm4/branches/idm/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java
jbpm4/branches/idm/modules/integration/form-plugin/
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/BindingsParser.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java
jbpm4/branches/idm/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml
jbpm4/branches/idm/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml
jbpm4/branches/idm/modules/pvm/pom.xml
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/JbpmDeployTask.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/ActivityBuilder.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/ExecutionType.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateJobDbSession.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUserCmd.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/spi/IdentitySession.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/MessageImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/AcquireJobsCmd.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExceptionHandler.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventListenerReference.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivity.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivityMessage.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToChildActivity.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToParentActivity.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/Signal.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/SignalMessage.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryActivityInstanceQueryImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessInstanceQueryImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandMessage.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/IdentityServiceImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleParser.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AbstractCollectionBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BasicTypeBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BusinessCalendarBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ByteBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CharBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ClassBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DoubleBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FieldBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FloatBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/HibernateConfigurationBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IntBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/InvokeBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JndiBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/LongBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailSessionBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailTemplateBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MapBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MessageSessionBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertiesBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertyBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RefBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RetryInterceptorBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ShortBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TypesBinding.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/BindingParser.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java
jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.default.cfg.xml
jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.history.hbm.xml
jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.identity.hbm.xml
jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.repository.hbm.xml
jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.task.hbm.xml
jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
jbpm4/branches/idm/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MailTemplateWireTest.java
jbpm4/branches/idm/modules/test-db/pom.xml
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/EndProcessInstanceTest.java
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/ProcessInstanceHistoryTest.java
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/identity/IdentityTest.java
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/ExecutionStateTest.java
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeStateTest.java
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeVariableTest.java
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch03-Gpd.xml
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch04-Services.xml
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
jbpm4/branches/idm/pom.xml
jbpm4/branches/idm/qa/build.xml
Log:
merged trunk changes
Modified: jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/Deployment.java
===================================================================
--- jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/Deployment.java 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/Deployment.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -26,19 +26,19 @@
import java.net.URL;
import java.util.zip.ZipInputStream;
-import org.jbpm.api.client.ClientProcessDefinition;
-
-/**
+/**
* @author Tom Baeyens
*/
public interface Deployment {
+ long getDbid();
+
String getName();
Deployment setName(String name);
long getTimestamp();
Deployment setTimestamp(long timestamp);
-
+
Deployment addResourceFromString(String resourceName, String string);
Deployment addResourceFromInputStream(String resourceName, InputStream inputStream);
Deployment addResourceFromClasspath(String resourceName);
@@ -48,6 +48,4 @@
/** @return deploymentId */
long deploy();
-
- Deployment addProcessDefinition(ClientProcessDefinition processDefinition);
}
Modified: jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/Execution.java
===================================================================
--- jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/Execution.java 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/Execution.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -35,13 +35,12 @@
* <h3 id="state">State of an execution</h3>
*
* <p>The state of an execution is either active or locked. An active execution is
either
- * executing or waiting for an external trigger. If an execution is not in {@link
#STATE_ACTIVE},
+ * executing or waiting for an external trigger. If an execution is not in {@link
#STATE_ACTIVE_ROOT},
* then it is locked. A locked execution is read only.
* </p>
*
- * <p>When a new execution is created, it is in {@link #STATE_ACTIVE}. To change
- * the state to a locked state, use {@link #lock(String)}.
- * {@link #STATE_ACTIVE Some STATE_* constants} are provided that represent the
+ * <p>When a new execution is created, it is in {@link #STATE_ACTIVE_ROOT}.
+ * {@link #STATE_ACTIVE_ROOT Some STATE_* constants} are provided that represent the
* most commonly used locked states. But the state '...' in the picture
indicates
* that any string can be provided as the state in the lock method.
* </p>
@@ -59,7 +58,7 @@
* </p>
*
* <p>Make sure that comparisons between {@link #getState()} and the
- * {@link #STATE_ACTIVE STATE_* constants} are
+ * {@link #STATE_ACTIVE_ROOT STATE_* constants} are
* done with .equals and not with '==' because if executions are
* loaded from persistent storage, a new string is created instead
* of the constants.
@@ -78,15 +77,31 @@
* initializations of variables and timers */
String STATE_CREATED = "created";
- /** either executing or in a wait state waiting for a signal.
+ /** single (non-concurrent) path of execution that is an active indicator
+ * of the current position in the diagram. jBPM can be executing automatic
+ * activities or some external entity might be responsible for continuing the
+ * execution (wait state for jBPM). An active execution is always
+ * a leaf in the execution tree.
* This is the normal state of an execution and the initial state
* when creating a new execution. Make sure that comparisons are
* done with .equals and not with '==' because if executions are
* loaded from persistent storage, a new string is created instead
* of the constants. */
- String STATE_ACTIVE = "active";
-
- /** parents with concurrent child executions are inactive.
+ String STATE_ACTIVE_ROOT = "active-root";
+
+ /** concurrent path of execution that is an active indicator
+ * of the current position in the diagram. The parent of an active
+ * concurrent execution is always an inactive concurrent root. jBPM can
+ * be executing automatic
+ * activities or some external entity might be responsible for continuing the
+ * execution (wait state for jBPM).
+ * Make sure that comparisons are
+ * done with .equals and not with '==' because if executions are
+ * loaded from persistent storage, a new string is created instead
+ * of the constants. */
+ String STATE_ACTIVE_CONCURRENT = "active-concurrent";
+
+ /** parent of concurrent child executions.
* When an execution has concurrent child executions, it implies that
* this execution can't be active. For example, at a fork, the parent
* execution can wait inactively in the fork being till all the
@@ -95,14 +110,26 @@
* done with .equals and not with '==' because if executions are
* loaded from persistent storage, a new string is created instead
* of the constants. */
- String STATE_INACTIVE = "inactive";
+ String STATE_INACTIVE_CONCURRENT_ROOT = "inactive-concurrent-root";
- /** this execution has ended. Make sure that comparisons are
+ /** parent of a scoped execution. This execution is inactive,
+ * but points to the parent scope like e.g. a group.
+ * This execution has exactly 1 child execution. That indicates
+ * the state inside of the scope.
+ * Make sure that comparisons are
* done with .equals and not with '==' because if executions are
* loaded from persistent storage, a new string is created instead
* of the constants. */
- String STATE_ENDED = "ended";
-
+ String STATE_INACTIVE_SCOPE = "inactive-scope";
+
+ /** concurrent execution that is inactively waiting in a join
+ * until other concurrent executions arrive.
+ * Make sure that comparisons are
+ * done with .equals and not with '==' because if executions are
+ * loaded from persistent storage, a new string is created instead
+ * of the constants. */
+ String STATE_INACTIVE_JOIN = "inactive-join";
+
/** indicates that this execution is temporary suspended with the
* {@link #suspend()} method. Human tasks of a suspended execution
* shouldn't show up in people's task list and timers of suspended
@@ -115,14 +142,11 @@
/** indicates that this execution is doing an asynchronous continuation. */
String STATE_ASYNC = "async";
- /** this execution has been cancelled before it came to completion.
- * Only history executions might expose this state. This state can be
- * passed in {@link ExecutionService#endProcessInstance(String, String)}.
- * Make sure that comparisons are
+ /** this execution has ended. Make sure that comparisons are
* done with .equals and not with '==' because if executions are
* loaded from persistent storage, a new string is created instead
* of the constants. */
- String STATE_CANCELLED = "cancelled";
+ String STATE_ENDED = "ended";
/** the externally given name or id of this execution. The id of a main
* path of execution is null. Can be used to differentiate concurrent
@@ -151,9 +175,6 @@
/** is this execution active ? This is the inverse of {@link #isLocked()}. */
boolean isActive();
- /** is this execution {@link #lock(String) locked} ? This is the inverse of {@link
#isActive()}. */
- boolean isLocked();
-
/** is this execution ended */
boolean isEnded();
@@ -205,4 +226,7 @@
* Returns an empty set in case there are no activities active.
* @see #findActiveExecutionIn(String) */
Set<String> findActiveActivityNames();
+
+ /** id of the process definition used for this execution */
+ String getProcessDefinitionId();
}
Modified: jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/IdentityService.java
===================================================================
---
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/IdentityService.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/IdentityService.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -26,15 +26,17 @@
import org.jbpm.api.identity.Group;
import org.jbpm.api.identity.User;
-
/**
* @author Tom Baeyens
*/
public interface IdentityService {
- /** create a new user */
- void createUser(String userId, String password, String givenName, String familyName);
+ /** create a new user. */
+ void createUser(String userId, String givenName, String familyName);
+ /** create a new user, providing an email address */
+ void createUser(String userId, String givenName, String familyName, String
businessEmail);
+
/** lookup a user
* @return the user or null if no such user exists */
User findUserById(String userId);
@@ -83,9 +85,8 @@
* but not the associated users. */
void deleteGroup(String groupId);
- /** makes the given user a member of the given group with the given role.
- * Role can be null. */
- void createMembership(String string, String groupId);
+ /** makes the given user a member of the given group. */
+ void createMembership(String userId, String groupId);
/** makes the given user a member of the given group with the given role.
* Role can be null. */
Modified:
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/ProcessDefinitionQuery.java
===================================================================
---
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/ProcessDefinitionQuery.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/ProcessDefinitionQuery.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -39,6 +39,7 @@
ProcessDefinitionQuery nameLike(String name);
ProcessDefinitionQuery name(String name);
ProcessDefinitionQuery deploymentDbid(long deploymentDbid);
+ ProcessDefinitionQuery suspended();
ProcessDefinitionQuery orderAsc(String property);
ProcessDefinitionQuery orderDesc(String property);
Modified:
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/ProcessInstanceQuery.java
===================================================================
---
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/ProcessInstanceQuery.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/ProcessInstanceQuery.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -35,6 +35,8 @@
ProcessInstanceQuery processInstanceId(String processInstanceId);
+ ProcessInstanceQuery suspended();
+
ProcessInstanceQuery orderAsc(String property);
ProcessInstanceQuery orderDesc(String property);
Modified:
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/RepositoryService.java
===================================================================
---
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/RepositoryService.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/RepositoryService.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -33,6 +33,8 @@
Deployment createDeployment();
+ void suspendDeployment(long deploymentDbid);
+ void resumeDeployment(long deploymentDbid);
void deleteDeployment(long deploymentDbid);
void deleteDeploymentCascade(long deploymentDbid);
@@ -41,5 +43,4 @@
ProcessDefinitionQuery createProcessDefinitionQuery();
ActivityCoordinates getActivityCoordinates(String processDefinitionId, String
activityName);
-
}
Modified:
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/activity/ActivityExecution.java
===================================================================
---
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/activity/ActivityExecution.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/activity/ActivityExecution.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -23,15 +23,10 @@
import org.jbpm.api.Execution;
import org.jbpm.api.JbpmException;
-import org.jbpm.api.client.ClientProcessDefinition;
-import org.jbpm.api.client.ClientProcessInstance;
-import org.jbpm.api.env.Environment;
import org.jbpm.api.model.Activity;
import org.jbpm.api.model.ObservableElement;
import org.jbpm.api.model.OpenExecution;
import org.jbpm.api.model.Transition;
-import org.jbpm.api.session.PvmDbSession;
-import org.jbpm.api.task.Task;
/** view upon an {@link Execution path of execution} exposed to
@@ -94,7 +89,7 @@
* <p>CAUTION: It's up to the client to make sure
* that this transition makes sense as there is no check whether the given transition
* is an outgoing transition of the current activity. The motivation for that is
- * that in case of superstates, that check can become too 'expensive'.
</p> */
+ * that in case of groups, that check can become too 'expensive'. </p>
*/
void take(Transition transition);
/** let's the given execution take the transition.
@@ -148,7 +143,7 @@
* status.
*
* <p>It is not recommended to use any of
- * {@link #STATE_ACTIVE the defined statuses} as that may case unpredictable
+ * {@link Execution the defined statuses in Execution} as that may case unpredictable
* side effects.</p>
*
* <p>The execution will be removed from it's parent.</p> */
@@ -188,28 +183,8 @@
* an integer and not the named value.*/
void setPriority(int priority);
+ // history methods //////////////////////////////////////////////////////////
- // previous methods /////////////////////////////////////////////////////////
-
- // TODO evaluate the previous methods (JBPM-)
- // these methods are kind of performance optimisations. a sequence and
- // some other specific control flow implementations can be optimised if they
- // have access to the previous activity or transition.
- // Those activities could also be implemented by letting the activities store
- // the contextual information in process variables or some other execution
- // context. But with the previous properties as done now, these control flow
- // activities can be implemented without storing an extra record. It's only a
property
- // that is only updated when the activity configuration indicates that it's
needed.
- // (see also Activity.isPreviousNeeded())
-
- /** returns the previously executed activity only if {@link
Activity#isPreviousNeeded()}
- * is set to true. */
- Activity getPreviousActivity();
-
- /** returns the previously taken transition only if {@link
Activity#isPreviousNeeded()}
- * is set to true. */
- Transition getPreviousTransition();
-
/** record history event that specifies for a decision activity which transition
* has been taken. */
void historyDecision(String transitionName);
Modified:
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/history/HistoryActivityInstanceQuery.java
===================================================================
---
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/history/HistoryActivityInstanceQuery.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/history/HistoryActivityInstanceQuery.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -24,9 +24,7 @@
import java.util.Date;
import java.util.List;
-import org.jbpm.api.task.Task;
-
/**
* @author Tom Baeyens
*/
Modified: jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/identity/User.java
===================================================================
---
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/identity/User.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/identity/User.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -32,5 +32,5 @@
String getGivenName();
String getFamilyName();
- String getEmailAddress();
+ String getBusinessEmail();
}
Modified: jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/job/Job.java
===================================================================
--- jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/job/Job.java 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/job/Job.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -35,8 +35,6 @@
String getLockOwner();
- boolean isSuspended();
-
Date getDueDate();
String getException();
Modified: jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/model/Activity.java
===================================================================
---
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/model/Activity.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/api/src/main/java/org/jbpm/api/model/Activity.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -111,22 +111,8 @@
/** indicates if this activity should be executed
* <a
href="package-summary.html#asynchronouscontinuations">asynchronously</a>.
*/
- boolean isExecutionAsync();
+ boolean isAsync();
- /** indicates if signals should be processed
- * <a
href="package-summary.html#asynchronouscontinuations">asynchronously</a>.
*/
- boolean isSignalAsync();
-
- /** indicates if execution should proceed
- * <a
href="package-summary.html#asynchronouscontinuations">asynchronously</a>
- * when this activity is left over any of the outgoing transitions. */
- boolean isLeaveAsync();
-
- /** indicates if this activity behaviour needs to know
- * {@link Execution#getPreviousActivity() the previous activity} or
- * {@link Execution#getPreviousTransition() previous transition}.
- * If this property is set to true, the properties {@link
Execution#getPreviousActivity()}
- * and {@link Execution#getPreviousTransition()} will be available to the
- * activity behaviour when it is executed or signalled. */
- boolean isPreviousNeeded();
+ /** the type of this activity which corresponds to the xml tag */
+ String getType();
}
\ No newline at end of file
Modified: jbpm4/branches/idm/modules/api/src/main/resources/jpdl-4.0.xsd
===================================================================
--- jbpm4/branches/idm/modules/api/src/main/resources/jpdl-4.0.xsd 2009-05-18 20:49:32 UTC
(rev 4838)
+++ jbpm4/branches/idm/modules/api/src/main/resources/jpdl-4.0.xsd 2009-05-19 07:26:59 UTC
(rev 4839)
@@ -421,9 +421,9 @@
</complexType>
</element>
- <!-- ~~~ SUPER-STATE ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
+ <!-- ~~~ group ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<!--
- <element name="super-state">
+ <element name="group">
<annotation><documentation>Scope enclosing a number of activities.
</documentation></annotation>
<complexType>
Modified: jbpm4/branches/idm/modules/devguide/src/main/docbook/en/master.xml
===================================================================
--- jbpm4/branches/idm/modules/devguide/src/main/docbook/en/master.xml 2009-05-18 20:49:32
UTC (rev 4838)
+++ jbpm4/branches/idm/modules/devguide/src/main/docbook/en/master.xml 2009-05-19 07:26:59
UTC (rev 4839)
@@ -8,6 +8,7 @@
<!ENTITY ch05-ImplementingBasicActivities SYSTEM
"modules/ch05-ImplementingBasicActivities.xml">
<!ENTITY ch06-ProcessAnatomy SYSTEM
"modules/ch06-ProcessAnatomy.xml">
<!ENTITY ch07-ImplementingAdvancedActivities SYSTEM
"modules/ch07-ImplementingAdvancedActivities.xml">
+ <!ENTITY ch08-Persistence SYSTEM
"modules/ch08-Persistence.xml">
<!ENTITY ch10-SoftwareLogging SYSTEM
"modules/ch10-SoftwareLogging.xml">
<!ENTITY ch11-History SYSTEM
"modules/ch11-History.xml">
]>
@@ -27,6 +28,7 @@
&ch05-ImplementingBasicActivities;
&ch06-ProcessAnatomy;
&ch07-ImplementingAdvancedActivities;
+ &ch08-Persistence;
&ch10-SoftwareLogging;
&ch11-History;
Copied:
jbpm4/branches/idm/modules/devguide/src/main/docbook/en/modules/ch08-Persistence.xml (from
rev 4838, jbpm4/trunk/modules/devguide/src/main/docbook/en/modules/ch08-Persistence.xml)
===================================================================
--- jbpm4/branches/idm/modules/devguide/src/main/docbook/en/modules/ch08-Persistence.xml
(rev 0)
+++
jbpm4/branches/idm/modules/devguide/src/main/docbook/en/modules/ch08-Persistence.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,15 @@
+<chapter id="persistence">
+ <title>Persistence</title>
+
+ <para>Currently jBPM's persistence is based on hibernate. But in the future
we might
+ switch to JPA. That is why we recommend to stick with the API as much as possible as
+ the API will hide you from those changes.
+ </para>
+
+ <para>TODO: leveraging the db for managing concurrent access
+ </para>
+ <para>TODO: hibernate-session and the standard transaction
+ </para>
+ <para>TODO: process definition caching
+ </para>
+</chapter>
\ No newline at end of file
Deleted:
jbpm4/branches/idm/modules/devguide/src/main/docbook/en/modules/chxx-Persistence.xml
===================================================================
---
jbpm4/branches/idm/modules/devguide/src/main/docbook/en/modules/chxx-Persistence.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/devguide/src/main/docbook/en/modules/chxx-Persistence.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,267 +0,0 @@
-<chapter id="persistence">
- <title>Persistence</title>
-
- <section>
- <title>Standard environment configuration</title>
- <para>This section describes how the environment can be configured to use
- hibernate in a standard Java environment.
- </para>
- <programlisting>01 | <jbpm-configuration>
-02 |
-03 | <process-engine>
-04 |<emphasis role="bold"> <hibernate-session-factory
/></emphasis>
-05 |<emphasis role="bold">
<hibernate-configuration></emphasis>
-06 |<emphasis role="bold"> <properties
resource="hibernate.properties" /></emphasis>
-07 |<emphasis role="bold"> <mapping
resource="jbpm.pvm.typedefs.hbm.xml" /></emphasis>
-08 |<emphasis role="bold"> <mapping
resource="jbpm.pvm.wire.hbm.xml" /></emphasis>
-09 |<emphasis role="bold"> <mapping
resource="jbpm.pvm.definition.hbm.xml" /></emphasis>
-10 |<emphasis role="bold"> <mapping
resource="jbpm.pvm.execution.hbm.xml" /></emphasis>
-11 |<emphasis role="bold"> <mapping
resource="jbpm.pvm.variable.hbm.xml" /></emphasis>
-12 |<emphasis role="bold"> <mapping
resource="jbpm.pvm.job.hbm.xml" /></emphasis>
-13 |<emphasis role="bold"> <mapping
resource="jbpm.jpdl.hbm.xml" /></emphasis>
-14 |<emphasis role="bold"> <cache-configuration
resource="jbpm.pvm.cache.xml"</emphasis>
-15 |<emphasis role="bold">
usage="nonstrict-read-write" /></emphasis>
-16 |<emphasis role="bold">
</hibernate-configuration></emphasis>
-17 | </process-engine>
-18 |
-19 | <transaction-context>
-20 |<emphasis role="bold"> <standard-transaction
/></emphasis>
-21 |<emphasis role="bold"> <hibernate-session
/></emphasis>
-22 |<emphasis role="bold"> <pvm-db-session
/></emphasis>
-23 | </transaction-context>
-24 |
-25 | </jbpm-configuration></programlisting>
- <para><literal>line 04</literal> specifies a hibernate session
factory in the
- process-engine context. This means that a hibernate session factory is lazy
- created when it is first needed and cached in the
- <literal>EnvironmentFactory</literal>.
- </para>
- <para>A hibernate session factory is build calling the
- method <literal>buildSessionFactory()</literal> on a hibernate
configuration.
- By default, the hibernate configuration will be looked up by type.
- </para>
- <para><literal>line 05</literal> specifies a hibernate
configuration.
- </para>
- <para><literal>line 06</literal> specifies the that the resource
file
- <literal>hibernate.properties</literal> should be loaded into the
configuration.
- </para>
- <para><literal>line 07 - 13</literal> specifies the mapping
resources files.
- </para>
- <para><literal>line 14 - 15</literal> provide a single place to
specify the
- hibernate caching strategy for all the PVM classes and collections.
- </para>
- <para><literal>line 20</literal> specifies a standard transaction.
This is
- a very simple global transaction strategy without recovery that can be used
- in standard environments to get all-or-nothing semantics over multiple
- transactional resources.
- </para>
- <para><literal>line 21</literal> specifies the hibernate session
that will
- automatically register itself with the standard transaction.
- </para>
- <para><literal>line 22</literal> specifies a
<literal>PvmDbSession</literal>.
- That is a class that adds methods that bind to specific queries to be executed
- on the hibernate session.
- </para>
- </section>
-
- <section>
- <title>Standard hibernate configuration</title>
- <para>Here is a set of default properties to configure hibernate with
- hsqldb in a standard Java environment.
- </para>
- <programlisting>hibernate.dialect
org.hibernate.dialect.HSQLDialect
-hibernate.connection.driver_class org.hsqldb.jdbcDriver
-hibernate.connection.url jdbc:hsqldb:mem:.
-hibernate.connection.username sa
-hibernate.connection.password
-hibernate.cache.use_second_level_cache true
-hibernate.cache.provider_class
org.hibernate.cache.HashtableCacheProvider</programlisting>
- <para>Optionally in development the schema export can be used to
- create the schema when the session factory is created and drop the
- schema when the session factory is closed.
- </para>
- <programlisting>hibernate.hbm2ddl.auto
create-drop</programlisting>
- <para>For more information about hibernate configurations, see the hibernate
- reference manual.
- </para>
- </section>
-
- <section>
- <title>Standard transaction</title>
- <para>By default, the <literal><hibernate-session
/></literal> will
- start a hibernate transaction with
<literal>session.beginTransaction()</literal>.
- Then the hibernate transaction is wrapped in a
<literal>org.jbpm.pvm.internal.hibernate.HibernateTransactionResource</literal>
- and that resource is enlisted with the <literal><standard-transaction
/></literal>
- (<literal>org.jbpm.tx.StandardTransaction</literal>)
- </para>
- <para>Inside of the environment block, the transaction is available
- through <literal>environment.getTransaction()</literal>. So inside an
- environment block, the transaction can be rolled back with
- <literal>environment.getTransaction().setRollbackOnly()</literal>
- </para>
- <para>When created, the standard transaction will register itself to be
notified on the
- close of the environment. So in side the close, the standard transaction will
- commit or rollback depending on whether
<literal>setRollbackOnly()</literal>
- was called.
- </para>
- <para>So in the configuration shown above, each environment block will be
- a separate transaction. At least, if the hibernate session is used.</para>
- </section>
-
- <section>
- <title>Basics of process persistence</title>
- <para>In the next example, we'll show how this hibernate persistence is
- used with a concrete example. The 'persistent process' is a simple
- three-step process:
- </para>
- <figure id="the.persistent.process">
- <title>The persistent process</title>
- <mediaobject><imageobject><imagedata align="center"
fileref="images/ch09.persistent.process.png"/></imageobject></mediaobject>
- </figure>
- <para>The activities in the three activities will be wait states just like
- in <xref linkend="externalactivityexample" />
- </para>
- <para>To make sure we can persist this class, we create the hibernate mapping
for
- it and add it to the configuration like this:
- </para>
- <programlisting><hibernate-configuration>
- <properties resource="hibernate.properties" />
- <mapping resource="jbpm.pvm.typedefs.hbm.xml" />
- <mapping resource="jbpm.pvm.wire.hbm.xml" />
- <mapping resource="jbpm.pvm.definition.hbm.xml" />
- <mapping resource="jbpm.pvm.execution.hbm.xml" />
- <mapping resource="jbpm.pvm.variable.hbm.xml" />
- <mapping resource="jbpm.pvm.job.hbm.xml" />
- <mapping resource="jbpm.jpdl.hbm.xml" />
- <emphasis role="bold"><mapping
resource="org/jbpm/examples/ch09/state.hbm.xml" /></emphasis>
- <cache-configuration resource="jbpm.pvm.cache.xml"
- usage="nonstrict-read-write" />
-</hibernate-configuration></programlisting>
- <para>The next code pieces show the contents of one unit test method. The
method
- will first create the environment factory. Then, in a first transaction, a process
- definition will be created and saved into the database. Then the next transaction
will
- create a new execution of that process. And the following two transactions will
- provide external triggers to the execution.
- </para>
- <programlisting>EnvironmentFactory environmentFactory =
EnvironmentFactory.parse(new ResourceStreamSource(
- "org/jbpm/examples/ch09/environment.cfg.xml"
-));</programlisting>
- <para>Then in a first transaction, a process is created and saved in the
database.
- This is typically referred to as deploying a process and it only needs to be done
- once.
- </para>
- <programlisting>Environment environment =
environmentFactory.openEnvironment();
-try {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
-
- ProcessDefinition processDefinition = ProcessFactory.build("persisted
process")
- .activity("one").initial().behaviour(new State())
- .transition().to("two")
- .activity("two").behaviour(new State())
- .transition().to("three")
- .activity("three").behaviour(new State())
- .done();
-
- pvmDbSession.save(processDefinition);
-} finally {
- environment.close();
-}</programlisting>
- <para>In the previous transaction, the process definition, the activities and
transitions
- will be inserted into the database tables.
- </para>
- <para>Next we'll show how a new process execution can be started for this
- process definition. Note that in this case, we provide <link
linkend="businesskey">a
- business key</link> called 'first'. This will make it easy for us to
retrieve
- the same execution from the database in subsequent transactions. After starting
- the new process execution, it will wait in activity 'one' cause the behaviour
is a
- wait state.
- </para>
- <programlisting>environment = environmentFactory.openEnvironment();
-try {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
-
- ProcessDefinition processDefinition =
pvmDbSession.findProcessDefinition("persisted process");
- assertNotNull(processDefinition);
-
- Execution execution = processDefinition.startExecution("first");
- assertEquals("one", execution.getActivity().getName());
- pvmDbSession.save(execution);
-
-} finally {
- environment.close();
-}</programlisting>
- <para>In the previous transaction, a new execution record will be inserted into
- the database.
- </para>
- <para>Next we feed in an external trigger into this existing process
execution.
- We load the execution, provide a signal and just save it back into the database.
- </para>
- <programlisting>environment = environmentFactory.openEnvironment();
-try {
- PvmDbSession pvmDbSession = environment.get(PvmDbSession.class);
-
- Execution execution = pvmDbSession.findExecution("persisted process",
"first");
- assertNotNull(execution);
- assertEquals("one", execution.getActivity().getName());
-
- // external trigger that will cause the execution to execute until
- // it reaches the next wait state
- execution.signal();
-
- assertEquals("two", execution.getActivity().getName());
-
- pvmDbSession.save(execution);
-
-} finally {
- environment.close();
-}</programlisting>
- <para>The previous transaction will result in an update of the existing
- execution, reassigning the foreign key to reference another record in
- the activity table.
- </para>
- <programlisting>UPDATE JBPM_EXECUTION
-SET
- NODE_=?,
- DBVERSION_=?,
- ...
-WHERE DBID_=?
- AND DBVERSION_=?</programlisting>
- <para>The version in this SQL shows the automatic optimistic locking that
- is baked into the PVM persistence so that process persistence can easily
- scale to multiple JVM's or multiple machines.
- </para>
- <para>In the example code, there is one more transaction that is
- completely similar to the previous which takes the execution from
- activity 'two' to activity 'three'.
- </para>
- <para>All of this shows that the PVM can move from one wait state to
- another wait state transactionally. Each transaction correcponds to
- a state transition.
- </para>
- <para>Note that in case of automatic activities, multiple activities
- will be executed before the execution reaches a wait state. Typically
- that is desired behaviour. In case the automatic activities take too
- long or you don't want to block the original transaction to wait for
- the completion of those automatic activities, check out <xref
linkend="asynchronouscontinuations"/>
- to learn about how it's possible to demarcate transactions in the process
- definition, which can also be seen as safe-points during process execution.
- </para>
- </section>
-
- <section id="businesskey">
- <title>Business key</title>
- <para>TODO</para>
- </section>
-
-
- <para>TODO: General persistence architecture
- </para>
- <para>TODO: Object references
- </para>
- <para>TODO: Threads, concurrency with respect to forks and joins
- </para>
- <para>TODO: Caching
- </para>
- <para>TODO: Process instance migration
- </para>
-</chapter>
\ No newline at end of file
Modified: jbpm4/branches/idm/modules/distro/pom.xml
===================================================================
--- jbpm4/branches/idm/modules/distro/pom.xml 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/distro/pom.xml 2009-05-19 07:26:59 UTC (rev 4839)
@@ -45,23 +45,14 @@
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-console-integration</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-console-form-plugin</artifactId>
- <version>${version}</version>
</dependency>
- <dependency>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-console-integration</artifactId>
- <classifier>config</classifier>
- <version>${version}</version>
- </dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-jboss4</artifactId>
- <version>${version}</version>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
Modified: jbpm4/branches/idm/modules/distro/src/main/files/db/build.xml
===================================================================
--- jbpm4/branches/idm/modules/distro/src/main/files/db/build.xml 2009-05-18 20:49:32 UTC
(rev 4838)
+++ jbpm4/branches/idm/modules/distro/src/main/files/db/build.xml 2009-05-19 07:26:59 UTC
(rev 4839)
@@ -5,16 +5,16 @@
<!-- DEVELOPER SPECIFIC CONFIGURATIONS -->
<property file="${user.home}/.jbpm4/build.properties" />
- <!-- JDBC PROPERTIES -->
- <property file="${user.home}/jdbc/${database}.properties" />
- <property file="${jbpm.home}/db/jdbc/${database}.properties" />
-
<!-- DEFAULT PROPERTY VALUES -->
<property name="database" value="hsqldb" />
<property name="jbpm.parent.dir" value="../.." />
<property name="jbpm.version" value="4.0.0-SNAPSHOT" />
<property name="jbpm.home"
value="${jbpm.parent.dir}/jbpm-${jbpm.version}" />
+ <!-- JDBC PROPERTIES -->
+ <property file="${user.home}/.jbpm4/jdbc/${database}.properties" />
+ <property file="${jbpm.home}/db/jdbc/${database}.properties" />
+
<!-- ### LOG PROPERTIES ################################################# -->
<target name="log.properties">
<echo message="database....... ${database}" />
Modified: jbpm4/branches/idm/modules/distro/src/main/files/db/example.identities.sql
===================================================================
--- jbpm4/branches/idm/modules/distro/src/main/files/db/example.identities.sql 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/distro/src/main/files/db/example.identities.sql 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,17 +1,16 @@
-INSERT INTO JBPM_ID_GROUP VALUES
(1,0,'manager','manager','security-role',NULL);
-INSERT INTO JBPM_ID_GROUP VALUES
(2,0,'administrator','administrator','security-role',NULL);
-INSERT INTO JBPM_ID_GROUP VALUES
(3,0,'user','user','security-role',NULL);
-INSERT INTO JBPM_ID_GROUP VALUES(4,0,'sales','sales',NULL,NULL);
+INSERT INTO JBPM4_ID_GROUP VALUES
(1,0,'manager','manager','security-role',NULL);
+INSERT INTO JBPM4_ID_GROUP VALUES
(2,0,'administrator','administrator','security-role',NULL);
+INSERT INTO JBPM4_ID_GROUP VALUES
(3,0,'user','user','security-role',NULL);
+INSERT INTO JBPM4_ID_GROUP VALUES(4,0,'sales','sales',NULL,NULL);
-INSERT INTO JBPM_ID_USER VALUES (1,0,'alex','password','Administrator
Login','');
-INSERT INTO JBPM_ID_USER VALUES (2,0,'mike','password','Managers
Login','');
-INSERT INTO JBPM_ID_USER VALUES (3,0,'peter','password','Users
Login','');
-INSERT INTO JBPM_ID_USER VALUES (4,0,'mary','password','Users
Login','');
+INSERT INTO JBPM4_ID_USER VALUES
(1,0,'alex','password','Alex',NULL,'alex(a)jbpm.org');
+INSERT INTO JBPM4_ID_USER VALUES
(2,0,'mike','password','Mike',NULL,'mike(a)jbpm.org');
+INSERT INTO JBPM4_ID_USER VALUES
(3,0,'peter','password','Peter',NULL,'peter(a)jbpm.org');
+INSERT INTO JBPM4_ID_USER VALUES
(4,0,'mary','password','Mary',NULL,'mary(a)jbpm.org');
-INSERT INTO JBPM_ID_MEMBERSHIP VALUES (1,0,1,2,NULL);
-INSERT INTO JBPM_ID_MEMBERSHIP VALUES (2,0,2,1,NULL);
-INSERT INTO JBPM_ID_MEMBERSHIP VALUES (3,0,3,3,NULL);
-INSERT INTO JBPM_ID_MEMBERSHIP VALUES (4,0,3,4,NULL);
-INSERT INTO JBPM_ID_MEMBERSHIP VALUES (5,0,4,3,NULL);
-INSERT INTO JBPM_ID_MEMBERSHIP VALUES (6,0,4,4,NULL);
-
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (1,0,1,2,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (2,0,2,1,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (3,0,3,3,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (4,0,3,4,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (5,0,4,3,NULL);
+INSERT INTO JBPM4_ID_MEMBERSHIP VALUES (6,0,4,4,NULL);
Modified:
jbpm4/branches/idm/modules/distro/src/main/files/db/hibernate.cfg/oracle.hibernate.cfg.xml
===================================================================
---
jbpm4/branches/idm/modules/distro/src/main/files/db/hibernate.cfg/oracle.hibernate.cfg.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/distro/src/main/files/db/hibernate.cfg/oracle.hibernate.cfg.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -7,7 +7,7 @@
<hibernate-configuration>
<session-factory>
- <property
name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
+ <property
name="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</property>
<property
name="hibernate.connection.driver_class">@jdbc.driver(a)</property>
<property
name="hibernate.connection.url">@jdbc.url(a)</property>
<property
name="hibernate.connection.username">@jdbc.username(a)</property>
Modified: jbpm4/branches/idm/modules/distro/src/main/files/examples/build.xml
===================================================================
--- jbpm4/branches/idm/modules/distro/src/main/files/examples/build.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/distro/src/main/files/examples/build.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -5,10 +5,6 @@
<!-- DEVELOPER SPECIFIC CONFIGURATIONS -->
<property file="${user.home}/.jbpm4/build.properties" />
- <!-- JDBC PROPERTIES -->
- <property file="${user.home}/jdbc/${database}.properties" />
- <property file="${jbpm.home}/db/jdbc/${database}.properties" />
-
<!-- DEFAULT PROPERTY VALUES -->
<property name="database" value="hsqldb" />
<property name="jbpm.parent.dir" value="../.." />
@@ -16,7 +12,11 @@
<property name="jboss.version" value="5.0.0.GA" />
<property name="jbpm.home"
value="${jbpm.parent.dir}/jbpm-${jbpm.version}" />
- <!-- ### LOG PROPERTIES ################################################# -->
+ <!-- JDBC PROPERTIES -->
+ <property file="${user.home}/.jbpm4/jdbc/${database}.properties" />
+ <property file="${jbpm.home}/db/jdbc/${database}.properties" />
+
+ <!-- ### LOG PROPERTIES ################################################# -->
<target name="log.properties">
<echo message="database: ${database}" />
<echo message="jdbc.driver........ ${jdbc.driver}" />
@@ -25,10 +25,8 @@
<echo message="jbpm.version....... ${jbpm.version}" />
<echo message="jbpm.home.......... ${jbpm.home}" />
</target>
-
- <!-- ### DEPLOY EXAMPLE BUSINESS ARCHIVES ############################### -->
- <target name="deploy.examples"
- description="deploys all the example processes">
+
+ <target name="jbpm.libs.path">
<path id="jbpm.libs.incl.dependencies">
<pathelement location="${jbpm.home}/examples/target/classes" />
<fileset dir="${jbpm.home}">
@@ -36,15 +34,13 @@
</fileset>
<fileset dir="${jbpm.home}/lib" />
</path>
- <mkdir dir="${jbpm.home}/examples/target/classes" />
- <javac srcdir="${jbpm.home}/examples/src"
- destdir="${jbpm.home}/examples/target/classes"
- classpathref="jbpm.libs.incl.dependencies" />
- <copy todir="${jbpm.home}/examples/target/classes">
- <fileset dir="${jbpm.home}/examples/src">
- <exclude name="**/*.java" />
- </fileset>
- </copy>
+ </target>
+
+ <!-- ### DEPLOY EXAMPLE BUSINESS ARCHIVES ############################### -->
+ <target name="deploy.examples"
+ description="deploys all the example processes"
+ depends="jbpm.libs.path">
+ <mkdir dir="${jbpm.home}/examples/target" />
<copy file="${jbpm.home}/db/hibernate.cfg/${database}.hibernate.cfg.xml"
tofile="${jbpm.home}/examples/target/classes/jbpm.hibernate.cfg.xml"
overwrite="true">
@@ -53,6 +49,22 @@
<jar destfile="${jbpm.home}/examples/target/examples.bar">
<fileset dir="${jbpm.home}/examples/src">
<include name="**/*.jpdl.xml" />
+ <exclude name="org/jbpm/examples/task/swimlane/process.jpdl.xml"
/>
+ <exclude name="org/jbpm/examples/task/candidates/process.jpdl.xml"
/>
+ <exclude
name="org/jbpm/examples/concurrency/graphbased/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/timer/repeat/process.jpdl.xml"
/>
+ <exclude name="org/jbpm/examples/esb/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/script/text/process.jpdl.xml"
/>
+ <exclude name="org/jbpm/examples/decision/handler/process.jpdl.xml"
/>
+ <exclude name="org/jbpm/examples/mail/template/process.jpdl.xml"
/>
+ <exclude name="org/jbpm/examples/script/expression/process.jpdl.xml"
/>
+ <exclude name="org/jbpm/examples/task/assignee/process.jpdl.xml"
/>
+ <exclude name="org/jbpm/examples/mail/inline/process.jpdl.xml"
/>
+ <exclude name="org/jbpm/examples/mail/template/process.jpdl.xml"
/>
+ <exclude name="org/jbpm/examples/eventlistener/process.jpdl.xml"
/>
+ <exclude name="org/jbpm/examples/timer/event/process.jpdl.xml"
/>
+ <exclude
name="org/jbpm/examples/task/assignmenthandler/process.jpdl.xml" />
+ <exclude name="org/jbpm/examples/java/JavaInstantiateTest.java"
/>
</fileset>
</jar>
<taskdef name="jbpm-deploy"
@@ -60,5 +72,22 @@
classpathref="jbpm.libs.incl.dependencies" />
<jbpm-deploy file="${jbpm.home}/examples/target/examples.bar" />
</target>
+
+ <target name="examples.jar" depends="jbpm.libs.path">
+ <mkdir dir="${jbpm.home}/examples/target/classes" />
+ <javac srcdir="${jbpm.home}/examples/src"
+ destdir="${jbpm.home}/examples/target/classes"
+ classpathref="jbpm.libs.incl.dependencies" />
+ <copy todir="${jbpm.home}/examples/target/classes">
+ <fileset dir="${jbpm.home}/examples/src">
+ <exclude name="**/*.java" />
+ </fileset>
+ </copy>
+ <jar destfile="${jbpm.home}/examples/target/examples.jar" >
+ <fileset dir="${jbpm.home}/examples/target/classes">
+ <include name="**/*.class" />
+ </fileset>
+ </jar>
+ </target>
</project>
Modified: jbpm4/branches/idm/modules/distro/src/main/files/gpd/build.xml
===================================================================
--- jbpm4/branches/idm/modules/distro/src/main/files/gpd/build.xml 2009-05-18 20:49:32 UTC
(rev 4838)
+++ jbpm4/branches/idm/modules/distro/src/main/files/gpd/build.xml 2009-05-19 07:26:59 UTC
(rev 4839)
@@ -36,6 +36,7 @@
<target name="get.eclipse"
unless="is.eclipse.distro.available"
description="downloads eclipse to ${eclipse.distro.dir}">
+ <mkdir dir="${eclipse.distro.dir}" />
<get src="${eclipse.distro.url}" dest="${eclipse.distro.path}"
/>
</target>
Modified: jbpm4/branches/idm/modules/distro/src/main/files/jboss/build.xml
===================================================================
--- jbpm4/branches/idm/modules/distro/src/main/files/jboss/build.xml 2009-05-18 20:49:32
UTC (rev 4838)
+++ jbpm4/branches/idm/modules/distro/src/main/files/jboss/build.xml 2009-05-19 07:26:59
UTC (rev 4839)
@@ -5,10 +5,6 @@
<!-- DEVELOPER SPECIFIC CONFIGURATIONS -->
<property file="${user.home}/.jbpm4/build.properties" />
- <!-- JDBC PROPERTIES -->
- <property file="${user.home}/jdbc/${database}.properties" />
- <property file="${jbpm.home}/jdbc/${database}.properties" />
-
<!-- DEFAULT PROPERTY VALUES -->
<property name="database" value="hsqldb" />
<property name="identity.component" value="jbpm-built-in" />
@@ -26,6 +22,10 @@
<property name="jboss.server.configuration" value="default"
/>
<property name="jboss.server.config.dir"
value="${jboss.home}/server/${jboss.server.configuration}" />
+ <!-- JDBC PROPERTIES -->
+ <property file="${user.home}/.jbpm4/jdbc/${database}.properties" />
+ <property file="${jbpm.home}/db/jdbc/${database}.properties" />
+
<!-- ### LOG PROPERTIES ################################################# -->
<target name="log.properties">
<echo message="database.................... ${database}" />
@@ -45,9 +45,27 @@
<equals arg1="${jboss.version}" arg2="5.0.0.GA" />
<equals arg1="${jboss.version}" arg2="5.0.1.GA" />
<equals arg1="${jboss.version}" arg2="5.1.0.GA" />
+ <equals arg1="${jboss.version}" arg2="5.1.0.CR1" />
</or>
</condition>
+ <!-- ### DEMO SETUP ##################################################### -->
+ <target name="demo.setup"
+ depends="install.jboss, install.jbpm.into.jboss, start.jboss"
+ description="installs jboss, installs jbpm into jboss, starts jboss,
creates the jBPM DB schema, deploys examples, loads example identities, installs and
starts eclipse">
+ <ant antfile="${jbpm.home}/db/build.xml"
target="create.jbpm.schema" />
+ <ant antfile="${jbpm.home}/examples/build.xml"
target="deploy.examples" />
+ <ant antfile="${jbpm.home}/db/build.xml"
target="load.example.identities" />
+ <ant antfile="${jbpm.home}/gpd/build.xml"
target="install.eclipse" />
+ <ant antfile="${jbpm.home}/gpd/build.xml"
target="start.eclipse" />
+ </target>
+
+ <target name="demo.teardown"
+ description="drops the jbpm db schema and stops jboss">
+ <ant antfile="${jbpm.home}/db/build.xml"
target="drop.jbpm.schema" />
+ <antcall target="stop.jboss" />
+ </target>
+
<!-- ### REINSTALL JBOSS ################################################ -->
<target name="reinstall.jboss"
depends="log.properties, delete.jboss.installation, install.jboss"
@@ -76,6 +94,7 @@
<target name="get.jboss"
unless="is.jboss.distro.available"
description="downloads jboss into ${jboss.distro.dir}">
+ <mkdir dir="${jboss.distro.dir}" />
<get src="${jboss.distro.url}" dest="${jboss.distro.path}"
/>
</target>
@@ -167,7 +186,18 @@
</fileset>
</copy>
</target>
-
+
+ <!-- ### THE JBOSS INTEGRATION TEST SPECIFICS ####################### -->
+ <target
name="internal.install.jbpm.into.jboss.integrationtestspecifics">
+ <copy todir="${jboss.server.config.dir}/deploy/jbpm/jbpm-service.sar"
overwrite="true">
+ <fileset dir="${jbpm.home}/jboss/jbpm.cfg.integration.tests" />
+ </copy>
+ <ant antfile="${jbpm.home}/examples/build.xml"
target="examples.jar" />
+ <mkdir dir="${jboss.server.config.dir}/deploy/jbpm/userlibs" />
+ <copy file="${jbpm.home}/examples/target/examples.jar"
+ todir="${jboss.server.config.dir}/deploy/jbpm/userlibs" />
+ </target>
+
<!-- ### THE HSQLDB SPECIFIC PART ####################################### -->
<target name="internal.install.jbpm.into.jboss.db.hsqldb" />
Modified:
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-enterprise.jar/META-INF/jbosscmp-jdbc.xml
===================================================================
---
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-enterprise.jar/META-INF/jbosscmp-jdbc.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-enterprise.jar/META-INF/jbosscmp-jdbc.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -11,7 +11,7 @@
<enterprise-beans>
<entity>
<ejb-name>Timer</ejb-name>
- <table-name>JBPM_JOB</table-name>
+ <table-name>JBPM4_JOB</table-name>
<cmp-field>
<field-name>dbid</field-name>
<column-name>DBID_</column-name>
Modified:
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/META-INF/jboss-service.xml
===================================================================
---
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/META-INF/jboss-service.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/META-INF/jboss-service.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -14,9 +14,9 @@
<!-- Authenticate against the Identiy database -->
<jaas:login-module
code="org.jboss.security.auth.spi.DatabaseServerLoginModule"
flag="required">
<jaas:module-option
name="dsJndiName">java:/JbpmDS</jaas:module-option>
- <jaas:module-option name="principalsQuery"> SELECT
PASSWORD_ FROM JBPM_ID_USER WHERE ID_=? </jaas:module-option>
+ <jaas:module-option name="principalsQuery"> SELECT
PASSWORD_ FROM JBPM4_ID_USER WHERE ID_=? </jaas:module-option>
<jaas:module-option name="rolesQuery">
- SELECT g.NAME_ ,'Roles' FROM JBPM_ID_USER u, JBPM_ID_MEMBERSHIP
m, JBPM_ID_GROUP g
+ SELECT g.NAME_ ,'Roles' FROM JBPM4_ID_USER u, JBPM4_ID_MEMBERSHIP
m, JBPM4_ID_GROUP g
WHERE g.TYPE_='security-role' AND m.GROUP_ = g.DBID_ AND m.USER_
= u.DBID_ AND u.ID_=? </jaas:module-option>
</jaas:login-module>
</jaas:authentication>
Deleted:
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml
===================================================================
---
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<jbpm-configuration>
-
- <import resource="jbpm.default.cfg.xml" />
- <import resource="jbpm.tx.jta.cfg.xml" />
- <import resource="jbpm.jpdl.cfg.xml" />
- <import resource="jbpm.identity.cfg.xml" />
-
-</jbpm-configuration>
Copied:
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml
(from rev 4838,
jbpm4/trunk/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml)
===================================================================
---
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml
(rev 0)
+++
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.cfg.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <import resource="jbpm.default.cfg.xml" />
+ <import resource="jbpm.tx.jta.cfg.xml" />
+ <import resource="jbpm.jpdl.cfg.xml" />
+ <import resource="jbpm.identity.cfg.xml" />
+
+ <import resource="jbpm.jobexecutor.cfg.xml" />
+
+</jbpm-configuration>
Copied:
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.mail.properties
(from rev 4838,
jbpm4/trunk/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.mail.properties)
===================================================================
---
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.mail.properties
(rev 0)
+++
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.common/deploy/jbpm/jbpm-service.sar/jbpm.mail.properties 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,3 @@
+mail.smtp.host=localhost
+mail.smtp.port=25
+mail.from=noreply(a)jbpm.org
Modified:
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.jboss5/conf/bootstrap/deployers.xml
===================================================================
---
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.jboss5/conf/bootstrap/deployers.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.jboss5/conf/bootstrap/deployers.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -102,7 +102,7 @@
<value>.spring</value>
<value>.rails</value>
<value>.esb</value>
- <value>.jpdl</value>
+ <value>.bar</value>
</set>
</parameter>
</constructor>
Modified:
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.jboss5/deployers/jbpm.deployer/META-INF/jbpm-deployers-jboss-beans.xml
===================================================================
---
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.jboss5/deployers/jbpm.deployer/META-INF/jbpm-deployers-jboss-beans.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/distro/src/main/files/jboss/config.jboss5/deployers/jbpm.deployer/META-INF/jbpm-deployers-jboss-beans.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -28,7 +28,7 @@
<property name="suffix">.jpdl.xml</property>
<!-- Move to .par when
https://jira.jboss.org/jira/browse/JBAS-6274 is done
-->
- <property name="jarExtension">jpdl</property>
+ <property name="jarExtension">bar</property>
<property name="allowMultipleFiles">true</property>
Modified:
jbpm4/branches/idm/modules/distro/src/main/files/jboss/hibernate.cfg/oracle.hibernate.cfg.xml
===================================================================
---
jbpm4/branches/idm/modules/distro/src/main/files/jboss/hibernate.cfg/oracle.hibernate.cfg.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/distro/src/main/files/jboss/hibernate.cfg/oracle.hibernate.cfg.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -7,7 +7,7 @@
<hibernate-configuration>
<session-factory>
- <property
name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
+ <property
name="hibernate.dialect">org.hibernate.dialect.Oracle9iDialect</property>
<property
name="hibernate.connection.datasource">java:JbpmDS</property>
<property
name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
<property
name="hibernate.transaction.manager_lookup_class">org.hibernate.transaction.JBossTransactionManagerLookup</property>
Modified:
jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml
===================================================================
---
jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.cfg.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -7,18 +7,10 @@
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
+ <import resource="jbpm.mail.templates.examples.xml" />
+
<!-- Job executor is excluded for running the example test cases.
To enable timers and messages in production use, this should be included.
import resource="jbpm.jobexecutor.cfg.xml" / -->
- <process-engine-context>
-
- <mail-template name="MemoTemplate">
- <to addresses='dilbert@office, alice@work, dogbert@house' />
- <subject>bureaucracy</subject>
- <text>Order
http://example.com/order/#{orderId} is stalled.</text>
- </mail-template>
-
- </process-engine-context>
-
</jbpm-configuration>
Copied:
jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties
(from rev 4838,
jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties)
===================================================================
---
jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties
(rev 0)
+++
jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.properties 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,3 @@
+mail.smtp.host localhost
+mail.smtp.port 2525
+mail.from noreply(a)jbpm.org
\ No newline at end of file
Copied:
jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml
(from rev 4838,
jbpm4/trunk/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml)
===================================================================
---
jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml
(rev 0)
+++
jbpm4/branches/idm/modules/distro/src/main/files/jboss/jbpm.cfg.integration.tests/jbpm.mail.templates.examples.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <process-engine-context>
+
+ <mail-template name="rectify template">
+ <to addresses="${addressee}" />
+ <cc users="bb" groups="innerparty" />
+ <bcc groups="thinkpol" />
+ <subject>rectify ${newspaper}</subject>
+ <text>${newspaper} ${date} ${details}</text>
+ </mail-template>
+
+ </process-engine-context>
+
+</jbpm-configuration>
\ No newline at end of file
Modified: jbpm4/branches/idm/modules/enterprise/pom.xml
===================================================================
--- jbpm4/branches/idm/modules/enterprise/pom.xml 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/enterprise/pom.xml 2009-05-19 07:26:59 UTC (rev 4839)
@@ -81,7 +81,17 @@
<!-- Plugins -->
<build>
-
+ <plugins>
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skipTests>true</skipTests>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+<!--
<testResources>
<testResource>
<directory>src/test/resources</directory>
@@ -169,4 +179,5 @@
</profiles>
+ -->
</project>
\ No newline at end of file
Modified:
jbpm4/branches/idm/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java
===================================================================
---
jbpm4/branches/idm/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/EjbTimerSessionTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -82,10 +82,10 @@
.endProcess();
// deploy process
- environment.get(RepositoryService.class)
- .createDeployment()
- .addProcessDefinition(processDefinition)
- .deploy();
+// environment.get(RepositoryService.class)
+// .createDeployment()
+// .addProcessDefinition(processDefinition)
+// .deploy();
processDefinitionId = processDefinition.getId();
}
Modified:
jbpm4/branches/idm/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java
===================================================================
---
jbpm4/branches/idm/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/enterprise/src/test/java/org/jbpm/enterprise/internal/ejb/TimerTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -130,10 +130,10 @@
public void testHappyTimer() throws CreateException {
// deploy process
listenerDescriptor.setClassName(HappyListener.class.getName());
- environment.get(RepositoryService.class)
- .createDeployment()
- .addProcessDefinition(processDefinition)
- .deploy();
+// environment.get(RepositoryService.class)
+// .createDeployment()
+// .addProcessDefinition(processDefinition)
+// .deploy();
// start execution
Execution execution =
environment.get(ExecutionService.class).startProcessInstanceById(
@@ -175,10 +175,10 @@
public void testNoisyTimer() throws CreateException {
// deploy process
listenerDescriptor.setClassName(NoisyListener.class.getName());
- environment.get(RepositoryService.class)
- .createDeployment()
- .addProcessDefinition(processDefinition)
- .deploy();
+// environment.get(RepositoryService.class)
+// .createDeployment()
+// .addProcessDefinition(processDefinition)
+// .deploy();
// start execution
ExecutionService executionService = environment.get(ExecutionService.class);
@@ -228,10 +228,10 @@
public void testCyclicTimer() throws CreateException {
// deploy process
listenerDescriptor.setClassName(HappyListener.class.getName());
- environment.get(RepositoryService.class)
- .createDeployment()
- .addProcessDefinition(processDefinition)
- .deploy();
+// environment.get(RepositoryService.class)
+// .createDeployment()
+// .addProcessDefinition(processDefinition)
+// .deploy();
// start execution
ExecutionImpl execution = (ExecutionImpl) environment.get(ExecutionService.class)
Modified: jbpm4/branches/idm/modules/examples/pom.xml
===================================================================
--- jbpm4/branches/idm/modules/examples/pom.xml 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/examples/pom.xml 2009-05-19 07:26:59 UTC (rev 4839)
@@ -98,12 +98,24 @@
</goals>
<configuration>
<tasks>
- <copy todir="target/test-classes"
overwrite="true" failonerror="false">
- <fileset dir="../../qa/db/${database}" />
+ <copy file="../../qa/jdbc/${database}.properties"
+ tofile="target/jdbc.properties" />
+ <copy
file="${user.home}/.jbpm4/jdbc/${database}.properties"
+ tofile="target/jdbc.properties"
+ overwrite="true"
+ failonerror="true "/>
+ <copy
file="../../modules/distro/src/main/files/db/hibernate.cfg/${database}.hibernate.cfg.xml"
+ tofile="target/test-classes/jbpm.hibernate.cfg.xml"
+ overwrite="true">
+ <filterset>
+ <filtersfile file="target/jdbc.properties" />
+ </filterset>
</copy>
- <copy todir="target/test-classes"
overwrite="true" failonerror="false">
- <fileset dir="${user.home}/.jbpm4/qa/db/${database}"
/>
- </copy>
+ <replace
file="target/test-classes/jbpm.hibernate.cfg.xml">
+ <replacetoken><![CDATA[<property
name="hibernate.format_sql">true</property>]]></replacetoken>
+ <replacevalue><![CDATA[<property
name="hibernate.format_sql">true</property>
+ <property
name="hibernate.hbm2ddl.auto">create-drop</property>]]></replacevalue>
+ </replace>
</tasks>
</configuration>
</execution>
@@ -160,7 +172,7 @@
<fileset
dir="../distro/src/main/files/jboss/jbpm.cfg.remote.client" />
</copy>
<copy todir="target/test-classes"
overwrite="true" failonerror="false">
- <fileset
dir="${user.home}/.jbpm4/qa/jbpm.cfg.remote.client" />
+ <fileset
dir="${user.home}/.jbpm4/jbpm.cfg.remote.client" />
</copy>
</tasks>
</configuration>
@@ -177,21 +189,12 @@
<!--
https://jira.jboss.org/jira/browse/JBPM-2147 -->
<!--
https://jira.jboss.org/jira/browse/JBPM-2200 -->
<exclude>org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java</exclude>
+
<exclude>org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java</exclude>
<exclude>org/jbpm/examples/task/candidates/TaskCandidatesTest.java</exclude>
-
<exclude>org/jbpm/examples/concurrency/graphbased/ConcurrencyGraphBasedTest.java</exclude>
-
<exclude>org/jbpm/examples/timer/repeat/TimerRepeatTest.java</exclude>
<exclude>org/jbpm/examples/esb/EsbTest.java</exclude>
-
<exclude>org/jbpm/examples/script/text/ScriptTextTest.java</exclude>
-
<exclude>org/jbpm/examples/decision/handler/DecisionHandlerTest.java</exclude>
<exclude>org/jbpm/examples/mail/template/TemplateMailTest.java</exclude>
-
<exclude>org/jbpm/examples/script/expression/ScriptExpressionTest.java</exclude>
-
<exclude>org/jbpm/examples/task/assignee/TaskAssigneeTest.java</exclude>
<exclude>org/jbpm/examples/mail/inline/InlineMailTest.java</exclude>
-
<exclude>org/jbpm/examples/mail/template/TemplateMailTest.java</exclude>
<exclude>org/jbpm/examples/eventlistener/EventListenerTest.java</exclude>
-
<exclude>org/jbpm/examples/timer/event/TimerEventTest.java</exclude>
-
<exclude>org/jbpm/examples/task/assignmenthandler/TaskAssignmentHandlerTest.java</exclude>
- <exclude>**/JavaInstantiateTest.java</exclude>
</excludes>
</configuration>
</plugin>
Modified:
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/mail/inline/InlineMailTest.java
===================================================================
---
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/mail/inline/InlineMailTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/mail/inline/InlineMailTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -23,9 +23,11 @@
import java.io.IOException;
import java.util.Arrays;
-import java.util.Collections;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
import java.util.List;
-import java.util.Random;
+import java.util.Map;
import javax.mail.Address;
import javax.mail.Message;
@@ -44,40 +46,80 @@
protected void setUp() throws Exception {
super.setUp();
- long deploymentDbid = repositoryService.createDeployment().addResourceFromClasspath(
- "org/jbpm/examples/mail/inline/process.jpdl.xml").deploy();
+
+ // deploy process
+ long deploymentDbid = repositoryService.createDeployment()
+
.addResourceFromClasspath("org/jbpm/examples/mail/inline/process.jpdl.xml")
+ .deploy();
registerDeployment(deploymentDbid);
+
+ // create actors
+ identityService.createUser("bb", "Big Brother", null,
"bb@oceania");
+ identityService.createUser("obrien", null, "O'Brien",
"obrien@miniluv");
+ identityService.createUser("charr", null, "Charrington",
"charr@miniluv");
+ identityService.createGroup("thinkpol");
+ identityService.createGroup("innerparty");
+ identityService.createMembership("obrien", "innerparty");
+ identityService.createMembership("charr", "thinkpol");
+ identityService.createMembership("obrien", "thinkpol");
}
+ protected void tearDown() throws Exception {
+ // delete actors
+ identityService.deleteGroup("thinkpol");
+ identityService.deleteGroup("innerparty");
+ identityService.deleteUser("bb");
+ identityService.deleteUser("obrien");
+ identityService.deleteUser("charr");
+
+ super.tearDown();
+ }
+
public void testInlineMail() throws MessagingException, IOException {
Wiser wiser = new Wiser();
- wiser.setPort(2525); // default is 25, but has security restrictions
+ wiser.setPort(2525);
wiser.start();
try {
+ // prepare dynamic values
+ String newspaper = "times";
+ Calendar calendar = Calendar.getInstance();
+ calendar.clear();
+ calendar.set(1983, Calendar.DECEMBER, 3);
+ Date date = calendar.getTime();
+ // assemble variables
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("newspaper", newspaper);
+ variables.put("date", date);
// start process instance
- Object orderId = new Random().nextInt(1000) + 1;
- executionService.startProcessInstanceByKey("InlineMail",
Collections.singletonMap("orderId",
- orderId));
+ executionService.startProcessInstanceByKey("InlineMail", variables);
// examine produced message
- List<WiserMessage> wiserMessages = wiser.getMessages();
- assertEquals(3, wiserMessages.size());
+ List<WiserMessage> wisMessages = wiser.getMessages();
+ // winston, bb, innerparty(obrien), thinkpol(charr, obrien)
+ assertEquals(5, wisMessages.size());
- for (WiserMessage wiserMessage : wiserMessages) {
- Message message = wiserMessage.getMimeMessage();
+ for (WiserMessage wisMessage : wisMessages) {
+ Message message = wisMessage.getMimeMessage();
// from
Address[] from = message.getFrom();
assertEquals(1, from.length);
assertEquals("noreply(a)jbpm.org", from[0].toString());
// to
- Address[] expectedTo = InternetAddress.parse("dilbert@office, alice@work,
dogbert@house");
+ Address[] expectedTo = InternetAddress.parse("winston@minitrue");
Address[] to = message.getRecipients(RecipientType.TO);
- assert Arrays.equals(expectedTo, to) : to;
+ assert Arrays.equals(expectedTo, to) : Arrays.asList(to);
+ // cc
+ Address[] expectedCc = InternetAddress.parse("bb@oceania,
obrien@miniluv");
+ System.out.println(Arrays.toString(expectedCc));
+ Address[] cc = message.getRecipients(RecipientType.CC);
+ System.out.println(Arrays.toString(cc));
+ assert Arrays.equals(expectedCc, cc) : Arrays.asList(cc);
+ // bcc - recipients undisclosed
+ assertNull(message.getRecipients(RecipientType.BCC));
// subject
- assertEquals("bureaucracy", message.getSubject());
+ assertEquals("rectify " + newspaper, message.getSubject());
// text
- assertEquals("Order
http://example.com/order/" + orderId + " is
stalled.",
- message.getContent());
+ assertTextPresent(newspaper + ' ' + date + " reporting bb
dayorder", (String) message.getContent());
}
}
finally {
Modified:
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/mail/template/TemplateMailTest.java
===================================================================
---
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/mail/template/TemplateMailTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/mail/template/TemplateMailTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -23,9 +23,11 @@
import java.io.IOException;
import java.util.Arrays;
-import java.util.Collections;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashMap;
import java.util.List;
-import java.util.Random;
+import java.util.Map;
import javax.mail.Address;
import javax.mail.Message;
@@ -44,40 +46,83 @@
protected void setUp() throws Exception {
super.setUp();
- long deploymentDbid = repositoryService.createDeployment().addResourceFromClasspath(
- "org/jbpm/examples/mail/template/process.jpdl.xml").deploy();
+
+ // deploy process
+ long deploymentDbid = repositoryService.createDeployment()
+
.addResourceFromClasspath("org/jbpm/examples/mail/template/process.jpdl.xml")
+ .deploy();
registerDeployment(deploymentDbid);
+
+ // create actors
+ identityService.createUser("bb", "Big Brother", null,
"bb@oceania");
+ identityService.createUser("obrien", null, "O'Brien",
"obrien@miniluv");
+ identityService.createUser("charr", null, "Charrington",
"charr@miniluv");
+ identityService.createGroup("thinkpol");
+ identityService.createGroup("innerparty");
+ identityService.createMembership("obrien", "innerparty");
+ identityService.createMembership("charr", "thinkpol");
+ identityService.createMembership("obrien", "thinkpol");
}
+ protected void tearDown() throws Exception {
+ // delete actors
+ identityService.deleteGroup("thinkpol");
+ identityService.deleteGroup("innerparty");
+ identityService.deleteUser("bb");
+ identityService.deleteUser("obrien");
+ identityService.deleteUser("charr");
+
+ super.tearDown();
+ }
+
public void testTemplateMail() throws MessagingException, IOException {
Wiser wiser = new Wiser();
- wiser.setPort(2525); // default is 25, but has security restrictions
+ wiser.setPort(2525);
wiser.start();
try {
+ // prepare dynamic values
+ String addressee = "winston@minitrue";
+ String newspaper = "times";
+ Calendar calendar = Calendar.getInstance();
+ calendar.clear();
+ calendar.set(1983, Calendar.DECEMBER, 3);
+ Date date = calendar.getTime();
+ String details = "reporting bb dayorder doubleplusungood refs unpersons
rewrite "
+ + "fullwise upsub antefiling";
+ // assemble variables
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("addressee", addressee);
+ variables.put("newspaper", newspaper);
+ variables.put("date", date);
+ variables.put("details", details);
// start process instance
- Object orderId = new Random().nextInt(1000) + 1;
- executionService.startProcessInstanceByKey("TemplateMail",
Collections.singletonMap(
- "orderId", orderId));
+ executionService.startProcessInstanceByKey("TemplateMail", variables);
// examine produced message
- List<WiserMessage> wiserMessages = wiser.getMessages();
- assertEquals(3, wiserMessages.size());
+ List<WiserMessage> wisMessages = wiser.getMessages();
+ // winston, bb, innerparty(obrien), thinkpol(charr, obrien)
+ assertEquals(5, wisMessages.size());
- for (WiserMessage wiserMessage : wiserMessages) {
- Message message = wiserMessage.getMimeMessage();
+ for (WiserMessage wisMessage : wisMessages) {
+ Message message = wisMessage.getMimeMessage();
// from
Address[] from = message.getFrom();
assertEquals(1, from.length);
assertEquals("noreply(a)jbpm.org", from[0].toString());
// to
- Address[] expectedTo = InternetAddress.parse("dilbert@office, alice@work,
dogbert@house");
+ Address[] expectedTo = InternetAddress.parse(addressee);
Address[] to = message.getRecipients(RecipientType.TO);
- assert Arrays.equals(expectedTo, to) : to;
+ assert Arrays.equals(expectedTo, to) : Arrays.asList(to);
+ // cc
+ Address[] expectedCc = InternetAddress.parse("bb@oceania,
obrien@miniluv");
+ Address[] cc = message.getRecipients(RecipientType.CC);
+ assert Arrays.equals(expectedCc, cc) : Arrays.asList(cc);
+ // bcc - recipients undisclosed
+ assertNull(message.getRecipients(RecipientType.BCC));
// subject
- assertEquals("bureaucracy", message.getSubject());
+ assertEquals("rectify " + newspaper, message.getSubject());
// text
- assertEquals("Order
http://example.com/order/" + orderId + " is
stalled.",
- message.getContent());
+ assertEquals(newspaper + ' ' + date + ' ' + details, (String)
message.getContent());
}
}
finally {
Modified:
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java
===================================================================
---
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/task/candidates/TaskCandidatesTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -41,10 +41,10 @@
// create identities
identityService.createGroup("sales-dept");
- identityService.createUser("johndoe", "johndoe",
"John", "Doe");
+ identityService.createUser("johndoe", "John", "Doe");
identityService.createMembership("johndoe", "sales-dept");
- identityService.createUser("joesmoe", "joesmoe", "Joe",
"Smoe");
+ identityService.createUser("joesmoe", "Joe", "Smoe");
identityService.createMembership("joesmoe", "sales-dept");
// deploy process
Modified:
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java
===================================================================
---
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/examples/src/test/java/org/jbpm/examples/task/swimlane/TaskSwimlaneTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -40,7 +40,7 @@
// create identities
identityService.createGroup("sales-dept");
- identityService.createUser("johndoe", "johndoe",
"John", "Doe");
+ identityService.createUser("johndoe", "John", "Doe");
identityService.createMembership("johndoe", "sales-dept");
// deploy process
Modified: jbpm4/branches/idm/modules/examples/src/test/resources/jbpm.cfg.xml
===================================================================
--- jbpm4/branches/idm/modules/examples/src/test/resources/jbpm.cfg.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/examples/src/test/resources/jbpm.cfg.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -7,18 +7,12 @@
<import resource="jbpm.jpdl.cfg.xml" />
<import resource="jbpm.identity.cfg.xml" />
- <!-- Job executor is excluded for running the example test cases.
- To enable timers and messages in production use, this should be included.
- import resource="jbpm.jobexecutor.cfg.xml" / -->
+ <!-- Job executor is excluded for running the example test cases. -->
+ <!-- To enable timers and messages in production use, this should be included.
-->
+ <!--
+ <import resource="jbpm.jobexecutor.cfg.xml" />
+ -->
- <process-engine-context>
+ <import resource="jbpm.mail.templates.examples.xml" />
- <mail-template name="MemoTemplate">
- <to addresses='dilbert@office, alice@work, dogbert@house' />
- <subject>bureaucracy</subject>
- <text>Order
http://example.com/order/#{orderId} is stalled.</text>
- </mail-template>
-
- </process-engine-context>
-
</jbpm-configuration>
Copied: jbpm4/branches/idm/modules/examples/src/test/resources/jbpm.mail.properties (from
rev 4838, jbpm4/trunk/modules/examples/src/test/resources/jbpm.mail.properties)
===================================================================
--- jbpm4/branches/idm/modules/examples/src/test/resources/jbpm.mail.properties
(rev 0)
+++ jbpm4/branches/idm/modules/examples/src/test/resources/jbpm.mail.properties 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,3 @@
+mail.smtp.host localhost
+mail.smtp.port 2525
+mail.from noreply(a)jbpm.org
\ No newline at end of file
Copied:
jbpm4/branches/idm/modules/examples/src/test/resources/jbpm.mail.templates.examples.xml
(from rev 4838,
jbpm4/trunk/modules/examples/src/test/resources/jbpm.mail.templates.examples.xml)
===================================================================
---
jbpm4/branches/idm/modules/examples/src/test/resources/jbpm.mail.templates.examples.xml
(rev 0)
+++
jbpm4/branches/idm/modules/examples/src/test/resources/jbpm.mail.templates.examples.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<jbpm-configuration>
+
+ <process-engine-context>
+
+ <mail-template name="rectify template">
+ <to addresses="${addressee}" />
+ <cc users="bb" groups="innerparty" />
+ <bcc groups="thinkpol" />
+ <subject>rectify ${newspaper}</subject>
+ <text>${newspaper} ${date} ${details}</text>
+ </mail-template>
+
+ </process-engine-context>
+
+</jbpm-configuration>
\ No newline at end of file
Modified:
jbpm4/branches/idm/modules/examples/src/test/resources/org/jbpm/examples/mail/inline/process.jpdl.xml
===================================================================
---
jbpm4/branches/idm/modules/examples/src/test/resources/org/jbpm/examples/mail/inline/process.jpdl.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/examples/src/test/resources/org/jbpm/examples/mail/inline/process.jpdl.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -3,16 +3,30 @@
<process name="InlineMail">
<start>
- <transition to="send memo"/>
+ <transition to="send rectify note" />
</start>
-
- <mail name="send memo">
- <to addresses='dilbert@office, alice@work, dogbert@house'/>
- <subject>bureaucracy</subject>
- <text>Order
http://example.com/order/#{orderId} is stalled.</text>
- <transition to="end" />
+
+ <mail name="send rectify note" language="juel">
+ <to addresses="winston@minitrue" />
+ <cc users="bb" groups="innerparty" />
+ <bcc groups="thinkpol" />
+ <subject>rectify ${newspaper}</subject>
+ <text>${newspaper} ${date} reporting bb dayorder doubleplusungood
+ refs unpersons rewrite fullwise upsub antefiling</text>
+ <!--
+
<html><table><tr><td>${newspaper}</td><td>${date}</td>
+ <td>reporting bb dayorder doubleplusungood
+ refs unpersons rewrite fullwise upsub antefiling</td>
+ </tr></table></html>
+ <attachments>
+ <attachment
url='http://www.george-orwell.org/1984/3.html' />
+ <attachment resource='org/example/pic.jpg' />
+ <attachment file='${user.home}/.face' />
+ </attachments>
+ -->
+ <transition to="end" />
</mail>
-
- <state name="end"/>
+ <state name="end" />
+
</process>
\ No newline at end of file
Modified:
jbpm4/branches/idm/modules/examples/src/test/resources/org/jbpm/examples/mail/template/process.jpdl.xml
===================================================================
---
jbpm4/branches/idm/modules/examples/src/test/resources/org/jbpm/examples/mail/template/process.jpdl.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/examples/src/test/resources/org/jbpm/examples/mail/template/process.jpdl.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -3,13 +3,13 @@
<process name="TemplateMail">
<start>
- <transition to="send memo" />
+ <transition to="send rectify note" />
</start>
- <mail name="send memo" template="MemoTemplate">
- <transition to="end" />
+ <mail name="send rectify note" template="rectify template">
+ <transition to="end" />
</mail>
-
- <state name="end"/>
+ <state name="end" />
+
</process>
\ No newline at end of file
Modified:
jbpm4/branches/idm/modules/examples/src/test/resources/org/jbpm/examples/sql/process.jpdl.xml
===================================================================
---
jbpm4/branches/idm/modules/examples/src/test/resources/org/jbpm/examples/sql/process.jpdl.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/examples/src/test/resources/org/jbpm/examples/sql/process.jpdl.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -11,7 +11,7 @@
g="96,16,126,52">
<query>
select NAME_
- from JBPM_TASK
+ from JBPM4_TASK
where NAME_ like :name
</query>
<parameters>
@@ -26,7 +26,7 @@
g="254,16,92,52">
<query>
select count(*)
- from JBPM_TASK
+ from JBPM4_TASK
</query>
<transition to="wait" />
</sql>
Modified:
jbpm4/branches/idm/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java
===================================================================
---
jbpm4/branches/idm/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/integration/console/src/main/java/org/jbpm/integration/console/ModelAdaptor.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -131,12 +131,12 @@
if(p0.getGroupId()!=null)
{
ParticipantRef participant = new ParticipantRef("candidate",
p0.getGroupId());
+ participant.setGroup(true);
task.getParticipantGroups().add(participant);
}
else if(p0.getUserId()!=null)
{
ParticipantRef participant = new ParticipantRef("candidate",
p0.getUserId());
- participant.setGroup(true);
task.getParticipantUsers().add(participant);
}
else
@@ -151,6 +151,11 @@
}
+ // prio and duedate
+ task.setPriority(t0.getPriority());
+ task.setDueDate(t0.getDueDate());
+ task.setCreateDate(t0.getCreate());
+
// task form url
String url = t0.getForm()!=null ? t0.getForm() : "";
task.setUrl( url );
Modified:
jbpm4/branches/idm/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java
===================================================================
---
jbpm4/branches/idm/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/integration/console/src/main/java/org/jbpm/integration/console/TaskManagementImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -23,11 +23,9 @@
import org.jboss.bpm.console.client.model.TaskRef;
import org.jboss.bpm.console.server.integration.TaskManagement;
-import org.jbpm.api.IdentityService;
import org.jbpm.api.TaskService;
import org.jbpm.api.env.Environment;
import org.jbpm.api.env.EnvironmentFactory;
-import org.jbpm.api.task.GroupRef;
import org.jbpm.api.task.Participation;
import org.jbpm.api.task.Task;
@@ -41,17 +39,27 @@
*/
public class TaskManagementImpl extends JBPMIntegration implements TaskManagement
{
- public List<TaskRef> getTasksForIdentity(String idRef)
+ public List<TaskRef> getAssignedTasks(String idRef)
{
- return internalGetTaskForIdentity(idRef, null);
- }
+ Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
- public List<TaskRef> getTasksForIdentity(String idRef, String participationType)
- {
- return internalGetTaskForIdentity(idRef, participationType);
+ try
+ {
+ TaskService taskService = this.processEngine.get(TaskService.class);
+ List<TaskRef> results = new ArrayList<TaskRef>();
+
+ List<Task> assignedTasks = taskService.findAssignedTasks(idRef);
+ adoptTasks(assignedTasks, results);
+
+ return results;
+ }
+ finally
+ {
+ env.close();
+ }
}
- private List<TaskRef> internalGetTaskForIdentity(String idRef, String
participationType)
+ public List<TaskRef> getUnassignedTasks(String idRef, String participationType)
{
Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
@@ -62,11 +70,7 @@
if(null==participationType || participationType.equals(Participation.CANDIDATE))
{
- // TODO: Paging
- List<Task> assignedTasks = taskService.findAssignedTasks(idRef);
List<Task> takableTasks = taskService.findTakableTasks(idRef);
-
- adoptTasks(assignedTasks, results);
adoptTasks(takableTasks, results);
}
else
@@ -90,21 +94,6 @@
}
}
- private GroupRef[] getGroupIdsForIdentityRef(String idRef)
- {
- IdentityService idService = this.processEngine.get(IdentityService.class);
- List<String> groupIds = idService.findGroupIdsByUser(idRef);
- GroupRef[] groupRefs = new GroupRef[groupIds.size()];
- int i = 0;
- for(String groupId : groupIds)
- {
- groupRefs[i] = new GroupRef(groupId);
- i++;
- }
-
- return groupRefs;
- }
-
public TaskRef getTaskById(long taskId)
{
Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
@@ -120,20 +109,6 @@
}
}
- public void takeTask(long taskId, String idRef)
- {
- Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
-
- try
- {
- TaskService taskService = this.processEngine.get(TaskService.class);
- taskService.takeTask(taskId, idRef);
- }
- finally{
- env.close();
- }
- }
-
public void assignTask(long taskId, String idRef)
{
Environment env = ((EnvironmentFactory)processEngine).openEnvironment();
@@ -171,7 +146,7 @@
TaskService taskService = this.processEngine.get(TaskService.class);
if(data!=null)
taskService.setVariables(taskId, data);
-
+
taskService.completeTask(taskId);
}
finally{
Property changes on: jbpm4/branches/idm/modules/integration/form-plugin
___________________________________________________________________
Name: svn:ignore
+ target
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/DecisionBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -106,7 +106,8 @@
if (hasConditions) {
return new DecisionConditionActivity();
} else {
- parse.addProblem("decision
'"+element.getAttribute("name")+"' must have one of: expr
attribute, handler attribute, handler element or condition expressions");
+ String message = "decision
'"+element.getAttribute("name")+"' must have one of: expr
attribute, handler attribute, handler element or condition expressions";
+ parse.addProblem(message,null, "error", element);
}
return null;
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EndActivity.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -21,8 +21,14 @@
*/
package org.jbpm.jpdl.internal.activity;
+import java.util.List;
+
import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.model.Activity;
import org.jbpm.api.model.OpenExecution;
+import org.jbpm.api.model.Transition;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
/**
@@ -36,18 +42,46 @@
protected String state = null;
public void execute(ActivityExecution execution) {
- OpenExecution executionToEnd = null;
- if (endProcessInstance) {
- executionToEnd = execution.getProcessInstance();
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+ ActivityImpl parentActivity = (ActivityImpl) activity.getParentActivity();
+
+ if ( (parentActivity!=null)
+ && ("group".equals(parentActivity.getType()))
+ ) {
+ // if the end activity itself has an outgoing transition
+ // (such end activities should be drawn on the border of the group)
+ if ( (outgoingTransitions!=null)
+ && (outgoingTransitions.size()==1)
+ ) {
+ Transition outgoingTransition = outgoingTransitions.get(0);
+ // taking the transition that goes over the group boundaries will
+ // destroy the scope automatically (see atomic operation TakeTransition)
+ execution.take(outgoingTransition);
+
+ } else {
+ execution.setActivity(parentActivity);
+ execution.signal();
+ }
+
} else {
- executionToEnd = execution;
+ OpenExecution executionToEnd = null;
+ if (endProcessInstance) {
+ executionToEnd = execution.getProcessInstance();
+ } else {
+ executionToEnd = execution;
+ }
+
+ if (state==null) {
+ execution.end(executionToEnd);
+ } else {
+ execution.end(executionToEnd, state);
+ }
}
-
- if (state==null) {
- execution.end(executionToEnd);
- } else {
- execution.end(executionToEnd, state);
- }
}
public void setEndProcessInstance(boolean endProcessInstance) {
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/EsbBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -81,7 +81,8 @@
||
( (expression!=null) && (descriptorElement!=null) )
) {
- parse.addProblem("in <"+TAG+"...> an expr or exactly one child
element is expected");
+ String message = "in <"+TAG+"...> an expr or exactly one child
element is expected";
+ parse.addProblem(message, null, "error", partElement);
}
if (expression!=null) {
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ForkActivity.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -21,12 +21,13 @@
*/
package org.jbpm.jpdl.internal.activity;
+import java.util.ArrayList;
import java.util.List;
import org.jbpm.api.Execution;
import org.jbpm.api.activity.ActivityExecution;
import org.jbpm.api.model.Activity;
-import org.jbpm.api.model.OpenExecution;
+import org.jbpm.api.model.Condition;
import org.jbpm.api.model.Transition;
import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -38,25 +39,53 @@
private static final long serialVersionUID = 1L;
- public void execute(ActivityExecution execution) throws Exception {
- OpenExecution processInstance = execution.getProcessInstance();
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+ public void execute(ExecutionImpl execution) {
Activity activity = execution.getActivity();
+
+ // evaluate the conditions and find the transitions that should be forked
+ List<Transition> forkingTransitions = new ArrayList<Transition>();
List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
-
- // for each outgoing transition
- for (Transition outgoingTransition: outgoingTransitions) {
- // launch a concurrent path of execution
- String childExecutionName = outgoingTransition.getName();
- // creating the execution will cause the execution to become inactive
- ExecutionImpl executionImpl = (ExecutionImpl) execution;
- Execution childExecution = executionImpl.createExecution(childExecutionName,
processInstance);
- execution.take(outgoingTransition, childExecution);
+ for (Transition transition: outgoingTransitions) {
+ Condition condition = transition.getCondition();
+ if ( (condition==null)
+ || (condition.evaluate(execution))
+ ) {
+ forkingTransitions.add(transition);
+ }
}
- // if this was the first fork
- if (execution.isProcessInstance()) {
- execution.setActivity(null);
+ // if no outgoing transitions should be forked,
+ if (forkingTransitions.size()==0) {
+ // end this execution
+ execution.end();
+
+ // if there is exactly 1 transition to be taken, just use the incoming execution
+ } else if (forkingTransitions.size()==1) {
+ execution.take(forkingTransitions.get(0));
+
+ // if there are more transitions
+ } else {
+ ExecutionImpl concurrentRoot = null;
+ if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
+ concurrentRoot = execution;
+ execution.setState(Execution.STATE_INACTIVE_CONCURRENT_ROOT);
+ execution.setActivity(null);
+ } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
+ concurrentRoot = execution.getParent();
+ }
+
+ for (Transition transition: forkingTransitions) {
+ // launch a concurrent path of execution
+ String childExecutionName = transition.getName();
+ ExecutionImpl concurrentExecution =
concurrentRoot.createExecution(childExecutionName);
+ concurrentExecution.setActivity(activity);
+ concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
+ concurrentExecution.take(transition);
+ }
}
}
}
Copied:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupActivity.java
(from rev 4838,
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupActivity.java)
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupActivity.java
(rev 0)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupActivity.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.activity;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.activity.ActivityExecution;
+import org.jbpm.api.model.Activity;
+import org.jbpm.api.model.Transition;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GroupActivity extends JpdlExternalActivity {
+
+ private static final long serialVersionUID = 1L;
+
+ public void execute(ActivityExecution execution) throws Exception {
+ execute((ExecutionImpl)execution);
+ }
+ public void execute(ExecutionImpl execution) throws Exception {
+ // find the start activity
+ Activity activity = execution.getActivity();
+ List<Activity> startActivities = findStartActivities(activity);
+ if (startActivities.size()==1) {
+ execution.execute(startActivities.get(0));
+ } else {
+
+ ExecutionImpl concurrentRoot = null;
+ if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
+ concurrentRoot = execution;
+ } else if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
+ concurrentRoot = execution.getParent();
+
+ } else {
+ throw new JbpmException("illegal state");
+ }
+
+ for (Activity startActivity: startActivities) {
+ ExecutionImpl concurrentExecution = concurrentRoot.createExecution();
+ concurrentExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
+ concurrentExecution.execute(startActivity);
+ }
+ }
+ }
+
+ private List<Activity> findStartActivities(Activity activity) {
+ List<Activity> startActivities = new ArrayList<Activity>();
+ List nestedActivities = activity.getActivities();
+ for (ActivityImpl nestedActivity : (List<ActivityImpl>) nestedActivities) {
+ if ( (nestedActivity.getIncomingTransitions()==null)
+ || (nestedActivity.getIncomingTransitions().isEmpty())
+ ) {
+ startActivities.add(nestedActivity);
+ }
+ }
+ return startActivities;
+ }
+
+ public void signal(ActivityExecution execution, String signalName, Map<String,
Object> parameters) throws Exception {
+ Transition transition = null;
+ Activity activity = execution.getActivity();
+ List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
+
+ int nbrOfOutgoingTransitions = (outgoingTransitions!=null ?
outgoingTransitions.size() : 0);
+ if ( (signalName==null)
+ && (nbrOfOutgoingTransitions==1)
+ ) {
+ transition = outgoingTransitions.get(0);
+ } else {
+ transition = activity.getOutgoingTransition(signalName);
+ }
+
+ execution.take(transition);
+ }
+}
Copied:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java
(from rev 4838,
jbpm4/trunk/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java)
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java
(rev 0)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/GroupBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.jpdl.internal.activity;
+
+import org.jbpm.jpdl.internal.xml.JpdlParser;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GroupBinding extends JpdlBinding {
+
+ public GroupBinding() {
+ super("group");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ GroupActivity groupActivity = new GroupActivity();
+
+ ActivityImpl activity = parse.findObject(ActivityImpl.class);
+
+ JpdlParser jpdlParser = (JpdlParser) parser;
+ jpdlParser.parseActivities(element, parse, activity);
+
+ return groupActivity;
+ }
+}
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JoinActivity.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -26,6 +26,7 @@
import java.util.List;
import org.jbpm.api.Execution;
+import org.jbpm.api.JbpmException;
import org.jbpm.api.activity.ActivityExecution;
import org.jbpm.api.model.Activity;
import org.jbpm.api.model.OpenExecution;
@@ -39,65 +40,76 @@
public class JoinActivity extends JpdlActivity {
private static final long serialVersionUID = 1L;
+
+ int multiplicity = -1;
- public void execute(ActivityExecution execution) throws Exception {
- // end the child execution execution
- // this will also remove the execution from it's parent
- execution.setState(Execution.STATE_INACTIVE);
- execution.waitForSignal();
+ public void execute(ActivityExecution execution) {
+ execute((ExecutionImpl)execution);
+ }
+
+ public void execute(ExecutionImpl execution) {
+ Activity activity = execution.getActivity();
- Activity join = execution.getActivity();
- List<OpenExecution> joinedExecutions = findJoinedExecutions(execution, join);
-
- if (isComplete(joinedExecutions, join)) {
- endJoinedExecutions(joinedExecutions, execution);
+ // if this is a single, non concurrent root
+ if (Execution.STATE_ACTIVE_ROOT.equals(execution.getState())) {
+ // just pass through
+ Transition transition = activity.getDefaultOutgoingTransition();
+ execution.take(transition);
+
+ } else if (Execution.STATE_ACTIVE_CONCURRENT.equals(execution.getState())) {
- OpenExecution processInstance = execution.getProcessInstance();
+ execution.setState(Execution.STATE_INACTIVE_JOIN);
+ execution.waitForSignal();
+
+ ExecutionImpl concurrentRoot = execution.getParent();
+ List<ExecutionImpl> joinedExecutions = getJoinedExecutions(concurrentRoot,
activity);
- Execution outgoingExecution = null;
- if ( processInstance.getExecutions()==null
- || processInstance.getExecutions().isEmpty()
- ) {
- outgoingExecution = processInstance;
- } else {
- ExecutionImpl executionImpl = (ExecutionImpl) execution;
- outgoingExecution = executionImpl.createExecution(processInstance);
+ if (isComplete(joinedExecutions, activity)) {
+ endJoinedExecutions(joinedExecutions);
+
+ ExecutionImpl outgoingExecution = null;
+ if (concurrentRoot.getExecutions().size()==0) {
+ outgoingExecution = concurrentRoot;
+ outgoingExecution.setState(Execution.STATE_ACTIVE_ROOT);
+ } else {
+ outgoingExecution = concurrentRoot.createExecution();
+ outgoingExecution.setState(Execution.STATE_ACTIVE_CONCURRENT);
+ }
+
+ execution.setActivity(activity, outgoingExecution);
+ Transition transition = activity.getDefaultOutgoingTransition();
+ outgoingExecution.take(transition);
}
- execution.setActivity(join, outgoingExecution);
- Transition transition = join.getDefaultOutgoingTransition();
- execution.take(transition, outgoingExecution);
+ } else {
+ throw new JbpmException("invalid execution state");
}
}
- List<OpenExecution> findJoinedExecutions(OpenExecution execution, Activity join)
{
- List<OpenExecution> joinedExecutions = new ArrayList<OpenExecution>();
- scanRecursive((OpenExecution)execution.getProcessInstance(), join,
joinedExecutions);
- return joinedExecutions;
+ protected boolean isComplete(List<ExecutionImpl> joinedExecutions, Activity
activity) {
+ int nbrOfExecutionsToJoin = multiplicity;
+ if (multiplicity==-1) {
+ nbrOfExecutionsToJoin = activity.getIncomingTransitions().size();
+ }
+ return joinedExecutions.size()==nbrOfExecutionsToJoin;
}
- void scanRecursive(OpenExecution execution, Activity join, List<OpenExecution>
joinedExecutions) {
- // if the execution is positioned in the join
- if (join.equals(execution.getActivity())) {
- joinedExecutions.add(execution);
- }
- Collection<OpenExecution> childExecutions =
(Collection)execution.getExecutions();
- if (childExecutions!=null) {
- for (OpenExecution childExecution: childExecutions) {
- scanRecursive(childExecution, join, joinedExecutions);
+ protected List<ExecutionImpl> getJoinedExecutions(ExecutionImpl concurrentRoot,
Activity activity) {
+ List<ExecutionImpl> joinedExecutions = new ArrayList<ExecutionImpl>();
+ List concurrentExecutions = (List)concurrentRoot.getExecutions();
+ for (ExecutionImpl concurrentExecution:
(List<ExecutionImpl>)concurrentExecutions) {
+ if ( (Execution.STATE_INACTIVE_JOIN.equals(concurrentExecution.getState()))
+ && (concurrentExecution.getActivity()==activity)
+ ) {
+ joinedExecutions.add(concurrentExecution);
}
}
+ return joinedExecutions;
}
- boolean isComplete(List<OpenExecution> joinedExecutions, Activity join) {
- int executionsToJoin = join.getIncomingTransitions().size();
- return (executionsToJoin==joinedExecutions.size());
- }
-
- void endJoinedExecutions(List<OpenExecution> joinedExecutions, ActivityExecution
execution) {
- for (OpenExecution joinedExecution: joinedExecutions) {
- execution.end(joinedExecution);
+ protected void endJoinedExecutions(List<ExecutionImpl> joinedExecutions) {
+ for (ExecutionImpl joinedExecution: joinedExecutions) {
+ joinedExecution.end();
}
}
-
}
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/JpdlBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -53,9 +53,11 @@
if (name!=null) {
// basic name validation
if ("".equals(name)) {
- parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name,
"is empty"));
+ String message = XmlUtil.errorMessageAttribute(element, "name", name,
"is empty");
+ parse.addProblem(message, null, "error", element);
} else if (name.indexOf('/')!=-1) {
- parse.addProblem(XmlUtil.errorMessageAttribute(element, "name", name,
"contains slash (/)"));
+ String message = XmlUtil.errorMessageAttribute(element, "name", name,
"contains slash (/)");
+ parse.addProblem(message, null, "error", element);
}
activity.setName(name);
}
@@ -77,11 +79,13 @@
TimerDefinitionImpl timerDefinitionImpl =
jpdlParser.parseTimerDefinition(timerElement, parse, activity);
timerDefinitionImpl.setSignalName(transitionName);
} else {
- parse.addProblem("a transition name is required when a timer is placed on
a transition");
+ parse.addProblem("a transition name is required when a timer is placed on
a transition", null, "error", element);
}
}
- TransitionImpl transition = activity.createOutgoingTransition(transitionName);
+ TransitionImpl transition = activity.createOutgoingTransition();
+ transition.setName(transitionName);
+
unresolvedTransitions.add(transition, transitionElement);
jpdlParser.parseOnEvent(transitionElement, transition, Event.TAKE, parse);
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/MailBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -21,18 +21,18 @@
*/
package org.jbpm.jpdl.internal.activity;
+import org.w3c.dom.Element;
+
import org.jbpm.api.env.Environment;
import org.jbpm.pvm.internal.email.impl.MailProducerImpl;
import org.jbpm.pvm.internal.email.impl.MailTemplate;
+import org.jbpm.pvm.internal.email.impl.MailTemplateRegistry;
import org.jbpm.pvm.internal.email.spi.MailProducer;
import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.WireContext;
import org.jbpm.pvm.internal.wire.binding.MailTemplateBinding;
import org.jbpm.pvm.internal.wire.binding.ObjectBinding;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.Element;
/**
* @author Alejandro Guizar
@@ -65,23 +65,22 @@
}
protected MailTemplate parseTemplate(Element element, Parse parse, Parser parser) {
+ MailTemplate template;
+
// look for template reference
String templateName = XmlUtil.attribute(element, "template");
if (templateName != null) {
// load template from configuration
- Object template = Environment.getCurrent().get(templateName);
- if (template instanceof MailTemplate) {
- return (MailTemplate) template;
+ MailTemplateRegistry templateRegistry =
Environment.getFromCurrent(MailTemplateRegistry.class);
+ template = templateRegistry.getTemplate(templateName);
+ if (template == null) {
+ parse.addProblem("mail template not found: " + templateName, null,
"error", element);
}
- else {
- parse.addProblem("mail template not found: " + templateName);
- }
}
else {
// parse inline template
- Descriptor templateDescriptor = (Descriptor) templateBinding.parse(element, parse,
parser);
- return (MailTemplate) WireContext.create(templateDescriptor);
+ template = templateBinding.parseMailTemplate(element, parse, parser);
}
- return null;
+ return template;
}
}
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/ScriptBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -49,7 +49,8 @@
ScriptManager scriptManager = Environment.getFromCurrent(ScriptManager.class);
language = scriptManager.getDefaultExpressionLanguage();
if (textElement!=null) {
- parse.addProblem("in <script ...> attribute expr can't be combined
with a nexted text element");
+ String message = "in <script ...> attribute expr can't be combined
with a nexted text element";
+ parse.addProblem(message, null, "error", element);
}
} else {
language = XmlUtil.attribute(element, "lang");
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/StartBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -44,8 +44,8 @@
if (processDefinition.getInitial()==null) {
processDefinition.setInitial(startActivity);
- } else {
- parse.addProblem("multiple start events not yet supported");
+ } else if (startActivity.getParentActivity()==null) {
+ parse.addProblem("multiple start events not yet supported", null,
"error", element);
}
return new StartActivity();
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/activity/SubProcessBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -75,7 +75,7 @@
if (outcomeValueElement!=null) {
String transitionName = XmlUtil.attribute(transitionElement,
"name");
if (transitionName==null) {
- parse.addProblem("transitions with an outcome-value must have a
name", transitionElement);
+ parse.addProblem("transitions with an outcome-value must have a
name", null, "error", transitionElement);
}
Element valueElement = XmlUtil.element(outcomeValueElement);
if (valueElement!=null) {
@@ -83,7 +83,7 @@
Object value = WireContext.create(descriptor);
outcomeVariableMappings.put(value, transitionName);
} else {
- parse.addProblem("outcome-value must contain exactly one element",
outcomeValueElement);
+ parse.addProblem("outcome-value must contain exactly one element",
null, "error", outcomeValueElement);
}
}
}
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/repository/JpdlDeployer.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -44,10 +44,6 @@
private static Log log = Log.getLog(JpdlDeployer.class.getName());
- public static final String KEY_ID = "id";
- public static final String KEY_KEY = "key";
- public static final String KEY_VERSION = "version";
-
static JpdlParser jpdlParser = new JpdlParser();
public void deploy(DeploymentImpl deployment) {
@@ -67,9 +63,9 @@
processDefinition.setDeploymentDbid(deployment.getDbid());
if (deployment.hasObjectProperties(processDefinitionName)) {
- String key = (String) deployment.getObjectProperty(processDefinitionName,
KEY_KEY);
- String id = (String) deployment.getObjectProperty(processDefinitionName,
KEY_ID);
- Long version = (Long) deployment.getObjectProperty(processDefinitionName,
KEY_VERSION);
+ String key = deployment.getProcessDefinitionKey(processDefinitionName);
+ String id = deployment.getProcessDefinitionId(processDefinitionName);
+ Long version =
deployment.getProcessDefinitionVersion(processDefinitionName);
processDefinition.setId(id);
processDefinition.setKey(key);
processDefinition.setVersion(version.intValue());
@@ -79,9 +75,9 @@
checkVersion(processDefinition, deployment);
checkId(processDefinition, deployment);
- deployment.addObjectProperty(processDefinitionName, KEY_KEY,
processDefinition.getKey());
- deployment.addObjectProperty(processDefinitionName, KEY_VERSION, new
Long(processDefinition.getVersion()));
- deployment.addObjectProperty(processDefinitionName, KEY_ID,
processDefinition.getId());
+ deployment.setProcessDefinitionId(processDefinitionName,
processDefinition.getId());
+ deployment.setProcessDefinitionKey(processDefinitionName,
processDefinition.getKey());
+ deployment.setProcessDefinitionVersion(processDefinitionName, new
Long(processDefinition.getVersion()));
}
deployment.addObject(processDefinitionName, processDefinition);
@@ -110,7 +106,8 @@
for (ProcessDefinition existingProcess: existingProcesses) {
if (!processDefinitionKey.equals(existingProcess.getKey())) {
- deployment.addProblem("invalid key
'"+processDefinitionKey+"' in process
"+processDefinition.getName()+". Existing process has name
'"+processDefinitionName+"' and key
'"+processDefinitionKey+"'");
+ String message = "invalid key '"+processDefinitionKey+"' in
process "+processDefinition.getName()+". Existing process has name
'"+processDefinitionName+"' and key
'"+processDefinitionKey+"'";
+ deployment.addProblem(message, null, "error", null);
}
}
@@ -120,7 +117,8 @@
for (ProcessDefinition existingProcess: existingProcesses) {
if (!processDefinitionName.equals(existingProcess.getName())) {
- deployment.addProblem("invalid name
'"+processDefinitionName+"' in process
"+processDefinition.getName()+". Existing process has name
'"+processDefinitionName+"' and key
'"+processDefinitionKey+"'");
+ String message = "invalid name '"+processDefinitionName+"' in
process "+processDefinition.getName()+". Existing process has name
'"+processDefinitionName+"' and key
'"+processDefinitionKey+"'";
+ deployment.addProblem(message, null, "error", null);
}
}
}
@@ -138,7 +136,7 @@
.id(id)
.uniqueResult();
if (existingProcessDefinition != null) {
- deployment.addProblem("process '" + id + "' already
exists");
+ deployment.addProblem("process '" + id + "' already
exists", null, "error", null);
}
}
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/BindingsParser.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/BindingsParser.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/BindingsParser.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -61,7 +61,7 @@
Class<?> bindingClass = ReflectUtil.loadClass(classLoader,
bindingClassName);
return (Binding) bindingClass.newInstance();
} catch (Exception e) {
- parse.addProblem("couldn't instantiate activity binding
"+bindingClassName, e);
+ parse.addProblem("couldn't instantiate activity binding
"+bindingClassName, e, "error", bindingElement);
}
}
return null;
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/JpdlParser.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -31,9 +31,6 @@
import java.util.Set;
import java.util.StringTokenizer;
-import javax.print.attribute.standard.Severity;
-
-import org.jbpm.api.Problem;
import org.jbpm.api.activity.ActivityBehaviour;
import org.jbpm.api.env.Environment;
import org.jbpm.api.listener.EventListener;
@@ -42,7 +39,9 @@
import org.jbpm.jpdl.internal.model.JpdlProcessDefinition;
import org.jbpm.pvm.internal.model.ActivityCoordinatesImpl;
import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.CompositeElementImpl;
import org.jbpm.pvm.internal.model.EventImpl;
+import org.jbpm.pvm.internal.model.EventListenerReference;
import org.jbpm.pvm.internal.model.ObservableElementImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
import org.jbpm.pvm.internal.model.ScopeElementImpl;
@@ -209,7 +208,7 @@
if (processDefinition.getInitial()==null) {
- parse.addProblem("no start activity in process");
+ parse.addProblem("no start activity in process", null, "error",
documentElement);
}
return processDefinition;
@@ -221,33 +220,33 @@
}
}
- public void parseActivities(Element documentElement, Parse parse, JpdlProcessDefinition
processDefinition) {
+ public void parseActivities(Element documentElement, Parse parse, CompositeElementImpl
compositeElement) {
List<Element> elements = XmlUtil.elements(documentElement);
- for (Element element : elements) {
- String tagName = XmlUtil.getTagLocalName(element);
+ for (Element nestedElement : elements) {
+ String tagName = XmlUtil.getTagLocalName(nestedElement);
if ( !"on".equals(tagName)
&& !"timer".equals(tagName)
&& !"swimlane".equals(tagName)
) {
- JpdlBinding activityBinding = (JpdlBinding) getBinding(element,
"activity");
+ JpdlBinding activityBinding = (JpdlBinding) getBinding(nestedElement,
"activity");
if (activityBinding != null) {
- ActivityImpl activity = processDefinition.createActivity();
+ ActivityImpl activity = compositeElement.createActivity();
parse.pushObject(activity);
try {
activity.setType(activityBinding.getTagName());
- activityBinding.parseName(element, activity, parse);
- activityBinding.parseTransitions(element, activity, parse, this);
+ activityBinding.parseName(nestedElement, activity, parse);
+ activityBinding.parseTransitions(nestedElement, activity, parse, this);
- if (XmlUtil.attributeBoolean(element, "async", false, parse,
Boolean.FALSE)) {
- activity.setExecutionAsync(true);
+ if (XmlUtil.attributeBoolean(nestedElement, "async", false, parse,
Boolean.FALSE)) {
+ activity.setAsync(true);
}
- ActivityBehaviour activityBehaviour = (ActivityBehaviour)
activityBinding.parse(element, parse, this);
+ ActivityBehaviour activityBehaviour = (ActivityBehaviour)
activityBinding.parse(nestedElement, parse, this);
activity.setBehaviour(activityBehaviour);
- parseOnEvents(element, parse, activity);
+ parseOnEvents(nestedElement, parse, activity);
- String g = XmlUtil.attribute(element, "g");
+ String g = XmlUtil.attribute(nestedElement, "g");
if (g != null) {
StringTokenizer stringTokenizer = new StringTokenizer(g, ",");
ActivityCoordinatesImpl coordinates = null;
@@ -265,7 +264,7 @@
if (coordinates != null) {
activity.setCoordinates(coordinates);
} else {
- parse.addProblem("invalid coordinates g=\"" + g +
"\" in " + activity);
+ parse.addProblem("invalid coordinates g=\"" + g +
"\" in " + activity, null, "error", nestedElement);
}
}
} finally {
@@ -297,10 +296,10 @@
Date duedatetimeDate = dateFormat.parse(duedatetime);
timerDefinition.setDueDate(duedatetimeDate);
} catch (ParseException e) {
- parse.addProblem("couldn't parse duedatetime "+duedatetime, e);
+ parse.addProblem("couldn't parse duedatetime "+duedatetime, e,
"error", timerElement);
}
} else {
- parse.addProblem("either duedate or duedatetime is required in timer");
+ parse.addProblem("either duedate or duedatetime is required in timer",
null, "error", timerElement);
}
String repeat = XmlUtil.attribute(timerElement, "repeat");
@@ -315,7 +314,7 @@
for (Element onElement: onElements) {
String eventName = XmlUtil.attribute(onElement, "event", true, parse);
parseOnEvent(onElement, scopeElement, eventName, parse);
-
+
Element timerElement = XmlUtil.element(onElement, "timer");
if (timerElement!=null) {
TimerDefinitionImpl timerDefinitionImpl = parseTimerDefinition(timerElement,
parse, scopeElement);
@@ -331,11 +330,20 @@
event = scopeElement.createEvent(eventName);
}
+ if (XmlUtil.attributeBoolean(element, "async", false, parse,
Boolean.FALSE)) {
+ event.setAsync(true);
+ }
+
for (Element eventListenerElement: XmlUtil.elements(element)) {
JpdlBinding eventBinding = (JpdlBinding) getBinding(eventListenerElement,
"eventlistener");
if (eventBinding!=null) {
EventListener eventListener = (EventListener)
eventBinding.parse(eventListenerElement, parse, this);
- event.createEventListenerReference(eventListener);
+ EventListenerReference eventListenerReference =
event.createEventListenerReference(eventListener);
+
+ if (XmlUtil.attributeBoolean(eventListenerElement, "async", false,
parse, Boolean.FALSE)) {
+ eventListenerReference.setAsync(true);
+ }
+
} else {
String tagName = XmlUtil.getTagLocalName(eventListenerElement);
if ( ! ( (scopeElement instanceof TransitionImpl)
@@ -395,7 +403,7 @@
ProcessDefinitionImpl processDefinition =
parse.findObject(ProcessDefinitionImpl.class);
if (processDefinition.getTaskDefinition(taskName)!=null) {
- parse.addProblem("duplicate task name "+taskName);
+ parse.addProblem("duplicate task name "+taskName, null,
"error",element);
} else {
processDefinition.addTaskDefinitionImpl(taskDefinition);
}
@@ -407,7 +415,7 @@
if (swimlaneDefinition!=null) {
taskDefinition.setSwimlaneDefinition(swimlaneDefinition);
} else {
- parse.addProblem("swimlane "+swimlaneName+" not declared");
+ parse.addProblem("swimlane "+swimlaneName+" not declared",
null, "error", element);
}
}
@@ -480,10 +488,10 @@
}
if (initRequired && sources==0) {
- parse.addProblem("no init specified", inElement);
+ parse.addProblem("no init specified", null, "error",
inElement);
}
if (sources>1) {
- parse.addProblem("init attribute and init element are mutually exclusive on
element variable", inElement);
+ parse.addProblem("init attribute and init element are mutually exclusive on
element variable", null, "error", inElement);
}
variableDefinitions.add(variableDefinition);
Modified:
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java
===================================================================
---
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/jpdl/src/main/java/org/jbpm/jpdl/internal/xml/UnresolvedTransition.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -42,7 +42,8 @@
if (destination!=null) {
destination.addIncomingTransition(transition);
} else {
- parse.addProblem(XmlUtil.errorMessageAttribute(transitionElement, "to",
to, "doesn't reference an existing activity name"));
+ String message = XmlUtil.errorMessageAttribute(transitionElement, "to",
to, "doesn't reference an existing activity name");
+ parse.addProblem(message, null, "error", transitionElement);
}
}
}
Modified: jbpm4/branches/idm/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml
===================================================================
--- jbpm4/branches/idm/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/jpdl/src/main/resources/jbpm.jpdl.activities.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -15,4 +15,5 @@
<activity binding="org.jbpm.jpdl.internal.activity.TaskBinding" />
<activity binding="org.jbpm.jpdl.internal.activity.SubProcessBinding"
/>
<activity binding="org.jbpm.jpdl.internal.activity.MailBinding" />
+ <activity binding="org.jbpm.jpdl.internal.activity.GroupBinding" />
</activities>
Modified: jbpm4/branches/idm/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml
===================================================================
--- jbpm4/branches/idm/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/jpdl/src/main/resources/jbpm.jpdl.hbm.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -38,7 +38,7 @@
</map>
</subclass>
- <!-- class name="org.jbpm.jpdl.internal.activity.JpdlActivity"
table="JBPM_JPDL_ACTIVITY" abstract="true"
discriminator-value="X">
+ <!-- class name="org.jbpm.jpdl.internal.activity.JpdlActivity"
table="JBPM4_JPDL_ACTIVITY" abstract="true"
discriminator-value="X">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
Modified: jbpm4/branches/idm/modules/pvm/pom.xml
===================================================================
--- jbpm4/branches/idm/modules/pvm/pom.xml 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/pvm/pom.xml 2009-05-19 07:26:59 UTC (rev 4839)
@@ -28,11 +28,6 @@
<relativePath>../../pom.xml</relativePath>
</parent>
- <!-- Properties -->
- <properties>
- <table.prefix>JBPM_</table.prefix>
-
<!--test.resources.directory>${project.build.directory}/test-resources</test.resources.directory-->
- </properties>
<repositories>
<repository>
<id>Snapshot</id>
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/JbpmDeployTask.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/JbpmDeployTask.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/ant/JbpmDeployTask.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -86,6 +86,8 @@
private void deployFile(ProcessEngine processEngine, File processFile) {
RepositoryService repositoryService = processEngine.getRepositoryService();
Deployment deployment = repositoryService.createDeployment();
+ deployment.setName(processFile.getName());
+ deployment.setTimestamp(System.currentTimeMillis());
if (processFile.getName().endsWith(".xml")) {
log("deploying process file "+processFile.getName());
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/ActivityBuilder.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/ActivityBuilder.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/builder/ActivityBuilder.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -97,16 +97,11 @@
}
public ActivityBuilder asyncExecute() {
- activity.setExecutionAsync(true);
+ activity.setAsync(true);
return this;
}
protected void addUnresolvedFlow(UnresolvedFlow unresolvedFlow) {
compositeBuilder.addUnresolvedFlow(unresolvedFlow);
}
-
- public ActivityBuilder needsPrevious() {
- activity.setPreviousNeeded(true);
- return this;
- }
}
Copied:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ResumeDeploymentCmd.java
(from rev 4838,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ResumeDeploymentCmd.java)
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ResumeDeploymentCmd.java
(rev 0)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/ResumeDeploymentCmd.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,49 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.cmd;
+
+import org.hibernate.Session;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ResumeDeploymentCmd implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ long deploymentDbid;
+
+ public ResumeDeploymentCmd(long deploymentDbid) {
+ this.deploymentDbid = deploymentDbid;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+ DeploymentImpl deployment = (DeploymentImpl) session.load(DeploymentImpl.class,
deploymentDbid);
+ deployment.resume();
+ return null;
+ }
+}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/StartProcessInstanceInLatestCmd.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -57,6 +57,9 @@
RepositorySession repositorySession = environment.get(RepositorySession.class);
processDefinition = (ClientProcessDefinition)
repositorySession.findProcessDefinitionByKey(processDefinitionKey);
+ if (processDefinition==null) {
+ throw new JbpmException("no process definition with key
"+processDefinitionKey);
+ }
ClientProcessInstance processInstance =
processDefinition.createProcessInstance(executionKey);
processInstance.setVariables(variables);
Copied:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SuspendDeploymentCmd.java
(from rev 4838,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SuspendDeploymentCmd.java)
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SuspendDeploymentCmd.java
(rev 0)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/cmd/SuspendDeploymentCmd.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,50 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.cmd;
+
+import org.hibernate.Session;
+import org.jbpm.api.cmd.Command;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.repository.DeploymentImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SuspendDeploymentCmd implements Command<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ long deploymentDbid;
+
+ public SuspendDeploymentCmd(long deploymentDbid) {
+ this.deploymentDbid = deploymentDbid;
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ Session session = environment.get(Session.class);
+ DeploymentImpl deployment = (DeploymentImpl) session.load(DeploymentImpl.class,
deploymentDbid);
+ deployment.suspend();
+ return null;
+ }
+
+}
Deleted:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/AddressBuilderImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/AddressBuilderImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/AddressBuilderImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,52 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.email.impl;
-
-import java.io.UnsupportedEncodingException;
-
-import javax.mail.Address;
-import javax.mail.internet.InternetAddress;
-
-import org.jbpm.api.JbpmException;
-import org.jbpm.api.identity.User;
-import org.jbpm.pvm.internal.email.spi.AddressBuilder;
-
-/**
- * @author Alejandro Guizar
- */
-public class AddressBuilderImpl implements AddressBuilder {
-
- public Address buildAddress(User user) {
- String givenName = user.getGivenName();
- String familyName = user.getFamilyName();
- String personal =
- givenName != null ? familyName != null ? givenName + ' ' + familyName :
givenName
- : familyName;
- try {
- return new InternetAddress(user.getEmailAddress(), personal);
- }
- catch (UnsupportedEncodingException e) {
- throw new JbpmException("invalid recipient name: " + personal);
- }
- }
-
-}
Copied:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/DefaultAddressResolver.java
(from rev 4838,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/DefaultAddressResolver.java)
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/DefaultAddressResolver.java
(rev 0)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/DefaultAddressResolver.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.email.impl;
+
+import java.io.UnsupportedEncodingException;
+import java.util.List;
+
+import javax.mail.Address;
+import javax.mail.internet.InternetAddress;
+
+import org.jbpm.api.JbpmException;
+import org.jbpm.api.env.Environment;
+import org.jbpm.api.identity.Group;
+import org.jbpm.api.identity.User;
+import org.jbpm.pvm.internal.email.spi.AddressResolver;
+import org.jbpm.pvm.internal.identity.spi.IdentitySession;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class DefaultAddressResolver implements AddressResolver {
+
+ public Address resolveAddress(User user) {
+ String givenName = user.getGivenName();
+ String familyName = user.getFamilyName();
+ String personal = givenName != null ? familyName != null ? givenName + ' ' +
familyName
+ : givenName : familyName;
+ try {
+ return new InternetAddress(user.getBusinessEmail(), personal);
+ }
+ catch (UnsupportedEncodingException e) {
+ throw new JbpmException("invalid recipient name: " + personal);
+ }
+ }
+
+ public Address[] resolveAddresses(Group group) {
+ List<User> users = Environment.getFromCurrent(IdentitySession.class)
+ .findUsersByGroup(group.getId());
+ int userCount = users.size();
+ Address[] addresses = new Address[userCount];
+ for (int i = 0; i < userCount; i++) {
+ addresses[i] = resolveAddress(users.get(i));
+ }
+ return addresses;
+ }
+
+}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailProducerImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -46,8 +46,9 @@
import org.jbpm.api.Execution;
import org.jbpm.api.JbpmException;
import org.jbpm.api.env.Environment;
+import org.jbpm.api.identity.Group;
import org.jbpm.api.identity.User;
-import org.jbpm.pvm.internal.email.spi.AddressBuilder;
+import org.jbpm.pvm.internal.email.spi.AddressResolver;
import org.jbpm.pvm.internal.email.spi.MailProducer;
import org.jbpm.pvm.internal.identity.spi.IdentitySession;
import org.jbpm.pvm.internal.script.ScriptManager;
@@ -99,20 +100,24 @@
}
}
+ Environment environment = Environment.getCurrent();
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ AddressResolver addressResolver = environment.get(AddressResolver.class);
+
// resolve and tokenize users
- IdentitySession identitySession = Environment.getFromCurrent(IdentitySession.class);
String userList = fromTemplate.getUsers();
if (userList != null) {
String[] userIds = tokenizeActors(userList, execution);
List<User> users = identitySession.findUsersById(userIds);
- addSenders(users, email);
+ addSenders(resolveAddresses(users, addressResolver), email);
}
- // resolve and tokenize actors
+
+ // resolve and tokenize groups
String groupList = fromTemplate.getGroups();
if (groupList != null) {
for (String groupId : tokenizeActors(groupList, execution)) {
- List<User> users = identitySession.findUsersByGroup(groupId);
- addSenders(users, email);
+ Group group = identitySession.findGroupById(groupId);
+ addSenders(addressResolver.resolveAddresses(group), email);
}
}
}
@@ -127,9 +132,18 @@
return evaluateExpression(recipients, execution).split("[,|\\s]+");
}
+ /** construct recipient addresses from user entities */
+ private Address[] resolveAddresses(List<User> users, AddressResolver
addressResolver) {
+ int userCount = users.size();
+ Address[] addresses = new Address[userCount];
+ for (int i = 0; i < userCount; i++) {
+ addresses[i] = addressResolver.resolveAddress(users.get(i));
+ }
+ return addresses;
+ }
+
/** add senders to message */
- private void addSenders(List<User> users, Message email) {
- Address[] addresses = buildAddresses(users);
+ private void addSenders(Address[] addresses, Message email) {
try {
email.addFrom(addresses);
}
@@ -138,18 +152,6 @@
}
}
- /** construct recipient addresses from user entities */
- private Address[] buildAddresses(List<User> users) {
- AddressBuilder addressBuilder = Environment.getFromCurrent(AddressBuilder.class);
-
- int userCount = users.size();
- Address[] addresses = new Address[userCount];
- for (int i = 0; i < userCount; i++) {
- addresses[i] = addressBuilder.buildAddress(users.get(i));
- }
- return addresses;
- }
-
protected void fillRecipients(Execution execution, Message email) {
// to
AddressTemplate to = template.getTo();
@@ -181,27 +183,30 @@
}
}
- IdentitySession identitySession = Environment.getFromCurrent(IdentitySession.class);
+ Environment environment = Environment.getCurrent();
+ IdentitySession identitySession = environment.get(IdentitySession.class);
+ AddressResolver addressResolver = environment.get(AddressResolver.class);
+
// resolve and tokenize users
String userList = addressTemplate.getUsers();
if (userList != null) {
String[] userIds = tokenizeActors(userList, execution);
List<User> users = identitySession.findUsersById(userIds);
- addRecipients(users, email, recipientType);
+ addRecipients(resolveAddresses(users, addressResolver), email, recipientType);
}
+
// resolve and tokenize groups
String groupList = addressTemplate.getGroups();
if (groupList != null) {
for (String groupId : tokenizeActors(groupList, execution)) {
- List<User> users = identitySession.findUsersByGroup(groupId);
- addRecipients(users, email, recipientType);
+ Group group = identitySession.findGroupById(groupId);
+ addRecipients(addressResolver.resolveAddresses(group), email, recipientType);
}
}
}
/** add recipient addresses to message */
- private void addRecipients(List<User> users, Message email, RecipientType
recipientType) {
- Address[] addresses = buildAddresses(users);
+ private void addRecipients(Address[] addresses, Message email, RecipientType
recipientType) {
try {
email.addRecipients(recipientType, addresses);
}
Copied:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailTemplateRegistry.java
(from rev 4838,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailTemplateRegistry.java)
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailTemplateRegistry.java
(rev 0)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/impl/MailTemplateRegistry.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,44 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.email.impl;
+
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Tom Baeyens
+ */
+public class MailTemplateRegistry implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ Map<String, MailTemplate> templates = new HashMap<String, MailTemplate>();
+
+ public void addTemplate(String templateName, MailTemplate template) {
+ templates.put(templateName, template);
+ }
+
+ public MailTemplate getTemplate(String templateName) {
+ return templates.get(templateName);
+ }
+}
Deleted:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/AddressBuilder.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/AddressBuilder.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/AddressBuilder.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,34 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.email.spi;
-
-import javax.mail.Address;
-
-import org.jbpm.api.identity.User;
-
-/**
- * @author Alejandro Guizar
- */
-public interface AddressBuilder {
-
- Address buildAddress(User user);
-}
Copied:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/AddressResolver.java
(from rev 4838,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/AddressResolver.java)
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/AddressResolver.java
(rev 0)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/email/spi/AddressResolver.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,37 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.email.spi;
+
+import javax.mail.Address;
+
+import org.jbpm.api.identity.Group;
+import org.jbpm.api.identity.User;
+
+/**
+ * @author Alejandro Guizar
+ */
+public interface AddressResolver {
+
+ Address resolveAddress(User user);
+
+ Address[] resolveAddresses(Group group);
+}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/ExecutionType.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/ExecutionType.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/ExecutionType.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -42,7 +42,7 @@
String activityName = rs.getString(names[0]);
ActivityImpl activity = (ActivityImpl)
execution.getProcessDefinition().getActivity(activityName);
execution.setActivity(activity);
- execution.setState(Execution.STATE_ACTIVE);
+ execution.setState(Execution.STATE_ACTIVE_ROOT);
return execution;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateJobDbSession.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateJobDbSession.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateJobDbSession.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -35,7 +35,6 @@
public class HibernateJobDbSession extends HibernateDbSession implements JobDbSession {
public JobImpl<?> findFirstAcquirableJob() {
- // query definition can be found at the bottom of resource jbpm.pvm.job.hbm.xml
Query query = session.getNamedQuery("findFirstAcquirableJob");
query.setTimestamp("now", Clock.getCurrentTime());
query.setMaxResults(1);
@@ -43,7 +42,6 @@
}
public List<JobImpl<?>> findExclusiveJobs(Execution processInstance) {
- // query definition can be found at the bottom of resource jbpm.pvm.job.hbm.xml
Query query = session.getNamedQuery("findExclusiveJobs");
query.setTimestamp("now", Clock.getCurrentTime());
query.setEntity("processInstance", processInstance);
@@ -51,7 +49,6 @@
}
public JobImpl<?> findFirstDueJob() {
- // query definition can be found at the bottom of resource jbpm.pvm.job.hbm.xml
Query query = session.getNamedQuery("findFirstDueJob");
query.setMaxResults(1);
return (JobImpl<?>) query.uniqueResult();
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernatePvmDbSession.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -37,6 +37,7 @@
import org.jbpm.api.session.PvmDbSession;
import org.jbpm.internal.log.Log;
import org.jbpm.pvm.internal.history.model.HistoryProcessInstanceImpl;
+import org.jbpm.pvm.internal.job.JobImpl;
import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.query.HistoryProcessInstanceQueryImpl;
import org.jbpm.pvm.internal.svc.DefaultCommandService;
@@ -264,6 +265,62 @@
}
}
+ public void cascadeExecutionSuspend(ExecutionImpl execution) {
+ // cascade suspend to jobs
+ Query query = session.createQuery(
+ "select job " +
+ "from "+JobImpl.class.getName()+" as job " +
+ "where job.execution = :execution " +
+ " and job.state != '"+JobImpl.STATE_SUSPENDED+"' "
+ );
+ query.setEntity("execution", execution);
+ List<JobImpl> jobs = query.list();
+ for (JobImpl job: jobs) {
+ job.suspend();
+ }
+
+ // cascade suspend to tasks
+ query = session.createQuery(
+ "select task " +
+ "from "+TaskImpl.class.getName()+" as task " +
+ "where task.execution = :execution " +
+ " and task.state != '"+TaskImpl.STATE_SUSPENDED+"' "
+ );
+ query.setEntity("execution", execution);
+ List<TaskImpl> tasks = query.list();
+ for (TaskImpl task: tasks) {
+ task.suspend();
+ }
+ }
+
+ public void cascadeExecutionResume(ExecutionImpl execution) {
+ // cascade suspend to jobs
+ Query query = session.createQuery(
+ "select job " +
+ "from "+JobImpl.class.getName()+" as job " +
+ "where job.execution = :execution " +
+ " and job.state = '"+TaskImpl.STATE_SUSPENDED+"' "
+ );
+ query.setEntity("execution", execution);
+ List<JobImpl> jobs = query.list();
+ for (JobImpl job: jobs) {
+ job.resume();
+ }
+
+ // cascade suspend to tasks
+ query = session.createQuery(
+ "select task " +
+ "from "+TaskImpl.class.getName()+" as task " +
+ "where task.execution = :execution " +
+ " and task.state = '"+TaskImpl.STATE_SUSPENDED+"' "
+ );
+ query.setEntity("execution", execution);
+ List<TaskImpl> tasks = query.list();
+ for (TaskImpl task: tasks) {
+ task.resume();
+ }
+ }
+
private List<TaskImpl> findTasks(String processInstanceId) {
Query query = session.createQuery(
"select task " +
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/hibernate/HibernateTaskDbSession.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -28,7 +28,6 @@
import org.jbpm.api.session.TaskDbSession;
import org.jbpm.api.task.Task;
import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.task.LifeCycle;
import org.jbpm.pvm.internal.task.SwimlaneImpl;
import org.jbpm.pvm.internal.task.TaskImpl;
import org.jbpm.pvm.internal.util.Clock;
@@ -55,9 +54,6 @@
if (! taskImpl.isPersisted()) {
Serializable dbid = session.save(taskImpl);
- if (taskImpl.getId() == null) {
- taskImpl.setId(dbid.toString());
- }
} else {
session.update(taskImpl);
@@ -67,7 +63,6 @@
public Task createTask() {
TaskImpl task = newTask();
task.setCreate(Clock.getCurrentTime());
- task.setState(LifeCycle.initialise(task));
return task;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUserCmd.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUserCmd.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/cmd/CreateUserCmd.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -34,21 +34,27 @@
private static final long serialVersionUID = 1L;
protected String userId;
- protected String password;
protected String givenName;
protected String familyName;
+ protected String businessEmail;
+ protected String password;
- public CreateUserCmd(String userId, String password, String givenName, String
familyName) {
+ public CreateUserCmd(String userId, String givenName, String familyName) {
this.userId = userId;
- this.password = password;
this.givenName = givenName;
this.familyName = familyName;
}
+ public CreateUserCmd(String userId, String givenName, String familyName, String
businessEmail) {
+ this.userId = userId;
+ this.givenName = givenName;
+ this.familyName = familyName;
+ this.businessEmail = businessEmail;
+ }
public Void execute(Environment environment) throws Exception {
IdentitySession identitySession = environment.get(IdentitySession.class);
- identitySession.createUser(userId, password, givenName, familyName);
+ identitySession.createUser(userId, givenName, familyName, businessEmail);
return null;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/IdentitySessionImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -21,71 +21,60 @@
*/
package org.jbpm.pvm.internal.identity.impl;
-import java.util.Collection;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.Session;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
import org.jbpm.api.JbpmException;
import org.jbpm.api.identity.Group;
import org.jbpm.api.identity.User;
import org.jbpm.pvm.internal.identity.spi.IdentitySession;
-
/**
* @author Tom Baeyens
*/
public class IdentitySessionImpl implements IdentitySession {
-
+
protected Session session;
- public String createUser(String userName, String password, String givenName, String
familyName) {
- UserImpl user = new UserImpl();
- user.setId(userName);
- user.setPassword(password);
- user.setGivenName(givenName);
- user.setFamilyName(familyName);
+ public String createUser(String userName, String givenName, String familyName, String
businessEmail) {
+ UserImpl user = new UserImpl(userName, givenName, familyName);
+ user.setBusinessEmail(businessEmail);
session.save(user);
-
+
return user.getId();
}
public User findUserById(String userId) {
- UserImpl user = (UserImpl) session.createQuery(
- "select user " +
- "from "+UserImpl.class.getName()+" as user " +
- "where user.id = '"+userId+"'"
- ).uniqueResult();
- return user;
+ return (User) session.createCriteria(UserImpl.class)
+ .add(Restrictions.eq("id", userId))
+ .uniqueResult();
}
public List<User> findUsersById(String... userIds) {
- return session.createQuery("from " + UserImpl.class.getName() + " u
" +
- "where u.id in :userIds")
- .setParameterList("userIds", userIds)
- .list();
+ return session.createCriteria(UserImpl.class).add(Restrictions.in("id",
userIds)).list();
}
public List<User> findUsers() {
- return session.createQuery(
- "from "+UserImpl.class.getName()
- ).list();
+ return session.createCriteria(UserImpl.class).list();
}
public void deleteUser(String userId) {
// lookup the user
User user = findUserById(userId);
-
+
// cascade the deletion to the memberships
- Query query = session.createQuery(
- "from "+MembershipImpl.class.getName()+" as m "+
- "where m.user is :user"
- );
+ Query query = session.createQuery("from "
+ + MembershipImpl.class.getName()
+ + " as m "
+ + "where m.user is :user");
query.setEntity("user", user);
List<MembershipImpl> memberships = query.list();
-
+
// delete the related memberships
- for (MembershipImpl membership: memberships) {
+ for (MembershipImpl membership : memberships) {
session.delete(membership);
}
@@ -95,103 +84,108 @@
public String createGroup(String groupName, String groupType, String parentGroupId) {
GroupImpl group = new GroupImpl();
- String groupId = (groupType!=null ? groupType+"."+groupName : groupName);
+ String groupId = groupType != null ? groupType + "." + groupName :
groupName;
group.setId(groupId);
group.setName(groupName);
group.setType(groupType);
-
- if (parentGroupId!=null) {
+
+ if (parentGroupId != null) {
GroupImpl parentGroup = findGroupById(parentGroupId);
group.setParent(parentGroup);
}
-
+
session.save(group);
-
+
return group.getId();
}
-
public List<User> findUsersByGroup(String groupId) {
- return session.createQuery("select m.user " +
- "from "+MembershipImpl.class.getName()+" m " +
- "where m.group.id = : groupId")
- .setString("groupId", groupId)
+ return session.createCriteria(MembershipImpl.class)
+ .createAlias("group", "g")
+ .add(Restrictions.eq("g.id", groupId))
+ .setProjection(Projections.property("user"))
.list();
}
-
+
public GroupImpl findGroupById(String groupId) {
- GroupImpl group = (GroupImpl) session.createQuery(
- "select group " +
- "from "+GroupImpl.class.getName()+" as group " +
- "where group.id = '"+groupId+"'"
- ).uniqueResult();
+ GroupImpl group = (GroupImpl) session.createQuery("select group "
+ + "from "
+ + GroupImpl.class.getName()
+ + " as group "
+ + "where group.id = '"
+ + groupId
+ + "'").uniqueResult();
return group;
}
public List<Group> findGroupsByUserAndGroupType(String userId, String groupType)
{
- Query query = session.createQuery(
- "select distinct membership.group " +
- "from "+MembershipImpl.class.getName()+" as membership " +
- "where membership.user.id = '"+userId+"'" +
- " and membership.group.type = '"+groupType+"'"
- );
+ Query query = session.createQuery("select distinct membership.group "
+ + "from "
+ + MembershipImpl.class.getName()
+ + " as membership "
+ + "where membership.user.id = '"
+ + userId
+ + "'"
+ + " and membership.group.type = '"
+ + groupType
+ + "'");
return query.list();
}
public List<Group> findGroupsByUser(String userId) {
- Query query = session.createQuery(
- "select distinct membership.group " +
- "from "+MembershipImpl.class.getName()+" as membership " +
- "where membership.user.id = '"+userId+"'"
- );
+ Query query = session.createQuery("select distinct membership.group "
+ + "from "
+ + MembershipImpl.class.getName()
+ + " as membership "
+ + "where membership.user.id = '"
+ + userId
+ + "'");
return query.list();
}
public List<Group> findGroups() {
- return session.createQuery(
- "from "+GroupImpl.class.getName()
- ).list();
+ return session.createQuery("from " + GroupImpl.class.getName()).list();
}
public void deleteGroup(String groupId) {
// look up the group
GroupImpl group = findGroupById(groupId);
-
+
// cascade the deletion to the memberships
- Query query = session.createQuery(
- "from "+MembershipImpl.class.getName()+" as m "+
- "where m.group is :group"
- );
+ Query query = session.createQuery("from "
+ + MembershipImpl.class.getName()
+ + " as m "
+ + "where m.group is :group");
query.setEntity("group", group);
List<MembershipImpl> memberships = query.list();
-
+
// delete the related memberships
- for (MembershipImpl membership: memberships) {
+ for (MembershipImpl membership : memberships) {
session.delete(membership);
}
-
+
// delete the group
session.delete(group);
}
public void createMembership(String userId, String groupId, String role) {
User user = findUserById(userId);
- if (user==null) {
- throw new JbpmException("user "+userId+" doesn't exist");
+ if (user == null) {
+ throw new JbpmException("user " + userId + " doesn't
exist");
}
GroupImpl group = findGroupById(groupId);
- if (group==null) {
- throw new JbpmException("group "+groupId+" doesn't
exist");
+ if (group == null) {
+ throw new JbpmException("group " + groupId + " doesn't
exist");
}
-
+
MembershipImpl membership = new MembershipImpl();
membership.setUser(user);
membership.setGroup(group);
membership.setRole(role);
-
+
session.save(membership);
}
-
+
public void deleteMembership(String userId, String groupId, String role) {
throw new UnsupportedOperationException("please implement me");
}
@@ -200,5 +194,4 @@
this.session = session;
}
-
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/JBossIdmIdentitySessionImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -59,7 +59,7 @@
transaction.enlistResource(identitySessionResource);
}
- public String createUser(String userName, String password, String givenName, String
lastName) {
+ public String createUser(String userName, String givenName, String familyName, String
businessEmail) {
try {
Identity identity =
identitySession.getPersistenceManager().createIdentity(userName);
@@ -67,8 +67,9 @@
// identitySession.getAttributesManager().updateCredential(identity, new
PasswordCredential(password));
Attribute[] attributes = new Attribute[] {
- new SimpleAttribute(P3PConstants.INFO_USER_NAME_GIVEN, new String[] { givenName
}),
- new SimpleAttribute(P3PConstants.INFO_USER_NAME_FAMILY, new String[] { lastName
})
+ new SimpleAttribute(P3PConstants.INFO_USER_NAME_GIVEN, givenName),
+ new SimpleAttribute(P3PConstants.INFO_USER_NAME_FAMILY, familyName),
+ new SimpleAttribute(P3PConstants.INFO_USER_BUSINESS_INFO_ONLINE_EMAIL,
businessEmail)
};
identitySession.getAttributesManager().addAttributes(identity, attributes);
} catch (IdentityException e) {
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/impl/UserImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -22,27 +22,25 @@
package org.jbpm.pvm.internal.identity.impl;
import java.io.Serializable;
-import java.util.Set;
import org.jbpm.api.identity.User;
-
/**
* @author Tom Baeyens
*/
public class UserImpl implements User, Serializable {
private static final long serialVersionUID = 1L;
-
+
protected long dbid;
protected int dbversion;
protected String id;
+ protected String password;
protected String givenName;
protected String familyName;
- protected String emailAddress;
- protected String password;
-
+ protected String businessEmail;
+
public UserImpl() {
}
@@ -55,40 +53,44 @@
public String getId() {
return id;
}
+
public String getGivenName() {
return givenName;
}
+
public String getFamilyName() {
return familyName;
}
- public String getEmailAddress() {
- return emailAddress;
- }
- public String toString() {
- if ( (givenName!=null)
- && (familyName!=null)
- ) {
- return givenName+" "+familyName;
- }
- return id;
+ public String getBusinessEmail() {
+ return businessEmail;
}
-
+
+ public String toString() {
+ return givenName != null ? familyName != null ? givenName + ' ' + familyName
: givenName
+ : familyName != null ? familyName : id;
+ }
+
public void setId(String id) {
this.id = id;
}
+
public void setGivenName(String givenName) {
this.givenName = givenName;
}
+
public void setFamilyName(String familyName) {
this.familyName = familyName;
}
- public void setEmailAddress(String emailAddress) {
- this.emailAddress = emailAddress;
- }
- public String getPassword() {
+
+ public void setBusinessEmail(String emailAddress) {
+ this.businessEmail = emailAddress;
+ }
+
+ public String getPassword() {
return password;
}
+
public void setPassword(String password) {
this.password = password;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/spi/IdentitySession.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/spi/IdentitySession.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/identity/spi/IdentitySession.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -29,10 +29,10 @@
/**
* @author Tom Baeyens
*/
-public interface IdentitySession{
+public interface IdentitySession {
/** create a new user */
- String createUser(String userId, String password, String givenName, String
familyName);
+ String createUser(String userId, String givenName, String familyName, String
businessEmail);
/** lookup a user.
* @return the user or null if no such user exists */
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/JobImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -13,6 +13,11 @@
private static final long serialVersionUID = 1L;
// private static final DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy
HH:mm:ss,SSS");
+ public static final String STATE_WAITING = "waiting";
+ public static final String STATE_ACQUIRED = "acquired";
+ public static final String STATE_ERROR = "error";
+ public static final String STATE_SUSPENDED = "suspended";
+
protected long dbid;
protected int dbversion;
@@ -20,8 +25,8 @@
* for async messages, this dueDate should be set to null. */
protected Date dueDate = null;
- /** suspended jobs will not execute. */
- protected boolean isSuspended;
+ /** job state. */
+ protected String state;
/** the execution (if any) for this jobImpl */
protected ExecutionImpl execution;
@@ -62,6 +67,30 @@
this.processInstance = execution.getProcessInstance();
}
+ public void acquire(String lockOwner, Date lockExpirationTime) {
+ this.state = STATE_ACQUIRED;
+ this.lockOwner = lockOwner;
+ this.lockExpirationTime = lockExpirationTime;
+ }
+ public void release() {
+ this.state = STATE_WAITING;
+ this.lockOwner = null;
+ this.lockExpirationTime = null;
+ }
+ public void setRetries(int retries) {
+ this.retries = retries;
+ if (this.retries==0) {
+ this.state = STATE_ERROR;
+ }
+ }
+ public void suspend() {
+ this.state = STATE_SUSPENDED;
+ }
+ public void resume() {
+ this.state = STATE_WAITING;
+ }
+
+
public long getDbid() {
return dbid;
}
@@ -71,9 +100,6 @@
public String getLockOwner() {
return lockOwner;
}
- public boolean isSuspended() {
- return isSuspended;
- }
public Date getDueDate() {
return dueDate;
}
@@ -92,24 +118,18 @@
public ExecutionImpl getExecution() {
return execution;
}
- public void setException(String exception) {
- this.exception = exception;
- }
public void setExclusive(boolean isExclusive) {
this.isExclusive = isExclusive;
}
public void setLockOwner(String jobExecutorName) {
this.lockOwner = jobExecutorName;
}
- public void setRetries(int retries) {
- this.retries = retries;
- }
- public void setSuspended(boolean isSuspended) {
- this.isSuspended = isSuspended;
- }
public ExecutionImpl getProcessInstance() {
return processInstance;
}
+ public void setException(String exception) {
+ this.exception = exception;
+ }
public Date getLockExpirationTime() {
return lockExpirationTime;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/MessageImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/MessageImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/MessageImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -21,7 +21,6 @@
*/
package org.jbpm.pvm.internal.job;
-import org.jbpm.api.JbpmException;
import org.jbpm.api.job.Message;
import org.jbpm.pvm.internal.model.ExecutionImpl;
@@ -43,11 +42,4 @@
this.execution = execution;
this.processInstance = execution.getProcessInstance();
}
-
- protected void unlockExecution() {
- if (execution == null) {
- throw new JbpmException("This message isn't bound to any
execution");
- }
- execution.unlock();
- }
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/job/TimerImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -136,8 +136,7 @@
if (log.isDebugEnabled()) log.debug("rescheduled "+this+" for
"+formatDueDate(dueDate));
// release the lock on the timer
- setLockOwner(null);
- setLockExpirationTime(null);
+ release();
// notify the jobExecutor at the end of the transaction
JobExecutor jobExecutor = environment.get(JobExecutor.class);
@@ -153,7 +152,7 @@
return deleteThisJob;
}
-
+
public String toString() {
StringBuffer buffer = new StringBuffer();
buffer.append("timer[");
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/AcquireJobsCmd.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/AcquireJobsCmd.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/AcquireJobsCmd.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -72,8 +72,7 @@
for (JobImpl<?> acquiredJob: acquiredJobs) {
long lockExpirationTime =
System.currentTimeMillis()+jobExecutor.getLockMillis();
log.trace("trying to obtain a lock for '"+acquiredJob+"'
with exp "+timeFormat.format(new Date(lockExpirationTime)));
- acquiredJob.setLockExpirationTime(new Date(lockExpirationTime));
- acquiredJob.setLockOwner(jobExecutor.getName());
+ acquiredJob.acquire(jobExecutor.getName(), new Date(lockExpirationTime));
acquiredJobDbids.add(acquiredJob.getDbid());
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExceptionHandler.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExceptionHandler.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/jobexecutor/JobExceptionHandler.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -26,7 +26,6 @@
import javax.transaction.Synchronization;
-import org.hibernate.Session;
import org.jbpm.api.JbpmException;
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.CommandService;
@@ -83,11 +82,9 @@
// decrement the number of retries
int decrementedRetries = job.getRetries()-1;
log.debug("decrementing retries to "+decrementedRetries+" for
"+job);
+ job.release();
job.setRetries(decrementedRetries);
- job.setException(sw.toString());
- log.debug("unlocking "+job);
- job.setLockOwner(null);
- job.setLockExpirationTime(null);
+ job.setException(sw.toString());
// notify the job executor after the transaction is completed
Transaction transaction = environment.get(Transaction.class);
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ActivityImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -46,10 +46,7 @@
protected ActivityImpl parentActivity;
protected String type;
- protected boolean isExecutionAsync;
- protected boolean isSignalAsync;
- protected boolean isLeaveAsync;
- protected boolean isPreviousNeeded;
+ protected boolean isAsync;
protected ActivityCoordinatesImpl coordinates;
@@ -81,7 +78,7 @@
return super.findActivity(activityName);
}
- // leaving transitions //////////////////////////////////////////////////////
+ // outgoing transitions //////////////////////////////////////////////////////
/** creates an outgoing transition from this activity. */
public TransitionImpl createOutgoingTransition() {
@@ -100,39 +97,6 @@
return transition;
}
-
- // TODO remove
- public Transition createOutgoingTransition(ActivityImpl destination) {
- return createOutgoingTransition(destination, null);
- }
-
- // TODO remove
- public TransitionImpl createOutgoingTransition(ActivityImpl destination, String
transitionName) {
- TransitionImpl transition = createOutgoingTransition(transitionName);
- if (destination!=null) {
- destination.addIncomingTransition(transition);
- }
- return transition;
- }
-
- // TODO remove
- public TransitionImpl createOutgoingTransition(String transitionName) {
- // create a new transition
- TransitionImpl transition = new TransitionImpl();
- transition.setName(transitionName);
-
- // wire it between the source and destination
- addOutgoingTransition(transition);
-
- // if there is no default transition yet
- if (defaultOutgoingTransition==null) {
- // make this the default outgoing transition
- defaultOutgoingTransition = transition;
- }
-
- return transition;
- }
-
/**
* adds the given transition as a leaving transition to this activity.
* Also the source of the transition is set to this activity.
@@ -142,18 +106,18 @@
* @throws NullPointerException if transition is null.
*/
public Transition addOutgoingTransition(TransitionImpl transition) {
- transition.setSource(this);
-
if (outgoingTransitions==null) {
outgoingTransitions = new ArrayList<TransitionImpl>();
}
if (! outgoingTransitions.contains(transition)) {
+ transition.setSource(this);
+ transition.setSourceIndex(outgoingTransitions.size());
outgoingTransitions.add(transition);
+ clearOutgoingTransitionsMap();
}
- outgoingTransitionsMap = null;
return transition;
}
-
+
/**
* removes the given transition from the leaving transitions.
* Also the transition's source will be nulled.
@@ -177,7 +141,7 @@
if (outgoingTransitions.isEmpty()) {
outgoingTransitions = null;
}
- outgoingTransitionsMap = null;
+ clearOutgoingTransitionsMap();
}
return isRemoved;
}
@@ -243,34 +207,22 @@
*/
public void setOutgoingTransitions(List<TransitionImpl> outgoingTransitions) {
if (this.outgoingTransitions!=null) {
- for (TransitionImpl removedTransition: this.outgoingTransitions) {
- removedTransition.setSource(null);
+ List<TransitionImpl> removedTransitions = new
ArrayList<TransitionImpl>(outgoingTransitions);
+ for (TransitionImpl removedTransition: removedTransitions) {
+ removeOutgoingTransition(removedTransition);
}
}
if (outgoingTransitions!=null) {
- this.outgoingTransitions = new
ArrayList<TransitionImpl>(outgoingTransitions);
+ this.outgoingTransitions = new ArrayList<TransitionImpl>();
for (TransitionImpl addedTransition: outgoingTransitions) {
- addedTransition.setSource(this);
+ addOutgoingTransition(addedTransition);
}
} else {
this.outgoingTransitions = null;
}
- this.outgoingTransitionsMap = null;
+ clearOutgoingTransitionsMap();
}
- /** the leaving transitions, keyed by transition name. If a transition with
- * the same name occurs mutltiple times, the first one is returned.
- * Leaving transitions with a null value for their name are not included
- * in the map.
- * Beware: the actual member is returned. No copy is made.
- */
- public Map<String, Transition> getOutgoingTransitionsMap() {
- if(outgoingTransitionsMap == null){
- this.outgoingTransitionsMap = getTransitionsMap(outgoingTransitions);
- }
- return (Map) outgoingTransitionsMap;
- }
-
// arriving transitions /////////////////////////////////////////////////////
/**
@@ -382,21 +334,33 @@
return behaviour;
}
- // various helper methods ///////////////////////////////////////////////////
-
- private static Map<String, TransitionImpl>
getTransitionsMap(List<TransitionImpl> transitions) {
- Map<String, TransitionImpl> map = null;
- if (transitions!=null) {
- map = new HashMap<String, TransitionImpl>();
- for (TransitionImpl transition: transitions) {
- if (! map.containsKey(transition.getName())) {
- map.put(transition.getName(), transition);
+ /** the leaving transitions, keyed by transition name. If a transition with
+ * the same name occurs mutltiple times, the first one is returned.
+ * Leaving transitions with a null value for their name are not included
+ * in the map.
+ * Beware: the actual member is returned. No copy is made.
+ */
+ public Map<String, Transition> getOutgoingTransitionsMap() {
+ if(outgoingTransitionsMap == null){
+ this.outgoingTransitionsMap = new HashMap<String, TransitionImpl>();
+ if (outgoingTransitions!=null) {
+ for (TransitionImpl transition: outgoingTransitions) {
+ if (! this.outgoingTransitionsMap.containsKey(transition.getName())) {
+ this.outgoingTransitionsMap.put(transition.getName(), transition);
+ }
}
}
}
- return map;
+ return (Map) outgoingTransitionsMap;
}
+
+ void clearOutgoingTransitionsMap() {
+ outgoingTransitionsMap = null;
+ }
+
+ // various helper methods ///////////////////////////////////////////////////
+
static Map<String, ActivityImpl> getActivitiesMap(List<ActivityImpl>
activities) {
Map<String, ActivityImpl> map = null;
if (activities!=null) {
@@ -455,30 +419,12 @@
public void setParentActivity(ActivityImpl parentActivity) {
this.parentActivity = parentActivity;
}
- public boolean isExecutionAsync() {
- return isExecutionAsync;
+ public boolean isAsync() {
+ return isAsync;
}
- public boolean isSignalAsync() {
- return isSignalAsync;
+ public void setAsync(boolean isExecutionAsync) {
+ this.isAsync = isExecutionAsync;
}
- public void setSignalAsync(boolean isSignalAsync) {
- this.isSignalAsync = isSignalAsync;
- }
- public void setExecutionAsync(boolean isExecutionAsync) {
- this.isExecutionAsync = isExecutionAsync;
- }
- public boolean isLeaveAsync() {
- return isLeaveAsync;
- }
- public void setLeaveAsync(boolean isLeaveAsync) {
- this.isLeaveAsync = isLeaveAsync;
- }
- public boolean isPreviousNeeded() {
- return isPreviousNeeded;
- }
- public void setPreviousNeeded(boolean isPreviousNeeded) {
- this.isPreviousNeeded = isPreviousNeeded;
- }
public String getType() {
return type;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -38,6 +38,7 @@
protected String name;
protected List<EventListenerReference> listenerReferences;
+ protected boolean isAsync;
public String toString() {
return (name != null ? "event(" + name + ")" :
"event");
@@ -89,4 +90,10 @@
public void setListenerReferences(List<EventListenerReference>
eventListenerReferences) {
this.listenerReferences = eventListenerReferences;
}
+ public boolean isAsync() {
+ return isAsync;
+ }
+ public void setAsync(boolean isAsync) {
+ this.isAsync = isAsync;
+ }
}
\ No newline at end of file
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventListenerReference.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventListenerReference.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/EventListenerReference.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -32,6 +32,7 @@
/** does this action accept propagated events ? */
boolean isPropagationEnabled = false;
+ boolean isAsync = false;
/** does this action accept propagated events ? Default is false. */
public boolean isPropagationEnabled() {
@@ -42,4 +43,12 @@
public void setPropagationEnabled(boolean isPropagationEnabled) {
this.isPropagationEnabled = isPropagationEnabled;
}
+
+ public boolean isAsync() {
+ return isAsync;
+ }
+
+ public void setAsync(boolean isAsync) {
+ this.isAsync = isAsync;
+ }
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExceptionHandlerImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -196,7 +196,7 @@
if (transition!=null) {
log.trace(toString()+" takes transition "+transitionName);
execution.setTransition(transition);
- execution.performAtomicOperationSync(ExecutionImpl.TAKE_TRANSITION);
+ execution.performAtomicOperationSync(ExecutionImpl.TRANSITION_END_ACTIVITY);
} else {
log.info("WARNING: "+toString()+" couldn't find transition
"+transitionName+" on "+activity);
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ExecutionImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -43,7 +43,6 @@
import org.jbpm.api.cmd.CommandService;
import org.jbpm.api.env.Environment;
import org.jbpm.api.env.Transaction;
-import org.jbpm.api.listener.EventListener;
import org.jbpm.api.listener.EventListenerExecution;
import org.jbpm.api.model.Activity;
import org.jbpm.api.model.Comment;
@@ -54,6 +53,7 @@
import org.jbpm.api.session.MessageSession;
import org.jbpm.api.session.RepositorySession;
import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.hibernate.HibernatePvmDbSession;
import org.jbpm.pvm.internal.history.HistoryEvent;
import org.jbpm.pvm.internal.history.HistorySession;
import org.jbpm.pvm.internal.history.events.ActivityEnd;
@@ -65,11 +65,13 @@
import org.jbpm.pvm.internal.job.MessageImpl;
import org.jbpm.pvm.internal.model.op.AtomicOperation;
import org.jbpm.pvm.internal.model.op.ExecuteActivity;
+import org.jbpm.pvm.internal.model.op.ExecuteEventListener;
import org.jbpm.pvm.internal.model.op.MoveToChildActivity;
import org.jbpm.pvm.internal.model.op.MoveToParentActivity;
-import org.jbpm.pvm.internal.model.op.ProceedToDestination;
import org.jbpm.pvm.internal.model.op.Signal;
-import org.jbpm.pvm.internal.model.op.TakeTransition;
+import org.jbpm.pvm.internal.model.op.TransitionEndActivity;
+import org.jbpm.pvm.internal.model.op.TransitionStartActivity;
+import org.jbpm.pvm.internal.model.op.TransitionTake;
import org.jbpm.pvm.internal.util.EqualsUtil;
import org.jbpm.pvm.internal.util.Priority;
@@ -88,10 +90,11 @@
// atomic operations
public static final AtomicOperation EXECUTE_ACTIVITY = new ExecuteActivity();
- public static final AtomicOperation PROCEED_TO_DESTINATION = new
ProceedToDestination();
- public static final AtomicOperation TAKE_TRANSITION = new TakeTransition();
+ public static final AtomicOperation TRANSITION_END_ACTIVITY = new
TransitionEndActivity();
+ public static final AtomicOperation TRANSITION_TAKE = new TransitionTake();
+ public static final AtomicOperation TRANSITION_START_ACTIVITY = new
TransitionStartActivity();
public static final AtomicOperation PROPAGATE_TO_PARENT = new MoveToParentActivity();
-
+
// persistent member fields /////////////////////////////////////////////////
/** an optional name for this execution. can be used to
@@ -121,8 +124,6 @@
protected ExecutionImpl parent = null;
protected ExecutionImpl processInstance;
- protected ScopeInstanceImpl scopeInstanceImpl;
-
/** the super process link in case this is a sub process execution */
protected ExecutionImpl superProcessExecution;
@@ -144,11 +145,12 @@
/** transition is not to be made persistable by default */
protected TransitionImpl transition;
+ protected Integer transitionSourceIndex;
/** the activity from which the transition was taken. This can be different from
- * the transition source in case a transition of an eclosing activity was taken.
- * transitionOrigin is not to be made persistable by default */
- protected ActivityImpl transitionOrigin;
+ * the transition source in case a transition of an eclosing activity was taken. */
+ protected ActivityImpl transitionSource;
+ protected String transitionSourceName;
protected EventImpl event;
protected ObservableElementImpl eventSource;
@@ -168,9 +170,6 @@
}
protected Propagation propagation = null;
- protected Activity previousActivity;
- protected Transition previousTransition;
-
// construction /////////////////////////////////////////////////////////////
public void initializeProcessInstance(ProcessDefinitionImpl processDefinition, String
key) {
@@ -192,7 +191,7 @@
if (state!=STATE_CREATED) {
throw new JbpmException(toString()+" is already begun: "+state);
}
- this.state = STATE_ACTIVE;
+ this.state = STATE_ACTIVE_ROOT;
ExecutionImpl scopedExecution = initializeScopes();
fireHistoryEvent(new ProcessInstanceStart());
@@ -236,13 +235,13 @@
public ExecutionImpl createScope(ScopeElementImpl scope) {
ExecutionImpl child = createExecution(scope.getName());
+ setState(STATE_INACTIVE_SCOPE);
+ child.setState(STATE_ACTIVE_ROOT);
+
// copy the current state from the child execution to the parent execution
child.setActivity(getActivity());
child.setTransition(getTransition());
child.setPropagation(getPropagation());
- child.setTransitionOrigin(getTransitionOrigin());
- child.setPreviousTransition(getPreviousTransition());
- child.setPreviousActivity(getPreviousActivity());
child.initializeVariables(scope, this);
child.initializeTimers(scope);
@@ -254,13 +253,19 @@
destroyTimers(scope);
// copy the current state from the child execution to the parent execution
- getParent().setActivity(getActivity());
- getParent().setTransition(getTransition());
- getParent().setPropagation(getPropagation());
- getParent().setTransitionOrigin(getTransitionOrigin());
- getParent().setPreviousTransition(getPreviousTransition());
- getParent().setPreviousActivity(getPreviousActivity());
+ parent.setActivity(getActivity());
+ parent.setTransition(getTransition());
+ parent.setPropagation(getPropagation());
+ ExecutionImpl parentsParent = parent.getParent();
+ if ( (parentsParent!=null)
+ && (STATE_INACTIVE_CONCURRENT_ROOT.equals(parentsParent.getState()))
+ ) {
+ parent.setState(STATE_ACTIVE_CONCURRENT);
+ } else {
+ parent.setState(STATE_ACTIVE_ROOT);
+ }
+
end();
return parent;
@@ -288,9 +293,13 @@
if (state==null) {
throw new JbpmException("state is null");
}
- if (state.equals(STATE_ACTIVE)
- || state.equals(STATE_CREATED)
- || state.equals(STATE_INACTIVE)
+
+ if (state.equals(STATE_CREATED)
+ || state.equals(STATE_ACTIVE_ROOT)
+ || state.equals(STATE_ACTIVE_CONCURRENT)
+ || state.equals(STATE_INACTIVE_CONCURRENT_ROOT)
+ || state.equals(STATE_INACTIVE_SCOPE)
+ || state.equals(STATE_INACTIVE_JOIN)
|| state.equals(STATE_SUSPENDED)
|| state.equals(STATE_ASYNC)) {
throw new JbpmException("invalid end state: "+state);
@@ -306,7 +315,9 @@
// end all child executions
if (executions!=null) {
- for (ExecutionImpl child: executions) {
+ // making a copy of the executions to prevent ConcurrentMoidificationException
+ List<ExecutionImpl> executionsToEnd = new
ArrayList<ExecutionImpl>(executions);
+ for (ExecutionImpl child: executionsToEnd) {
child.end(state);
}
}
@@ -321,6 +332,7 @@
} else { // this is a process instance
fireHistoryEvent(new ProcessInstanceEnd());
fire(Event.END, getProcessDefinition());
+
if (superProcessExecution!=null) {
log.trace(toString()+" signals super process execution");
superProcessExecution.signal();
@@ -348,24 +360,6 @@
}
- // execution method : suspend and resume ////////////////////////////////////
-
- /** @see Execution#suspend() */
- public void suspend() {
- if (isSuspended()) {
- throw new JbpmException(toString()+" is suspended");
- }
- lock(STATE_SUSPENDED);
- }
-
- /** @see Execution#resume() */
- public void resume() {
- if (! isSuspended()) {
- throw new JbpmException(toString()+" is not suspended");
- }
- unlock();
- }
-
// execution method : signal ////////////////////////////////////////////////
public void signal() {
@@ -381,11 +375,12 @@
}
public void signal(String signal, Map<String, Object> parameters) {
- checkLock();
+ checkActive();
+ propagation = Propagation.EXPLICIT;
if (getActivity()!=null) {
performAtomicOperation(new Signal(signal, parameters, getActivity()));
} else if (transition!=null) {
- performAtomicOperation(ExecutionImpl.PROCEED_TO_DESTINATION);
+ performAtomicOperation(ExecutionImpl.TRANSITION_START_ACTIVITY);
} else {
throw new JbpmException("execution is not in a activity or in a
transition");
}
@@ -432,16 +427,12 @@
/** @see Execution#takeDefaultTransition() */
public void take(Transition transition) {
- checkLock();
+ checkActive();
setPropagation(Propagation.EXPLICIT);
setTransition((TransitionImpl) transition);
- // copy the current activity as the transition origin. the origin can be different
from
- // the transition source in case a transition is taken from an enclosing activity
- setTransitionOrigin(getActivity());
- setPreviousTransition(null);
- performAtomicOperation(TAKE_TRANSITION);
+ performAtomicOperation(TRANSITION_END_ACTIVITY);
}
public void take(Transition transition, Execution execution) {
@@ -467,7 +458,7 @@
if (activity==null) {
throw new JbpmException("activity is null");
}
- checkLock();
+ checkActive();
this.propagation = Propagation.EXPLICIT;
performAtomicOperation(new MoveToChildActivity((ActivityImpl) activity));
@@ -482,7 +473,7 @@
// execution method : proceed ///////////////////////////////////////////////
public void proceed() {
- checkLock();
+ checkActive();
// in graph based processDefinition languages we assume that a
// default transition is available
@@ -511,30 +502,21 @@
}
}
- public void setActivity(Activity destination, Execution execution) {
- ((ExecutionImpl)execution).setActivity(destination);
+ public void setActivity(Activity activity, Execution execution) {
+ ((ExecutionImpl)execution).setActivity(activity);
}
- public void setActivity(Activity destination) {
- setActivity((ActivityImpl) destination);
+ public void setActivity(Activity activity) {
+ setActivity((ActivityImpl) activity);
}
// execution : internal methods /////////////////////////////////////////////
public void moveTo(ActivityImpl destination) {
- // if the parent activity needs to know the previous activity
- if (destination.isPreviousNeeded()) {
- setPreviousActivity(getActivity());
- setPreviousTransition(getTransition());
- } else {
- this.previousActivity = null;
- this.previousTransition = null;
- }
-
// move the execution to the destination
setActivity(destination);
transition = null;
- transitionOrigin = null;
+ transitionSource = null;
}
public ExecutionImpl startActivity(ActivityImpl activity) {
@@ -572,7 +554,7 @@
throw new JbpmException("no message-session configured to send asynchronous
continuation message");
}
MessageImpl<?> asyncMessage = operation.createAsyncMessage(this);
- lock(Execution.STATE_ASYNC);
+ setState(Execution.STATE_ASYNC);
messageSession.send(asyncMessage);
}
@@ -632,35 +614,16 @@
/** fires the given event without propagation */
void fire(EventImpl event, ObservableElement eventSource, ObservableElement
observableElement) {
- try {
- this.event = event;
- this.eventSource = (ObservableElementImpl) eventSource;
-
- List<EventListenerReference> eventListenerReferences =
event.getListenerReferences();
-
- if (eventListenerReferences!=null) {
- for (EventListenerReference eventListenerReference: eventListenerReferences) {
-
- if ( (observableElement.equals(eventSource)) // this event is not propagated
- || (eventListenerReference.isPropagationEnabled()) // propagation is
allowed
- ) {
- EventListener eventListener = eventListenerReference.get();
-
- log.trace("executing "+eventListener+" for "+event);
- try {
- // TODO can/should this invocation be unified with the exception handler
invocation of the event notification method?
- eventListener.notify(this);
- } catch (Exception e) {
- log.trace("exception during action: "+e);
- handleException((ObservableElementImpl) observableElement, event,
eventListenerReference, e, "couldn't run action "+eventListener);
- }
- }
+ List<EventListenerReference> eventListenerReferences =
event.getListenerReferences();
+ if (eventListenerReferences!=null) {
+ for (EventListenerReference eventListenerReference: eventListenerReferences) {
+ ExecuteEventListener executeEventListenerOperation = new
ExecuteEventListener(eventListenerReference, event, (ObservableElementImpl) eventSource,
observableElement);
+ if (eventListenerReference.isAsync()) {
+ sendContinuationMessage(executeEventListenerOperation);
+ } else {
+ executeEventListenerOperation.perform(this);
}
}
-
- } finally {
- this.eventSource = null;
- this.event = null;
}
}
@@ -749,47 +712,29 @@
// child executions /////////////////////////////////////////////////////////
- /** @see Execution#createProcessInstance() */
public ExecutionImpl createExecution() {
- return createExecution((String)null);
+ return createExecution(null);
}
- public Execution createExecution(Execution parent) {
- return ((ExecutionImpl)parent).createExecution();
- }
-
- public Execution createExecution(String name, Execution parent) {
- return ((ExecutionImpl)parent).createExecution(name);
- }
-
- /** @see Execution#createProcessInstance(String) */
public ExecutionImpl createExecution(String name) {
- // creating a child execution implies that this execution
- // is not a leave any more and therefore, it is inactivated
- if (isActive()) {
- lock(STATE_INACTIVE);
- propagation = Propagation.EXPLICIT;
- }
+ // ?!
+ propagation = Propagation.EXPLICIT;
// create child execution
ExecutionImpl childExecution = newChildExecution();
+ addExecution(childExecution);
+
+ // initialize new concurrent execution
childExecution.setProcessDefinition(getProcessDefinition());
- childExecution.setActivity(getActivity());
childExecution.processInstance = this.processInstance;
- childExecution.state = STATE_ACTIVE;
childExecution.name = name;
log.debug("creating "+childExecution);
- // add it to this execution
- addExecution(childExecution);
- // invalidate the cached executionsMap
- executionsMap = null;
-
- // id generation
+
+ // id generation (after initialization)
IdGenerator keyGenerator = Environment.getFromCurrent(IdGenerator.class, false);
if (keyGenerator!=null) {
childExecution.id = keyGenerator.createId(getProcessDefinition(), this,
childExecution);
}
-
return childExecution;
}
@@ -805,6 +750,7 @@
executions = new ArrayList<ExecutionImpl>();
}
executions.add(executionImpl);
+ executionsMap = null;
}
/** @see Execution#getExecution(String) */
@@ -816,16 +762,6 @@
public void removeExecution(Execution child) {
if (executions!=null) {
if (executions.remove(child)) {
- if ( state.equals(STATE_INACTIVE) &&
- (executions.isEmpty())
- ) {
- if (log.isTraceEnabled()) {
- log.trace("last child execution was removed; unlocking");
- }
- state = STATE_ACTIVE;
- } else if (log.isTraceEnabled()) {
- log.trace("removed "+child+" from "+this);
- }
// invalidate the executionsMap cache
executionsMap = null;
} else {
@@ -834,10 +770,6 @@
}
}
- public void removeExecution(Execution child, Execution parent) {
- ((ExecutionImpl)parent).removeExecution(child);
- }
-
public Map<String, Execution> getExecutionsMap() {
if ( (executionsMap==null)
&& (executions!=null)
@@ -867,7 +799,7 @@
}
protected Set<String> addActiveActivityNames(Set<String> activityNames) {
- if ( (state.equals(STATE_ACTIVE))
+ if ( (state.equals(STATE_ACTIVE_ROOT))
&& (activityName!=null)
) {
activityNames.add(activityName);
@@ -884,7 +816,7 @@
public ExecutionImpl findActiveExecutionIn(String activityName) {
if ( activityName.equals(this.activityName)
- && state.equals(STATE_ACTIVE)) {
+ && isActive()) {
return this;
}
@@ -925,32 +857,63 @@
return subProcessInstance;
}
- // state : internal methods /////////////////////////////////////////////////
+ // state mgmt ///////////////////////////////////////////////////////////////
- /** @see Execution#lock(String) */
- public void lock(String state) {
- if (state==null) {
- throw new JbpmException("given state is null");
+ /** @see Execution#suspend() */
+ public void suspend() {
+ super.suspend();
+ HibernatePvmDbSession hibernatePvmDbSession =
Environment.getFromCurrent(HibernatePvmDbSession.class, false);
+ if (hibernatePvmDbSession!=null) {
+ hibernatePvmDbSession.cascadeExecutionSuspend(this);
}
- checkLock();
- log.trace("locking "+this);
- this.state = state;
}
-
- /** @see Execution#unlock() */
- public void unlock() {
- if (Execution.STATE_ACTIVE.equals(state)) {
- throw new JbpmException("state is already active");
+
+ /** @see Execution#resume() */
+ public void resume() {
+ super.resume();
+ HibernatePvmDbSession hibernatePvmDbSession =
Environment.getFromCurrent(HibernatePvmDbSession.class, false);
+ if (hibernatePvmDbSession!=null) {
+ hibernatePvmDbSession.cascadeExecutionResume(this);
}
- log.trace("unlocking "+this);
- this.state = Execution.STATE_ACTIVE;
}
- protected void checkLock() {
- if (!Execution.STATE_ACTIVE.equals(state)) {
+ public void setState(String state) {
+ this.state = state;
+ }
+
+ protected void checkActive() {
+ if (!isActive()) {
throw new JbpmException(toString()+" is not active: "+state);
}
}
+
+ public boolean isEnded() {
+ if (Execution.STATE_ENDED.equals(state)) {
+ return true;
+ }
+ if (Execution.STATE_CREATED.equals(state)) {
+ return false;
+ }
+ if (Execution.STATE_ACTIVE_ROOT.equals(state)) {
+ return false;
+ }
+ if (Execution.STATE_ACTIVE_CONCURRENT.equals(state)) {
+ return false;
+ }
+ if (Execution.STATE_INACTIVE_CONCURRENT_ROOT.equals(state)) {
+ return false;
+ }
+ if (Execution.STATE_INACTIVE_SCOPE.equals(state)) {
+ return false;
+ }
+ if (Execution.STATE_SUSPENDED.equals(state)) {
+ return false;
+ }
+ if (Execution.STATE_ASYNC.equals(state)) {
+ return false;
+ }
+ return true;
+ }
////////////////////////////////////////////////////////////////////////////////
@@ -1034,8 +997,34 @@
return EqualsUtil.equals(this, o);
}
- // special getters and setters /////////////////////////////////////////////////
+ // process definition getter and setter /////////////////////////////////////
+ // this getter and setter is special because persistence is based on the //
+ // process definition id. //
+ /////////////////////////////////////////////////////////////////////////////
+
+ public ProcessDefinitionImpl getProcessDefinition() {
+ if ( (processDefinition==null)
+ && (processDefinitionId!=null)
+ ) {
+ RepositorySession repositorySession =
Environment.getFromCurrent(RepositorySession.class);
+ processDefinition = (ProcessDefinitionImpl)
repositorySession.findProcessDefinitionById(processDefinitionId);
+ if (processDefinition==null) {
+ throw new JbpmException("couldn't find process definition
"+processDefinitionId+" in the repository");
+ }
+ }
+ return processDefinition;
+ }
+ public void setProcessDefinition(ProcessDefinitionImpl processDefinition) {
+ this.processDefinition = processDefinition;
+ this.processDefinitionId = processDefinition.getId();
+ }
+
+ // activity getter and setter ///////////////////////////////////////////////
+ // this getter and setter is special because persistence is based on the //
+ // activity name. //
+ /////////////////////////////////////////////////////////////////////////////
+
public ActivityImpl getActivity() {
if ( (activity==null)
&& (activityName!=null)
@@ -1058,25 +1047,47 @@
return activityName;
}
- public ProcessDefinitionImpl getProcessDefinition() {
- if ( (processDefinition==null)
- && (processDefinitionId!=null)
+ // transition getter and setter /////////////////////////////////////////////
+ // this getter and setter is special because persistence is based on the //
+ // transition index of the current activity. //
+ /////////////////////////////////////////////////////////////////////////////
+
+ public void setTransition(TransitionImpl transition) {
+ this.transition = transition;
+ if (transition==null) {
+ this.transitionSource = null;
+ this.transitionSourceName = null;
+ this.transitionSourceIndex = null;
+ } else {
+ this.transitionSource = transition.getSource();
+ this.transitionSourceName = transitionSource.getName();
+ this.transitionSourceIndex = transition.getSourceIndex();
+ }
+ }
+
+ public TransitionImpl getTransition() {
+ if ( (transition==null)
+ && (transitionSourceIndex!=null)
) {
- RepositorySession repositorySession =
Environment.getFromCurrent(RepositorySession.class);
- processDefinition = (ProcessDefinitionImpl)
repositorySession.findProcessDefinitionById(processDefinitionId);
- if (processDefinition==null) {
- throw new JbpmException("couldn't find process definition
"+processDefinitionId+" in the repository");
- }
+ transition = (TransitionImpl)
getTransitionSource().getOutgoingTransitions().get(transitionSourceIndex);
}
- return processDefinition;
+ return transition;
}
- public void setProcessDefinition(ProcessDefinitionImpl processDefinition) {
- this.processDefinition = processDefinition;
- this.processDefinitionId = processDefinition.getId();
+
+ public ActivityImpl getTransitionSource() {
+ if ( (transitionSource==null)
+ && (transitionSourceName!=null)
+ ) {
+ transitionSource = getProcessDefinition().findActivity(transitionSourceName);
+ }
+ return transitionSource;
}
+
+
// getters and setters /////////////////////////////////////////////////////////
+
public boolean isProcessInstance() {
return parent==null;
}
@@ -1106,9 +1117,6 @@
public int getPriority() {
return priority;
}
- public TransitionImpl getTransition() {
- return transition;
- }
public void setEvent(EventImpl event) {
this.event = event;
}
@@ -1118,15 +1126,6 @@
public void setPriority(int priority) {
this.priority = priority;
}
- public void setTransition(TransitionImpl transition) {
- this.transition = transition;
- }
- public Activity getPreviousActivity() {
- return previousActivity;
- }
- public Transition getPreviousTransition() {
- return previousTransition;
- }
public ExecutionImpl getProcessInstance() {
return processInstance;
}
@@ -1136,12 +1135,6 @@
public void setComments(Set<CommentImpl> comments) {
this.comments = comments;
}
- public ActivityImpl getTransitionOrigin() {
- return transitionOrigin;
- }
- public void setTransitionOrigin(ActivityImpl transitionOrigin) {
- this.transitionOrigin = transitionOrigin;
- }
public String getKey() {
return key;
}
@@ -1154,21 +1147,12 @@
public void setName(String name) {
this.name = name;
}
- public void setState(String state) {
- this.state = state;
- }
public void setExecutions(Collection<ExecutionImpl> executions) {
this.executions = executions;
}
public void setParent(ExecutionImpl parent) {
this.parent = parent;
}
- public void setPreviousActivity(Activity previousActivity) {
- this.previousActivity = previousActivity;
- }
- public void setPreviousTransition(Transition previousTransition) {
- this.previousTransition = previousTransition;
- }
public ExecutionImpl getSuperProcessExecution() {
return superProcessExecution;
}
@@ -1202,4 +1186,19 @@
public void setHistoryActivityStart(Date historyActivityStart) {
this.historyActivityStart = historyActivityStart;
}
+ public String getProcessDefinitionId() {
+ return processDefinitionId;
+ }
+
+ public boolean hasAsyncEndEvent(List<ActivityImpl> leftActivities) {
+ for (ActivityImpl leftActivity : leftActivities) {
+ EventImpl endEvent = leftActivity.getEvent(Event.END);
+ if ( (endEvent!=null)
+ && (endEvent.isAsync())
+ ) {
+ return true;
+ }
+ }
+ return false;
+ }
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/ScopeInstanceImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -33,10 +33,13 @@
import org.jbpm.api.Execution;
import org.jbpm.api.JbpmException;
+import org.jbpm.api.client.ClientExecution;
+import org.jbpm.api.client.ClientProcessDefinition;
import org.jbpm.api.env.Environment;
import org.jbpm.api.job.Timer;
import org.jbpm.api.session.TimerSession;
import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.hibernate.HibernatePvmDbSession;
import org.jbpm.pvm.internal.job.TimerImpl;
import org.jbpm.pvm.internal.type.Converter;
import org.jbpm.pvm.internal.type.Type;
@@ -63,6 +66,7 @@
protected Set<TimerImpl> timers;
protected String state;
+ protected String suspendHistoryState;
// variables ////////////////////////////////////////////////////////////////
@@ -88,10 +92,6 @@
}
public void createVariable(String key, Object value, String typeName) {
- if (isEnded()) {
- throw new JbpmException("can't create variable '"+key+"'
on "+this+": "+state);
- }
-
log.debug("create variable '"+key+"' in
'"+this+"' with value '"+value+"'");
Type type = null;
@@ -145,9 +145,6 @@
}
public void setVariable(String key, Object value) {
- if (isEnded()) {
- throw new JbpmException("can't update variable '"+key+"'
on "+this+": "+state);
- }
Variable variable = getVariableObject(key);
// if there is already a variable instance and it doesn't support the current
type...
if ( (variable!=null)
@@ -248,10 +245,6 @@
}
public boolean removeVariable(String key) {
- if (isEnded()) {
- throw new JbpmException("can't remove variable '"+key+"'
on "+this+": "+state);
- }
-
Variable variable = null;
if (hasVariables) {
variable = variables.remove(key);
@@ -397,6 +390,29 @@
// state ////////////////////////////////////////////////////////////////////
+ /** @see Execution#suspend() */
+ public void suspend() {
+ if (Execution.STATE_SUSPENDED.equals(state)) {
+ return;
+ }
+ suspendHistoryState = state;
+ state = Execution.STATE_SUSPENDED;
+ }
+
+ /** @see Execution#resume() */
+ public void resume() {
+ if (!Execution.STATE_SUSPENDED.equals(state)) {
+ return;
+ }
+ state = suspendHistoryState;
+ suspendHistoryState = null;
+ }
+
+ public void setState(String state) {
+ this.state = state;
+ }
+
+
/** @see Execution#getState() */
public String getState() {
return state;
@@ -404,24 +420,14 @@
/** @see Execution#isActive() */
public boolean isActive() {
- return Execution.STATE_ACTIVE.equals(state);
+ return Execution.STATE_ACTIVE_ROOT.equals(state)
+ || Execution.STATE_ACTIVE_CONCURRENT.equals(state);
}
- /** @see Execution#isLocked() */
- public boolean isLocked() {
- return ! isActive();
- }
-
- /** @see Execution#isSuspended() */
public boolean isSuspended() {
return Execution.STATE_SUSPENDED.equals(state);
}
- /** @see Execution#isEnded() */
- public boolean isEnded() {
- return Execution.STATE_ENDED.equals(state);
- }
-
// customizable methods /////////////////////////////////////////////////////
public ExecutionImpl getProcessInstance() {
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/TransitionImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -38,10 +38,10 @@
private static final long serialVersionUID = 1L;
protected ActivityImpl source;
+ protected Integer sourceIndex;
protected ActivityImpl destination;
protected Descriptor conditionDescriptor;
protected Descriptor waitConditionDescriptor;
- protected boolean isTakeAsync;
/* Use one of the ActivityImpl.createOutgoingTransition methods instead. */
TransitionImpl() {
@@ -107,20 +107,9 @@
// getters and setters //////////////////////////////////////////////////////
public void setName(String name) {
- // if there is no source activity associated with this transition
- if (source==null) {
- // it s just a setter
- this.name = name;
-
- } else { // otherwise
- // make sure the source activity's leavingTransitionsMap remains up to date
- if (this.name!=null) {
- source.removeOutgoingTransition(this);
- }
- this.name = name;
- if (name!=null) {
- source.addOutgoingTransition(this);
- }
+ this.name = name;
+ if (source!=null) {
+ source.clearOutgoingTransitionsMap();
}
}
@@ -166,10 +155,10 @@
public void setWaitConditionDescriptor(Descriptor waitConditionDescriptor) {
this.waitConditionDescriptor = waitConditionDescriptor;
}
- public boolean isTakeAsync() {
- return isTakeAsync;
+ public Integer getSourceIndex() {
+ return sourceIndex;
}
- public void setTakeAsync(boolean isTakeAsync) {
- this.isTakeAsync = isTakeAsync;
+ public void setSourceIndex(Integer sourceIndex) {
+ this.sourceIndex = sourceIndex;
}
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivity.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivity.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivity.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -34,17 +34,17 @@
private static Log log = Log.getLog(ExecuteActivity.class.getName());
public boolean isAsync(ExecutionImpl execution) {
- return execution.getActivity().isExecutionAsync();
+ return execution.getActivity().isAsync();
}
public void perform(ExecutionImpl execution) {
ActivityImpl activity = execution.getActivity();
- if (log.isTraceEnabled()) {
+ if (log.isDebugEnabled()) {
if (execution.getName()!=null) {
- log.trace(execution.toString()+" executes "+activity);
+ log.debug(execution.toString()+" executes "+activity);
} else {
- log.trace("executing "+activity);
+ log.debug("executing "+activity);
}
}
@@ -66,7 +66,7 @@
}
public String toString() {
- return "execute(activity)";
+ return "ExecuteActivity";
}
public MessageImpl<?> createAsyncMessage(ExecutionImpl execution) {
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivityMessage.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivityMessage.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteActivityMessage.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.internal.model.op;
+import org.jbpm.api.Execution;
import org.jbpm.api.env.Environment;
import org.jbpm.pvm.internal.job.MessageImpl;
import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
@@ -41,7 +42,8 @@
}
public Object execute(Environment environment) throws Exception {
- unlockExecution();
+ execution.setState(Execution.STATE_ACTIVE_ROOT);
+
execution.performAtomicOperationSync(ExecutionImpl.EXECUTE_ACTIVITY);
JobDbSession jobDbSession = environment.get(JobDbSession.class);
@@ -51,7 +53,7 @@
}
public String toString() {
- return "execute-activity-message["+dbid+"]";
+ return "ExecuteActivityMessage["+dbid+"]";
}
}
Copied:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListener.java
(from rev 4838,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListener.java)
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListener.java
(rev 0)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ExecuteEventListener.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,91 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.model.op;
+
+import org.jbpm.api.listener.EventListener;
+import org.jbpm.api.model.ObservableElement;
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.EventImpl;
+import org.jbpm.pvm.internal.model.EventListenerReference;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ObservableElementImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class ExecuteEventListener implements AtomicOperation {
+
+ private static Log log = Log.getLog(ExecuteEventListener.class.getName());
+
+ protected EventListenerReference eventListenerReference;
+ protected EventImpl event;
+ protected ObservableElementImpl eventSource;
+ protected ObservableElement observableElement;
+
+ public ExecuteEventListener(EventListenerReference eventListenerReference, EventImpl
event, ObservableElementImpl eventSource, ObservableElement observableElement) {
+ this.eventListenerReference = eventListenerReference;
+ this.event = event;
+ this.eventSource = eventSource;
+ this.observableElement = observableElement;
+ }
+
+ public boolean isAsync(ExecutionImpl execution) {
+ return eventListenerReference.isAsync();
+ }
+
+ public void perform(ExecutionImpl execution) {
+ try {
+ execution.setEvent(event);
+ execution.setEventSource(eventSource);
+
+ if ( (observableElement.equals(eventSource)) // this event is not propagated
+ || (eventListenerReference.isPropagationEnabled()) // propagation is
allowed
+ ) {
+ EventListener eventListener = eventListenerReference.get();
+
+ log.trace("executing "+eventListener+" for "+event);
+ try {
+ // TODO can/should this invocation be unified with the exception handler
invocation of the event notification method?
+ eventListener.notify(execution);
+ } catch (Exception e) {
+ log.trace("exception during action: "+e);
+ execution.handleException((ObservableElementImpl) observableElement, event,
eventListenerReference, e, "couldn't run action "+eventListener);
+ }
+ }
+
+ } finally {
+ execution.setEvent(null);
+ execution.setEventSource(null);
+ }
+ }
+
+ public MessageImpl< ? > createAsyncMessage(ExecutionImpl execution) {
+ return null;
+ }
+
+ public String toString() {
+ return "ExecuteEventListener";
+ }
+}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToChildActivity.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToChildActivity.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToChildActivity.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -38,7 +38,7 @@
}
public void perform(ExecutionImpl execution) {
- execution.moveTo(activity);
+ execution.setActivity(activity);
ExecutionImpl propagatingExecution = execution.startActivity(activity);
propagatingExecution.performAtomicOperation(ExecutionImpl.EXECUTE_ACTIVITY);
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToParentActivity.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToParentActivity.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/MoveToParentActivity.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -35,10 +35,7 @@
ActivityImpl parentActivity = activity.getParentActivity();
ExecutionImpl propagatingExecution = execution.endActivity(activity);
- // Restore original source activity
- // (so that the call to moveTo updates the previous activity)
- propagatingExecution.setActivity(activity);
- propagatingExecution.moveTo(parentActivity);
+ propagatingExecution.setActivity(parentActivity);
propagatingExecution.performAtomicOperation(new Signal(null, null, parentActivity));
}
Deleted:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ProceedToDestination.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ProceedToDestination.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ProceedToDestination.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,90 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.model.op;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.ObservableElementImpl;
-
-/**
- * @author Tom Baeyens
- */
-public class ProceedToDestination implements AtomicOperation {
-
- public boolean isAsync(ExecutionImpl execution) {
- return false;
- }
-
- public void perform(ExecutionImpl execution) {
- ActivityImpl destination = execution.getTransition().getDestination();
- execution.setActivity(destination);
- List<ActivityImpl> enteredActivities =
getActivitiesEntered(execution.getTransitionOrigin(), destination);
-
- ExecutionImpl propagatingExecution = execution;
- for (ActivityImpl enteredActivity : enteredActivities) {
- propagatingExecution = propagatingExecution.startActivity(enteredActivity);
- }
-
- // Restore original transition source activity
- // (so that the call to moveTo updates the previous activity)
- propagatingExecution.setActivity(execution.getTransitionOrigin());
- propagatingExecution.moveTo(destination);
-
- propagatingExecution.performAtomicOperation(ExecutionImpl.EXECUTE_ACTIVITY);
- }
-
- public List<ActivityImpl> getActivitiesEntered(ActivityImpl origin, ActivityImpl
destination) {
- LinkedList<ActivityImpl> activitiesEntered = new
LinkedList<ActivityImpl>();
-
- if (origin.equals(destination)) {
- activitiesEntered.add(destination);
-
- } else {
- List<ObservableElementImpl> sourceChain = origin.getParentChain();
-
- if (!sourceChain.contains(destination)) {
- ActivityImpl destinationActivity = destination;
- while ( (destinationActivity!=null)
- && (!sourceChain.contains(destinationActivity))
- ) {
- activitiesEntered.addFirst(destinationActivity);
- destinationActivity = destinationActivity.getParentActivity();
- }
- }
- }
-
- return activitiesEntered;
- }
-
-
- public String toString() {
- return "proceed-to-destination";
- }
-
- public MessageImpl<?> createAsyncMessage(ExecutionImpl execution) {
- return new ProceedToDestinationMessage(execution);
- }
-}
Deleted:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ProceedToDestinationMessage.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ProceedToDestinationMessage.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/ProceedToDestinationMessage.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,57 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.model.op;
-
-import org.jbpm.api.env.Environment;
-import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-
-/**
- * @author Tom Baeyens
- */
-public class ProceedToDestinationMessage extends MessageImpl<Object> {
-
- private static final long serialVersionUID = 1L;
-
- public ProceedToDestinationMessage() {
- super();
- }
-
- public ProceedToDestinationMessage(ExecutionImpl execution) {
- super(execution);
- }
-
- public Object execute(Environment environment) throws Exception {
- unlockExecution();
- execution.performAtomicOperationSync(ExecutionImpl.PROCEED_TO_DESTINATION);
-
- JobDbSession jobDbSession = environment.get(JobDbSession.class);
- jobDbSession.delete(this);
-
- return null;
- }
-
- public String toString() {
- return "proceed-to-destination-message["+dbid+"]";
- }
-}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/Signal.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/Signal.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/Signal.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -49,14 +49,14 @@
}
public boolean isAsync(ExecutionImpl execution) {
- return execution.getActivity().isSignalAsync();
+ return false;
}
public void perform(ExecutionImpl execution) {
if (execution.getName()!=null) {
log.debug(execution.toString()+" signals "+activity);
} else {
- log.debug("signalling "+activity+", signal="+signalName);
+ log.debug("signalling "+activity+", signalName="+signalName);
}
ExternalActivityBehaviour externalActivityBehaviour = (ExternalActivityBehaviour)
activity.getBehaviour();
@@ -78,7 +78,7 @@
}
public String toString() {
- return "signal(activity)";
+ return "Signal";
}
public MessageImpl<?> createAsyncMessage(ExecutionImpl execution) {
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/SignalMessage.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/SignalMessage.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/SignalMessage.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.internal.model.op;
+import org.jbpm.api.Execution;
import org.jbpm.api.env.Environment;
import org.jbpm.pvm.internal.job.MessageImpl;
import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
@@ -47,7 +48,7 @@
}
public Object execute(Environment environment) throws Exception {
- unlockExecution();
+ execution.setState(Execution.STATE_ACTIVE_ROOT);
Signal signal = new Signal(signalName, null, activity);
execution.performAtomicOperationSync(signal);
@@ -59,6 +60,6 @@
}
public String toString() {
- return "signal-transition-message["+dbid+"]";
+ return "SignalMessage["+dbid+"]";
}
}
Deleted:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TakeTransition.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TakeTransition.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TakeTransition.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,104 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.model.op;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.jbpm.api.model.Condition;
-import org.jbpm.api.model.Event;
-import org.jbpm.internal.log.Log;
-import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.pvm.internal.model.ActivityImpl;
-import org.jbpm.pvm.internal.model.ObservableElementImpl;
-import org.jbpm.pvm.internal.model.TransitionImpl;
-
-public class TakeTransition implements AtomicOperation {
-
- private static Log log = Log.getLog(TakeTransition.class.getName());
-
- public boolean isAsync(ExecutionImpl execution) {
- return execution.getActivity().isLeaveAsync()
- || execution.getTransition().isTakeAsync();
- }
-
- public void perform(ExecutionImpl execution) {
- TransitionImpl transition = execution.getTransition();
-
- if (execution.getName()!=null) {
- log.debug(execution.toString()+" takes "+transition);
- } else {
- log.debug("taking "+transition);
- }
-
- List<ActivityImpl> leftActivities = getActivitiesLeft(execution.getActivity(),
transition.getDestination());
- ExecutionImpl propagatingExecution = execution;
- for (ActivityImpl leftActivity : leftActivities) {
- propagatingExecution = propagatingExecution.endActivity(leftActivity);
- }
-
- propagatingExecution.setActivity(null);
- propagatingExecution.fire(Event.TAKE, transition);
-
- boolean wait = false;
-
- Condition waitCondition = transition.getWaitCondition();
- if (waitCondition!=null) {
- wait = waitCondition.evaluate(propagatingExecution);
- }
-
- if (!wait) {
- propagatingExecution.performAtomicOperation(ExecutionImpl.PROCEED_TO_DESTINATION);
- }
- }
-
- List<ActivityImpl> getActivitiesLeft(ActivityImpl source, ActivityImpl
destination) {
- List<ActivityImpl> activitiesLeft = new ArrayList<ActivityImpl>();
-
- if (source.equals(destination)) {
- activitiesLeft.add(source);
- } else {
- List<ObservableElementImpl> destinationChain = destination.getParentChain();
-
- if (!destinationChain.contains(source)) {
- ActivityImpl sourceActivity = source;
- while ( (sourceActivity!=null)
- && (!destinationChain.contains(sourceActivity))
- ) {
- activitiesLeft.add(sourceActivity);
- sourceActivity = sourceActivity.getParentActivity();
- }
- }
- }
-
- return activitiesLeft;
- }
-
- public String toString() {
- return "take-transition";
- }
-
- public MessageImpl<?> createAsyncMessage(ExecutionImpl execution) {
- return new TakeTransitionMessage(execution);
- }
-}
\ No newline at end of file
Deleted:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TakeTransitionMessage.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TakeTransitionMessage.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TakeTransitionMessage.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,56 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.pvm.internal.model.op;
-
-import org.jbpm.api.env.Environment;
-import org.jbpm.pvm.internal.job.MessageImpl;
-import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-
-/**
- * @author Tom Baeyens
- */
-public class TakeTransitionMessage extends MessageImpl<Object> {
-
- private static final long serialVersionUID = 1L;
-
- public TakeTransitionMessage() {
- }
-
- public TakeTransitionMessage(ExecutionImpl execution) {
- super(execution);
- }
-
- public Object execute(Environment environment) throws Exception {
- unlockExecution();
- execution.performAtomicOperationSync(ExecutionImpl.TAKE_TRANSITION);
-
- JobDbSession jobDbSession = environment.get(JobDbSession.class);
- jobDbSession.delete(this);
-
- return null;
- }
-
- public String toString() {
- return "take-transition-message["+dbid+"]";
- }
-}
Copied:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivity.java
(from rev 4838,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivity.java)
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivity.java
(rev 0)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivity.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.model.op;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ObservableElementImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+
+public class TransitionEndActivity implements AtomicOperation {
+
+ private static final TransitionTake TRANSITION_TAKE = new TransitionTake();
+
+ private static Log log = Log.getLog(TransitionEndActivity.class.getName());
+
+ public boolean isAsync(ExecutionImpl execution) {
+ TransitionImpl transition = execution.getTransition();
+ List<ActivityImpl> leftActivities = getActivitiesLeft(execution.getActivity(),
transition.getDestination());
+ return execution.hasAsyncEndEvent(leftActivities);
+ }
+
+ public void perform(ExecutionImpl execution) {
+ TransitionImpl transition = execution.getTransition();
+
+ if (execution.getName() != null) {
+ log.debug(execution.toString() + " takes " + transition);
+ } else {
+ log.debug("taking " + transition);
+ }
+
+ List<ActivityImpl> leftActivities = getActivitiesLeft(execution.getActivity(),
transition.getDestination());
+ ExecutionImpl propagatingExecution = endActivity(execution, leftActivities);
+
+ propagatingExecution.performAtomicOperation(TRANSITION_TAKE);
+ }
+
+ public static ExecutionImpl endActivity(ExecutionImpl execution,
List<ActivityImpl> leftActivities) {
+ ExecutionImpl propagatingExecution = execution;
+ for (ActivityImpl leftActivity : leftActivities) {
+ propagatingExecution = propagatingExecution.endActivity(leftActivity);
+ }
+ propagatingExecution.setActivity(null);
+ return propagatingExecution;
+ }
+
+ List<ActivityImpl> getActivitiesLeft(ActivityImpl source, ActivityImpl
destination) {
+ List<ActivityImpl> activitiesLeft = new ArrayList<ActivityImpl>();
+
+ if (source.equals(destination)) {
+ activitiesLeft.add(source);
+ } else {
+ List<ObservableElementImpl> destinationChain = destination.getParentChain();
+
+ if (!destinationChain.contains(source)) {
+ ActivityImpl sourceActivity = source;
+ while ((sourceActivity != null) &&
(!destinationChain.contains(sourceActivity))) {
+ activitiesLeft.add(sourceActivity);
+ sourceActivity = sourceActivity.getParentActivity();
+ }
+ }
+ }
+
+ return activitiesLeft;
+ }
+
+ public String toString() {
+ return "TakeTransition";
+ }
+
+ public MessageImpl< ? > createAsyncMessage(ExecutionImpl execution) {
+ return new TransitionEndActivityMessage(execution);
+ }
+}
\ No newline at end of file
Copied:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivityMessage.java
(from rev 4838,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivityMessage.java)
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivityMessage.java
(rev 0)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionEndActivityMessage.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.model.op;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+/**
+ * @author Tom Baeyens
+ */
+public class TransitionEndActivityMessage extends MessageImpl<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ public TransitionEndActivityMessage() {
+ }
+
+ public TransitionEndActivityMessage(ExecutionImpl execution) {
+ super(execution);
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ execution.setState(Execution.STATE_ACTIVE_ROOT);
+
+ execution.performAtomicOperationSync(ExecutionImpl.TRANSITION_END_ACTIVITY);
+
+ JobDbSession jobDbSession = environment.get(JobDbSession.class);
+ jobDbSession.delete(this);
+
+ return null;
+ }
+
+ public String toString() {
+ return "TakeTransitionMessage["+dbid+"]";
+ }
+}
Copied:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivity.java
(from rev 4838,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivity.java)
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivity.java
(rev 0)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivity.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.model.op;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.ActivityImpl;
+import org.jbpm.pvm.internal.model.ObservableElementImpl;
+
+/**
+ * @author Tom Baeyens
+ */
+public class TransitionStartActivity implements AtomicOperation {
+
+ public boolean isAsync(ExecutionImpl execution) {
+ return false;
+ }
+
+ public void perform(ExecutionImpl execution) {
+ ActivityImpl destination = execution.getTransition().getDestination();
+ execution.setActivity(destination);
+ List<ActivityImpl> enteredActivities =
getActivitiesEntered(execution.getTransitionSource(), destination);
+
+ ExecutionImpl propagatingExecution = execution;
+ for (ActivityImpl enteredActivity : enteredActivities) {
+ propagatingExecution = propagatingExecution.startActivity(enteredActivity);
+ }
+
+ propagatingExecution.setActivity(destination);
+ propagatingExecution.setTransition(null);
+
+ propagatingExecution.performAtomicOperation(ExecutionImpl.EXECUTE_ACTIVITY);
+ }
+
+ public List<ActivityImpl> getActivitiesEntered(ActivityImpl origin, ActivityImpl
destination) {
+ LinkedList<ActivityImpl> activitiesEntered = new
LinkedList<ActivityImpl>();
+
+ if (origin.equals(destination)) {
+ activitiesEntered.add(destination);
+
+ } else {
+ List<ObservableElementImpl> sourceChain = origin.getParentChain();
+
+ if (!sourceChain.contains(destination)) {
+ ActivityImpl destinationActivity = destination;
+ while ( (destinationActivity!=null)
+ && (!sourceChain.contains(destinationActivity))
+ ) {
+ activitiesEntered.addFirst(destinationActivity);
+ destinationActivity = destinationActivity.getParentActivity();
+ }
+ }
+ }
+
+ return activitiesEntered;
+ }
+
+
+ public String toString() {
+ return "ProceedToDestination";
+ }
+
+ public MessageImpl<?> createAsyncMessage(ExecutionImpl execution) {
+ return new TransitionStartActivityMessage(execution);
+ }
+}
Copied:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivityMessage.java
(from rev 4838,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivityMessage.java)
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivityMessage.java
(rev 0)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionStartActivityMessage.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,57 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.model.op;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+/**
+ * @author Tom Baeyens
+ */
+public class TransitionStartActivityMessage extends MessageImpl<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ public TransitionStartActivityMessage() {
+ }
+
+ public TransitionStartActivityMessage(ExecutionImpl execution) {
+ super(execution);
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ execution.setState(Execution.STATE_ACTIVE_ROOT);
+ execution.performAtomicOperationSync(ExecutionImpl.TRANSITION_START_ACTIVITY);
+
+ JobDbSession jobDbSession = environment.get(JobDbSession.class);
+ jobDbSession.delete(this);
+
+ return null;
+ }
+
+ public String toString() {
+ return "ProceedToDestinationMessage["+dbid+"]";
+ }
+}
Copied:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTake.java
(from rev 4838,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTake.java)
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTake.java
(rev 0)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTake.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.model.op;
+
+import org.jbpm.api.model.Event;
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.model.EventImpl;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TransitionTake implements AtomicOperation {
+
+ public boolean isAsync(ExecutionImpl execution) {
+ TransitionImpl transition = execution.getTransition();
+ EventImpl event = transition.getEvent(Event.TAKE);
+ return ((event!=null) && (event.isAsync()));
+ }
+
+ public void perform(ExecutionImpl execution) {
+ TransitionImpl transition = execution.getTransition();
+ execution.fire(Event.TAKE, transition);
+ execution.performAtomicOperation(ExecutionImpl.TRANSITION_START_ACTIVITY);
+ }
+
+ public MessageImpl< ? > createAsyncMessage(ExecutionImpl execution) {
+ return new TransitionTakeMessage(execution);
+ }
+}
Copied:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTakeMessage.java
(from rev 4838,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTakeMessage.java)
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTakeMessage.java
(rev 0)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/model/op/TransitionTakeMessage.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,58 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.model.op;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.env.Environment;
+import org.jbpm.pvm.internal.job.MessageImpl;
+import org.jbpm.pvm.internal.jobexecutor.JobDbSession;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class TransitionTakeMessage extends MessageImpl<Object> {
+
+ private static final long serialVersionUID = 1L;
+
+ public TransitionTakeMessage() {
+ }
+
+ public TransitionTakeMessage(ExecutionImpl execution) {
+ super(execution);
+ }
+
+ public Object execute(Environment environment) throws Exception {
+ execution.setState(Execution.STATE_ACTIVE_ROOT);
+ execution.performAtomicOperationSync(ExecutionImpl.TRANSITION_TAKE);
+
+ JobDbSession jobDbSession = environment.get(JobDbSession.class);
+ jobDbSession.delete(this);
+
+ return null;
+ }
+
+ public String toString() {
+ return "TransitionTakeMessage["+dbid+"]";
+ }
+}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryActivityInstanceQueryImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryActivityInstanceQueryImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/HistoryActivityInstanceQueryImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -86,7 +86,7 @@
appendWhereClause(" hai.activityName =
'"+activityName+"'", hql);
}
- return hql().toString();
+ return hql.toString();
}
protected void applyParameters(Query query) {
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessDefinitionQueryImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -57,6 +57,7 @@
protected String key;
protected String nameLike;
protected String name;
+ protected boolean suspended;
protected Long deploymentDbid;
public ProcessDefinitionQueryImpl(CommandService commandService) {
@@ -102,15 +103,21 @@
hql.append(" as keyProperty, ");
hql.append(DeploymentProperty.class.getName());
hql.append(" as versionProperty ");
-
- appendWhereClause("idProperty.key = 'id'", hql);
+
+ if (suspended) {
+ appendWhereClause("deployment.state =
'"+DeploymentImpl.STATE_SUSPENDED+"'", hql);
+ } else {
+ appendWhereClause("deployment.state !=
'"+DeploymentImpl.STATE_SUSPENDED+"'", hql);
+ }
+
+ appendWhereClause("idProperty.key =
'"+DeploymentImpl.KEY_PROCESS_DEFINITION_ID+"'", hql);
appendWhereClause("idProperty.deployment = deployment ", hql);
- appendWhereClause("keyProperty.key = 'key' ", hql);
+ appendWhereClause("keyProperty.key =
'"+DeploymentImpl.KEY_PROCESS_DEFINITION_KEY+"' ", hql);
appendWhereClause("keyProperty.objectName = idProperty.objectName ", hql);
appendWhereClause("keyProperty.deployment = deployment ", hql);
- appendWhereClause("versionProperty.key = 'version' ", hql);
+ appendWhereClause("versionProperty.key =
'"+DeploymentImpl.KEY_PROCESS_DEFINITION_VERSION+"' ", hql);
appendWhereClause("versionProperty.objectName = idProperty.objectName ",
hql);
appendWhereClause("versionProperty.deployment = deployment ", hql);
@@ -159,6 +166,11 @@
this.key = key;
return this;
}
+
+ public ProcessDefinitionQuery suspended() {
+ this.suspended = true;
+ return this;
+ }
public ProcessDefinitionQuery nameLike(String name) {
this.nameLike = name;
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessInstanceQueryImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessInstanceQueryImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/query/ProcessInstanceQueryImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -39,6 +39,7 @@
protected String processDefinitionId;
protected String processInstanceId;
+ protected boolean suspended;
public ProcessInstanceQueryImpl(CommandService commandService) {
super(commandService);
@@ -61,6 +62,12 @@
appendWhereClause("processInstance.parent is null ", hql);
+ if (suspended) {
+ appendWhereClause("processInstance.state =
'"+ExecutionImpl.STATE_SUSPENDED+"' ", hql);
+ } else {
+ appendWhereClause("processInstance.state !=
'"+ExecutionImpl.STATE_SUSPENDED+"' ", hql);
+ }
+
if (processInstanceId!=null) {
appendWhereClause("processInstance.processInstance.id =
'"+processInstanceId+"' ", hql);
}
@@ -87,11 +94,6 @@
return this;
}
- public ProcessInstanceQuery processDefinitionId(String processDefinitionId) {
- this.processDefinitionId = processDefinitionId;
- return this;
- }
-
public ProcessInstanceQuery page(int firstResult, int maxResults) {
this.page = new Page(firstResult, maxResults);
return this;
@@ -101,4 +103,14 @@
this.processInstanceId = processInstanceId;
return this;
}
+
+ public ProcessInstanceQuery processDefinitionId(String processDefinitionId) {
+ this.processDefinitionId = processDefinitionId;
+ return this;
+ }
+
+ public ProcessInstanceQuery suspended() {
+ this.suspended = true;
+ return this;
+ }
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/DeploymentImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -37,8 +37,9 @@
import org.jbpm.api.Deployment;
import org.jbpm.api.JbpmException;
-import org.jbpm.api.client.ClientProcessDefinition;
import org.jbpm.api.cmd.CommandService;
+import org.jbpm.api.env.Environment;
+import org.jbpm.api.session.RepositorySession;
import org.jbpm.pvm.internal.cmd.DeployCmd;
import org.jbpm.pvm.internal.lob.Lob;
import org.jbpm.pvm.internal.stream.ByteArrayStreamInput;
@@ -57,9 +58,17 @@
*/
public class DeploymentImpl extends ProblemList implements Deployment {
+ public static final String STATE_ACTIVE = "active";
+ public static final String STATE_SUSPENDED = "suspended";
+
+ public static final String KEY_PROCESS_DEFINITION_ID = "pdid";
+ public static final String KEY_PROCESS_DEFINITION_KEY = "pdkey";
+ public static final String KEY_PROCESS_DEFINITION_VERSION = "pdversion";
+
protected long dbid;
protected String name;
protected long timestamp;
+ protected String state = STATE_ACTIVE;
protected Map<String, Lob> resources;
protected CommandService commandService;
@@ -164,8 +173,34 @@
}
objects.put(objectName, object);
}
+
+ // object properties ////////////////////////////////////////////////////////
+
+ public void setProcessDefinitionId(String processDefinitionName, String
processDefinitionId) {
+ setObjectProperty(processDefinitionName, KEY_PROCESS_DEFINITION_ID,
processDefinitionId);
+ }
+
+ public String getProcessDefinitionId(String processDefinitionName) {
+ return (String) getObjectProperty(processDefinitionName, KEY_PROCESS_DEFINITION_ID);
+ }
- public void addObjectProperty(String objectName, String key, Object value) {
+ public void setProcessDefinitionKey(String processDefinitionName, String
processDefinitionKey) {
+ setObjectProperty(processDefinitionName, KEY_PROCESS_DEFINITION_KEY,
processDefinitionKey);
+ }
+
+ public String getProcessDefinitionKey(String processDefinitionName) {
+ return (String) getObjectProperty(processDefinitionName,
KEY_PROCESS_DEFINITION_KEY);
+ }
+
+ public void setProcessDefinitionVersion(String processDefinitionName, Long
processDefinitionVersion) {
+ setObjectProperty(processDefinitionName, KEY_PROCESS_DEFINITION_VERSION,
processDefinitionVersion);
+ }
+
+ public Long getProcessDefinitionVersion(String processDefinitionName) {
+ return (Long) getObjectProperty(processDefinitionName,
KEY_PROCESS_DEFINITION_VERSION);
+ }
+
+ public void setObjectProperty(String objectName, String key, Object value) {
if (objectProperties==null) {
objectProperties = new HashSet<DeploymentProperty>();
}
@@ -187,6 +222,19 @@
return null;
}
+ public Set<String> getProcessDefinitionIds() {
+ Set<String> processDefinitionIds = new HashSet<String>();
+ if (objectProperties!=null) {
+ for (DeploymentProperty deploymentProperty: objectProperties) {
+ if (KEY_PROCESS_DEFINITION_ID.equals(deploymentProperty.getKey())) {
+ String processDefinitionId = deploymentProperty.getStringValue();
+ processDefinitionIds.add(processDefinitionId);
+ }
+ }
+ }
+ return processDefinitionIds;
+ }
+
public boolean hasObjectProperties(String objectName) {
if (objectProperties!=null) {
for (DeploymentProperty deploymentProperty: objectProperties) {
@@ -197,7 +245,33 @@
}
return false;
}
+
+ public void suspend() {
+ if (isSuspended()) {
+ throw new JbpmException("deployment is already suspended");
+ }
+ RepositorySessionImpl repositorySession =
Environment.getFromCurrent(RepositorySessionImpl.class, false);
+ if (repositorySession!=null) {
+ repositorySession.cascadeDeploymentSuspend(this);
+ }
+ state = STATE_SUSPENDED;
+ }
+ public void resume() {
+ if (!isSuspended()) {
+ throw new JbpmException("deployment is not suspended");
+ }
+ RepositorySessionImpl repositorySession =
Environment.getFromCurrent(RepositorySessionImpl.class, false);
+ if (repositorySession!=null) {
+ repositorySession.cascadeDeploymentResume(this);
+ }
+ state = STATE_ACTIVE;
+ }
+
+ public boolean isSuspended() {
+ return STATE_SUSPENDED.equals(state);
+ }
+
protected Object writeReplace() throws ObjectStreamException {
commandService = null;
return this;
@@ -226,9 +300,4 @@
this.timestamp = timestamp;
return this;
}
-
-
- public Deployment addProcessDefinition(ClientProcessDefinition processDefinition) {
- throw new UnsupportedOperationException("implement me");
- }
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCache.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -31,5 +31,6 @@
void set(long deploymentdbid, Map<String, Object> deployedObjects);
Object get(long deploymentDbid, String objectName);
+ void remove(long deploymentDbid);
void clear();
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryCacheImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -56,6 +56,12 @@
}
}
+ public void remove(long deploymentDbid) {
+ if (deployments!=null) {
+ deployments.remove(deploymentDbid);
+ }
+ }
+
public void clear() {
deployments = new HashMap<Long, Map<String,Object>>();
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositoryServiceImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -31,6 +31,8 @@
import org.jbpm.pvm.internal.cmd.DeleteDeploymentCmd;
import org.jbpm.pvm.internal.cmd.GetActivityCoordinates;
import org.jbpm.pvm.internal.cmd.GetResourceAsStreamCmd;
+import org.jbpm.pvm.internal.cmd.ResumeDeploymentCmd;
+import org.jbpm.pvm.internal.cmd.SuspendDeploymentCmd;
import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
/**
@@ -44,6 +46,14 @@
return new DeploymentImpl(commandService);
}
+ public void suspendDeployment(long deploymentDbid) {
+ commandService.execute(new SuspendDeploymentCmd(deploymentDbid));
+ }
+
+ public void resumeDeployment(long deploymentDbid) {
+ commandService.execute(new ResumeDeploymentCmd(deploymentDbid));
+ }
+
public void deleteDeployment(long deploymentDbid) {
commandService.execute(new DeleteDeploymentCmd(deploymentDbid));
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/repository/RepositorySessionImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -23,7 +23,10 @@
import java.io.InputStream;
import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import org.hibernate.Query;
import org.hibernate.Session;
import org.jbpm.api.Deployment;
import org.jbpm.api.JbpmException;
@@ -33,6 +36,7 @@
import org.jbpm.api.client.ClientProcessDefinition;
import org.jbpm.api.session.RepositorySession;
import org.jbpm.internal.log.Log;
+import org.jbpm.pvm.internal.model.ExecutionImpl;
import org.jbpm.pvm.internal.query.ProcessDefinitionQueryImpl;
/**
@@ -59,13 +63,58 @@
log.info("errors during deployment of "+deployment+":
"+jbpmException.getMessage());
throw jbpmException;
} else {
-
repositoryCache.set(deploymentImpl.getDbid(), deploymentImpl.getObjects());
}
return deploymentImpl.getDbid();
}
+
+ public void cascadeDeploymentSuspend(DeploymentImpl deployment) {
+ // cascade to all executions in this deployment
+ Set<String> processDefinitionIds = deployment.getProcessDefinitionIds();
+ if (!processDefinitionIds.isEmpty()) {
+ Query query = session.createQuery(
+ "select execution " +
+ "from "+ExecutionImpl.class.getName()+" as execution " +
+ "where execution.processDefinitionId in (:processDefinitionIds) " +
+ " and execution.state !=
'"+ExecutionImpl.STATE_SUSPENDED+"'"
+ );
+ query.setParameterList("processDefinitionIds", processDefinitionIds);
+ List<ExecutionImpl> executions = query.list();
+ for (ExecutionImpl execution: executions) {
+ execution.suspend();
+ }
+ }
+
+ // TODO cleaning this cache should actually be done as a synchronization
+ // after the transaction. If a concurrent transaction for an execution
+ // starts between clearing the cache and committing the transaction, then
+ // that transaction could potentially re-initialize the process definition
+ // in the cache.
+ repositoryCache.remove(deployment.getDbid());
+ }
+
+ public void cascadeDeploymentResume(DeploymentImpl deployment) {
+ // cascade to all executions in this deployment
+ Set<String> processDefinitionIds = deployment.getProcessDefinitionIds();
+ if (!processDefinitionIds.isEmpty()) {
+ Query query = session.createQuery(
+ "select execution " +
+ "from "+ExecutionImpl.class.getName()+" as execution " +
+ "where execution.processDefinitionId in (:processDefinitionIds) " +
+ " and execution.state =
'"+ExecutionImpl.STATE_SUSPENDED+"'"
+ );
+ query.setParameterList("processDefinitionIds", processDefinitionIds);
+ List<ExecutionImpl> executions = query.list();
+ for (ExecutionImpl execution: executions) {
+ execution.resume();
+ }
+ }
+
+ deploy(deployment);
+ }
+
public DeploymentImpl getDeployment(long deploymentDbid) {
return (DeploymentImpl) session.get(DeploymentImpl.class, deploymentDbid);
}
@@ -78,10 +127,11 @@
} else {
log.trace("loading deployment "+deploymentDbid+" from db");
DeploymentImpl deployment = (DeploymentImpl) session.load(DeploymentImpl.class,
deploymentDbid);
+ if (deployment.isSuspended()) {
+ throw new JbpmException("deployment "+deploymentDbid+" is
suspended");
+ }
deploy(deployment);
-
object = repositoryCache.get(deploymentDbid, objectName);
-
if (object==null) {
throw new JbpmException("deployment "+deploymentDbid+" doesn't
contain object "+objectName);
}
@@ -121,7 +171,7 @@
DeploymentProperty deploymentProperty = (DeploymentProperty) session.createQuery(
"select deploymentProperty " +
"from "+DeploymentProperty.class.getName()+" as deploymentProperty
" +
- "where deploymentProperty.key = 'id' " +
+ "where deploymentProperty.key =
'"+DeploymentImpl.KEY_PROCESS_DEFINITION_ID+"' " +
" and deploymentProperty.stringValue =
'"+processDefinitionId+"' "
).setMaxResults(1).uniqueResult();
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandMessage.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandMessage.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/AsyncCommandMessage.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -21,6 +21,7 @@
*/
package org.jbpm.pvm.internal.svc;
+import org.jbpm.api.Execution;
import org.jbpm.api.cmd.Command;
import org.jbpm.api.cmd.CommandService;
import org.jbpm.api.env.Environment;
@@ -47,7 +48,8 @@
}
public Object execute(Environment environment) throws Exception {
- unlockExecution();
+ execution.setState(Execution.STATE_ACTIVE_ROOT);
+
if (userId!=null) {
environment.setUserId(userId);
}
@@ -63,6 +65,6 @@
}
public String toString() {
- return "async-command-message["+dbid+"]";
+ return "AsyncCommandMessage["+dbid+"]";
}
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/IdentityServiceImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/IdentityServiceImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/svc/IdentityServiceImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -46,10 +46,14 @@
protected CommandService commandService;
- public void createUser(String userId, String password, String givenName, String
familyName) {
- commandService.execute(new CreateUserCmd(userId, password, givenName, familyName));
+ public void createUser(String userId, String givenName, String familyName) {
+ commandService.execute(new CreateUserCmd(userId, givenName, familyName));
}
+ public void createUser(String userId, String givenName, String familyName, String
businessEmail) {
+ commandService.execute(new CreateUserCmd(userId, givenName, familyName,
businessEmail));
+ }
+
public User findUserById(String userId) {
return commandService.execute(new FindUserCmd(userId));
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycle.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -83,7 +83,7 @@
Activity activity = lifeCycleProcess.getActivity(state);
lifeCycleExecution.setActivity((ActivityImpl) activity);
lifeCycleExecution.signal(eventName);
- task.state = lifeCycleExecution.getActivity().getName();
+ task.setState(lifeCycleExecution.getActivity().getName());
}
public IdGenerator getIdGenerator() {
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleParser.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleParser.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/LifeCycleParser.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -25,6 +25,7 @@
import org.jbpm.pvm.internal.model.ActivityImpl;
import org.jbpm.pvm.internal.model.ProcessDefinitionImpl;
+import org.jbpm.pvm.internal.model.TransitionImpl;
import org.jbpm.pvm.internal.util.XmlUtil;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
@@ -54,7 +55,7 @@
if (initial!=null) {
lifeCycleProcess.setInitial(initial);
} else {
- parse.addProblem("initial "+initialStateName+" doesn't
exist");
+ parse.addProblem("initial "+initialStateName+" doesn't
exist", null, "error", element);
}
}
@@ -63,7 +64,7 @@
public void parseTransitions(Element element, ProcessDefinitionImpl lifeCycleProcess,
Parse parse) {
if (! element.hasAttribute("name")) {
- parse.addProblem("state doesn't have a name:
"+XmlUtil.toString(element));
+ parse.addProblem("state doesn't have a name:
"+XmlUtil.toString(element), null, "error", element);
return;
}
String stateName = element.getAttribute("name");
@@ -77,26 +78,29 @@
public void parseTransition(Element element, ActivityImpl state, Parse parse) {
if (! element.hasAttribute("name")) {
- parse.addProblem("transition doesn't have a name:
"+XmlUtil.toString(element));
+ parse.addProblem("transition doesn't have a name:
"+XmlUtil.toString(element), null, "error", element);
return;
}
String transitionName = element.getAttribute("name");
if (! element.hasAttribute("to")) {
- parse.addProblem("transition "+transitionName+" doesn't have a
to attribute indicating the destination state: "+XmlUtil.toString(element));
+ String message = "transition "+transitionName+" doesn't have a
to attribute indicating the destination state: "+XmlUtil.toString(element);
+ parse.addProblem(message, null, "error", element);
return;
}
String destinationName = element.getAttribute("to");
ActivityImpl destination = (ActivityImpl)
state.getProcessDefinition().getActivity(destinationName);
if (destination!=null) {
- state.createOutgoingTransition(destination, transitionName);
+ TransitionImpl transition = state.createOutgoingTransition();
+ transition.setDestination(destination);
+ transition.setName(transitionName);
} else {
- parse.addProblem("destination "+destinationName+" of
"+transitionName+" is unknown");
+ parse.addProblem("destination "+destinationName+" of
"+transitionName+" is unknown", null, "error", element);
}
}
public void parseState(Element element, ProcessDefinitionImpl lifeCycleProcess, Parse
parse) {
if (! element.hasAttribute("name")) {
- parse.addProblem("state doesn't have an id:
"+XmlUtil.toString(element));
+ parse.addProblem("state doesn't have an id:
"+XmlUtil.toString(element), null, "error", element);
return;
}
String stateName = element.getAttribute("name");
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -62,9 +62,14 @@
// private static Log log = Log.getLog(TaskImpl.class.getName());
- private static final TaskHandler DEFAULT_TASK_HANDLER = new TaskHandler();
+ private static final TaskHandler DEFAULT_TASK_HANDLER = new TaskHandler();
+
+ public static final String STATE_CREATED = "created";
+ public static final String STATE_ASSIGNED = "assigned";
+ public static final String STATE_COMPLETED = "completed";
+ public static final String STATE_SUSPENDED = "suspended";
+ public static final String STATE_ACTIVE = "active";
- protected String id;
protected String name;
protected String description;
@@ -82,7 +87,7 @@
protected int priority = Priority.NORMAL;
- protected String state;
+ protected String state = STATE_ACTIVE;
protected String taskDefinitionName;
protected TaskDefinitionImpl taskDefinition;
@@ -208,6 +213,15 @@
getTaskHandler().taskCancel(this, reason);
}
+ // state ////////////////////////////////////////////////////////////////////
+
+ public boolean isCompleted() {
+ if (STATE_COMPLETED.equals(state)) {
+ return true;
+ }
+ return false;
+ }
+
// variables ////////////////////////////////////////////////////////////////
public void setVariable(String key, Object value) {
@@ -385,12 +399,6 @@
public long getDbid() {
return dbid;
}
- public String getId() {
- return id;
- }
- public void setId(String id) {
- this.id = id;
- }
public String getName() {
return name;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/task/TaskQueryImpl.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -144,6 +144,8 @@
}
}
+ appendWhereClause("task.state !=
'"+TaskImpl.STATE_SUSPENDED+"' ", hql);
+
if (assignee == UNASSIGNED) {
appendWhereClause("task.assignee is null ", hql);
} else if (assignee != null) {
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/util/XmlUtil.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -128,7 +128,7 @@
}
if (required && (parse!=null)) {
- parse.addProblem("nested element
<"+XmlUtil.getTagLocalName(element)+"><"+tagName+" ...
/>... is required");
+ parse.addProblem("nested element
<"+XmlUtil.getTagLocalName(element)+"><"+tagName+" ...
/>... is required", null, "error", element);
}
return null;
}
@@ -323,13 +323,13 @@
if (element.hasAttribute(attributeName)) {
String value = element.getAttribute(attributeName);
if (required && "".equals(value)) {
- parse.addProblem("attribute
<"+XmlUtil.getTagLocalName(element)+"
"+attributeName+"=\"\" is empty");
+ parse.addProblem("attribute
<"+XmlUtil.getTagLocalName(element)+"
"+attributeName+"=\"\" is empty", null, "error",
element);
}
return value;
}
if (required) {
- parse.addProblem("attribute <"+XmlUtil.getTagLocalName(element)+"
"+attributeName+"=\"...\" is required");
+ parse.addProblem("attribute <"+XmlUtil.getTagLocalName(element)+"
"+attributeName+"=\"...\" is required", null, "error",
element);
}
return defaultValue;
@@ -344,7 +344,7 @@
try {
return Integer.parseInt(valueText);
} catch (NumberFormatException e) {
- parse.addProblem(errorMessageAttribute(element, attributeName, valueText,
"value not parsable as integer"));
+ parse.addProblem(errorMessageAttribute(element, attributeName, valueText,
"value not parsable as integer"), null, "error", element);
}
}
@@ -362,7 +362,7 @@
if (valueText!=null) {
Boolean value = parseBooleanValue(valueText);
if (value==null) {
- parse.addProblem(errorMessageAttribute(element, attributeName, valueText,
"value not in {true, enabled, on, false, disabled, off}"));
+ parse.addProblem(errorMessageAttribute(element, attributeName, valueText,
"value not in {true, enabled, on, false, disabled, off}"), null,
"error", element);
}
return value;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AbstractCollectionBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AbstractCollectionBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AbstractCollectionBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -58,10 +58,10 @@
if (collectionInterface.isAssignableFrom(collectionClass)) {
return true;
} else {
- parse.addProblem("class "+ className+" is not a
"+collectionInterface.getName());
+ parse.addProblem("class "+ className+" is not a
"+collectionInterface.getName(), null, "error", null);
}
} catch (JbpmException e) {
- parse.addProblem("class "+className+" could not be found");
+ parse.addProblem("class "+className+" could not be found",
null, "error", null);
}
return false;
}
Copied:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AddressResolverBinding.java
(from rev 4838,
jbpm4/trunk/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AddressResolverBinding.java)
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AddressResolverBinding.java
(rev 0)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/AddressResolverBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.pvm.internal.wire.binding;
+
+import org.jbpm.pvm.internal.email.impl.DefaultAddressResolver;
+import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
+import org.jbpm.pvm.internal.xml.Parse;
+import org.jbpm.pvm.internal.xml.Parser;
+import org.w3c.dom.Element;
+
+/**
+ * @author Alejandro Guizar
+ */
+public class AddressResolverBinding extends WireDescriptorBinding {
+
+ public AddressResolverBinding() {
+ super("address-resolver");
+ }
+
+ public Object parse(Element element, Parse parse, Parser parser) {
+ return new ObjectDescriptor(DefaultAddressResolver.class);
+ }
+
+}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BasicTypeBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BasicTypeBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BasicTypeBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -20,7 +20,7 @@
String value = element.getAttribute("value");
descriptor = createDescriptor(value, element, parse);
} else {
- parse.addProblem("attribute 'value' is required in element
'"+XmlUtil.getTagLocalName(element)+"':
"+XmlUtil.toString(element));
+ parse.addProblem("attribute 'value' is required in element
'"+XmlUtil.getTagLocalName(element)+"':
"+XmlUtil.toString(element), null, "error", element);
}
return descriptor;
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BusinessCalendarBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BusinessCalendarBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/BusinessCalendarBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -142,14 +142,14 @@
dayParts.add(dayPart);
} catch(Exception e) {
- parse.addProblem(dayText+" has invalid hours part
'"+part+"': "+e.getMessage());
+ parse.addProblem(dayText+" has invalid hours part
'"+part+"': "+e.getMessage(), null, "error",
daysElement);
}
dayPartIndex++;
}
} else {
- parse.addProblem(dayText+" must have attribute 'hours'");
+ parse.addProblem(dayText+" must have attribute 'hours'", null,
"error", daysElement);
}
DayPart[] dayPartArray = new DayPart[dayParts.size()];
@@ -186,7 +186,7 @@
holiday.setToDay(toDate);
} else {
- parse.addProblem("attribute 'period' in element business-calendar is
required");
+ parse.addProblem("attribute 'period' in element business-calendar is
required", null, "error", holidayElement);
}
// now we are going to set the toDay to the end of the day, rather then the
beginning.
@@ -198,7 +198,7 @@
holiday.setToDay(toDay);
} catch (Exception e) {
- parse.addProblem("couldn't parse holiday:
"+XmlUtil.toString(holidayElement));
+ parse.addProblem("couldn't parse holiday:
"+XmlUtil.toString(holidayElement), null, "error", holidayElement);
}
return holiday;
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ByteBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ByteBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ByteBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -48,7 +48,7 @@
return byteDescriptor;
} catch (NumberFormatException e) {
- parse.addProblem(createValueExceptionMessage("'"+value+"'
cannot be parsed to a byte", element));
+ parse.addProblem(createValueExceptionMessage("'"+value+"'
cannot be parsed to a byte", element), null, "error", element);
}
return null;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CharBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CharBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/CharBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -42,7 +42,7 @@
protected AbstractDescriptor createDescriptor(String value, Element element, Parse
parse) {
CharacterDescriptor characterDescriptor = new CharacterDescriptor();
if (value.length()!=1) {
- parse.addProblem(createValueExceptionMessage("length of value must be 1",
element));
+ parse.addProblem(createValueExceptionMessage("length of value must be 1",
element), null, "error", element);
return null;
}
char c = value.charAt(0);
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ClassBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ClassBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ClassBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -26,7 +26,7 @@
classDescriptor = new ClassDescriptor();
classDescriptor.setClassName(className);
} else {
- parse.addProblem("class must have classname attribute:
"+XmlUtil.toString(element));
+ parse.addProblem("class must have classname attribute:
"+XmlUtil.toString(element), null, "error", element);
}
return classDescriptor;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DoubleBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DoubleBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/DoubleBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -45,7 +45,7 @@
try {
doubleValue = new Double(value);
} catch (NumberFormatException e) {
- parse.addProblem(createValueExceptionMessage("'"+value+"'
cannot be parsed to a double", element));
+ parse.addProblem(createValueExceptionMessage("'"+value+"'
cannot be parsed to a double", element), null, "error", element);
return null;
}
doubleDescriptor.setValue(doubleValue);
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FieldBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FieldBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FieldBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -47,7 +47,7 @@
if (element.hasAttribute("name")) {
fieldOperation.setFieldName(element.getAttribute("name"));
} else {
- parse.addProblem("field must have name : "+XmlUtil.toString(element));
+ parse.addProblem("field must have name : "+XmlUtil.toString(element),
null, "error", element);
}
Element descriptorElement = XmlUtil.element(element);
if (descriptorElement!=null) {
@@ -55,10 +55,10 @@
if (descriptor!=null) {
fieldOperation.setDescriptor(descriptor);
} else {
- parse.addProblem("unknown descriptor element
"+descriptorElement.getTagName()+" inside field operation:
"+XmlUtil.toString(element));
+ parse.addProblem("unknown descriptor element
"+descriptorElement.getTagName()+" inside field operation:
"+XmlUtil.toString(element), null, "error", element);
}
} else {
- parse.addProblem("field must have 1 descriptor element out of
"+parser.getBindings().getTagNames(WireParser.CATEGORY_DESCRIPTOR)+" as content:
"+XmlUtil.toString(element));
+ parse.addProblem("field must have 1 descriptor element out of
"+parser.getBindings().getTagNames(WireParser.CATEGORY_DESCRIPTOR)+" as content:
"+XmlUtil.toString(element), null, "error", element);
}
return fieldOperation;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FloatBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FloatBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/FloatBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -45,7 +45,7 @@
try {
floatValue = new Float(value);
} catch (NumberFormatException e) {
- parse.addProblem(createValueExceptionMessage("'"+value+"'
cannot be parsed to a float", element));
+ parse.addProblem(createValueExceptionMessage("'"+value+"'
cannot be parsed to a float", element), null, "error", element);
return null;
}
floatDescriptor.setValue(floatValue);
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/HibernateConfigurationBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/HibernateConfigurationBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/HibernateConfigurationBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -105,7 +105,7 @@
descriptor.addCfgUrl(urlText);
} else {
- parse.addProblem("exactly 1 attribute in {resource, file, url} was
expected in cfg: "+XmlUtil.toString(configElement));
+ parse.addProblem("exactly 1 attribute in {resource, file, url} was
expected in cfg: "+XmlUtil.toString(configElement), null, "error",
configElement);
}
} else if ("mapping".equals(XmlUtil.getTagLocalName(configElement))) {
@@ -130,7 +130,7 @@
descriptor.addMappingUrl(urlText);
} else {
- parse.addProblem("exactly 1 attribute in {resource, file, class, url} was
expected in mapping: "+XmlUtil.toString(element));
+ parse.addProblem("exactly 1 attribute in {resource, file, class, url} was
expected in mapping: "+XmlUtil.toString(element), null, "error",
configElement);
}
} else if ("properties".equals(XmlUtil.getTagLocalName(configElement)))
{
@@ -147,7 +147,7 @@
|| ("transactional".equals(cacheUsage))
)
){
- parse.addProblem("problem in cache-configuration: no usage attribute or
illegal value: "+cacheUsage+" Possible values are {read-only,
nonstrict-read-write, read-write, transactional}");
+ parse.addProblem("problem in cache-configuration: no usage attribute or
illegal value: "+cacheUsage+" Possible values are {read-only,
nonstrict-read-write, read-write, transactional}", null, "error",
configElement);
} else {
if (configElement.hasAttribute("file")) {
@@ -156,7 +156,7 @@
if (file.exists() && file.isFile()) {
streamSource = new FileStreamInput(file);
} else {
- parse.addProblem("file "+fileName+" isn't a
file");
+ parse.addProblem("file "+fileName+" isn't a file",
null, "error", configElement);
}
}
@@ -171,7 +171,7 @@
URL url = new URL(urlText);
streamSource = new UrlStreamInput(url);
} catch (Exception e) {
- parse.addProblem("couldn't open url "+urlText, e);
+ parse.addProblem("couldn't open url "+urlText, e,
"error", configElement);
}
}
@@ -199,14 +199,14 @@
descriptor.addCollectionToCache(collection, cacheUsage);
} else {
- parse.addProblem("unknown hibernate cache configuration element
"+XmlUtil.toString(configElement));
+ parse.addProblem("unknown hibernate cache configuration element
"+XmlUtil.toString(configElement), null, "error", configElement);
}
}
}
}
} else {
- parse.addProblem("unknown hibernate configuration element
"+XmlUtil.toString(configElement));
+ parse.addProblem("unknown hibernate configuration element
"+XmlUtil.toString(configElement), null, "error", configElement);
}
}
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IntBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IntBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/IntBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -45,7 +45,7 @@
try {
integerValue = new Integer(value);
} catch (NumberFormatException e) {
- parse.addProblem(createValueExceptionMessage("'"+value+"'
cannot be parsed to an int", element));
+ parse.addProblem(createValueExceptionMessage("'"+value+"'
cannot be parsed to an int", element), null, "error", element);
return null;
}
integerDescriptor.setValue(integerValue);
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/InvokeBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/InvokeBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/InvokeBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -48,7 +48,7 @@
if (element.hasAttribute("method")) {
invokeOperation.setMethodName(element.getAttribute("method"));
} else {
- parse.addProblem("invoke must have method :
"+XmlUtil.toString(element));
+ parse.addProblem("invoke must have method : "+XmlUtil.toString(element),
null, "error", element);
}
List<Element> argElements = XmlUtil.elements(element, "arg");
Parser wireParser = (Parser) parser;
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JndiBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JndiBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/JndiBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -45,7 +45,7 @@
return new JndiDescriptor(jndiName);
} else {
- parse.addProblem("jndi requires attribute 'jndi-name'");
+ parse.addProblem("jndi requires attribute 'jndi-name'", null,
"error", element);
}
return null;
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/LongBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/LongBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/LongBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -45,7 +45,7 @@
try {
longValue = new Long(value);
} catch (NumberFormatException e) {
- parse.addProblem(createValueExceptionMessage("'"+value+"'
cannot be parsed to a long", element));
+ parse.addProblem(createValueExceptionMessage("'"+value+"'
cannot be parsed to a long", element), null, "error", element);
return null;
}
longDescriptor.setValue(longValue);
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailSessionBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailSessionBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailSessionBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -94,7 +94,7 @@
serverDescriptor.addInjection("sessionProperties",
propertiesDescriptor);
}
else {
- parse.addProblem("missing mail session properties");
+ parse.addProblem("missing mail session properties", null,
"error", serverElement);
}
// authenticator
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailTemplateBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailTemplateBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MailTemplateBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -21,22 +21,19 @@
*/
package org.jbpm.pvm.internal.wire.binding;
-import java.util.ArrayList;
-import java.util.List;
+import org.w3c.dom.DocumentFragment;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.jbpm.pvm.internal.email.impl.AddressTemplate;
import org.jbpm.pvm.internal.email.impl.AttachmentTemplate;
import org.jbpm.pvm.internal.email.impl.MailTemplate;
-import org.jbpm.pvm.internal.email.impl.AddressTemplate;
+import org.jbpm.pvm.internal.email.impl.MailTemplateRegistry;
import org.jbpm.pvm.internal.util.XmlUtil;
-import org.jbpm.pvm.internal.wire.Descriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ListDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.ObjectDescriptor;
-import org.jbpm.pvm.internal.wire.descriptor.StringDescriptor;
+import org.jbpm.pvm.internal.wire.WireDefinition;
+import org.jbpm.pvm.internal.wire.descriptor.ProvidedObjectDescriptor;
import org.jbpm.pvm.internal.xml.Parse;
import org.jbpm.pvm.internal.xml.Parser;
-import org.w3c.dom.DocumentFragment;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
/**
* @author Alejandro Guizar
@@ -48,64 +45,52 @@
}
public Object parse(Element element, Parse parse, Parser parser) {
- ObjectDescriptor templateDescriptor = new ObjectDescriptor(MailTemplate.class);
- // name
- String name = element.getAttribute("name");
- if (name != null) {
- templateDescriptor.setName(name);
+ // MailTemplateRegistry is added to the WireDescriptor with a
ProvidedObjectDescriptor
+ // The MailTemplateRegistry descriptor is lazy initialized by this binding
+ // mail-templates will add a MailTemplate to the MailTemplateRegistry
+ ProvidedObjectDescriptor templateRegistryDescriptor;
+ MailTemplateRegistry templateRegistry;
+
+ WireDefinition wireDefinition = parse.findObject(WireDefinition.class);
+ String templateRegistryDescriptorName = wireDefinition != null ?
wireDefinition.getDescriptorName(MailTemplateRegistry.class)
+ : null;
+ if (templateRegistryDescriptorName != null) {
+ templateRegistryDescriptor = (ProvidedObjectDescriptor)
wireDefinition.getDescriptor(templateRegistryDescriptorName);
+ templateRegistry = (MailTemplateRegistry)
templateRegistryDescriptor.getProvidedObject();
+ templateRegistryDescriptor = null; // setting it to null so that the wire parser
doesn't add it to the wiredefinition again
}
else {
- parse.addProblem("template has no name");
+ templateRegistry = new MailTemplateRegistry();
+ templateRegistryDescriptor = new ProvidedObjectDescriptor(templateRegistry, true);
}
- // language
- String language = XmlUtil.attribute(element, "language");
- if (language != null) {
- templateDescriptor.addInjection("language", new
StringDescriptor(language));
- }
- // from
- Element fromElement = XmlUtil.element(element, "from");
- if (fromElement != null) {
- Descriptor fromDescriptor = parseRecipientTemplate(fromElement, parse, parser);
- templateDescriptor.addInjection("from", fromDescriptor);
- }
- // to
- Element toElement = XmlUtil.element(element, "to");
- if (toElement != null) {
- Descriptor toDescriptor = parseRecipientTemplate(toElement, parse, parser);
- templateDescriptor.addPropertyInjection("to", toDescriptor);
- }
- else {
- parse.addProblem("template '" + name + "' has no
'to' recipients");
- }
- // cc
- Element ccElement = XmlUtil.element(element, "cc");
- if (ccElement != null) {
- Descriptor ccDescriptor = parseRecipientTemplate(ccElement, parse, parser);
- templateDescriptor.addPropertyInjection("cc", ccDescriptor);
- }
- // bcc
- Element bccElement = XmlUtil.element(element, "bcc");
- if (bccElement != null) {
- Descriptor bccDescriptor = parseRecipientTemplate(bccElement, parse, parser);
- templateDescriptor.addPropertyInjection("bcc", bccDescriptor);
- }
- // subject
+
+ // create the mail template and add it to the registry
+ MailTemplate mailTemplate = parseMailTemplate(element, parse, parser);
+ String templateName = XmlUtil.attribute(element, "name", true, parse);
+ templateRegistry.addTemplate(templateName, mailTemplate);
+
+ return templateRegistryDescriptor;
+ }
+
+ public MailTemplate parseMailTemplate(Element element, Parse parse, Parser parser) {
+ MailTemplate mailTemplate = new MailTemplate();
+ mailTemplate.setLanguage(XmlUtil.attribute(element, "language"));
+
+ mailTemplate.setFrom(parseRecipientTemplate(element, "from", parse,
parser));
+ mailTemplate.setTo(parseRecipientTemplate(element, "to", parse, parser));
+ mailTemplate.setCc(parseRecipientTemplate(element, "cc", parse, parser));
+ mailTemplate.setBcc(parseRecipientTemplate(element, "bcc", parse,
parser));
+
Element subjectElement = XmlUtil.element(element, "subject");
if (subjectElement != null) {
- StringDescriptor subjectDescriptor =
- new StringDescriptor(XmlUtil.getContentText(subjectElement));
- templateDescriptor.addInjection("subject", subjectDescriptor);
+ mailTemplate.setSubject(XmlUtil.getContentText(subjectElement));
}
- else {
- parse.addProblem("template '" + name + "' has no
subject");
- }
- // text
+
Element textElement = XmlUtil.element(element, "text");
if (textElement != null) {
- StringDescriptor textDescriptor = new
StringDescriptor(XmlUtil.getContentText(textElement));
- templateDescriptor.addInjection("text", textDescriptor);
+ mailTemplate.setText(XmlUtil.getContentText(textElement));
}
- // html
+
Element htmlElement = XmlUtil.element(element, "html");
if (htmlElement != null) {
// extract child nodes from html element
@@ -114,49 +99,33 @@
next = child.getNextSibling();
fragment.appendChild(child);
}
- StringDescriptor htmlDescriptor = new
StringDescriptor(XmlUtil.toString(fragment));
- templateDescriptor.addInjection("html", htmlDescriptor);
+ mailTemplate.setHtml(XmlUtil.toString(fragment));
}
+
// attachments
Element attachmentsElement = XmlUtil.element(element, "attachments");
if (attachmentsElement != null) {
- List<Descriptor> attachmentDescriptors = new ArrayList<Descriptor>();
for (Element attachmentElement : XmlUtil.elements(attachmentsElement,
"attachment")) {
- ObjectDescriptor attachmentDescriptor = new
ObjectDescriptor(AttachmentTemplate.class);
- attachmentDescriptors.add(attachmentDescriptor);
- // url
- String url = XmlUtil.attribute(attachmentElement, "url");
- if (url != null) attachmentDescriptor.addInjection("url", new
StringDescriptor(url));
- // resource
- String resource = XmlUtil.attribute(attachmentElement, "resource");
- if (resource != null)
- attachmentDescriptor.addInjection("resource", new
StringDescriptor(resource));
- // file
- String file = XmlUtil.attribute(attachmentElement, "file");
- if (file != null) attachmentDescriptor.addInjection("file", new
StringDescriptor(file));
- }
+ AttachmentTemplate attachmentTemplate = new AttachmentTemplate();
+ mailTemplate.addAttachmentTemplate(attachmentTemplate);
- ListDescriptor attachmentsDescriptor = new ListDescriptor();
- attachmentsDescriptor.setValueDescriptors(attachmentDescriptors);
- templateDescriptor.addInjection("attachmentTemplates",
attachmentsDescriptor);
+ attachmentTemplate.setUrl(XmlUtil.attribute(attachmentElement,
"url"));
+ attachmentTemplate.setResource(XmlUtil.attribute(attachmentElement,
"resource"));
+ attachmentTemplate.setFile(XmlUtil.attribute(attachmentElement,
"file"));
+ }
}
- return templateDescriptor;
+ return mailTemplate;
}
- protected Descriptor parseRecipientTemplate(Element element, Parse parse, Parser
parser) {
- ObjectDescriptor recipientDescriptor = new ObjectDescriptor(AddressTemplate.class);
+ protected AddressTemplate parseRecipientTemplate(Element element, String tagName, Parse
parse,
+ Parser parser) {
+ Element recipientElement = XmlUtil.element(element, tagName);
+ if (recipientElement == null) return null;
- String addresses = XmlUtil.attribute(element, "addresses");
- if (addresses != null)
- recipientDescriptor.addInjection("addresses", new
StringDescriptor(addresses));
-
- String users = XmlUtil.attribute(element, "users");
- if (users != null) recipientDescriptor.addInjection("users", new
StringDescriptor(users));
-
- String groups = XmlUtil.attribute(element, "groups");
- if (groups != null) recipientDescriptor.addInjection("groups", new
StringDescriptor(groups));
-
- return recipientDescriptor;
+ AddressTemplate addressTemplate = new AddressTemplate();
+ addressTemplate.setAddresses(XmlUtil.attribute(recipientElement,
"addresses"));
+ addressTemplate.setUsers(XmlUtil.attribute(recipientElement, "users"));
+ addressTemplate.setGroups(XmlUtil.attribute(recipientElement, "groups"));
+ return addressTemplate;
}
-
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MapBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MapBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MapBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -78,10 +78,10 @@
keyDescriptors.add(keyDescriptor);
valueDescriptors.add(valueDescriptor);
} else {
- parse.addProblem("entry must have key and value element with a single
descriptor as contents: "+XmlUtil.toString(entryElement));
+ parse.addProblem("entry must have key and value element with a single
descriptor as contents: "+XmlUtil.toString(entryElement), null, "error",
entryElement);
}
} else {
- parse.addProblem("map can only contain entry elements:
"+XmlUtil.toString(entryElement));
+ parse.addProblem("map can only contain entry elements:
"+XmlUtil.toString(entryElement), null, "error", entryElement);
}
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MessageSessionBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MessageSessionBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/MessageSessionBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -59,7 +59,7 @@
JndiDescriptor jndiDescriptor = new JndiDescriptor(jmsSessionJndiName);
objectDescriptor.addInjection("jmsSession", jndiDescriptor);
} else {
- parse.addProblem("attribute
<"+XmlUtil.getTagLocalName(element)+" session-jndi=\"...\" is
required when target=\"jms\"");
+ parse.addProblem("attribute
<"+XmlUtil.getTagLocalName(element)+" session-jndi=\"...\" is
required when target=\"jms\"", null, "error", element);
}
if (element.hasAttribute("destination-jndi")) {
@@ -67,7 +67,7 @@
JndiDescriptor jndiDescriptor = new JndiDescriptor(jmsDestinationJndiName);
objectDescriptor.addInjection("jmsDestination", jndiDescriptor);
} else {
- parse.addProblem("attribute
<"+XmlUtil.getTagLocalName(element)+" destination-jndi=\"...\" is
required when target=\"jms\"");
+ parse.addProblem("attribute
<"+XmlUtil.getTagLocalName(element)+" destination-jndi=\"...\" is
required when target=\"jms\"", null, "error", element);
}
} else {
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ObjectBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -76,10 +76,10 @@
if (className!=null) {
descriptor.setClassName(className);
if (factoryObjectName!=null) {
- parse.addProblem("attribute 'factory' is specified together with
attribute 'class' in element 'object': "+XmlUtil.toString(element));
+ parse.addProblem("attribute 'factory' is specified together with
attribute 'class' in element 'object': "+XmlUtil.toString(element),
null, "error", element);
}
if (factoryElement!=null) {
- parse.addProblem("element 'factory' is specified together with
attribute 'class' in element 'object': "+XmlUtil.toString(element));
+ parse.addProblem("element 'factory' is specified together with
attribute 'class' in element 'object': "+XmlUtil.toString(element),
null, "error", element);
}
Element constructorElement = XmlUtil.element(element, "constructor");
@@ -89,14 +89,14 @@
descriptor.setArgDescriptors(argDescriptors);
if (element.hasAttribute("method")) {
- parse.addProblem("attributes 'class' and 'method' indicate
static method and also a 'constructor' element is specified for element
'object': "+XmlUtil.toString(element));
+ parse.addProblem("attributes 'class' and 'method' indicate
static method and also a 'constructor' element is specified for element
'object': "+XmlUtil.toString(element), null, "error", element);
}
}
} else if (factoryObjectName!=null) {
descriptor.setFactoryObjectName(factoryObjectName);
if (factoryElement!=null) {
- parse.addProblem("element 'factory' is specified together with
attribute 'factory' in element 'object':
"+XmlUtil.toString(element));
+ parse.addProblem("element 'factory' is specified together with
attribute 'factory' in element 'object': "+XmlUtil.toString(element),
null, "error", element);
}
} else if (factoryElement!=null) {
@@ -105,7 +105,7 @@
descriptor.setFactoryDescriptor(factoryDescriptor);
} else {
- parse.addProblem("element 'object' must have one of {attribute
'class', attribute 'factory' or element 'factory'}:
"+XmlUtil.toString(element));
+ parse.addProblem("element 'object' must have one of {attribute
'class', attribute 'factory' or element 'factory'}:
"+XmlUtil.toString(element), null, "error", element);
}
// method
@@ -116,11 +116,11 @@
List<ArgDescriptor> argDescriptors = wireParser.parseArgs(argElements,
parse);
descriptor.setArgDescriptors(argDescriptors);
} else if (className == null) {
- parse.addProblem("element 'object' with a element 'factory' or
a attribute 'factory' must have a attribute 'method':
"+XmlUtil.toString(element));
+ parse.addProblem("element 'object' with a element 'factory' or
a attribute 'factory' must have a attribute 'method':
"+XmlUtil.toString(element), null, "error", element);
}
if( (className == null) && (XmlUtil.element(element, "constructor")
!= null)){
- parse.addProblem("element 'object' with a element 'factory' or
a attribute 'factory' can't have a 'constructor' element:
"+XmlUtil.toString(element));
+ parse.addProblem("element 'object' with a element 'factory' or
a attribute 'factory' can't have a 'constructor' element:
"+XmlUtil.toString(element), null, "error", element);
}
// read the operations elements
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertiesBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertiesBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertiesBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -81,10 +81,10 @@
keyDescriptors.add(new StringDescriptor(name));
valueDescriptors.add(new StringDescriptor(value));
} else {
- parse.addProblem("property must have name and value attributes:
"+XmlUtil.toString(propertyElement));
+ parse.addProblem("property must have name and value attributes:
"+XmlUtil.toString(propertyElement), null, "error", propertyElement);
}
} else {
- parse.addProblem("properties can only contain property elements:
"+XmlUtil.toString(propertyElement));
+ parse.addProblem("properties can only contain property elements:
"+XmlUtil.toString(propertyElement), null, "error", propertyElement);
}
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertyBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertyBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/PropertyBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -86,7 +86,7 @@
} else if (element.hasAttribute("name")) {
propertyOperation.setPropertyName(element.getAttribute("name"));
} else {
- parse.addProblem("property must have name or setter attribute:
"+XmlUtil.toString(element));
+ parse.addProblem("property must have name or setter attribute:
"+XmlUtil.toString(element), null, "error", element);
}
Element descriptorElement = XmlUtil.element(element);
if (descriptorElement!=null) {
@@ -94,10 +94,10 @@
if (descriptor!=null) {
propertyOperation.setDescriptor(descriptor);
} else {
- parse.addProblem("couldn't parse property content element as a value
descriptor: "+XmlUtil.toString(element));
+ parse.addProblem("couldn't parse property content element as a value
descriptor: "+XmlUtil.toString(element), null, "error", element);
}
} else {
- parse.addProblem("property must have 1 descriptor element out of
"+parser.getBindings().getTagNames(WireParser.CATEGORY_DESCRIPTOR)+" as content:
"+XmlUtil.toString(element));
+ parse.addProblem("property must have 1 descriptor element out of
"+parser.getBindings().getTagNames(WireParser.CATEGORY_DESCRIPTOR)+" as content:
"+XmlUtil.toString(element), null, "error", element);
}
return propertyOperation;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RefBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RefBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RefBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -45,7 +45,7 @@
if (element.hasAttribute("object")) {
descriptor.setValue(element.getAttribute("object"));
} else {
- parse.addProblem("ref must have object attribute:
"+XmlUtil.toString(element));
+ parse.addProblem("ref must have object attribute:
"+XmlUtil.toString(element), null, "error", element);
}
return descriptor;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RetryInterceptorBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RetryInterceptorBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/RetryInterceptorBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -48,7 +48,7 @@
int retries = Integer.parseInt(retriesText);
retryInterceptorDescriptor.setRetries(retries);
} catch (NumberFormatException e) {
- parse.addProblem("couldn't parse retries "+retriesText);
+ parse.addProblem("couldn't parse retries "+retriesText, null,
"error", element);
}
}
@@ -58,7 +58,7 @@
long delay = Long.parseLong(delayText);
retryInterceptorDescriptor.setDelay(delay);
} catch (NumberFormatException e) {
- parse.addProblem("couldn't parse delay "+delayText);
+ parse.addProblem("couldn't parse delay "+delayText, null,
"error", element);
}
}
@@ -68,7 +68,7 @@
long delayFactor = Long.parseLong(delayFactorText);
retryInterceptorDescriptor.setDelayFactor(delayFactor);
} catch (NumberFormatException e) {
- parse.addProblem("couldn't parse delay-factor "+delayFactorText);
+ parse.addProblem("couldn't parse delay-factor "+delayFactorText,
null, "error", element);
}
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ScriptManagerBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -66,7 +66,7 @@
descriptor.addInjection("readContextNames", new
ProvidedObjectDescriptor(readContextNames));
} else {
- parse.addProblem("'read-contexts' is a required attribute in element
<script-manager />");
+ parse.addProblem("'read-contexts' is a required attribute in element
<script-manager />", null, "error", element);
}
if (element.hasAttribute("write-context")) {
@@ -74,7 +74,7 @@
descriptor.addInjection("writeContextName", new
StringDescriptor(writeContextName));
} else {
- parse.addProblem("'write-context' is a required attribute in element
<script-manager />");
+ parse.addProblem("'write-context' is a required attribute in element
<script-manager />", null, "error", element);
}
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
@@ -84,13 +84,13 @@
if (scriptElement.hasAttribute("name")) {
languageName = scriptElement.getAttribute("name");
} else {
- parse.addProblem("'name' is a required attribute in element
<script-language />");
+ parse.addProblem("'name' is a required attribute in element
<script-language />", null, "error", element);
}
String factoryClassName = null;
if (scriptElement.hasAttribute("factory")) {
factoryClassName = scriptElement.getAttribute("factory");
} else {
- parse.addProblem("'name' is a required attribute in element
<script-language />");
+ parse.addProblem("'name' is a required attribute in element
<script-language />", null, "error", element);
}
if ( (languageName!=null)
@@ -101,7 +101,7 @@
ScriptEngineFactory scriptEngineFactory = (ScriptEngineFactory)
factoryClass.newInstance();
scriptEngineManager.registerEngineName(languageName, scriptEngineFactory);
} catch (Exception e) {
- parse.addProblem("couldn't instantiate ScriptEngineFactory
"+factoryClassName, e);
+ parse.addProblem("couldn't instantiate ScriptEngineFactory
"+factoryClassName, e, "error", element);
}
}
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ShortBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ShortBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/ShortBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -45,7 +45,7 @@
try {
shortValue = new Short(value);
} catch (NumberFormatException e) {
- parse.addProblem(createValueExceptionMessage("'"+value+"'
cannot be parsed to a short", element));
+ parse.addProblem(createValueExceptionMessage("'"+value+"'
cannot be parsed to a short", element), null, "error", element);
return null;
}
shortDescriptor.setValue(shortValue);
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TransactionBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -54,7 +54,7 @@
} else if ("jta".equals(type)){
transactionDescriptor = new ObjectDescriptor(JtaTransaction.class);
} else {
- parse.addProblem("unsupported transaction type: "+type);
+ parse.addProblem("unsupported transaction type: "+type, null,
"error", element);
}
return transactionDescriptor;
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TypesBinding.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TypesBinding.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/binding/TypesBinding.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -65,7 +65,7 @@
streamSource = new FileStreamInput(file);
parser.importStream(streamSource, element, parse);
} else {
- parse.addProblem("file "+fileName+" isn't a file");
+ parse.addProblem("file "+fileName+" isn't a file", null,
"error", element);
}
}
@@ -82,7 +82,7 @@
streamSource = new UrlStreamInput(url);
parser.importStream(streamSource, element, parse);
} catch (Exception e) {
- parse.addProblem("couldn't open url "+urlText, e);
+ parse.addProblem("couldn't open url "+urlText, e,
"error", element);
}
}
@@ -126,10 +126,10 @@
} else if ("string".equalsIgnoreCase(idType)) {
matcher = new HibernateStringIdMatcher(hibernateSessionFactoryName);
} else {
- parse.addProblem("id-type was not 'long' or 'string':
"+idType);
+ parse.addProblem("id-type was not 'long' or 'string':
"+idType, null, "error", element);
}
} else {
- parse.addProblem("id-type is required in a persistable type");
+ parse.addProblem("id-type is required in a persistable type", null,
"error", element);
}
// otherwise, we expect type="some.java.ClassName"
@@ -145,10 +145,10 @@
try {
matcher = (Matcher) parser.parseElement(matcherObjectElement, parse);
} catch (ClassCastException e) {
- parse.addProblem("matcher is not a "+Matcher.class.getName()+":
"+(matcher!=null ? matcher.getClass().getName() : "null"));
+ parse.addProblem("matcher is not a "+Matcher.class.getName()+":
"+(matcher!=null ? matcher.getClass().getName() : "null"), null,
"error", element);
}
} else {
- parse.addProblem("no matcher specified in
"+XmlUtil.toString(element));
+ parse.addProblem("no matcher specified in "+XmlUtil.toString(element),
null, "error", element);
}
}
@@ -163,7 +163,7 @@
Class<?> converterClass = ReflectUtil.loadClass(classLoader,
converterClassName);
converter = (Converter) converterClass.newInstance();
} catch (Exception e) {
- parse.addProblem("couldn't instantiate converter
"+converterClassName);
+ parse.addProblem("couldn't instantiate converter
"+converterClassName, null, "error", element);
}
} else {
// look for the matcher element
@@ -173,7 +173,7 @@
try {
converter = (Converter) parser.parseElement(converterObjectElement, parse);
} catch (ClassCastException e) {
- parse.addProblem("converter is not a
"+Converter.class.getName()+": "+(converter!=null ?
converter.getClass().getName() : "null"));
+ parse.addProblem("converter is not a
"+Converter.class.getName()+": "+(converter!=null ?
converter.getClass().getName() : "null"), null, "error", element);
}
}
}
@@ -189,10 +189,10 @@
try {
variableClass = ReflectUtil.loadClass(classLoader, variableClassName);
} catch (Exception e) {
- parse.addProblem("couldn't instantiate variable-class
"+variableClassName, e);
+ parse.addProblem("couldn't instantiate variable-class
"+variableClassName, e, "error", element);
}
} else {
- parse.addProblem("variable-class is required on a type:
"+XmlUtil.toString(element));
+ parse.addProblem("variable-class is required on a type:
"+XmlUtil.toString(element), null, "error", element);
}
type.setVariableClass(variableClass);
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/BindingParser.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/BindingParser.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/wire/xml/BindingParser.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -52,7 +52,7 @@
log.trace("couldn't instantiate binding "+bindingClassName);
}
} else {
- parse.addProblem("class is a required attribute in a binding
"+XmlUtil.toString(bindingElement));
+ parse.addProblem("class is a required attribute in a binding
"+XmlUtil.toString(bindingElement), null, "error", bindingElement);
}
if (binding!=null) {
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parse.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -146,7 +146,7 @@
return new InputSource(inputStream);
}
- addProblem("no source specified to parse");
+ addProblem("no source specified to parse", null, "error", null);
return null;
}
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/Parser.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -300,7 +300,7 @@
try {
parse.documentBuilder = documentBuilderFactory.newDocumentBuilder();
} catch (Exception e) {
- parse.addProblem("couldn't get new document builder", e);
+ parse.addProblem("couldn't get new document builder", e,
"error", null);
return null;
}
parse.documentBuilder.setErrorHandler(parse);
@@ -376,7 +376,7 @@
}
} catch (Exception e) {
- importingParse.addProblem("couldn't import "+importedStreamInput,
e);
+ importingParse.addProblem("couldn't import "+importedStreamInput, e,
"error", null);
}
}
@@ -395,7 +395,7 @@
} catch (Exception e) {
e.printStackTrace();
- parse.addProblem("couldn't interpret the dom model:
"+e.getMessage(), e);
+ parse.addProblem("couldn't interpret the dom model:
"+e.getMessage(), e, "error", null);
}
}
@@ -404,7 +404,7 @@
try {
parse.inputStream.close();
} catch (Exception e) {
- parse.addProblem("couldn't close input stream", e);
+ parse.addProblem("couldn't close input stream", e,
"error", null);
}
}
}
@@ -451,7 +451,7 @@
xmlReader.parse(inputSource);
} catch (Exception e) {
- parse.addProblem("couldn't parse xml document", e);
+ parse.addProblem("couldn't parse xml document", e, "error",
null);
}
return document;
@@ -511,7 +511,7 @@
if (binding!=null) {
object = binding.parse(element, parse, this);
} else {
- parse.addProblem("no element parser for tag "+tagName+(category!=null ?
" in category "+category : " in the default category"));
+ parse.addProblem("no element parser for tag "+tagName+(category!=null ?
" in category "+category : " in the default category"), null,
"error", element);
}
return object;
@@ -532,7 +532,7 @@
argDescriptor.setTypeName(XmlUtil.attribute(argElement, "type"));
Element descriptorElement = XmlUtil.element(argElement);
if (descriptorElement==null) {
- parse.addProblem("arg must contain exactly one descriptor element out of
"+bindings.getTagNames(category)+" as contents:"+XmlUtil.toString((Element)
argElement.getParentNode()));
+ parse.addProblem("arg must contain exactly one descriptor element out of
"+bindings.getTagNames(category)+" as contents:"+XmlUtil.toString((Element)
argElement.getParentNode()), null, "error", argElement);
} else {
Descriptor descriptor = (Descriptor) parseElement(descriptorElement, parse,
category);
argDescriptor.setDescriptor(descriptor);
Modified:
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/main/java/org/jbpm/pvm/internal/xml/ProblemList.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -66,26 +66,26 @@
// problem constructor methods with default values //////////////////////////
/** add a problem with {@link ProblemImpl#TYPE_ERROR the default severity}.*/
- public void addProblem(String msg) {
- addProblem(msg, null, ProblemImpl.TYPE_ERROR, null);
- }
+// public void addProblem(String msg) {
+// addProblem(msg, null, ProblemImpl.TYPE_ERROR, null);
+// }
/** add a problem with an exception cause and
* {@link ProblemImpl#TYPE_ERROR the default severity}.*/
- public void addProblem(String msg, Exception e) {
- addProblem(msg, e, ProblemImpl.TYPE_ERROR, null);
- }
+// public void addProblem(String msg, Exception e) {
+// addProblem(msg, e, ProblemImpl.TYPE_ERROR, null);
+// }
/** add a problem with {@link ProblemImpl#TYPE_ERROR the default severity}.*/
- public void addProblem(String msg, Element element) {
- addProblem(msg, null, ProblemImpl.TYPE_ERROR, element);
- }
+// public void addProblem(String msg, Element element) {
+// addProblem(msg, null, ProblemImpl.TYPE_ERROR, element);
+// }
/** add a problem with an exception cause and
* {@link ProblemImpl#TYPE_ERROR the default severity}.*/
- public void addProblem(String msg, Exception e, Element element) {
- addProblem(msg, e, ProblemImpl.TYPE_ERROR, element);
- }
+// public void addProblem(String msg, Exception e, Element element) {
+// addProblem(msg, e, ProblemImpl.TYPE_ERROR, element);
+// }
// problem mgmt methods /////////////////////////////////////////////////////
Modified: jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.default.cfg.xml
===================================================================
--- jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.default.cfg.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.default.cfg.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -22,7 +22,7 @@
default-script-language="juel"
read-contexts="execution, environment, process-engine"
write-context="">
- <script-language name="juel"
factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
+ <script-language name="juel"
factory="org.jbpm.pvm.internal.script.JuelScriptEngineFactory" />
</script-manager>
<authentication />
@@ -30,6 +30,8 @@
<id-generator />
<types resource="jbpm.variable.types.xml" />
+ <address-resolver />
+
<business-calendar>
<monday hours="9:00-12:00 and 12:30-17:00"/>
<tuesday hours="9:00-12:00 and 12:30-17:00"/>
@@ -38,6 +40,11 @@
<friday hours="9:00-12:00 and 12:30-17:00"/>
<holiday period="01/07/2008 - 31/08/2008"/>
</business-calendar>
+
+ <!--mail-template name="TaskNotification"
+ -->
+ <!--mail-template name="TaskReminder"
+ -->
</process-engine-context>
@@ -51,11 +58,7 @@
<history-session />
<mail-session>
<mail-server>
- <session-properties>
- <property name="mail.smtp.host" value="localhost" />
- <property name="mail.smtp.port" value="2525" />
- <property name="mail.from" value="noreply(a)jbpm.org"
/>
- </session-properties>
+ <session-properties resource="jbpm.mail.properties" />
</mail-server>
</mail-session>
</transaction-context>
Modified: jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.execution.hbm.xml
===================================================================
--- jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.execution.hbm.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -20,7 +20,7 @@
<!-- ### PROCESS DEFINITION ############################################# -->
<class name="ExecutionImpl"
- table="JBPM_EXECUTION"
+ table="JBPM4_EXECUTION"
discriminator-value="pvm">
<id name="dbid" column="DBID_">
<generator class="native" />
@@ -30,6 +30,8 @@
<property name="activityName" column="ACTIVITYNAME_" />
<property name="processDefinitionId" column="PROCDEFID_"
/>
+ <property name="transitionSourceName" column="TRANSRC_" />
+ <property name="transitionSourceIndex" column="TRANSRCIDX_"
/>
<property name="hasVariables" column="HASVARS_" />
<map name="variables"
@@ -53,20 +55,12 @@
<property name="name" column="NAME_" />
<property name="key" column="KEY_" />
<property name="id" column="ID_" unique="true"
/>
-
<property name="state" column="STATE_" />
+ <property name="suspendHistoryState" column="SUSPHISTSTATE_"
/>
<property name="priority" column="PRIORITY_" />
<property name="historyActivityInstanceDbid"
column="HISACTINST_" />
- <!-- many-to-one name="transition" column="TRANSITION_"
class="TransitionImpl" / -->
-
- <!-- many-to-one name="transitionOrigin"
- class="org.jbpm.pvm.internal.model.ActivityImpl"
- column="TRANSORIG_"
- foreign-key="FK_EXEC_TRANSORIG"
- index="IDX_EXEC_TRANSORIG" / -->
-
<list name="executions"
cascade="all-delete-orphan"
inverse="false"
@@ -103,7 +97,7 @@
</class>
<!-- ### COMMENTS ####################################################### -->
- <class name="CommentImpl" table="JBPM_COMMENT">
+ <class name="CommentImpl" table="JBPM4_COMMENT">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -124,7 +118,7 @@
</class>
<!-- ### VARIABLE ####################################################### -->
- <class name="org.jbpm.pvm.internal.type.Variable"
abstract="true" discriminator-value=" "
table="JBPM_VARIABLE">
+ <class name="org.jbpm.pvm.internal.type.Variable"
abstract="true" discriminator-value=" "
table="JBPM4_VARIABLE">
<!-- discriminator values:
date : org.jbpm.pvm.internal.type.variable.DateVariable
double : org.jbpm.pvm.internal.type.variable.DoubleVariable
@@ -198,7 +192,7 @@
</subclass>
<!-- ### LOB ############################################################ -->
- <class name="org.jbpm.pvm.internal.lob.Lob"
table="JBPM_LOB">
+ <class name="org.jbpm.pvm.internal.lob.Lob"
table="JBPM4_LOB">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -209,7 +203,7 @@
<property name="text" type="text"
column="TEXT_VALUE_"/>
</class>
- <class name="org.jbpm.pvm.internal.job.JobImpl" table="JBPM_JOB"
discriminator-value="Job">
+ <class name="org.jbpm.pvm.internal.job.JobImpl"
table="JBPM4_JOB" discriminator-value="Job">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -217,7 +211,7 @@
<version name="dbversion" column="DBVERSION_" />
<property name="dueDate" column="DUEDATE_"
type="timestamp" index="IDX_JOBDUEDATE" />
- <property name="isSuspended" column="ISSUSPENDED_" />
+ <property name="state" column="STATE_" />
<property name="isExclusive" column="ISEXCLUSIVE_" />
<property name="lockOwner" column="LOCKOWNER_" />
<property name="lockExpirationTime" column="LOCKEXPTIME_"
index="IDX_JOBLOCKEXP" />
@@ -254,8 +248,9 @@
cascade="none"
foreign-key="FK_JOB_NODE"/ -->
</subclass>
- <subclass name="org.jbpm.pvm.internal.model.op.TakeTransitionMessage"
discriminator-value="TakeTrMsg" />
- <subclass
name="org.jbpm.pvm.internal.model.op.ProceedToDestinationMessage"
discriminator-value="ProceedDestMsg" />
+ <subclass
name="org.jbpm.pvm.internal.model.op.TransitionEndActivityMessage"
discriminator-value="TrEndActMsg" />
+ <subclass name="org.jbpm.pvm.internal.model.op.TransitionTakeMessage"
discriminator-value="TrTakeMsg" />
+ <subclass
name="org.jbpm.pvm.internal.model.op.TransitionStartActivityMessage"
discriminator-value="TrStartActMsg" />
<subclass name="org.jbpm.pvm.internal.job.CommandMessage"
discriminator-value="CmdMsg" />
</subclass>
@@ -307,6 +302,8 @@
)
and
( job.retries > 0 )
+ and
+ ( job.state != 'suspended' )
)
order by job.dueDate asc
]]>
@@ -320,6 +317,7 @@
and job.processInstance = :processInstance
and job.isExclusive = true
and job.retries > 0
+ and job.state != 'suspended'
and ( (job.dueDate is null)
or (job.dueDate <= :now)
)
@@ -333,6 +331,7 @@
from org.jbpm.pvm.internal.job.JobImpl as job
where job.lockOwner is null
and job.retries > 0
+ and job.state != 'suspended'
order by job.dueDate asc
]]>
</query>
@@ -343,6 +342,7 @@
select execution
from org.jbpm.pvm.internal.model.ExecutionImpl as execution
where execution.id = :id
+ and execution.state != 'suspended'
]]>
</query>
@@ -352,6 +352,7 @@
from org.jbpm.pvm.internal.model.ExecutionImpl as processInstance
where processInstance.id = :processInstanceId
and processInstance.parent is null
+ and processInstance.state != 'suspended'
]]>
</query>
Modified: jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.history.hbm.xml
===================================================================
--- jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.history.hbm.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.history.hbm.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -4,7 +4,7 @@
<hibernate-mapping package="org.jbpm.pvm.internal.history.model"
default-access="field">
<!-- ### HISTORY PROCESS INSTANCE ####################################### -->
- <class name="HistoryProcessInstanceImpl"
table="JBPM_HIST_PROCINST">
+ <class name="HistoryProcessInstanceImpl"
table="JBPM4_HIST_PROCINST">
<id name="processInstanceId" column="ID_">
<generator class="assigned" />
</id>
@@ -35,7 +35,7 @@
</class>
<!-- ### HISTORY PROCESS INSTANCE ####################################### -->
- <class name="HistoryActivityInstanceImpl"
table="JBPM_HIST_ACTINST" discriminator-value="ACT">
+ <class name="HistoryActivityInstanceImpl"
table="JBPM4_HIST_ACTINST" discriminator-value="ACT">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
Modified: jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.identity.hbm.xml
===================================================================
--- jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.identity.hbm.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.identity.hbm.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -4,7 +4,7 @@
<hibernate-mapping package="org.jbpm.pvm.internal.identity.impl"
default-access="field">
<!-- ### USER ########################################################### -->
- <class name="UserImpl" table="JBPM_ID_USER">
+ <class name="UserImpl" table="JBPM4_ID_USER">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -14,10 +14,11 @@
<property name="password" column="PASSWORD_" />
<property name="givenName" column="GIVENNAME_" />
<property name="familyName" column="FAMILYNAME_" />
+ <property name="businessEmail" column="BUSINESSEMAIL_" />
</class>
<!-- ### MEMBERSHIP ##################################################### -->
- <class name="MembershipImpl" table="JBPM_ID_MEMBERSHIP">
+ <class name="MembershipImpl" table="JBPM4_ID_MEMBERSHIP">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -39,7 +40,7 @@
</class>
<!-- ### GROUP ########################################################### -->
- <class name="GroupImpl" table="JBPM_ID_GROUP">
+ <class name="GroupImpl" table="JBPM4_ID_GROUP">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
Modified: jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.repository.hbm.xml
===================================================================
--- jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.repository.hbm.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.repository.hbm.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -5,7 +5,7 @@
<!-- ### Deployment ##################################################### -->
<class name="org.jbpm.pvm.internal.repository.DeploymentImpl"
- table="JBPM_DEPLOYMENT">
+ table="JBPM4_DEPLOYMENT">
<!-- ProcessElementImpl part ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -->
<id name="dbid" column="DBID_">
@@ -14,6 +14,7 @@
<property name="name" type="text" column="NAME_"
/>
<property name="timestamp" column="TIMESTAMP_" />
+ <property name="state" column="STATE_" />
<map name="resources" cascade="all-delete-orphan">
<key foreign-key="FK_LOB_DEPLOYMENT">
@@ -24,7 +25,7 @@
</map>
<set name="objectProperties"
- table="JBPM_DEPLOYPROPS"
+ table="JBPM4_DEPLOYPROPS"
cascade="all">
<key column="DEPLOYMENT_" />
<one-to-many
class="org.jbpm.pvm.internal.repository.DeploymentProperty" />
@@ -32,7 +33,7 @@
</class>
- <class name="org.jbpm.pvm.internal.repository.DeploymentProperty"
table="JBPM_DEPLOYPROP">
+ <class name="org.jbpm.pvm.internal.repository.DeploymentProperty"
table="JBPM4_DEPLOYPROP">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
Modified: jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.task.hbm.xml
===================================================================
--- jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.task.hbm.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.task.hbm.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -4,68 +4,9 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping auto-import="false"
package="org.jbpm.pvm.internal.task" default-access="field">
- <!-- ### ASSIGNABLE DEFINITIONS #########################################
- <class name="AssignableDefinitionImpl"
- table="JBPM_ASSIGNDEF"
- discriminator-value="A" >
- <id name="dbid" column="DBID_">
- <generator class="native" />
- </id>
- <discriminator><column name="CLASS_" /></discriminator>
- <version name="dbversion" column="DBVERSION_" />
-
- <property name="name" column="NAME_"/>
- <property name="description" column="DESCR_"/>
- <property name="assigneeExpression" column="ASS_EXPR_"/>
- <property name="assigneeExpressionLanguage"
column="ASS_EXPR_LANG_"/>
- <property name="candidateUsersExpression"
column="CNDUSR_EXPR_"/>
- <property name="candidateUsersExpressionLanguage"
column="CNDUSR_EXPRLANG_"/>
- <property name="candidateGroupsExpression"
column="CNDGRP_EXPR_"/>
- <property name="candidateGroupsExpressionLanguage"
column="CNDGRP_EXPRLANG_"/>
-
- <many-to-one name="assignmentHandlerDescriptor"
- column="ASSHNDLR_DESCR_"
- cascade="all"
-
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
- foreign-key="FK_ASSHNDLR_DESCR"
- index="IDX_ASSHNDLR_DESCR" />
-
- <subclass name="SwimlaneDefinitionImpl"
discriminator-value="S">
- </subclass>
- -->
-
- <!-- ### TASK DEFINITION ################################################
- <subclass name="TaskDefinitionImpl"
discriminator-value="T">
-
- <property name="priority" column="PRIORITY_"/>
- <property name="dueDateDuration" column="DUEDATE_"/>
-
- <many-to-one name="taskHandlerDescriptor"
- column="TSKHNDLRDESCR_"
- cascade="all"
-
class="org.jbpm.pvm.internal.wire.descriptor.AbstractDescriptor"
- foreign-key="FK_TSKHNDLR_DESCR"
- index="IDX_TSKHNDLR_DESCR" />
-
- <many-to-one name="swimlaneDefinition"
- column="SWIMLDEF_"
- cascade="all"
- class="SwimlaneDefinitionImpl"
- foreign-key="FK_TSK_SWIMLDEF"
- index="IDX_TSK_SWIMLDEF" />
-
- <list name="subTaskDefinitions"
cascade="all-delete-orphan">
- <key column="TASKDEF_" />
- <list-index column="TASKDEF_IDX_" />
- <one-to-many class="TaskDefinitionImpl" />
- </list>
- </subclass>
- </class>
- -->
-
<!-- ### TASK ########################################################### -->
<class name="TaskImpl"
- table="JBPM_TASK"
+ table="JBPM4_TASK"
discriminator-value="T">
<id name="dbid" column="DBID_">
<generator class="native" />
@@ -73,9 +14,10 @@
<discriminator type="char" column="CLASS_"/>
<version name="dbversion" column="DBVERSION_" />
- <property name="id" column="ID_" unique="true"
/>
<property name="name" column="NAME_"/>
<property name="description" column="DESCR_"/>
+ <property name="state" column="STATE_"/>
+ <property name="suspendHistoryState" column="SUSPHISTSTATE_"
/>
<property name="assignee" column="ASSIGNEE_"/>
<property name="form" column="FORM_"/>
@@ -135,7 +77,7 @@
</class>
<!-- ### PARTICIPANT #################################################### -->
- <class name="ParticipationImpl" table="JBPM_PARTICIPATION">
+ <class name="ParticipationImpl" table="JBPM4_PARTICIPATION">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
@@ -159,7 +101,7 @@
</class>
<!-- ### SWIMLANE ####################################################### -->
- <class name="SwimlaneImpl" table="JBPM_SWIMLANE">
+ <class name="SwimlaneImpl" table="JBPM4_SWIMLANE">
<id name="dbid" column="DBID_">
<generator class="native" />
</id>
Modified: jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.wire.bindings.xml
===================================================================
--- jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.wire.bindings.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/pvm/src/main/resources/jbpm.wire.bindings.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -39,6 +39,8 @@
<binding
class="org.jbpm.pvm.internal.wire.binding.BusinessCalendarBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.IdGeneratorBinding"
/>
<binding class="org.jbpm.pvm.internal.wire.binding.AuthenticationBinding"
/>
+ <binding class="org.jbpm.pvm.internal.wire.binding.MailTemplateBinding"
/>
+ <binding
class="org.jbpm.pvm.internal.wire.binding.AddressResolverBinding"/>
<!-- hibernate bindings -->
<binding
class="org.jbpm.pvm.internal.wire.binding.HibernateConfigurationBinding" />
<binding
class="org.jbpm.pvm.internal.wire.binding.SeamHibernateSessionBinding" />
@@ -53,7 +55,6 @@
<binding
class="org.jbpm.pvm.internal.wire.binding.JbossIdmIdentitySessionBinding" />
<binding
class="org.jbpm.pvm.internal.wire.binding.RepositorySessionBinding" />
<binding class="org.jbpm.pvm.internal.wire.binding.MailSessionBinding"
/>
- <binding class="org.jbpm.pvm.internal.wire.binding.MailTemplateBinding"
/>
<!-- db sessions -->
<binding class="org.jbpm.pvm.internal.wire.binding.PvmDbSessionBinding"
/>
Modified:
jbpm4/branches/idm/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MailTemplateWireTest.java
===================================================================
---
jbpm4/branches/idm/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MailTemplateWireTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/pvm/src/test/java/org/jbpm/pvm/internal/wire/MailTemplateWireTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -25,6 +25,7 @@
import org.jbpm.pvm.internal.email.impl.AttachmentTemplate;
import org.jbpm.pvm.internal.email.impl.MailTemplate;
+import org.jbpm.pvm.internal.email.impl.MailTemplateRegistry;
/**
* @author Alejandro Guizar
@@ -40,8 +41,9 @@
+ "</mail-template>"
+ "</objects>");
- Object template = wireContext.get("memo");
- assertTrue(template instanceof MailTemplate);
+ MailTemplateRegistry templateRegistry = wireContext.get(MailTemplateRegistry.class);
+ assertNotNull(templateRegistry);
+ assertNotNull(templateRegistry.getTemplate("memo"));
}
public void testLanguage() {
@@ -53,7 +55,7 @@
+ "</mail-template>"
+ "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
+ MailTemplate template =
wireContext.get(MailTemplateRegistry.class).getTemplate("memo");
assertEquals("juel", template.getLanguage());
}
@@ -67,7 +69,7 @@
+ "</mail-template>"
+ "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
+ MailTemplate template =
wireContext.get(MailTemplateRegistry.class).getTemplate("memo");
assertEquals("wacko(a)jbpm.org", template.getFrom().getAddresses());
}
@@ -80,7 +82,7 @@
+ "</mail-template>"
+ "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
+ MailTemplate template =
wireContext.get(MailTemplateRegistry.class).getTemplate("memo");
assertEquals("dilbert@office, alice@work, dogbert@house",
template.getTo().getAddresses());
}
@@ -94,7 +96,7 @@
+ "</mail-template>"
+ "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
+ MailTemplate template =
wireContext.get(MailTemplateRegistry.class).getTemplate("memo");
assertEquals("theboss, hrpolicymaker", template.getCc().getUsers());
}
@@ -108,7 +110,7 @@
+ "</mail-template>"
+ "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
+ MailTemplate template =
wireContext.get(MailTemplateRegistry.class).getTemplate("memo");
assertEquals("thoughtpolice", template.getBcc().getGroups());
}
@@ -121,7 +123,7 @@
+ "</mail-template>"
+ "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
+ MailTemplate template =
wireContext.get(MailTemplateRegistry.class).getTemplate("memo");
assertEquals("bureaucracy", template.getSubject());
}
@@ -135,7 +137,7 @@
+ "</mail-template>"
+ "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
+ MailTemplate template =
wireContext.get(MailTemplateRegistry.class).getTemplate("memo");
assertEquals("plain text content", template.getText());
}
@@ -149,7 +151,7 @@
+ "</mail-template>"
+ "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
+ MailTemplate template =
wireContext.get(MailTemplateRegistry.class).getTemplate("memo");
assertEquals("<strong>rich</strong> content",
template.getHtml());
}
@@ -167,7 +169,7 @@
+ "</mail-template>"
+ "</objects>");
- MailTemplate template = wireContext.get(MailTemplate.class);
+ MailTemplate template =
wireContext.get(MailTemplateRegistry.class).getTemplate("memo");
List<AttachmentTemplate> attachmentTemplates =
template.getAttachmentTemplates();
assertEquals(3, attachmentTemplates.size());
// url
Modified: jbpm4/branches/idm/modules/test-db/pom.xml
===================================================================
--- jbpm4/branches/idm/modules/test-db/pom.xml 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/modules/test-db/pom.xml 2009-05-19 07:26:59 UTC (rev 4839)
@@ -72,12 +72,24 @@
</goals>
<configuration>
<tasks>
- <copy todir="target/test-classes"
overwrite="true" failonerror="false">
- <fileset dir="../../qa/db/${database}" />
+ <copy file="../../qa/jdbc/${database}.properties"
+ tofile="target/jdbc.properties" />
+ <copy
file="${user.home}/.jbpm4/jdbc/${database}.properties"
+ tofile="target/jdbc.properties"
+ overwrite="true"
+ failonerror="true "/>
+ <copy
file="../../modules/distro/src/main/files/db/hibernate.cfg/${database}.hibernate.cfg.xml"
+ tofile="target/test-classes/jbpm.hibernate.cfg.xml"
+ overwrite="true">
+ <filterset>
+ <filtersfile file="target/jdbc.properties" />
+ </filterset>
</copy>
- <copy todir="target/test-classes"
overwrite="true" failonerror="false">
- <fileset dir="${user.home}/.jbpm4/qa/db/${database}"
/>
- </copy>
+ <replace
file="target/test-classes/jbpm.hibernate.cfg.xml">
+ <replacetoken><![CDATA[<property
name="hibernate.format_sql">true</property>]]></replacetoken>
+ <replacevalue><![CDATA[<property
name="hibernate.format_sql">true</property>
+ <property
name="hibernate.hbm2ddl.auto">create-drop</property>]]></replacevalue>
+ </replace>
</tasks>
</configuration>
</execution>
Copied:
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/activities/GroupBasicsTest.java
(from rev 4838,
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/GroupBasicsTest.java)
===================================================================
---
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/activities/GroupBasicsTest.java
(rev 0)
+++
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/activities/GroupBasicsTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,249 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.test.activities;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GroupBasicsTest extends JbpmTestCase {
+
+ public void testSimplestGroup() {
+ deployJpdlXmlString(
+ "<process name='Group'>" +
+ " <start>" +
+ " <transition to='group' />" +
+ " </start>" +
+ " <group name='group'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a'>" +
+ " <transition to='done' />" +
+ " </state>" +
+ " <end name='done' />" +
+ " <transition to='end' />" +
+ " </group>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("Group");
+ assertEquals("a", processInstance.getActivityName());
+
+ processInstance = executionService.signalExecutionById(processInstance.getId());
+ assertTrue(processInstance.isEnded());
+ }
+
+ public void testGroupWithoutStartActivity() {
+ deployJpdlXmlString(
+ "<process name='Group'>" +
+ " <start>" +
+ " <transition to='group' />" +
+ " </start>" +
+ " <group name='group'>" +
+ " <state name='a'>" +
+ " <transition to='done' />" +
+ " </state>" +
+ " <end name='done' />" +
+ " <transition to='end' />" +
+ " </group>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("Group");
+ assertEquals("a", processInstance.getActivityName());
+
+ processInstance = executionService.signalExecutionById(processInstance.getId());
+ assertTrue(processInstance.isEnded());
+ }
+
+ public void testGroupMultipleEntryStartActivities() {
+ deployJpdlXmlString(
+ "<process name='Group'>" +
+ " <start>" +
+ " <transition to='choose' />" +
+ " </start>" +
+ " <decision name='choose' expr='#{theWayToGo}'>"
+
+ " <transition name='left' to='left' />" +
+ " <transition name='right' to='right' />" +
+ " </decision>" +
+ " <group name='group'>" +
+ " <start name='left'>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <start name='right'>" +
+ " <transition to='b' />" +
+ " </start>" +
+ " <state name='a'>" +
+ " <transition to='done' />" +
+ " </state>" +
+ " <state name='b'>" +
+ " <transition to='done' />" +
+ " </state>" +
+ " <end name='done' />" +
+ " <transition to='end' />" +
+ " </group>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ Map<String, Object> variables = new HashMap<String, Object>();
+ variables.put("theWayToGo", "left");
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("Group", variables);
+ assertEquals("a", processInstance.getActivityName());
+
+ processInstance = executionService.signalExecutionById(processInstance.getId());
+ assertTrue(processInstance.isEnded());
+
+ variables.put("theWayToGo", "right");
+ processInstance = executionService.startProcessInstanceByKey("Group",
variables);
+ assertEquals("b", processInstance.getActivityName());
+
+ processInstance = executionService.signalExecutionById(processInstance.getId());
+ assertTrue(processInstance.isEnded());
+ }
+
+ public void testGroupDirectEntryTransition() {
+ deployJpdlXmlString(
+ "<process name='Group'>" +
+ " <start>" +
+ " <transition to='direct' />" +
+ " </start>" +
+ " <group name='group'>" +
+ " <start name='direct'>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a'>" +
+ " <transition to='done' />" +
+ " </state>" +
+ " <end name='done' />" +
+ " <transition to='end' />" +
+ " </group>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("Group");
+ assertEquals("a", processInstance.getActivityName());
+
+ processInstance = executionService.signalExecutionById(processInstance.getId());
+ assertTrue(processInstance.isEnded());
+ }
+
+ public void testGroupWithoutEndActivity() {
+ deployJpdlXmlString(
+ "<process name='Group'>" +
+ " <start>" +
+ " <transition to='group' />" +
+ " </start>" +
+ " <group name='group'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' />" +
+ " <transition to='end' />" +
+ " </group>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("Group");
+ assertEquals("a", processInstance.getActivityName());
+
+ processInstance = executionService.signalExecutionById(processInstance.getId());
+ assertTrue(processInstance.isEnded());
+ }
+
+ public void testGroupMultipleExitEndActivities() {
+ deployJpdlXmlString(
+ "<process name='Group'>" +
+ " <start>" +
+ " <transition to='group' />" +
+ " </start>" +
+ " <group name='group'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a'>" +
+ " <transition name='a' to='exitA' />" +
+ " <transition name='b' to='exitB' />" +
+ " </state>" +
+ " <end name='exitA'>" +
+ " <transition to='endA' />" +
+ " </end>" +
+ " <end name='exitB'>" +
+ " <transition to='endB' />" +
+ " </end>" +
+ " </group>" +
+ " <end name='endA' />" +
+ " <end name='endB' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("Group");
+ assertEquals("a", processInstance.getActivityName());
+
+ processInstance = executionService.signalExecutionById(processInstance.getId(),
"a");
+ assertTrue(processInstance.isEnded());
+ assertEquals("endA", processInstance.getActivityName());
+
+ processInstance = executionService.startProcessInstanceByKey("Group");
+ assertEquals("a", processInstance.getActivityName());
+
+ processInstance = executionService.signalExecutionById(processInstance.getId(),
"b");
+ assertTrue(processInstance.isEnded());
+ assertEquals("endB", processInstance.getActivityName());
+ }
+
+ public void testGroupDirectExitTransition() {
+ deployJpdlXmlString(
+ "<process name='Group'>" +
+ " <start>" +
+ " <transition to='group' />" +
+ " </start>" +
+ " <group name='group'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a'>" +
+ " <transition to='end' />" +
+ " </state>" +
+ " </group>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("Group");
+ assertEquals("a", processInstance.getActivityName());
+
+ processInstance = executionService.signalExecutionById(processInstance.getId());
+ assertTrue(processInstance.isEnded());
+ }
+}
Copied:
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/activities/GroupTimersTest.java
(from rev 4838,
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/activities/GroupTimersTest.java)
===================================================================
---
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/activities/GroupTimersTest.java
(rev 0)
+++
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/activities/GroupTimersTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,99 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.test.activities;
+
+import java.util.List;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+import org.jbpm.api.job.Timer;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class GroupTimersTest extends JbpmTestCase {
+
+ public void testGroupWithTimer() {
+ deployJpdlXmlString(
+ "<process name='Group'>" +
+ " <start>" +
+ " <transition to='group' />" +
+ " </start>" +
+ " <group name='group'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a'>" +
+ " <transition to='done' />" +
+ " </state>" +
+ " <end name='done' />" +
+ " <transition to='end' />" +
+ " <transition name='timeout' to='escalate'>" +
+ " <timer duedate='2 hours' />" +
+ " </transition>" +
+ " </group>" +
+ " <state name='end' />" +
+ " <state name='escalate' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("Group");
+
+ assertEquals(Execution.STATE_INACTIVE_SCOPE, processInstance.getState());
+ assertEquals("group", processInstance.getActivityName());
+ assertEquals(1, processInstance.getExecutions().size());
+ Execution groupExecution = processInstance.getExecutions().iterator().next();
+ assertEquals(Execution.STATE_ACTIVE_ROOT, groupExecution.getState());
+ assertEquals("a", groupExecution.getActivityName());
+
+ processInstance = executionService.signalExecutionById(groupExecution.getId());
+
+ assertEquals(Execution.STATE_ACTIVE_ROOT, processInstance.getState());
+ assertEquals("end", processInstance.getActivityName());
+ assertEquals(0, processInstance.getExecutions().size());
+
+
+ processInstance = executionService.startProcessInstanceByKey("Group");
+
+ List<Job> jobs = managementService
+ .createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .list();
+
+ assertEquals(1, jobs.size());
+
+ Timer timer = (Timer) jobs.get(0);
+ assertEquals("timeout", timer.getSignalName());
+
+ managementService.executeJob(timer.getDbid());
+
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+
+ assertEquals(Execution.STATE_ACTIVE_ROOT, processInstance.getState());
+ assertEquals("escalate", processInstance.getActivityName());
+ assertEquals(0, processInstance.getExecutions().size());
+ }
+
+}
Copied: jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/async (from rev
4838, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async)
Deleted:
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,184 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.test.async;
-
-import java.util.List;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.ProcessInstance;
-import org.jbpm.api.job.Job;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class AsyncBasicsTest extends JbpmTestCase {
-
- static boolean doneSomething;
-
- protected void setUp() throws Exception {
- super.setUp();
-
- doneSomething = false;
- }
-
-
- public static class Do {
- public void something() {
- doneSomething = true;
- }
- }
-
- public void testAsyncWaitStatesSequence() {
- deployJpdlXmlString(
- "<process name='TwoAsyncStates'>" +
- " <start>" +
- " <transition to='a' />" +
- " </start>" +
- " <java name='a' async='true'
class='"+Do.class.getName()+"' method='something'>" +
- " <transition to='b' />" +
- " </java>" +
- " <java name='b' async='true'
class='"+Do.class.getName()+"' method='something'>" +
- " <transition to='end' />" +
- " </java>" +
- " <end name='end' />" +
- "</process>"
- );
-
- ProcessInstance processInstance =
executionService.startProcessInstanceByKey("TwoAsyncStates");
- assertEquals("a", processInstance.getActivityName());
- assertEquals(Execution.STATE_ASYNC, processInstance.getState());
-
- assertFalse(doneSomething);
-
- List<Job> jobs = managementService
- .createJobQuery()
- .processInstanceId(processInstance.getId())
- .list();
-
- assertEquals(1, jobs.size());
-
- Job job = jobs.get(0);
-
- managementService.executeJob(job.getDbid());
-
- assertTrue(doneSomething);
- doneSomething = false;
-
- processInstance = executionService.findProcessInstanceById(processInstance.getId());
- assertEquals("b", processInstance.getActivityName());
- assertEquals(Execution.STATE_ASYNC, processInstance.getState());
-
- jobs = managementService
- .createJobQuery()
- .processInstanceId(processInstance.getId())
- .list();
-
- assertEquals(1, jobs.size());
-
- job = jobs.get(0);
-
- managementService.executeJob(job.getDbid());
-
- assertTrue(doneSomething);
- processInstance = executionService.findProcessInstanceById(processInstance.getId());
- assertNull(processInstance);
- }
-
- public void testAsyncTransitions() {
- deployJpdlXmlString(
- "<process name='TwoAsyncStates'>" +
- " <start>" +
- " <transition to='a' />" +
- " </start>" +
- " <java name='a' class='"+Do.class.getName()+"'
method='something'>" +
- " <transition async='true' to='b' />" +
- " </java>" +
- " <java name='b' class='"+Do.class.getName()+"'
method='something'>" +
- " <transition async='true' to='end' />" +
- " </java>" +
- " <end name='end' />" +
- "</process>"
- );
-
- ProcessInstance processInstance =
executionService.startProcessInstanceByKey("TwoAsyncStates");
- assertEquals(Execution.STATE_ASYNC, processInstance.getState());
-
- assertTrue(doneSomething);
- doneSomething = false;
-
- List<Job> jobs = managementService
- .createJobQuery()
- .processInstanceId(processInstance.getId())
- .list();
-
- assertEquals(1, jobs.size());
-
- Job job = jobs.get(0);
-
- managementService.executeJob(job.getDbid());
-
- assertTrue(doneSomething);
-
- processInstance = executionService.findProcessInstanceById(processInstance.getId());
- assertEquals(Execution.STATE_ASYNC, processInstance.getState());
-
- jobs = managementService
- .createJobQuery()
- .processInstanceId(processInstance.getId())
- .list();
-
- assertEquals(1, jobs.size());
-
- job = jobs.get(0);
-
- managementService.executeJob(job.getDbid());
-
- processInstance = executionService.findProcessInstanceById(processInstance.getId());
- assertNull(processInstance);
- }
-
-
- public void testExecutionBlockedDuringAsync() {
- deployJpdlXmlString(
- "<process name='AsyncState'>" +
- " <start>" +
- " <transition to='a' />" +
- " </start>" +
- " <state name='a' async='true'>" +
- " <transition to='end' />" +
- " </state>" +
- " <end name='end' />" +
- "</process>"
- );
-
- ProcessInstance processInstance =
executionService.startProcessInstanceByKey("AsyncState");
-
- try {
- executionService.signalExecutionById(processInstance.getId());
- fail("expected exception");
- } catch (Exception e) {
- assertTextPresent("process-instance is not active: async",
e.getMessage());
- }
- }
-}
Copied:
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java
(from rev 4838,
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java)
===================================================================
---
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java
(rev 0)
+++
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/async/AsyncBasicsTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,184 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.test.async;
+
+import java.util.List;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.job.Job;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class AsyncBasicsTest extends JbpmTestCase {
+
+ static boolean doneSomething;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ doneSomething = false;
+ }
+
+
+ public static class Do {
+ public void something() {
+ doneSomething = true;
+ }
+ }
+
+ public void testAsyncWaitStatesSequence() {
+ deployJpdlXmlString(
+ "<process name='TwoAsyncStates'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <java name='a' async='true'
class='"+Do.class.getName()+"' method='something'>" +
+ " <transition to='b' />" +
+ " </java>" +
+ " <java name='b' async='true'
class='"+Do.class.getName()+"' method='something'>" +
+ " <transition to='end' />" +
+ " </java>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("TwoAsyncStates");
+ assertEquals("a", processInstance.getActivityName());
+ assertEquals(Execution.STATE_ASYNC, processInstance.getState());
+
+ assertFalse(doneSomething);
+
+ List<Job> jobs = managementService
+ .createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .list();
+
+ assertEquals(1, jobs.size());
+
+ Job job = jobs.get(0);
+
+ managementService.executeJob(job.getDbid());
+
+ assertTrue(doneSomething);
+ doneSomething = false;
+
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertEquals("b", processInstance.getActivityName());
+ assertEquals(Execution.STATE_ASYNC, processInstance.getState());
+
+ jobs = managementService
+ .createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .list();
+
+ assertEquals(1, jobs.size());
+
+ job = jobs.get(0);
+
+ managementService.executeJob(job.getDbid());
+
+ assertTrue(doneSomething);
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNull(processInstance);
+ }
+
+ public void testAsyncTransitions() {
+ deployJpdlXmlString(
+ "<process name='TwoAsyncStates'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <java name='a' class='"+Do.class.getName()+"'
method='something'>" +
+ " <transition async='true' to='b' />" +
+ " </java>" +
+ " <java name='b' class='"+Do.class.getName()+"'
method='something'>" +
+ " <transition async='true' to='end' />" +
+ " </java>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("TwoAsyncStates");
+ assertEquals(Execution.STATE_ASYNC, processInstance.getState());
+
+ assertTrue(doneSomething);
+ doneSomething = false;
+
+ List<Job> jobs = managementService
+ .createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .list();
+
+ assertEquals(1, jobs.size());
+
+ Job job = jobs.get(0);
+
+ managementService.executeJob(job.getDbid());
+
+ assertTrue(doneSomething);
+
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertEquals(Execution.STATE_ASYNC, processInstance.getState());
+
+ jobs = managementService
+ .createJobQuery()
+ .processInstanceId(processInstance.getId())
+ .list();
+
+ assertEquals(1, jobs.size());
+
+ job = jobs.get(0);
+
+ managementService.executeJob(job.getDbid());
+
+ processInstance = executionService.findProcessInstanceById(processInstance.getId());
+ assertNull(processInstance);
+ }
+
+
+ public void testExecutionBlockedDuringAsync() {
+ deployJpdlXmlString(
+ "<process name='AsyncState'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a' async='true'>" +
+ " <transition to='end' />" +
+ " </state>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("AsyncState");
+
+ try {
+ executionService.signalExecutionById(processInstance.getId());
+ fail("expected exception");
+ } catch (Exception e) {
+ assertTextPresent("process-instance is not active: async",
e.getMessage());
+ }
+ }
+}
Copied: jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/deploy (from rev
4838, jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy)
Deleted:
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/deploy/SuspendDeploymentTest.java
===================================================================
---
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/SuspendDeploymentTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/deploy/SuspendDeploymentTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,152 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.test.deploy;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.ProcessDefinition;
-import org.jbpm.test.JbpmTestCase;
-
-
-/**
- * @author Tom Baeyens
- */
-public class SuspendDeploymentTest extends JbpmTestCase {
-
- public void testSuspendDeployment() {
- deployJpdlXmlString(
- "<process name='claim'>" +
- " <start>" +
- " <transition to='c' />" +
- " </start>" +
- " <state name='c' />" +
- "</process>"
- );
-
- long deploymentHireDbid = deployJpdlXmlString(
- "<process name='hire'>" +
- " <start>" +
- " <transition to='h' />" +
- " </start>" +
- " <state name='h' />" +
- "</process>"
- );
-
- deployJpdlXmlString(
- "<process name='fire'>" +
- " <start>" +
- " <transition to='f' />" +
- " </start>" +
- " <state name='f' />" +
- "</process>"
- );
-
- Set<String> expectedProcessNames = new HashSet<String>();
- expectedProcessNames.add("claim");
- expectedProcessNames.add("hire");
- expectedProcessNames.add("fire");
-
- List<ProcessDefinition> processDefinitions = repositoryService
- .createProcessDefinitionQuery()
- .list();
-
- assertEquals(expectedProcessNames, getProcessDefinitionNames(processDefinitions));
-
- executionService.startProcessInstanceByKey("claim");
- executionService.startProcessInstanceByKey("claim");
-
- executionService.startProcessInstanceByKey("hire");
- executionService.startProcessInstanceByKey("hire");
-
- executionService.startProcessInstanceByKey("fire");
- executionService.startProcessInstanceByKey("fire");
-
- List<Execution> processInstances = executionService
- .createProcessInstanceQuery()
- .list();
-
- assertEquals(2, countProcessInstancesFor(processInstances, "claim"));
- assertEquals(2, countProcessInstancesFor(processInstances, "hire"));
- assertEquals(2, countProcessInstancesFor(processInstances, "fire"));
- assertEquals(6, processInstances.size());
-
-
- repositoryService.suspendDeployment(deploymentHireDbid);
-
-
- expectedProcessNames.remove("hire");
-
- processDefinitions = repositoryService
- .createProcessDefinitionQuery()
- .list();
-
- assertEquals(expectedProcessNames, getProcessDefinitionNames(processDefinitions));
-
- processInstances = executionService
- .createProcessInstanceQuery()
- .list();
-
- assertEquals(2, countProcessInstancesFor(processInstances, "claim"));
- assertEquals(2, countProcessInstancesFor(processInstances, "fire"));
- assertEquals(4, processInstances.size());
-
- repositoryService.resumeDeployment(deploymentHireDbid);
-
- expectedProcessNames.add("hire");
-
- processDefinitions = repositoryService
- .createProcessDefinitionQuery()
- .list();
-
- assertEquals(expectedProcessNames, getProcessDefinitionNames(processDefinitions));
-
- processInstances = executionService
- .createProcessInstanceQuery()
- .list();
-
- assertEquals(2, countProcessInstancesFor(processInstances, "claim"));
- assertEquals(2, countProcessInstancesFor(processInstances, "hire"));
- assertEquals(2, countProcessInstancesFor(processInstances, "fire"));
- assertEquals(6, processInstances.size());
- }
-
- int countProcessInstancesFor(List<Execution> processInstances, String
processDefinitionKey) {
- int count = 0;
- for (Execution processInstance: processInstances) {
- if (processInstance.getProcessDefinitionId().startsWith(processDefinitionKey)) {
- count++;
- }
- }
- return count;
- }
-
- Object getProcessDefinitionNames(List<ProcessDefinition> processDefinitions) {
- Set<String> processNames = new HashSet<String>();
- for (ProcessDefinition processDefinition: processDefinitions) {
- processNames.add(processDefinition.getName());
- }
- return processNames;
- }
-}
Copied:
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/deploy/SuspendDeploymentTest.java
(from rev 4838,
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/deploy/SuspendDeploymentTest.java)
===================================================================
---
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/deploy/SuspendDeploymentTest.java
(rev 0)
+++
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/deploy/SuspendDeploymentTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,152 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.test.deploy;
+
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.ProcessDefinition;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class SuspendDeploymentTest extends JbpmTestCase {
+
+ public void testSuspendDeployment() {
+ deployJpdlXmlString(
+ "<process name='claim'>" +
+ " <start>" +
+ " <transition to='c' />" +
+ " </start>" +
+ " <state name='c' />" +
+ "</process>"
+ );
+
+ long deploymentHireDbid = deployJpdlXmlString(
+ "<process name='hire'>" +
+ " <start>" +
+ " <transition to='h' />" +
+ " </start>" +
+ " <state name='h' />" +
+ "</process>"
+ );
+
+ deployJpdlXmlString(
+ "<process name='fire'>" +
+ " <start>" +
+ " <transition to='f' />" +
+ " </start>" +
+ " <state name='f' />" +
+ "</process>"
+ );
+
+ Set<String> expectedProcessNames = new HashSet<String>();
+ expectedProcessNames.add("claim");
+ expectedProcessNames.add("hire");
+ expectedProcessNames.add("fire");
+
+ List<ProcessDefinition> processDefinitions = repositoryService
+ .createProcessDefinitionQuery()
+ .list();
+
+ assertEquals(expectedProcessNames, getProcessDefinitionNames(processDefinitions));
+
+ executionService.startProcessInstanceByKey("claim");
+ executionService.startProcessInstanceByKey("claim");
+
+ executionService.startProcessInstanceByKey("hire");
+ executionService.startProcessInstanceByKey("hire");
+
+ executionService.startProcessInstanceByKey("fire");
+ executionService.startProcessInstanceByKey("fire");
+
+ List<Execution> processInstances = executionService
+ .createProcessInstanceQuery()
+ .list();
+
+ assertEquals(2, countProcessInstancesFor(processInstances, "claim"));
+ assertEquals(2, countProcessInstancesFor(processInstances, "hire"));
+ assertEquals(2, countProcessInstancesFor(processInstances, "fire"));
+ assertEquals(6, processInstances.size());
+
+
+ repositoryService.suspendDeployment(deploymentHireDbid);
+
+
+ expectedProcessNames.remove("hire");
+
+ processDefinitions = repositoryService
+ .createProcessDefinitionQuery()
+ .list();
+
+ assertEquals(expectedProcessNames, getProcessDefinitionNames(processDefinitions));
+
+ processInstances = executionService
+ .createProcessInstanceQuery()
+ .list();
+
+ assertEquals(2, countProcessInstancesFor(processInstances, "claim"));
+ assertEquals(2, countProcessInstancesFor(processInstances, "fire"));
+ assertEquals(4, processInstances.size());
+
+ repositoryService.resumeDeployment(deploymentHireDbid);
+
+ expectedProcessNames.add("hire");
+
+ processDefinitions = repositoryService
+ .createProcessDefinitionQuery()
+ .list();
+
+ assertEquals(expectedProcessNames, getProcessDefinitionNames(processDefinitions));
+
+ processInstances = executionService
+ .createProcessInstanceQuery()
+ .list();
+
+ assertEquals(2, countProcessInstancesFor(processInstances, "claim"));
+ assertEquals(2, countProcessInstancesFor(processInstances, "hire"));
+ assertEquals(2, countProcessInstancesFor(processInstances, "fire"));
+ assertEquals(6, processInstances.size());
+ }
+
+ int countProcessInstancesFor(List<Execution> processInstances, String
processDefinitionKey) {
+ int count = 0;
+ for (Execution processInstance: processInstances) {
+ if (processInstance.getProcessDefinitionId().startsWith(processDefinitionKey)) {
+ count++;
+ }
+ }
+ return count;
+ }
+
+ Object getProcessDefinitionNames(List<ProcessDefinition> processDefinitions) {
+ Set<String> processNames = new HashSet<String>();
+ for (ProcessDefinition processDefinition: processDefinitions) {
+ processNames.add(processDefinition.getName());
+ }
+ return processNames;
+ }
+}
Modified:
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java
===================================================================
---
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/eventlistener/EventListenerTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -144,7 +144,7 @@
" </start>" +
" <state name='s'>" +
" <on event='end'>" +
- " <event-listener
class='"+ActivityStartListener.class.getName()+"' />" +
+ " <event-listener
class='"+ActivityEndListener.class.getName()+"' />" +
" </on>" +
" <transition to='end' />" +
" </state>" +
Modified:
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/EndProcessInstanceTest.java
===================================================================
---
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/EndProcessInstanceTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/EndProcessInstanceTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -48,7 +48,7 @@
Execution execution = executionService.startProcessInstanceByKey("ICL");
String processInstanceId = execution.getId();
- executionService.endProcessInstance(processInstanceId, Execution.STATE_CANCELLED);
+ executionService.endProcessInstance(processInstanceId, "cancel");
List<Execution> executions = executionService.createProcessInstanceQuery()
.processInstanceId(processInstanceId)
@@ -59,7 +59,8 @@
.processInstanceId(processInstanceId)
.uniqueResult();
+ assertNotNull(historyProcessInstance.getStartTime());
assertNotNull(historyProcessInstance.getEndTime());
- assertEquals(Execution.STATE_CANCELLED, historyProcessInstance.getState());
+ assertEquals("cancel", historyProcessInstance.getState());
}
}
Copied:
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/HistoryActivityInstanceQeuryTest.java
(from rev 4838,
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/HistoryActivityInstanceQeuryTest.java)
===================================================================
---
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/HistoryActivityInstanceQeuryTest.java
(rev 0)
+++
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/HistoryActivityInstanceQeuryTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,87 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.test.history;
+
+import java.util.List;
+
+import org.jbpm.api.ProcessInstance;
+import org.jbpm.api.history.HistoryActivityInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryActivityInstanceQeuryTest extends JbpmTestCase {
+
+ public void testSimpleQuery() {
+ deployJpdlXmlString(
+ "<process name='abc'>" +
+ " <start>" +
+ " <transition to='a' />" +
+ " </start>" +
+ " <state name='a'>" +
+ " <transition to ='b' />" +
+ " </state>" +
+ " <state name='b'>" +
+ " <transition to ='c' />" +
+ " </state>" +
+ " <state name='c'>" +
+ " <transition to ='end' />" +
+ " </state>" +
+ " <end name='end' />" +
+ "</process>"
+ );
+
+ ProcessInstance processInstance =
executionService.startProcessInstanceByKey("abc");
+ executionService.signalExecutionById(processInstance.getId());
+ executionService.signalExecutionById(processInstance.getId());
+ executionService.signalExecutionById(processInstance.getId());
+
+ processInstance = executionService.startProcessInstanceByKey("abc");
+ executionService.signalExecutionById(processInstance.getId());
+ executionService.signalExecutionById(processInstance.getId());
+
+ processInstance = executionService.startProcessInstanceByKey("abc");
+ executionService.signalExecutionById(processInstance.getId());
+
+ executionService.startProcessInstanceByKey("abc");
+
+ List<HistoryActivityInstance> histActInsts =
historyService.createHistoryActivityInstanceQuery()
+ .activityName("a")
+ .list();
+
+ assertEquals(4, histActInsts.size());
+
+ histActInsts = historyService.createHistoryActivityInstanceQuery()
+ .activityName("b")
+ .list();
+
+ assertEquals(3, histActInsts.size());
+
+ histActInsts = historyService.createHistoryActivityInstanceQuery()
+ .activityName("c")
+ .list();
+
+ assertEquals(2, histActInsts.size());
+ }
+}
Copied:
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/HistoryTaskAssigneeTest.java
(from rev 4838,
jbpm4/trunk/modules/test-db/src/test/java/org/jbpm/test/history/HistoryTaskAssigneeTest.java)
===================================================================
---
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/HistoryTaskAssigneeTest.java
(rev 0)
+++
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/HistoryTaskAssigneeTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
+ */
+package org.jbpm.test.history;
+
+import org.jbpm.api.Execution;
+import org.jbpm.api.history.HistoryActivityInstance;
+import org.jbpm.test.JbpmTestCase;
+
+
+/**
+ * @author Tom Baeyens
+ */
+public class HistoryTaskAssigneeTest extends JbpmTestCase {
+
+ public void testHistoryTaskAssignee() {
+ deployJpdlXmlString(
+ "<process name='TaskAssignee'>" +
+ " <start>" +
+ " <transition to='review' />" +
+ " </start>" +
+ " <task name='review' " +
+ " assignee='johndoe'>" +
+ " <transition to='wait' />" +
+ " </task>" +
+ " <state name='wait'/>" +
+ "</process>"
+ );
+
+ executionService.startProcessInstanceByKey("TaskAssignee");
+
+ HistoryActivityInstance historyActivityInstance = historyService
+ .createHistoryActivityInstanceQuery()
+ .uniqueResult();
+
+ }
+
+}
Modified:
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/ProcessInstanceHistoryTest.java
===================================================================
---
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/ProcessInstanceHistoryTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/history/ProcessInstanceHistoryTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -61,6 +61,7 @@
assertEquals(HistoryProcessInstance.STATE_ENDED,
historyProcessInstance.getState());
assertNotNull(historyProcessInstance.getStartTime());
assertNotNull(historyProcessInstance.getEndTime());
+ assertTrue(historyProcessInstance.getDuration()>=0);
}
// also check that the ended process instances have been removed from the
Modified:
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/identity/IdentityTest.java
===================================================================
---
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/identity/IdentityTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/test-db/src/test/java/org/jbpm/test/identity/IdentityTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -23,22 +23,18 @@
import java.util.List;
-import org.jbpm.api.IdentityService;
import org.jbpm.api.identity.Group;
import org.jbpm.api.identity.User;
import org.jbpm.test.JbpmTestCase;
-
/**
* @author Tom Baeyens
*/
public class IdentityTest extends JbpmTestCase {
public void testSingleUser() throws Exception {
- IdentityService identityService = processEngine.get(IdentityService.class);
+ identityService.createUser("johndoe", "John", "Doe");
- identityService.createUser("johndoe", "johndoe",
"John", "Doe");
-
List<User> users = identityService.findUsers();
assertNotNull(users);
assertEquals(1, users.size());
@@ -55,12 +51,10 @@
}
public void testSingleGroup() throws Exception {
- IdentityService identityService = processEngine.get(IdentityService.class);
+ identityService.createUser("johndoe", "John", "Doe");
+ identityService.createUser("joesmoe", "Joe", "Smoe");
+ identityService.createUser("jackblack", "Jack",
"Black");
- identityService.createUser("johndoe", "johndoe",
"John", "Doe");
- identityService.createUser("joesmoe", "joesmoe", "Joe",
"Smoe");
- identityService.createUser("jackblack", "jackblack",
"Jack", "Black");
-
String redhatId = identityService.createGroup("redhat", Group.TYPE_UNIT,
null);
String jbossId = identityService.createGroup("jboss", Group.TYPE_UNIT,
"redhat");
String jbpmId = identityService.createGroup("jbpm", Group.TYPE_UNIT,
"jboss");
Deleted:
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/EventPropagationTest.java
===================================================================
---
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/EventPropagationTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/EventPropagationTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,405 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2005, JBoss Inc., and individual contributors as indicated
- * by the @authors tag. See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site:
http://www.fsf.org.
- */
-package org.jbpm.test.activities;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.activity.ExternalActivityBehaviour;
-import org.jbpm.api.client.ClientExecution;
-import org.jbpm.api.client.ClientProcessDefinition;
-import org.jbpm.api.listener.EventListener;
-import org.jbpm.api.listener.EventListenerExecution;
-import org.jbpm.api.model.Activity;
-import org.jbpm.api.model.Event;
-import org.jbpm.api.model.ObservableElement;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.test.BaseJbpmTestCase;
-
-/**
- * @author Tom Baeyens
- */
-public class EventPropagationTest extends BaseJbpmTestCase {
-
- public class Recorder implements EventListener {
- private static final long serialVersionUID = 1L;
- public List<Object> events = new ArrayList<Object>();
- public void notify(EventListenerExecution execution) {
- ObservableElement eventSource = execution.getEventSource();
- events.add(execution.getEvent()+" on "+eventSource);
- }
- }
-
- public static class FireableState implements ExternalActivityBehaviour {
- private static final long serialVersionUID = 1L;
- public void execute(ActivityExecution execution) {
- execution.waitForSignal();
- }
- public void signal(ActivityExecution execution, String signalName, Map<String,
Object> parameters) {
- execution.fire(signalName, execution.getActivity());
- }
- }
-
- public void testListenToActivityLeaveOnProcessForProcessActivities(){
- Recorder recorder = new Recorder();
-
- ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess("propagate")
- .startEvent(Event.END)
- .listener(recorder, true)
- .endEvent()
- .startActivity("initial", new WaitState())
- .initial()
- .transition("end")
- .endActivity()
- .startActivity("end", new WaitState())
- .endActivity()
- .endProcess();
-
- ClientExecution execution = processDefinition.startProcessInstance();
- execution.signal();
-
- assertEquals("event(end) on activity(initial)", recorder.events.get(0));
- assertEquals(1, recorder.events.size());
- }
-
- public void testListenToActivityEnterOnProcessForProcessActivities(){
- Recorder recorder = new Recorder();
-
- ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess("propagate")
- .startEvent(Event.START)
- .listener(recorder, true)
- .endEvent()
- .startActivity("initial", new WaitState())
- .initial()
- .transition("end")
- .endActivity()
- .startActivity("end", new WaitState())
- .endActivity()
- .endProcess();
-
- ClientExecution execution = processDefinition.startProcessInstance();
- execution.signal();
-
- assertEquals("event(start) on process(propagate)",
recorder.events.get(0));
- assertEquals("event(start) on activity(end)", recorder.events.get(1));
- assertEquals(2, recorder.events.size());
- }
-
- public void testListenToTransitionOnProcessForTransitionBetweenProcessActivities(){
- Recorder recorder = new Recorder();
-
- ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess("propagate")
- .startEvent(Event.TAKE)
- .listener(recorder, true)
- .endEvent()
- .startActivity("initial", new WaitState())
- .initial()
- .transition("end", "go")
- .endActivity()
- .startActivity("end", new WaitState())
- .endActivity()
- .endProcess();
-
- ClientExecution execution = processDefinition.startProcessInstance();
- execution.signal();
-
- assertEquals("event(take) on (initial)--go-->(end)",
recorder.events.get(0));
- assertEquals(1, recorder.events.size());
- }
-
- // propagation of process elements in composite activities ///////////////////////
-
- public static class Sequence implements ExternalActivityBehaviour {
- private static final long serialVersionUID = 1L;
- public void execute(ActivityExecution execution) {
- List<Activity> activities = execution.getActivity().getActivities();
- if ( (activities!=null)
- && (!activities.isEmpty())
- ) {
- execution.execute(activities.get(0));
- }
- }
- public void signal(ActivityExecution execution, String signal, Map<String,
Object> parameters) {
- Activity previous = execution.getPreviousActivity();
- List<Activity> activities = execution.getActivity().getActivities();
- int index = activities.indexOf(previous);
- index++;
- if (index < activities.size()) {
- Activity next = activities.get(index);
- execution.execute(next);
- }
- }
- }
-
-
- public void testListenToActivityLeaveOnProcessForSequenceChildActivities(){
- Recorder recorder = new Recorder();
-
- ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess("propagate")
- .startEvent(Event.END)
- .listener(recorder, true)
- .endEvent()
- .startActivity("sequence", new Sequence())
- .initial()
- .needsPrevious()
- .startActivity("one", new WaitState())
- .endActivity()
- .startActivity("two", new WaitState())
- .endActivity()
- .startActivity("three", new WaitState())
- .endActivity()
- .endActivity()
- .startActivity("end", new WaitState())
- .endActivity()
- .endProcess();
-
- ClientExecution execution = processDefinition.startProcessInstance();
- assertEquals(0, recorder.events.size());
- execution.signal();
- assertEquals("event(end) on activity(one)", recorder.events.get(0));
- assertEquals(1, recorder.events.size());
- execution.signal();
- assertEquals("event(end) on activity(two)", recorder.events.get(1));
- assertEquals(2, recorder.events.size());
- execution.signal();
- assertEquals("event(end) on activity(three)", recorder.events.get(2));
- assertEquals("event(end) on process(propagate)", recorder.events.get(3));
- assertEquals(recorder.events.toString(), 4, recorder.events.size());
- }
-
- public void
testListenToActivityLeaveOnProcessForTransitionBetweenSequenceChildActivities(){
- Recorder recorder = new Recorder();
-
- ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess("propagate")
- .startEvent(Event.END)
- .listener(recorder, true)
- .endEvent()
- .startActivity("sequence", new Sequence())
- .initial()
- .startActivity("one", new WaitState())
- .transition("two")
- .endActivity()
- .startActivity("two", new WaitState())
- .endActivity()
- .endActivity()
- .startActivity("end", new WaitState())
- .endActivity()
- .endProcess();
-
- ClientExecution execution = processDefinition.startProcessInstance();
-
- assertEquals(0, recorder.events.size());
- execution.signal();
- assertEquals("event(end) on activity(one)", recorder.events.get(0));
- assertEquals(1, recorder.events.size());
- execution.signal();
- assertEquals("event(end) on activity(two)", recorder.events.get(1));
- assertEquals(2, recorder.events.size());
- }
-
-
- public void testListenToActivityEnterOnProcessForSequenceChildActivities(){
- Recorder recorder = new Recorder();
-
- ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess("propagate")
- .startEvent(Event.START)
- .listener(recorder, true)
- .endEvent()
- .startActivity("sequence", new Sequence())
- .initial()
- .needsPrevious()
- .startActivity("one", new WaitState())
- .endActivity()
- .startActivity("two", new WaitState())
- .endActivity()
- .startActivity("three", new WaitState())
- .endActivity()
- .endActivity()
- .startActivity("end", new WaitState())
- .endActivity()
- .endProcess();
-
- ClientExecution execution = processDefinition.startProcessInstance();
-
- List<Object> expectedEvents = new ArrayList<Object>();
- expectedEvents.add("event(start) on process(propagate)");
- expectedEvents.add("event(start) on activity(one)");
- assertEquals(expectedEvents, recorder.events);
-
- execution.signal();
-
- expectedEvents.add("event(start) on activity(two)");
- assertEquals(expectedEvents, recorder.events);
-
- execution.signal();
-
- expectedEvents.add("event(start) on activity(three)");
- assertEquals(expectedEvents, recorder.events);
- }
-
- public void
testListenToTransitionTakeOnProcessForTransitionBetweenSequenceChildActivities(){
- Recorder recorder = new Recorder();
-
- ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess("propagate")
- .startEvent(Event.TAKE)
- .listener(recorder, true)
- .endEvent()
- .startActivity("sequence", new Sequence())
- .initial()
- .startActivity("one", new WaitState())
- .transition("two", "increment")
- .endActivity()
- .startActivity("two", new WaitState())
- .endActivity()
- .endActivity()
- .startActivity("end", new WaitState())
- .endActivity()
- .endProcess();
-
- ClientExecution execution = processDefinition.startProcessInstance();
-
- assertEquals(0, recorder.events.size());
- execution.signal();
- assertEquals("event(take) on (one)--increment-->(two)",
recorder.events.get(0));
- assertEquals(1, recorder.events.size());
- }
-
- public void testDeeplyNestedCustomEvent(){
- Recorder processRecorder = new Recorder();
- Recorder outerRecorder = new Recorder();
- Recorder middelRecorder = new Recorder();
- Recorder innerRecorder = new Recorder();
- Recorder nestedStateRecorder = new Recorder();
-
- ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess("propagate")
- .startEvent("hello")
- .listener(processRecorder, true)
- .endEvent()
- .startActivity("outer", new Sequence())
- .initial()
- .startEvent("hello")
- .listener(outerRecorder, true)
- .endEvent()
- .startActivity("middel", new Sequence())
- .startEvent("hello")
- .listener(middelRecorder, true)
- .endEvent()
- .startActivity("inner", new Sequence())
- .startEvent("hello")
- .listener(innerRecorder, true)
- .endEvent()
- .startActivity("nested state", new FireableState())
- .startEvent("hello")
- .listener(nestedStateRecorder, true)
- .endEvent()
- .endActivity()
- .endActivity()
- .endActivity()
- .endActivity()
- .endProcess();
-
- ClientExecution execution = processDefinition.startProcessInstance();
-
- assertEquals(0, processRecorder.events.size());
- execution.signal("hello");
-
- assertEquals("event(hello) on activity(nested state)",
processRecorder.events.get(0));
- assertEquals(1, processRecorder.events.size());
-
- assertEquals("event(hello) on activity(nested state)",
outerRecorder.events.get(0));
- assertEquals(1, outerRecorder.events.size());
-
- assertEquals("event(hello) on activity(nested state)",
middelRecorder.events.get(0));
- assertEquals(1, middelRecorder.events.size());
-
- assertEquals("event(hello) on activity(nested state)",
innerRecorder.events.get(0));
- assertEquals(1, innerRecorder.events.size());
-
- assertEquals("event(hello) on activity(nested state)",
nestedStateRecorder.events.get(0));
- assertEquals(1, nestedStateRecorder.events.size());
- }
-
- public void testPropagatedEventsDisabled(){
- Recorder processRecorder = new Recorder();
- Recorder outerRecorder = new Recorder();
- Recorder middleRecorder = new Recorder();
- Recorder innerRecorder = new Recorder();
- Recorder nestedStateRecorder = new Recorder();
-
- ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess("propagate")
- .startEvent("hello")
- .listener(processRecorder, true)
- .endEvent()
- .startActivity("outer", new Sequence())
- .initial()
- .startEvent("hello")
- .listener(outerRecorder, true)
- .endEvent()
- .startActivity("middle", new Sequence())
- .startEvent("hello")
- .listener(middleRecorder)
- .endEvent()
- .startActivity("inner", new Sequence())
- .startEvent("hello")
- .listener(innerRecorder, true)
- .endEvent()
- .startActivity("nested state", new FireableState())
- .startEvent("hello")
- .listener(nestedStateRecorder)
- .endEvent()
- .endActivity()
- .endActivity()
- .endActivity()
- .endActivity()
- .endProcess();
-
- ClientExecution execution = processDefinition.startProcessInstance();
-
- // the middle action should not be executed for an event that was propagated from the
nested state
- execution.signal("hello");
-
- assertEquals("event(hello) on activity(nested state)",
processRecorder.events.get(0));
- assertEquals(1, processRecorder.events.size());
-
- assertEquals("event(hello) on activity(nested state)",
outerRecorder.events.get(0));
- assertEquals(1, outerRecorder.events.size());
-
- assertEquals(0, middleRecorder.events.size());
-
- assertEquals("event(hello) on activity(nested state)",
innerRecorder.events.get(0));
- assertEquals(1, innerRecorder.events.size());
-
- assertEquals("event(hello) on activity(nested state)",
nestedStateRecorder.events.get(0));
- assertEquals(1, nestedStateRecorder.events.size());
- }
-}
Modified:
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/ExecutionStateTest.java
===================================================================
---
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/ExecutionStateTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/ExecutionStateTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -60,18 +60,18 @@
public static class AutomaticActivity implements ActivityBehaviour {
private static final long serialVersionUID = 1L;
public void execute(ActivityExecution execution) {
- assertEquals(Execution.STATE_ACTIVE, execution.getState());
+ assertEquals(Execution.STATE_ACTIVE_ROOT, execution.getState());
}
}
public static class WaitState implements ExternalActivityBehaviour {
private static final long serialVersionUID = 1L;
public void execute(ActivityExecution execution) {
- assertEquals(Execution.STATE_ACTIVE, execution.getState());
+ assertEquals(Execution.STATE_ACTIVE_ROOT, execution.getState());
execution.waitForSignal();
}
public void signal(ActivityExecution execution, String signalName, Map<String,
Object> parameters) {
- assertEquals(Execution.STATE_ACTIVE, execution.getState());
+ assertEquals(Execution.STATE_ACTIVE_ROOT, execution.getState());
execution.take(signalName);
}
}
@@ -95,7 +95,7 @@
processInstance.start();
- assertEquals(Execution.STATE_ACTIVE, processInstance.getState());
+ assertEquals(Execution.STATE_ACTIVE_ROOT, processInstance.getState());
processInstance.signal();
@@ -119,7 +119,7 @@
ClientProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
- assertEquals(Execution.STATE_INACTIVE, processInstance.getState());
+ assertEquals(Execution.STATE_INACTIVE_SCOPE, processInstance.getState());
try {
processInstance.signal();
@@ -176,39 +176,53 @@
processInstance.start();
try {
- processInstance.end("active");
+ processInstance.end(Execution.STATE_CREATED);
fail("expected exception");
} catch (JbpmException e) {
// OK
- assertTextPresent("invalid end state: active", e.getMessage());
+ assertTextPresent("invalid end state: "+Execution.STATE_CREATED,
e.getMessage());
}
try {
- processInstance.end("suspended");
+ processInstance.end(Execution.STATE_ACTIVE_ROOT);
fail("expected exception");
} catch (JbpmException e) {
// OK
- assertTextPresent("invalid end state: suspended", e.getMessage());
+ assertTextPresent("invalid end state: "+Execution.STATE_ACTIVE_ROOT,
e.getMessage());
}
try {
- processInstance.end("created");
+ processInstance.end(Execution.STATE_ACTIVE_CONCURRENT);
fail("expected exception");
} catch (JbpmException e) {
// OK
- assertTextPresent("invalid end state: created", e.getMessage());
+ assertTextPresent("invalid end state:
"+Execution.STATE_ACTIVE_CONCURRENT, e.getMessage());
}
try {
- processInstance.end("async");
+ processInstance.end(Execution.STATE_INACTIVE_CONCURRENT_ROOT);
fail("expected exception");
} catch (JbpmException e) {
// OK
- assertTextPresent("invalid end state: async", e.getMessage());
+ assertTextPresent("invalid end state:
"+Execution.STATE_INACTIVE_CONCURRENT_ROOT, e.getMessage());
}
try {
- processInstance.end("inactive");
+ processInstance.end(Execution.STATE_INACTIVE_SCOPE);
fail("expected exception");
} catch (JbpmException e) {
// OK
- assertTextPresent("invalid end state: inactive", e.getMessage());
+ assertTextPresent("invalid end state: "+Execution.STATE_INACTIVE_SCOPE,
e.getMessage());
}
+ try {
+ processInstance.end(Execution.STATE_SUSPENDED);
+ fail("expected exception");
+ } catch (JbpmException e) {
+ // OK
+ assertTextPresent("invalid end state: "+Execution.STATE_SUSPENDED,
e.getMessage());
+ }
+ try {
+ processInstance.end(Execution.STATE_ASYNC);
+ fail("expected exception");
+ } catch (JbpmException e) {
+ // OK
+ assertTextPresent("invalid end state: "+Execution.STATE_ASYNC,
e.getMessage());
+ }
}
}
Modified:
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeStateTest.java
===================================================================
---
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeStateTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeStateTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -41,18 +41,18 @@
public static class AutomaticActivity implements ActivityBehaviour {
private static final long serialVersionUID = 1L;
public void execute(ActivityExecution execution) {
- assertEquals(Execution.STATE_ACTIVE, execution.getState());
+ assertEquals(Execution.STATE_ACTIVE_ROOT, execution.getState());
}
}
public static class WaitState implements ExternalActivityBehaviour {
private static final long serialVersionUID = 1L;
public void execute(ActivityExecution execution) {
- assertEquals(Execution.STATE_ACTIVE, execution.getState());
+ assertEquals(Execution.STATE_ACTIVE_ROOT, execution.getState());
execution.waitForSignal();
}
public void signal(ActivityExecution execution, String signalName, Map<String,
Object> parameters) throws Exception {
- assertEquals(Execution.STATE_ACTIVE, execution.getState());
+ assertEquals(Execution.STATE_ACTIVE_ROOT, execution.getState());
execution.take(signalName);
}
}
@@ -79,12 +79,12 @@
processInstance.start();
Execution scopeExecution = processInstance.getExecutions().iterator().next();
- assertEquals(Execution.STATE_INACTIVE, processInstance.getState());
- assertEquals(Execution.STATE_ACTIVE, scopeExecution.getState());
+ assertEquals(Execution.STATE_INACTIVE_SCOPE, processInstance.getState());
+ assertEquals(Execution.STATE_ACTIVE_ROOT, scopeExecution.getState());
processInstance.signal(scopeExecution);
assertEquals(Execution.STATE_ENDED, scopeExecution.getState());
- assertEquals(Execution.STATE_ACTIVE, processInstance.getState());
+ assertEquals(Execution.STATE_ACTIVE_ROOT, processInstance.getState());
}
}
Modified:
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeVariableTest.java
===================================================================
---
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeVariableTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/ScopeVariableTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -199,14 +199,5 @@
bScope.createVariable("temp", "28C");
processInstance.signal(bScope);
-
- try {
- bScope.setVariable("temp", "21C");
- fail("expected exception");
- } catch (JbpmException e) {
- // OK
- assertTextPresent("can't update variable 'temp' on
execution[b]", e.getMessage());
- }
}
-
}
Deleted:
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionBasedConcurrencyTest.java
===================================================================
---
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionBasedConcurrencyTest.java 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/test-pojo/src/main/java/org/jbpm/test/activities/TransitionBasedConcurrencyTest.java 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,187 +0,0 @@
-package org.jbpm.test.activities;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-
-import org.jbpm.api.Execution;
-import org.jbpm.api.activity.ActivityBehaviour;
-import org.jbpm.api.activity.ActivityExecution;
-import org.jbpm.api.activity.ExternalActivityBehaviour;
-import org.jbpm.api.client.ClientExecution;
-import org.jbpm.api.client.ClientProcessDefinition;
-import org.jbpm.api.model.Activity;
-import org.jbpm.api.model.OpenExecution;
-import org.jbpm.api.model.Transition;
-import org.jbpm.pvm.internal.builder.ProcessDefinitionBuilder;
-import org.jbpm.pvm.internal.model.ExecutionImpl;
-import org.jbpm.test.BaseJbpmTestCase;
-
-/**
- * concurrent execution where synchronization is done by checking if the
- * number of expected child executions arrived at the join.
- *
- * @author Tom Baeyens
- */
-public class TransitionBasedConcurrencyTest extends BaseJbpmTestCase {
-
- public static class Fork implements ActivityBehaviour {
- private static final long serialVersionUID = 1L;
- public void execute(ActivityExecution execution) {
- OpenExecution processInstance = execution.getProcessInstance();
-
- Activity activity = execution.getActivity();
- List<Transition> outgoingTransitions = activity.getOutgoingTransitions();
-
- // for each outgoing transition
- for (Transition outgoingTransition: outgoingTransitions) {
- // launch a concurrent path of execution
- String childExecutionName = outgoingTransition.getName();
- // creating the execution will cause the execution to become inactive
- ExecutionImpl executionImpl = (ExecutionImpl) execution;
- Execution childExecution = executionImpl.createExecution(childExecutionName,
processInstance);
- execution.take(outgoingTransition, childExecution);
- }
-
- // if this was the first fork
- if (execution.isProcessInstance()) {
- execution.setActivity(null);
- }
- }
- }
-
- public static class Join implements ActivityBehaviour {
- private static final long serialVersionUID = 1L;
- public void execute(ActivityExecution execution) throws Exception {
- // end the child execution execution
- // this will also remove the execution from it's parent
- execution.setState(Execution.STATE_INACTIVE);
- execution.waitForSignal();
-
- Activity join = execution.getActivity();
- List<OpenExecution> joinedExecutions = findJoinedExecutions(execution,
join);
-
- if (isComplete(joinedExecutions, join)) {
- endJoinedExecutions(joinedExecutions, execution);
-
- OpenExecution processInstance = execution.getProcessInstance();
-
- Execution outgoingExecution = null;
- if ( processInstance.getExecutions()==null
- || processInstance.getExecutions().isEmpty()
- ) {
- outgoingExecution = processInstance;
- } else {
- ExecutionImpl executionImpl = (ExecutionImpl) execution;
- outgoingExecution = executionImpl.createExecution(processInstance);
- }
-
- execution.setActivity(join, outgoingExecution);
- Transition transition = join.getDefaultOutgoingTransition();
- execution.take(transition, outgoingExecution);
- }
- }
-
- List<OpenExecution> findJoinedExecutions(OpenExecution execution, Activity
join) {
- List<OpenExecution> joinedExecutions = new ArrayList<OpenExecution>();
- scanRecursive(execution.getProcessInstance(), join, joinedExecutions);
- return joinedExecutions;
- }
-
- void scanRecursive(OpenExecution execution, Activity join, List<OpenExecution>
joinedExecutions) {
- // if the execution is positioned in the join
- if (join.equals(execution.getActivity())) {
- joinedExecutions.add(execution);
- }
- Collection<OpenExecution> childExecutions = (List)execution.getExecutions();
- if (childExecutions!=null) {
- for (OpenExecution childExecution: childExecutions) {
- scanRecursive(childExecution, join, joinedExecutions);
- }
- }
- }
-
- boolean isComplete(List<OpenExecution> joinedExecutions, Activity join) {
- int executionsToJoin = join.getIncomingTransitions().size();
- return (executionsToJoin==joinedExecutions.size());
- }
-
- void endJoinedExecutions(List<OpenExecution> joinedExecutions,
ActivityExecution execution) {
- for (OpenExecution joinedExecution: joinedExecutions) {
- execution.end(joinedExecution);
- }
- }
- }
-
- public static class WaitState implements ExternalActivityBehaviour {
- private static final long serialVersionUID = 1L;
- public void execute(ActivityExecution execution) {
- execution.waitForSignal();
- }
- public void signal(ActivityExecution execution, String signalName, Map<String,
Object> parameters) {
- execution.take(signalName);
- }
- }
-
- public void testTransitionBasedConcurrency() {
-
- ClientProcessDefinition processDefinition = ProcessDefinitionBuilder
- .startProcess()
- .startActivity("fork", new Fork())
- .initial()
- .transition("bill", "billing")
- .transition("ship", "shipping")
- .endActivity()
- .startActivity("bill", new WaitState())
- .transition("join")
- .endActivity()
- .startActivity("ship", new WaitState())
- .transition("join")
- .endActivity()
- .startActivity("join", new Join())
- .transition("end")
- .endActivity()
- .startActivity("end", new WaitState())
- .endActivity()
- .endProcess();
-
- ClientExecution main = processDefinition.startProcessInstance();
-
- assertNull("fork", main.getActivity());
- assertEquals(Execution.STATE_INACTIVE, main.getState());
-
- Execution billing = main.getExecution("billing");
- assertNotNull(billing);
- assertEquals("bill", billing.getActivityName());
- assertFalse(billing.isEnded());
-
- Execution shipping = main.getExecution("shipping");
-
- assertNotNull(shipping);
- assertEquals("ship", shipping.getActivityName());
- assertFalse(shipping.isEnded());
- assertTrue(main.getExecutions().contains(billing));
- assertTrue(main.getExecutions().contains(shipping));
-
- main.signal(billing);
-
- assertNull(main.getActivityName());
- assertEquals("join", billing.getActivityName());
- assertEquals("ship", shipping.getActivityName());
- assertEquals(Execution.STATE_ACTIVE, shipping.getState());
- assertEquals(Execution.STATE_INACTIVE, billing.getState());
- assertEquals(Execution.STATE_INACTIVE, main.getState());
-
- main.signal(shipping);
-
- assertEquals(Execution.STATE_ACTIVE, main.getState());
- assertEquals("end", main.getActivityName());
- assertEquals("join", billing.getActivityName());
- assertTrue(billing.isEnded());
- assertEquals("join", shipping.getActivityName());
- assertTrue(shipping.isEnded());
- assertFalse(main.getExecutions().contains(billing));
- assertFalse(main.getExecutions().contains(shipping));
- }
-}
Deleted:
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/images/gpd.open.in.xml.png
===================================================================
(Binary files differ)
Modified:
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml
===================================================================
---
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch01-Introduction.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -51,48 +51,5 @@
are not part of the support offerings.
</para>
</section>
-
- <section id="processdefinitionprocessinstanceandexecutions">
- <title>Process definition, process instance and executions</title>
- <para>A process definition is description of the steps in a procedure.
- For example, an insurance company could have a <literal>loan</literal>
- process definition that describes the steps of how the company deals
- with loan requests.
- </para>
- <figure id="loan.process.definition.example">
- <title>The loan process definition example</title>
- <mediaobject><imageobject><imagedata align="center"
fileref="images/loan.process.definition.png"/></imageobject></mediaobject>
- </figure>
- <para>One process instance represents one particular run of a process
definition.
- For example, the loan request of John Doe last Friday to finance his new boat
- is represented in one process instance of the loan process definition.
- </para>
- <para>A process instance contains all the runtime state. The
- most prominent property is the pointer that keeps track of the current activity.
- </para>
- <figure id="loan.process.instance.example">
- <title>The loan process instance example</title>
- <mediaobject><imageobject><imagedata align="center"
fileref="images/loan.process.instance.png"/></imageobject></mediaobject>
- </figure>
- <para>Suppose that wiring the money and archiving can be done in parallel.
- Then the main process instance will have two child executions to keep
- track of the state like this:
- </para>
- <figure id="loan.executions.example">
- <title>The loan executions example</title>
- <mediaobject><imageobject><imagedata align="center"
fileref="images/loan.executions.png"/></imageobject></mediaobject>
- </figure>
- <para>More general, a process instance is the root of a tree of executions.
- When a new process instance is started, the process instance is in fact the root
- execution scope. Only leaf executions can be active.
- </para>
- <para>The motivation to work with a tree structure like this is that
- this conceptually remains simple in the case where there is only one path
- of execution. The services API doesn't need to make a functional difference
- between process instances and executions. Therefore, the API has only
- one Execution type to refer to both <literal>ProcessInstance</literal>s
and
- <literal>Execution</literal>s.
- </para>
- </section>
</chapter>
Modified:
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml
===================================================================
---
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch02-Installation.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -2,90 +2,170 @@
<title>Installation</title>
<para>This chapter describes how to install jBPM in different
- application environments.
+ application environments.
</para>
- <section id="runningtheinstaller">
- <title>Running the installer</title>
- <para>Start the installer on a command line like this:</para>
- <programlisting>java -jar jbpm-installer-${version}.jar</programlisting>
- <para>The installer has 2 purposes
+ <section id="thedistribution">
+ <title>The distribution</title>
+ <para>Just unzip the jBPM download to some location on your hard drive.
+ You'll see following subdirectories:
</para>
<itemizedlist>
- <listitem>Install jBPM on your system. This includes the
- jBPM jars, jBPM sources, third party jars, docs, examples,
- db scripts and more. This contains all you need to get
- going with jBPM in your application.
+ <listitem><literal>db</literal>: DB schema creation
scripts</listitem>
+ <listitem><literal>doc</literal>: User guide, javadocs and
developers guide</listitem>
+ <listitem><literal>examples</literal>: Example processes that are
used in the user guide</listitem>
+ <listitem><literal>gpd</literal>: Graphical process designer
plugin as an eclipse archived site</listitem>
+ <listitem><literal>jboss</literal>: JBoss installer to install
jBPM into JBoss</listitem>
+ <listitem><literal>lib</literal>: Third party libs and some
special jBPM libraries</listitem>
+ <listitem><literal>src</literal>: Sources</listitem>
+ <listitem><literal>jbpm.jar</literal>: The jBPM main library
archive</listitem>
+ </itemizedlist>
+ </section>
+
+ <section id="gettingstartedquickly">
+ <title>Getting started quickly</title>
+ <para>The <emphasis role="bold">demo setup</emphasis> is
the simplest way to get started.
+ This section describes the steps to complete the demo setup.
+ </para>
+ <para>If you have jboss-5.0.0.GA on locally on your machine, create a directory
+ called <literal>downloads</literal> in your jBPM home directory and copy
+ the jboss distribution zip file in there. Same for an Eclipse Ganymede SR2 JEE
distribution
+ (eclipse-jee-ganymede-SR2-win32.zip). If you have it already locally, copy it to
+ the downloads directory. If you don't have those files in that place, they will
be downloaded
+ automatically by the demo setup ant script.
+ </para>
+ <para>Open a command prompt and go do directory
<literal>${jbpm.home}/jboss</literal>. Then
+ run
+ </para>
+ <programlisting>ant demo.setup</programlisting>
+ <para>That will</para>
+ <itemizedlist>
+ <listitem>Install JBoss into the
<literal>${jbpm.home}/jboss-5.0.0.GA</literal> directory</listitem>
+ <listitem>Install jBPM into that JBoss installation. By default, this
includes a hypersonic
+ database that is accessable over TCP/IP.
</listitem>
- <listitem>Install jBPM into JBoss, this part can install jBPM
- into a JBoss server. JBoss will be deployed as a service and
- be accessible to all applications running on it.
- </listitem>
+ <listitem>Start JBoss. This will also start the hypersonic
DB.</listitem>
+ <listitem>Create the DB Schema</listitem>
+ <listitem>Create an examples.bar business archive from the examples and
deploy it to the jBPM DB.</listitem>
+ <listitem>Load the example users and groups from
<literal>${jbpm.home}/db/example.identities.sql</literal> </listitem>
+ <listitem>Install eclipse into
<literal>${jbpm.home}/eclipse</literal></listitem>
+ <listitem>Start eclipse</listitem>
</itemizedlist>
+ <para>Once this is done and eclipse has started, you can continue to follow the
instructions
+ of <xref linkend="graphicalprocessdesigner" />
+ </para>
+ <para>And you can surf to <ulink
url="http://localhost:8080/gwt-console">the jBPM console</ulink>
+ You can login as one of the following users:
+ </para>
+ <table><title>Example console users:</title>
+ <tgroup cols="2" rowsep="1" colsep="1">
+ <thead>
+ <row>
+ <entry>Username</entry>
+ <entry>Password</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>alex</entry>
+ <entry>password</entry>
+ </row>
+ <row>
+ <entry>mike</entry>
+ <entry>password</entry>
+ </row>
+ <row>
+ <entry>peter</entry>
+ <entry>password</entry>
+ </row>
+ <row>
+ <entry>mary</entry>
+ <entry>password</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
</section>
- <section id="libraries">
- <title>Libraries</title>
- <para>The lib directory you'll find the jbpm libs and the third party libs.
- Including all the libraries in the lib directory, is the simplest way to get
- started. To minimize the number of jars that you need to include, see
- the developers guide.
+ <section id="antscripts">
+ <title>Ant scripts</title>
+ <para>As you already saw one example in the demo setup, the distribution a
couple of ant
+ scripts:
</para>
+ <itemizedlist>
+
<listitem><literal>${jbpm.home}/jboss/build.xml</literal></listitem>
+
<listitem><literal>${jbpm.home}/db/build.xml</literal></listitem>
+
<listitem><literal>${jbpm.home}/gpd/build.xml</literal></listitem>
+
<listitem><literal>${jbpm.home}/examples/build.xml</literal></listitem>
+ </itemizedlist>
+ <para>With <literal>ant -p</literal> you can find out what each of
these scripts can do.
+ </para>
+ <para>The scripts are parametrized with default values. Following properties
you might
+ want to customize:
+ </para>
+ <itemizedlist>
+ <listitem><literal>database</literal> : Default value is
<literal>hsqldb</literal>. Alternative values
+ are <literal>mysql</literal>, <literal>oracle</literal> and
<literal>postgresql</literal></listitem>
+ <listitem><literal>jboss.version</literal> : Default value is
<literal>5.0.0.GA</literal>. Alternative
+ value is <literal>5.0.1.GA</literal></listitem>
+ </itemizedlist>
+ <para>To customize the values for these properties, just use
<literal>-D</literal> like this
+ </para>
+ <programlisting>ant -Ddatabase=postgresql demo.setup</programlisting>
+ <para>Or specify the customized values in
<literal>${user.home}/.jbpm4/build.properties</literal>
+ </para>
+ <para>To specify your jdbc properties that are used in the DB schema
generation, direct DB access like
+ deployment and for the JBoss datasource creation, the easiest is to update the
appropriate
+ properties file in directory <literal>${jbpm.home}/db/jdbc</literal>.
The appropriate properties
+ file will be loaded by the scripts that are DB related.
+ </para>
</section>
-
- <section id="tomcat-xxx">
- <title>Tomcat xxx</title>
- <para>TODO: this will contain a description of how to use the
- installer to install jbpm on tomcat</para>
- </section>
- <section id="jboss-xxx">
- <title>JBoss xxx</title>
- <para>TODO: this will contain a description of how to use the
- installer to install jbpm on jboss</para>
+ <section id="jboss">
+ <title>JBoss</title>
+ <para>The build file
<literal>${jbpm.home}/jboss/build.xml</literal> contains scripts for
+ installing jBPM into JBoss 5. Navigate to that directory and run <literal>ant
-p</literal>
+ for more details.
+ </para>
</section>
<section id="database">
<title>Database</title>
- <para>jBPM works with your database of choice. That way, jBPM's data
- tables can be placed next to your application tables in the same
- database. In case you're working outside an application server
- you can combine your application updates with jBPM's process updates in a
- single transaction by using the same JDBC connection.
+ <para>The build file <literal>${jbpm.home}/db/build.xml</literal>
contains scripts for
+ DB operations like creating and dropping the schema. Navigate to that directory and
run <literal>ant -p</literal>
+ for more details.
</para>
- <section>
- <title>Creating the DB tables</title>
- <para>In directory <literal>db</literal> the sql scripts to
create
- the DB schema can be found for the supported databases.
- </para>
- </section>
</section>
+ <section id="tomcat">
+ <title>Tomcat</title>
+ <para>TODO: this will contain a description of how to use the
+ installer to install jbpm on tomcat</para>
+ </section>
+
<section id="configurationfiles">
<title>Configuration files</title>
- <para>TODO
+ <para>If you're not deploying in JBoss, then the example configuration
files
+ in the examples <literal>src</literal> are the best starting point.
</para>
- <para>In the meantime, see in the examples for a set of example
- configuration files. Central file is jbpm.cfg.xml. All other files
- are referenced from that file.
- </para>
</section>
<section id="graphicalprocessdesigner">
<title>Graphical Process Designer (GPD)</title>
<para>Eclipse is used as the platform to host the jPDL graphical process
- designer. This section will describe how to obtain Eclipse, install it
- the GPD.</para>
+ designer. This section will describe how to obtain and install Eclipse and
+ how to install the GPD plugin in Eclipse.</para>
<section>
- <title>Download Eclipse</title>
- <para>You'll need Eclipse 3.4.1.
+ <title>Get Eclipse</title>
+ <para>You'll need Eclipse 3.4.2.
</para>
- <para>Download the
- <ulink
url="http://www.eclipse.org/downloads/download.php?file=/technology/...
IDE for Java Developers (85 MB)</ulink> or
- <ulink
url="http://www.eclipse.org/downloads/download.php?file=/technology/...
IDE for Java EE Developers (163 MB)</ulink>.
+ <para>Use the <link linkend="gettingstarted">demo
setup</link> or download
+ eclipse manually:
+ <ulink
url="http://www.eclipse.org/downloads/download.php?file=/technology/...
IDE for Java EE Developers (163 MB)</ulink>.
</para>
<para>The classic version of eclipse will not be sufficient as it does
- not have an XML editor.
+ not have an XML editor. Eclipse for Java developers should also
+ work.
</para>
</section>
<section>
@@ -188,5 +268,18 @@
</itemizedlist>
<para>You're all set to start playing with the coolest Java process
technology!</para>
</section>
+
+ <section>
+ <title>Adding deployment with ant</title>
+ <para>You can leverage the eclipse ant integration to ease deployment of
processes.
+ We'll show you how it works with the examples. Then you can copy this practice
in your
+ own project. First, open up the Ant view.
+ </para>
+ <itemizedlist>
+ <listitem>Select <literal>Window</literal> -->
<literal>Show View</literal> --> <literal>Other...</literal>
--> <literal>Ant</literal> -->
<literal>Ant</literal></listitem>
+ <listitem>Then drag the build file <literal>build.xml</literal>
in the examples project from the package explorer to the Ant view</listitem>
+ </itemizedlist>
+ </section>
+
</section>
</chapter>
\ No newline at end of file
Modified: jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch03-Gpd.xml
===================================================================
---
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch03-Gpd.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch03-Gpd.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -39,19 +39,6 @@
<title>Editing jPDL using the source view</title>
<mediaobject><imageobject><imagedata align="center"
fileref="images/gpd.xml.view.png"/></imageobject></mediaobject>
</figure>
- <para>You can of course still edit the process XML sources using the built in
XML editor.
- To do this, select the process file, right click
- and select 'Open with...' --> 'XML editor'
- </para>
- <figure id="gpd.open.in.xml">
- <title>Open a process file in XML editor</title>
- <mediaobject><imageobject><imagedata align="center"
fileref="images/gpd.open.in.xml.png"/></imageobject></mediaobject>
- </figure>
- <para>After you've done this, eclipse will remember that and the next time
- you double click it, eclipse will open your process file in the XML Editor
- automatically. To open up the process file in the GPD, perform the
- same Open-with-action, but select 'jBPM jPDL 4 Editor'
- </para>
</section>
</chapter>
Modified:
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch04-Services.xml
===================================================================
---
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch04-Services.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch04-Services.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -1,14 +1,55 @@
<chapter id="services">
<title>Services</title>
- <para>Interacting with jBPM occurs through services.
- The service interfaces can be obtained from the
<literal>ProcessEngine</literal>
- which is build from a <literal>Configuration</literal>.
- </para>
-
+ <section id="processdefinitionprocessinstanceandexecutions">
+ <title>Process definition, process instance and executions</title>
+ <para>A process definition is description of the steps in a procedure.
+ For example, an insurance company could have a <literal>loan</literal>
+ process definition that describes the steps of how the company deals
+ with loan requests.
+ </para>
+ <figure id="loan.process.definition.example">
+ <title>The loan process definition example</title>
+ <mediaobject><imageobject><imagedata align="center"
fileref="images/loan.process.definition.png"/></imageobject></mediaobject>
+ </figure>
+ <para>One process instance represents one particular run of a process
definition.
+ For example, the loan request of John Doe last Friday to finance his new boat
+ is represented in one process instance of the loan process definition.
+ </para>
+ <para>A process instance contains all the runtime state. The
+ most prominent property is the pointer that keeps track of the current activity.
+ </para>
+ <figure id="loan.process.instance.example">
+ <title>The loan process instance example</title>
+ <mediaobject><imageobject><imagedata align="center"
fileref="images/loan.process.instance.png"/></imageobject></mediaobject>
+ </figure>
+ <para>Suppose that wiring the money and archiving can be done in parallel.
+ Then the main process instance will have two child executions to keep
+ track of the state like this:
+ </para>
+ <figure id="loan.executions.example">
+ <title>The loan executions example</title>
+ <mediaobject><imageobject><imagedata align="center"
fileref="images/loan.executions.png"/></imageobject></mediaobject>
+ </figure>
+ <para>More general, a process instance is the root of a tree of executions.
+ When a new process instance is started, the process instance is in fact the root
+ execution scope. Only leaf executions can be active.
+ </para>
+ <para>The motivation to work with a tree structure like this is that
+ this conceptually remains simple in the case where there is only one path
+ of execution. The services API doesn't need to make a functional difference
+ between process instances and executions. Therefore, the API has only
+ one Execution type to refer to both <literal>ProcessInstance</literal>s
and
+ <literal>Execution</literal>s.
+ </para>
+ </section>
+
<section id="processengine">
<title>ProcessEngine</title>
-
+ <para>Interacting with jBPM occurs through services.
+ The service interfaces can be obtained from the
<literal>ProcessEngine</literal>
+ which is build from a <literal>Configuration</literal>.
+ </para>
<para>A <literal>ProcessEngine</literal> is thread safe and can be
stored in a
static member field or even better in JNDI or some other central location.
One <literal>ProcessEngine</literal> object can be used by all requests
and
Modified: jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml
===================================================================
---
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml 2009-05-18
20:49:32 UTC (rev 4838)
+++
jbpm4/branches/idm/modules/userguide/src/main/docbook/en/modules/ch05-Jpdl.xml 2009-05-19
07:26:59 UTC (rev 4839)
@@ -2189,13 +2189,13 @@
<para>A timer can be specified in the
<literal>transition</literal>
element in wait state activities such as <literal>state</literal>s,
<literal>task</literal>s, <literal>sub-process</literal>es
and
- <literal>super-state</literal>s.
+ <literal>group</literal>s.
When such a timer fires, that transition is taken.
</para>
<para>A timer can also be specified in custom events in wait state
activities such as <literal>state</literal>s,
<literal>task</literal>s, <literal>sub-process</literal>es
and
- <literal>super-state</literal>s. The
<literal>timer</literal> element
+ <literal>group</literal>s. The <literal>timer</literal>
element
should then be the first element in the <literal>on</literal> element
representing
the event. In that case the event fires upon the duedate of the timer.
</para>
Modified: jbpm4/branches/idm/pom.xml
===================================================================
--- jbpm4/branches/idm/pom.xml 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/pom.xml 2009-05-19 07:26:59 UTC (rev 4839)
@@ -48,6 +48,7 @@
<cactus.version>13-1.7.1</cactus.version>
<freemarker.version>2.3.15</freemarker.version>
<gwt.console.version>1.0.0-SNAPSHOT</gwt.console.version>
+ <jbpm.gpd.version>4.0.0-SNAPSHOT</jbpm.gpd.version>
<hibernate.version>3.3.1.GA</hibernate.version>
<slf4j.version>1.5.2</slf4j.version>
<hsqldb.version>1.8.0.7</hsqldb.version>
@@ -96,39 +97,32 @@
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-enterprise</artifactId>
- <classifier>config</classifier>
- <version>${version}</version>
- </dependency>
- <dependency>
- <groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-examples</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-jboss5</artifactId>
+ <artifactId>jbpm-jpdl</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-jboss5</artifactId>
- <classifier>config</classifier>
+ <artifactId>jbpm-log</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-jpdl</artifactId>
+ <artifactId>jbpm-pvm</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-log</artifactId>
+ <artifactId>jbpm-test-base</artifactId>
<version>${version}</version>
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-pvm</artifactId>
+ <artifactId>jbpm-test-db</artifactId>
<version>${version}</version>
</dependency>
<dependency>
@@ -138,14 +132,24 @@
</dependency>
<dependency>
<groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-test-base</artifactId>
+ <artifactId>jbpm-jboss5</artifactId>
<version>${version}</version>
</dependency>
- <dependency>
- <groupId>org.jbpm.jbpm4</groupId>
- <artifactId>jbpm-test-db</artifactId>
- <version>${version}</version>
- </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-console-integration</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-console-form-plugin</artifactId>
+ <version>${version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm.jbpm4</groupId>
+ <artifactId>jbpm-jboss4</artifactId>
+ <version>${version}</version>
+ </dependency>
<!-- GWT console -->
@@ -178,7 +182,7 @@
<groupId>org.jbpm.jbpm4</groupId>
<artifactId>jbpm-gpd</artifactId>
<type>zip</type>
- <version>${version}</version>
+ <version>${jbpm.gpd.version}</version>
</dependency>
<!-- External dependencies -->
Deleted: jbpm4/branches/idm/profiles.xml.example
===================================================================
--- jbpm4/branches/idm/profiles.xml.example 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/profiles.xml.example 2009-05-19 07:26:59 UTC (rev 4839)
@@ -1,63 +0,0 @@
-<profilesXml
xmlns="http://maven.apache.org/POM/4.0.0"
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/profiles-1.0.0.xsd">
-
- <profiles>
-
- <!-- This profile can also be defined in ~/.m2/settings.xml -->
-
- <profile>
- <id>jboss-home-profile</id>
- <activation>
- <property>
- <name>user.name</name>
- </property>
- </activation>
- <properties>
-
- <!--
- JBOSS_HOME FOR INTEGRATION TESTS
- -->
-
- <jboss422.home>/jboss-4.2.2.GA</jboss422.home>
- <jboss423.home>/jboss-4.2.3.GA</jboss423.home>
- <jboss500.home>/jboss-5.0.0.GA</jboss500.home>
-
- <!--
- DEFAULT CONNECTION SETTINGS FOR THE JBPM QA ENV
- -->
- <jdbc.mysql.server>localhost</jdbc.mysql.server>
- <jdbc.mysql.port>3306</jdbc.mysql.port>
- <jdbc.mysql.database>jbpm4</jdbc.mysql.database>
-
<jdbc.mysql.url>jdbc:mysql://${jdbc.mysql.server}:${jdbc.mysql.port}/${jdbc.mysql.database}</jdbc.mysql.url>
- <jdbc.mysql.username>jbpmtest</jdbc.mysql.username>
- <jdbc.mysql.password></jdbc.mysql.password>
-
- <jdbc.postgresql.server>localhost</jdbc.postgresql.server>
- <jdbc.postgresql.port>5432</jdbc.postgresql.port>
- <jdbc.postgresql.database>jbpm4</jdbc.postgresql.database>
-
<jdbc.postgresql.url>jdbc:postgresql://${jdbc.postgresql.server}:${jdbc.postgresql.port}/${jdbc.postgresql.database}</jdbc.postgresql.url>
- <jdbc.postgresql.username>jbpmtest</jdbc.postgresql.username>
- <jdbc.postgresql.password></jdbc.postgresql.password>
-
- <jdbc.sybase.server>localhost</jdbc.sybase.server>
- <jdbc.sybase.port>5000</jdbc.sybase.port>
- <jdbc.sybase.database>jbpm4</jdbc.sybase.database>
-
<jdbc.sybase.url>jdbc:sybase:Tds:${jdbc.sybase.server}:${jdbc.sybase.port}/${jdbc.sybase.database}</jdbc.sybase.url>
- <jdbc.sybase.username>jbpmtest</jdbc.sybase.username>
- <jdbc.sybase.password>jbpmtest</jdbc.sybase.password>
-
<jdbc.sybase.driver>com.sybase.jdbc3.jdbc.SybDriver</jdbc.sybase.driver>
-
<jdbc.sybase.datasource>com.sybase.jdbc3.jdbc.SybXADataSource</jdbc.sybase.datasource>
-
- <jdbc.oracle.server>localhost</jdbc.oracle.server>
- <jdbc.oracle.port>1521</jdbc.oracle.port>
- <jdbc.oracle.database>XE</jdbc.oracle.database>
- <jdbc.oracle.username>jbpmtest</jdbc.oracle.username>
- <jdbc.oracle.password>jbpmtest</jdbc.oracle.password>
-
<jdbc.oracle.url>jdbc:oracle:thin:${jdbc.oracle.username}/${jdbc.oracle.password}@${jdbc.oracle.server}:${jdbc.oracle.port}:${jdbc.oracle.database}</jdbc.oracle.url>
- </properties>
- </profile>
-
- </profiles>
-
-</profilesXml>
Modified: jbpm4/branches/idm/qa/build.xml
===================================================================
--- jbpm4/branches/idm/qa/build.xml 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/qa/build.xml 2009-05-19 07:26:59 UTC (rev 4839)
@@ -49,18 +49,19 @@
description="reinstalls jbpm, reinstalls jboss, installs jbpm into jboss,
starts jboss and then creates the jbpm schema">
<ant antfile="${jbpm.home}/jboss/build.xml"
target="reinstall.jboss" />
<ant antfile="${jbpm.home}/jboss/build.xml"
target="install.jbpm.into.jboss" />
+ <ant antfile="${jbpm.home}/jboss/build.xml"
target="internal.install.jbpm.into.jboss.integrationtestspecifics" />
<ant antfile="${jbpm.home}/jboss/build.xml"
target="start.jboss" />
<ant antfile="${jbpm.home}/db/build.xml"
target="create.jbpm.schema" />
</target>
<target name="post.install">
<!-- overwrite the default jdbc properties in the distro with those specified in the
qa jdbc directory -->
- <copy file="db/${database}.properties"
+ <copy file="jdbc/${database}.properties"
todir="${jbpm.home}/db/jdbc"
overwrite="true"
failonerror="false" />
<!-- overwrite the jdbc properties in the distro with those specified in the user
specific properties -->
- <copy file="${user.home}/.jbpm4/db/${database}.properties"
+ <copy file="${user.home}/.jbpm4/jdbc/${database}.properties"
todir="${jbpm.home}/db/jdbc"
overwrite="true"
failonerror="false" />
@@ -75,19 +76,4 @@
<ant antfile="${jbpm.home}/jboss/build.xml"
target="stop.jboss" />
</target>
- <target name="manual.testrun.setup"
- depends="log.properties, integration.testrun.setup"
- description="full integration testrun setup, deploys the examples, loads
the identities, installs eclipse and then starts eclipse">
- <ant antfile="${jbpm.home}/examples/build.xml"
target="deploy.examples" />
- <ant antfile="${jbpm.home}/db/build.xml"
target="load.example.identities" />
- <ant antfile="${jbpm.home}/gpd/build.xml"
target="install.eclipse" />
- <ant antfile="${jbpm.home}/gpd/build.xml"
target="start.eclipse" />
- </target>
-
- <target name="manual.testrun.teardown"
- depends="log.properties"
- description="stops jboss">
- <ant antfile="${jbpm.home}/jboss/build.xml"
target="stop.jboss" />
- </target>
-
</project>
Copied: jbpm4/branches/idm/qa/jdbc (from rev 4838, jbpm4/trunk/qa/jdbc)
Deleted: jbpm4/branches/idm/qa/jdbc/hsqldb.properties
===================================================================
--- jbpm4/trunk/qa/jdbc/hsqldb.properties 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/qa/jdbc/hsqldb.properties 2009-05-19 07:26:59 UTC (rev 4839)
@@ -1,4 +0,0 @@
-jdbc.driver=org.hsqldb.jdbcDriver
-jdbc.url=jdbc:hsqldb:hsql://localhost:1701
-jdbc.username=sa
-jdbc.password=
Copied: jbpm4/branches/idm/qa/jdbc/hsqldb.properties (from rev 4838,
jbpm4/trunk/qa/jdbc/hsqldb.properties)
===================================================================
--- jbpm4/branches/idm/qa/jdbc/hsqldb.properties (rev 0)
+++ jbpm4/branches/idm/qa/jdbc/hsqldb.properties 2009-05-19 07:26:59 UTC (rev 4839)
@@ -0,0 +1,4 @@
+jdbc.driver=org.hsqldb.jdbcDriver
+jdbc.url=jdbc:hsqldb:hsql://localhost:1701
+jdbc.username=sa
+jdbc.password=
Deleted: jbpm4/branches/idm/qa/jdbc/mysql.properties
===================================================================
--- jbpm4/trunk/qa/jdbc/mysql.properties 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/qa/jdbc/mysql.properties 2009-05-19 07:26:59 UTC (rev 4839)
@@ -1,4 +0,0 @@
-jdbc.driver=com.mysql.jdbc.Driver
-jdbc.url=jdbc:mysql://dev02.qa.atl.jboss.com:3306/pvm1
-jdbc.username=pvm1
-jdbc.password=pvm1
Copied: jbpm4/branches/idm/qa/jdbc/mysql.properties (from rev 4838,
jbpm4/trunk/qa/jdbc/mysql.properties)
===================================================================
--- jbpm4/branches/idm/qa/jdbc/mysql.properties (rev 0)
+++ jbpm4/branches/idm/qa/jdbc/mysql.properties 2009-05-19 07:26:59 UTC (rev 4839)
@@ -0,0 +1,4 @@
+jdbc.driver=com.mysql.jdbc.Driver
+jdbc.url=jdbc:mysql://dev02.qa.atl.jboss.com:3306/pvm1
+jdbc.username=pvm1
+jdbc.password=pvm1
Deleted: jbpm4/branches/idm/qa/jdbc/oracle.properties
===================================================================
--- jbpm4/trunk/qa/jdbc/oracle.properties 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/qa/jdbc/oracle.properties 2009-05-19 07:26:59 UTC (rev 4839)
@@ -1,4 +0,0 @@
-jdbc.driver=oracle.jdbc.driver.OracleDriver
-jdbc.url=jdbc:oracle:thin:@dev01.qa.atl.jboss.com:1521:qadb01
-jdbc.username=PVM3
-jdbc.password=PVM3
Copied: jbpm4/branches/idm/qa/jdbc/oracle.properties (from rev 4838,
jbpm4/trunk/qa/jdbc/oracle.properties)
===================================================================
--- jbpm4/branches/idm/qa/jdbc/oracle.properties (rev 0)
+++ jbpm4/branches/idm/qa/jdbc/oracle.properties 2009-05-19 07:26:59 UTC (rev 4839)
@@ -0,0 +1,4 @@
+jdbc.driver=oracle.jdbc.driver.OracleDriver
+jdbc.url=jdbc:oracle:thin:@dev01.qa.atl.jboss.com:1521:qadb01
+jdbc.username=PVM3
+jdbc.password=PVM3
Deleted: jbpm4/branches/idm/qa/jdbc/postgresql.properties
===================================================================
--- jbpm4/trunk/qa/jdbc/postgresql.properties 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/qa/jdbc/postgresql.properties 2009-05-19 07:26:59 UTC (rev 4839)
@@ -1,7 +0,0 @@
-jdbc.driver=org.postgresql.Driver
-jdbc.port=5432
-jdbc.server=dev01.qa.atl.jboss.com
-jdbc.databasename=pvm3
-jdbc.url=jdbc:postgresql://dev01.qa.atl.jboss.com:5432/pvm3
-jdbc.username=pvm3
-jdbc.password=pvm3
Copied: jbpm4/branches/idm/qa/jdbc/postgresql.properties (from rev 4838,
jbpm4/trunk/qa/jdbc/postgresql.properties)
===================================================================
--- jbpm4/branches/idm/qa/jdbc/postgresql.properties (rev 0)
+++ jbpm4/branches/idm/qa/jdbc/postgresql.properties 2009-05-19 07:26:59 UTC (rev 4839)
@@ -0,0 +1,7 @@
+jdbc.driver=org.postgresql.Driver
+jdbc.port=5432
+jdbc.server=dev01.qa.atl.jboss.com
+jdbc.databasename=pvm3
+jdbc.url=jdbc:postgresql://dev01.qa.atl.jboss.com:5432/pvm3
+jdbc.username=pvm3
+jdbc.password=pvm3
Deleted: jbpm4/branches/idm/qa/jdbc/sybase.properties
===================================================================
--- jbpm4/trunk/qa/jdbc/sybase.properties 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/qa/jdbc/sybase.properties 2009-05-19 07:26:59 UTC (rev 4839)
@@ -1,5 +0,0 @@
-jdbc.driver=net.sourceforge.jtds.jdbc.Driver
-# jdbc.driver=com.sybase.jdbc3.jdbc.SybDriver
-jdbc.url=jdbc:sybase:Tds:localhost:5000/jbpmdb
-jdbc.username=jbpm
-jdbc.password=jbpm
Copied: jbpm4/branches/idm/qa/jdbc/sybase.properties (from rev 4838,
jbpm4/trunk/qa/jdbc/sybase.properties)
===================================================================
--- jbpm4/branches/idm/qa/jdbc/sybase.properties (rev 0)
+++ jbpm4/branches/idm/qa/jdbc/sybase.properties 2009-05-19 07:26:59 UTC (rev 4839)
@@ -0,0 +1,5 @@
+jdbc.driver=net.sourceforge.jtds.jdbc.Driver
+# jdbc.driver=com.sybase.jdbc3.jdbc.SybDriver
+jdbc.url=jdbc:sybase:Tds:localhost:5000/jbpmdb
+jdbc.username=jbpm
+jdbc.password=jbpm
Deleted: jbpm4/branches/idm/qa/manual.testrun.setup.bat
===================================================================
--- jbpm4/branches/idm/qa/manual.testrun.setup.bat 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/qa/manual.testrun.setup.bat 2009-05-19 07:26:59 UTC (rev 4839)
@@ -1,2 +0,0 @@
-cmd /C mvn -U -Pdistro clean install
-cmd /C ant -f qa/build.xml manual.testrun.setup
Deleted: jbpm4/branches/idm/qa/manual.testrun.setup.sh
===================================================================
--- jbpm4/branches/idm/qa/manual.testrun.setup.sh 2009-05-18 20:49:32 UTC (rev 4838)
+++ jbpm4/branches/idm/qa/manual.testrun.setup.sh 2009-05-19 07:26:59 UTC (rev 4839)
@@ -1,3 +0,0 @@
-set MAVEN_OPTS=-Xms1024M -Xmx1024M
-mvn -U -Pdistro clean install
-ant -f qa/build.xml manual.testrun.setup
Copied: jbpm4/branches/idm/qa/test.demo.setup.bat (from rev 4838,
jbpm4/trunk/qa/test.demo.setup.bat)
===================================================================
--- jbpm4/branches/idm/qa/test.demo.setup.bat (rev 0)
+++ jbpm4/branches/idm/qa/test.demo.setup.bat 2009-05-19 07:26:59 UTC (rev 4839)
@@ -0,0 +1,4 @@
+echo To run this, make sure that at least you have jbpm.parent.dir specified in your
${user.home}/.jbpm4/build.properties
+cmd /C mvn -U -Pdistro clean install
+cmd /C ant -f qa/build.xml reinstall.jbpm
+cmd /C ant -f modules/distro/src/main/files/jboss/build.xml demo.setup
Copied: jbpm4/branches/idm/qa/test.demo.setup.sh (from rev 4838,
jbpm4/trunk/qa/test.demo.setup.sh)
===================================================================
--- jbpm4/branches/idm/qa/test.demo.setup.sh (rev 0)
+++ jbpm4/branches/idm/qa/test.demo.setup.sh 2009-05-19 07:26:59 UTC (rev 4839)
@@ -0,0 +1,3 @@
+set MAVEN_OPTS=-Xms1024M -Xmx1024M
+mvn -U -Pdistro clean install
+ant -f qa/build.xml manual.testrun.setup