Browse files

- adding jbpm-services

  - moving jbpm-human-task (cdi) implementation to jbpm-services
  • Loading branch information...
1 parent e06a0b9 commit 1697ba4ca99129551f301e751e947e4b9455e5de @Salaboy Salaboy committed Nov 5, 2012
Showing with 3,303 additions and 27 deletions.
  1. +0 −12 jbpm-human-task/jbpm-human-task-services/.gitignore
  2. +0 −10 jbpm-human-task/jbpm-human-task-workitems/.gitignore
  3. +0 −2 jbpm-human-task/pom.xml
  4. +163 −0 jbpm-services/droolsjbpm-knowledge-services/pom.xml
  5. +24 −0 ...sjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/api/KnowledgeAdminDataService.java
  6. +51 −0 ...droolsjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/api/KnowledgeDataService.java
  7. +53 −0 ...oolsjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/api/KnowledgeDomainService.java
  8. +24 −0 ...rvices/droolsjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/api/SearchService.java
  9. +25 −0 ...vices/droolsjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/api/SessionLocator.java
  10. +37 −0 ...oolsjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/api/bpmn2/BPMN2DataService.java
  11. +42 −0 ...-knowledge-services/src/main/java/org/droolsjbpm/services/impl/KnowledgeAdminDataServiceImpl.java
  12. +143 −0 ...sjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/KnowledgeDataServiceImpl.java
  13. +167 −0 ...bpm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/KnowledgeDomainServiceImpl.java
  14. +126 −0 ...s/droolsjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/SearchServiceImpl.java
  15. +34 −0 .../droolsjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/SessionLocatorImpl.java
  16. +206 −0 ...bpm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/bpmn2/BPMN2DataServiceImpl.java
  17. +56 −0 ...dge-services/src/main/java/org/droolsjbpm/services/impl/bpmn2/BPMN2DataServiceSemanticModule.java
  18. +103 −0 ...dge-services/src/main/java/org/droolsjbpm/services/impl/bpmn2/HumanTaskGetInformationHandler.java
  19. +67 −0 ...pm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/bpmn2/ProcessDescRepoHelper.java
  20. +59 −0 ...ledge-services/src/main/java/org/droolsjbpm/services/impl/bpmn2/ProcessGetInformationHandler.java
  21. +54 −0 ...m-knowledge-services/src/main/java/org/droolsjbpm/services/impl/bpmn2/ProcessGetInputHandler.java
  22. +139 −0 ...ge-services/src/main/java/org/droolsjbpm/services/impl/event/listeners/CDIKbaseEventListener.java
  23. +120 −0 ...-services/src/main/java/org/droolsjbpm/services/impl/event/listeners/CDIProcessEventListener.java
  24. +35 −0 ...nowledge-services/src/main/java/org/droolsjbpm/services/impl/helpers/NodeInstanceDescFactory.java
  25. +32 −0 ...bpm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/helpers/ProcessDescFactory.java
  26. +35 −0 ...ledge-services/src/main/java/org/droolsjbpm/services/impl/helpers/ProcessInstanceDescFactory.java
  27. +119 −0 ...olsjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/model/NodeInstanceDesc.java
  28. +110 −0 ...s/droolsjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/model/ProcessDesc.java
  29. +69 −0 ...olsjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/model/ProcessInputDesc.java
  30. +116 −0 ...jbpm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/model/ProcessInstanceDesc.java
  31. +105 −0 ...lsjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/model/VariableStateDesc.java
  32. +5 −0 jbpm-services/droolsjbpm-knowledge-services/src/main/resources/META-INF/beans.xml
  33. +125 −0 ...oolsjbpm-knowledge-services/src/test/java/org/droolsjbpm/services/test/BPMN2DataServicesTest.java
  34. +280 −0 ...knowledge-services/src/test/java/org/droolsjbpm/services/test/DomainKnowledgeServiceBaseTest.java
  35. +72 −0 ...-knowledge-services/src/test/java/org/droolsjbpm/services/test/DomainKnowledgeServiceCDITest.java
  36. +32 −0 ...roolsjbpm-knowledge-services/src/test/java/org/droolsjbpm/services/test/TaskDatabaseProducer.java
  37. +53 −0 jbpm-services/droolsjbpm-knowledge-services/src/test/resources/META-INF/beans.xml
  38. +65 −0 jbpm-services/droolsjbpm-knowledge-services/src/test/resources/META-INF/persistence.xml
  39. +273 −0 jbpm-services/droolsjbpm-knowledge-services/src/test/resources/example/humanTask.bpmn
  40. +1 −2 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/pom.xml
  41. 0 ...-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/AccessType.java
  42. 0 ...task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/AllowedToDelegate.java
  43. 0 ...-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Attachment.java
  44. 0 ...task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/BooleanExpression.java
  45. 0 ...human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/CommandName.java
  46. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Comment.java
  47. 0 ...ask → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/CompletionBehavior.java
  48. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Content.java
  49. 0 ...human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/ContentData.java
  50. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Deadline.java
  51. 0 ...m-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Deadlines.java
  52. 0 ...-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Delegation.java
  53. 0 ...task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/EmailNotification.java
  54. 0 ... jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/EmailNotificationHeader.java
  55. 0 ...-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Escalation.java
  56. 0 ...m-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/FaultData.java
  57. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Group.java
  58. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/I18NText.java
  59. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Language.java
  60. 0 ...uman-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Notification.java
  61. 0 ...-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/NotificationType.java
  62. 0 ...m-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Operation.java
  63. 0 ...k → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/OrganizationalEntity.java
  64. 0 ...task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/PeopleAssignments.java
  65. 0 ...sk → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/PresentationElement.java
  66. 0 ...uman-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Reassignment.java
  67. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Status.java
  68. 0 ...uman-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/StatusChange.java
  69. 0 ...-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/SubTasksStrategy.java
  70. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/Task.java
  71. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/TaskData.java
  72. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/TaskDef.java
  73. 0 ...m-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/TaskEvent.java
  74. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/User.java
  75. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/UserInfo.java
  76. 0 ...jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/annotations/CommandBased.java
  77. 0 ...k → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/annotations/External.java
  78. 0 ...k → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/annotations/Internal.java
  79. 0 ...task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/annotations/Local.java
  80. 0 ...-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/annotations/Mvel.java
  81. 0 ...k → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskAdminService.java
  82. 0 ...bpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskAttachmentService.java
  83. 0 ... jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskCommandExecutor.java
  84. 0 ...→ jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskCommentService.java
  85. 0 ...→ jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskContentService.java
  86. 0 ...jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskDeadlinesService.java
  87. 0 ...ask → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskDefService.java
  88. 0 ... → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskEventsService.java
  89. 0 ... jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskIdentityService.java
  90. 0 ... jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskInstanceService.java
  91. 0 ...m-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskPresentationService.java
  92. 0 ...k → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskQueryService.java
  93. 0 ...bpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskServiceEntryPoint.java
  94. 0 ...bpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/api/TaskStatisticsService.java
  95. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/ActivateTaskCommand.java
  96. 0 ... jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/AddTaskCommand.java
  97. 0 .../jbpm-human-task-services/src/main/java/org/jbpm/task/commands/ClaimNextAvailableTaskCommand.java
  98. 0 ...bpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/ClaimTaskCommand.java
  99. 0 ... → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/CommandsUtil.java
  100. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/CompleteTaskCommand.java
  101. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/DelegateTaskCommand.java
  102. 0 ...jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/ExitTaskCommand.java
  103. 0 ...jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/FailTaskCommand.java
  104. 0 ...m-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/ForwardTaskCommand.java
  105. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/NominateTaskCommand.java
  106. 0 ...m-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/ReleaseTaskCommand.java
  107. 0 ...pm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/ResumeTaskCommand.java
  108. 0 ...jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/SkipTaskCommand.java
  109. 0 ...bpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/StartTaskCommand.java
  110. 0 ...jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/StopTaskCommand.java
  111. 0 ...m-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/SuspendTaskCommand.java
  112. 0 ...k → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/TaskCommand.java
  113. 0 ...vices}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/TaskCommandExecutorImpl.java
  114. 0 ...k → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/commands/TaskContext.java
  115. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/deadlines/DeadlinesDecorator.java
  116. 0 ...ervices}/jbpm-human-task-services/src/main/java/org/jbpm/task/deadlines/NotificationListener.java
  117. 0 ...k-services/src/main/java/org/jbpm/task/deadlines/notifications/impl/MockNotificationListener.java
  118. 0 ...ervices}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskActivatedEvent.java
  119. 0 ...pm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskAddedEvent.java
  120. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskClaimedEvent.java
  121. 0 ...ervices}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskCompletedEvent.java
  122. 0 ...ervices}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskDelegatedEvent.java
  123. 0 ...m-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskExitedEvent.java
  124. 0 ...m-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskFailedEvent.java
  125. 0 ...ervices}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskForwardedEvent.java
  126. 0 ...ervices}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskNominatedEvent.java
  127. 0 ...services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskReleasedEvent.java
  128. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskResumedEvent.java
  129. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskSkippedEvent.java
  130. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskStartedEvent.java
  131. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskStoppedEvent.java
  132. 0 ...ervices}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/AfterTaskSuspendedEvent.java
  133. 0 ...rvices}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskActivatedEvent.java
  134. 0 ...m-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskAddedEvent.java
  135. 0 ...services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskClaimedEvent.java
  136. 0 ...rvices}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskCompletedEvent.java
  137. 0 ...rvices}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskDelegatedEvent.java
  138. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskExitedEvent.java
  139. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskFailedEvent.java
  140. 0 ...rvices}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskForwardedEvent.java
  141. 0 ...rvices}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskNominatedEvent.java
  142. 0 ...ervices}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskReleasedEvent.java
  143. 0 ...services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskResumedEvent.java
  144. 0 ...services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskSkippedEvent.java
  145. 0 ...services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskStartedEvent.java
  146. 0 ...services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskStoppedEvent.java
  147. 0 ...rvices}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/BeforeTaskSuspendedEvent.java
  148. 0 ...jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/events/NotificationEvent.java
  149. 0 ...vices}/jbpm-human-task-services/src/main/java/org/jbpm/task/exception/CannotAddTaskException.java
  150. 0 ...es}/jbpm-human-task-services/src/main/java/org/jbpm/task/exception/IllegalTaskStateException.java
  151. 0 .../jbpm-human-task-services/src/main/java/org/jbpm/task/exception/IncorrectParametersException.java
  152. 0 ...es}/jbpm-human-task-services/src/main/java/org/jbpm/task/exception/PermissionDeniedException.java
  153. 0 ...sk → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/exception/TaskError.java
  154. 0 ... jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/exception/TaskException.java
  155. 0 ...vices}/jbpm-human-task-services/src/main/java/org/jbpm/task/identity/DBUserGroupCallbackImpl.java
  156. 0 ...ces}/jbpm-human-task-services/src/main/java/org/jbpm/task/identity/JAASUserGroupCallbackImpl.java
  157. 0 ...es}/jbpm-human-task-services/src/main/java/org/jbpm/task/identity/JBossUserGroupCallbackImpl.java
  158. 0 ...ces}/jbpm-human-task-services/src/main/java/org/jbpm/task/identity/LDAPUserGroupCallbackImpl.java
  159. 0 ...bpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/identity/LDAPUserInfoImpl.java
  160. 0 ...ces}/jbpm-human-task-services/src/main/java/org/jbpm/task/identity/MvelUserGroupCallbackImpl.java
  161. 0 ...pm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/identity/UserGroupCallback.java
  162. 0 ...-human-task-services/src/main/java/org/jbpm/task/identity/UserGroupLifeCycleManagerDecorator.java
  163. 0 ...pm-human-task-services/src/main/java/org/jbpm/task/identity/UserGroupTaskAttachmentDecorator.java
  164. 0 ...man-task-services/src/main/java/org/jbpm/task/identity/UserGroupTaskCommandExecutorDecorator.java
  165. 0 .../jbpm-human-task-services/src/main/java/org/jbpm/task/identity/UserGroupTaskCommentDecorator.java
  166. 0 ...bpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/TaskAdminServiceImpl.java
  167. 0 ...ervices}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/TaskAttachmentServiceImpl.java
  168. 0 ...m-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/TaskCommentServiceImpl.java
  169. 0 ...m-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/TaskContentServiceImpl.java
  170. 0 ...services}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/TaskDeadlinesServiceImpl.java
  171. 0 ... jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/TaskDefServiceImpl.java
  172. 0 ...pm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/TaskEventsServiceImpl.java
  173. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/TaskIdentityServiceImpl.java
  174. 0 ...-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/TaskInstanceServiceImpl.java
  175. 0 ...bpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/TaskQueryServiceImpl.java
  176. 0 ...ervices}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/TaskServiceEntryPointImpl.java
  177. 0 ...ervices}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/TaskStatisticsServiceImpl.java
  178. 0 ...n-task-services/src/main/java/org/jbpm/task/impl/command/CommandBasedTaskInstanceServiceImpl.java
  179. 0 ...services}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/factories/TaskDefFactory.java
  180. 0 ...pm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/impl/factories/TaskFactory.java
  181. 0 ...m-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/internals/lifecycle/Allowed.java
  182. 0 ...s}/jbpm-human-task-services/src/main/java/org/jbpm/task/internals/lifecycle/LifeCycleManager.java
  183. 0 ...bpm-human-task-services/src/main/java/org/jbpm/task/internals/lifecycle/MVELLifeCycleManager.java
  184. 0 ...s}/jbpm-human-task-services/src/main/java/org/jbpm/task/internals/lifecycle/OperationCommand.java
  185. 0 ...k-services/src/main/java/org/jbpm/task/lifecycle/listeners/DefaultTaskLifeCycleEventListener.java
  186. 0 ...-services/src/main/java/org/jbpm/task/lifecycle/listeners/InternalTaskLifeCycleEventListener.java
  187. 0 ...-task-services/src/main/java/org/jbpm/task/lifecycle/listeners/JPATaskLifeCycleEventListener.java
  188. 0 ...man-task-services/src/main/java/org/jbpm/task/lifecycle/listeners/TaskLifeCycleEventListener.java
  189. 0 ... → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/query/DeadlineSummary.java
  190. 0 ...task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/query/TaskSummary.java
  191. 0 ...jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/subtask/SubTaskDecorator.java
  192. 0 ... → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/utils/CollectionUtils.java
  193. 0 ...services}/jbpm-human-task-services/src/main/java/org/jbpm/task/utils/ContentMarshallerHelper.java
  194. 0 ...n-task → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/utils/MVELUtils.java
  195. 0 ...sk → jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/utils/OnErrorAction.java
  196. 0 ... jbpm-services}/jbpm-human-task-services/src/main/java/org/jbpm/task/utils/TaskServiceModule.java
  197. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/resources/META-INF/Taskorm.xml
  198. 0 ...an-task-workitems → jbpm-services/jbpm-human-task-services}/src/main/resources/META-INF/beans.xml
  199. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/resources/log4j.properties
  200. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/main/resources/operations-dsl.mvel
  201. 0 ...jbpm-human-task-services/src/main}/resources/org/jbpm/task/identity/UserGroupsAssignmentsOne.mvel
  202. 0 ...sk → jbpm-services}/jbpm-human-task-services/src/test/filtered-resources/META-INF/persistence.xml
  203. 0 ...-task → jbpm-services}/jbpm-human-task-services/src/test/filtered-resources/datasource.properties
  204. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/test/java/org/jbpm/task/BaseTest.java
  205. 0 ...task → jbpm-services}/jbpm-human-task-services/src/test/java/org/jbpm/task/DeadlinesBaseTest.java
  206. 0 ...ask → jbpm-services}/jbpm-human-task-services/src/test/java/org/jbpm/task/DeadlinesLocalTest.java
  207. 0 ...ask → jbpm-services}/jbpm-human-task-services/src/test/java/org/jbpm/task/EscalationBaseTest.java
  208. 0 ...task → jbpm-services}/jbpm-human-task-services/src/test/java/org/jbpm/task/LifeCycleBaseTest.java
  209. 0 ...ervices}/jbpm-human-task-services/src/test/java/org/jbpm/task/LifeCycleLocalCommandBasedTest.java
  210. 0 ...ask → jbpm-services}/jbpm-human-task-services/src/test/java/org/jbpm/task/LifeCycleLocalTest.java
  211. 0 ...uman-task → jbpm-services}/jbpm-human-task-services/src/test/java/org/jbpm/task/MockUserInfo.java
  212. 0 ...uman-task → jbpm-services}/jbpm-human-task-services/src/test/java/org/jbpm/task/MvelFilePath.java
  213. 0 ...m-human-task → jbpm-services}/jbpm-human-task-services/src/test/java/org/jbpm/task/NoCDITest.java
  214. 0 ...-task → jbpm-services}/jbpm-human-task-services/src/test/java/org/jbpm/task/SubTasksBaseTest.java
  215. 0 ...task → jbpm-services}/jbpm-human-task-services/src/test/java/org/jbpm/task/SubTasksLocalTest.java
  216. 0 ...s}/jbpm-human-task-services/src/test/java/org/jbpm/task/identity/DBUserGroupCallbackImplTest.java
  217. 0 .../jbpm-human-task-services/src/test/java/org/jbpm/task/identity/LDAPUserGroupCallbackImplTest.java
  218. 0 ...services}/jbpm-human-task-services/src/test/java/org/jbpm/task/identity/LDAPUserInfoImplTest.java
  219. 0 ...ervices/jbpm-human-task-services}/src/test/java/org/jbpm/task/internals/TaskDatabaseProducer.java
  220. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/test/resources/META-INF/beans.xml
  221. 0 ...k-workitems → jbpm-services/jbpm-human-task-services}/src/test/resources/META-INF/persistence.xml
  222. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/test/resources/beans-commandbased.xml
  223. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/test/resources/beans-deadlines.xml
  224. 0 ...k → jbpm-services}/jbpm-human-task-services/src/test/resources/jbpm.usergroup.callback.properties
  225. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/test/resources/jndi.properties
  226. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/test/resources/ldap-config.ldif
  227. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-services/src/test/resources/log4j.xml
  228. 0 ...jbpm-human-task-services/src/test}/resources/org/jbpm/task/identity/UserGroupsAssignmentsOne.mvel
  229. 0 .../jbpm-human-task-services/src/test/resources/org/jbpm/task/identity/UserGroupsAssignmentsTwo.mvel
  230. 0 ...-human-task-services/src/test/resources/org/jbpm/task/identity/jbpm.usergroup.callback.properties
  231. 0 ...}/jbpm-human-task-services/src/test/resources/org/jbpm/task/service/DeadlineWithNotification.mvel
  232. 0 ...ervices/src/test/resources/org/jbpm/task/service/DeadlineWithNotificationContentSingleObject.mvel
  233. 0 ...}/jbpm-human-task-services/src/test/resources/org/jbpm/task/service/DeadlineWithReassignment.mvel
  234. 0 ...ices}/jbpm-human-task-services/src/test/resources/org/jbpm/task/service/QueryData_TasksOwned.mvel
  235. 0 ...m-human-task-services/src/test/resources/org/jbpm/task/service/QueryData_TasksPotentialOwner.mvel
  236. 0 ...-human-task-services/src/test/resources/org/jbpm/task/service/QueryData_UnescalatedDeadlines.mvel
  237. 0 ...task-services/src/test/resources/org/jbpm/task/service/QueryResults_PeopleAssignmentQuerries.mvel
  238. 0 ...uman-task-services/src/test/resources/org/jbpm/task/service/QueryResults_TasksOwnedInEnglish.mvel
  239. 0 ...human-task-services/src/test/resources/org/jbpm/task/service/QueryResults_TasksOwnedInGerman.mvel
  240. +1 −1 {jbpm-human-task → jbpm-services}/jbpm-human-task-workitems/pom.xml
  241. 0 ...ervices}/jbpm-human-task-workitems/src/main/java/org/jbpm/task/wih/AbstractHTWorkItemHandler.java
  242. 0 ...bpm-services}/jbpm-human-task-workitems/src/main/java/org/jbpm/task/wih/CDIHTWorkItemHandler.java
  243. 0 ...ervices}/jbpm-human-task-workitems/src/main/java/org/jbpm/task/wih/ExternalTaskEventListener.java
  244. 0 ...services}/jbpm-human-task-workitems/src/main/java/org/jbpm/task/wih/GenericHTWorkItemHandler.java
  245. 0 ...an-task-services → jbpm-services/jbpm-human-task-workitems}/src/main/resources/META-INF/beans.xml
  246. 0 ...rvices/jbpm-human-task-workitems}/src/test/java/org/jbpm/task/internals/TaskDatabaseProducer.java
  247. 0 ...an-task → jbpm-services}/jbpm-human-task-workitems/src/test/java/org/jbpm/task/test/MyObject.java
  248. 0 ...ces}/jbpm-human-task-workitems/src/test/java/org/jbpm/task/test/TestStatefulKnowledgeSession.java
  249. 0 ...ervices}/jbpm-human-task-workitems/src/test/java/org/jbpm/task/wih/HTWorkItemHandlerBaseTest.java
  250. 0 ...services}/jbpm-human-task-workitems/src/test/java/org/jbpm/task/wih/HTWorkItemHandlerCDITest.java
  251. 0 ...rvices}/jbpm-human-task-workitems/src/test/java/org/jbpm/task/wih/HTWorkItemHandlerNOCDITest.java
  252. 0 {jbpm-human-task → jbpm-services}/jbpm-human-task-workitems/src/test/resources/META-INF/beans.xml
  253. 0 ...k-services → jbpm-services/jbpm-human-task-workitems}/src/test/resources/META-INF/persistence.xml
  254. +81 −0 jbpm-services/pom.xml
  255. +1 −0 pom.xml
View
12 jbpm-human-task/jbpm-human-task-services/.gitignore
@@ -1,12 +0,0 @@
-/target
-/bin
-
-# Eclipse, Netbeans and IntelliJ files
-/.*
-!.gitignore
-/nbproject
-/*.ipr
-/*.iws
-/*.iml
-
-# Test data
View
10 jbpm-human-task/jbpm-human-task-workitems/.gitignore
@@ -1,10 +0,0 @@
-/target
-/local
-
-# Eclipse, Netbeans and IntelliJ files
-/.*
-!.gitignore
-/nbproject
-/*.ipr
-/*.iws
-/*.iml
View
2 jbpm-human-task/pom.xml
@@ -13,8 +13,6 @@
<packaging>pom</packaging>
<modules>
- <module>jbpm-human-task-services</module>
- <module>jbpm-human-task-workitems</module>
<module>jbpm-human-task-core</module>
<module>jbpm-human-task-hornetq</module>
<module>jbpm-human-task-mina</module>
View
163 jbpm-services/droolsjbpm-knowledge-services/pom.xml
@@ -0,0 +1,163 @@
+<?xml version="1.0"?>
+<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-services</artifactId>
+ <version>6.0.0-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jbpm</groupId>
+ <artifactId>droolsjbpm-knowledge-services</artifactId>
+ <version>0.1-SNAPSHOT</version>
@ge0ffrey
Drools and jBPM member
ge0ffrey added a note Nov 6, 2012

Because it's part of the jbpm repo, it should use the jbpm version (so basically, don't declare a version)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ <name>Drools jBPM :: Knowledge Services</name>
+
+ <properties>
+ <jbpm.version>6.0.0-SNAPSHOT</jbpm.version>
+ <drools.version>6.0.0-SNAPSHOT</drools.version>
+ <seam.version>3.1.0.Final</seam.version>
+ <weld.version>1.1.8.Final</weld.version>
+ <hibernate-core.version>3.3.2.GA</hibernate-core.version>
+ <hibernate-em.version>3.4.0.GA</hibernate-em.version>
+ <arquillian.version>1.0.1.Final</arquillian.version>
+ <arquillian_weld.version>1.0.0.CR3</arquillian_weld.version>
+ <com.h2database.version>[1.3.166,)</com.h2database.version>
@ge0ffrey
Drools and jBPM member
ge0ffrey added a note Nov 6, 2012

All these version should be inheritend from the droolsjbpm-parent pom, so they are in sync with the rest of droolsbjbpm.

If jbpm-services uses a different weld version than drools-compiler or guvnor this can cause serious compatibility issues to our users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.10</version>
+ <scope>test</scope>
@ge0ffrey
Drools and jBPM member
ge0ffrey added a note Nov 6, 2012

The droolsjbpm-parent pom already adds the junit dependency in scope test automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-human-task-services</artifactId>
+ <version>${jbpm.version}</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-human-task-workitems</artifactId>
+ <version>${jbpm.version}</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>1.4</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jbpm</groupId>
+ <artifactId>jbpm-bpmn2</artifactId>
+ <version>${jbpm.version}</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.seam.persistence</groupId>
+ <artifactId>seam-persistence</artifactId>
+ <version>${seam.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.weld</groupId>
+ <artifactId>weld-core</artifactId>
+ <version>${weld.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <version>1.0-SP4</version>
@ge0ffrey
Drools and jBPM member
ge0ffrey added a note Nov 6, 2012

All such versions should be declared in the dependencyManagement of the droolsjbpm-parent pom (see droolsjbpm-build-bootstrap/pom.xml). No other pom should have a <version> element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <version>${hibernate-em.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ <version>${hibernate-core.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>knowledge-api</artifactId>
+ <version>${drools.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.drools</groupId>
+ <artifactId>drools-core</artifactId>
+ <version>${drools.version}</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.mvel</groupId>
+ <artifactId>mvel2</artifactId>
+ <version>2.1.3.Final</version>
+ <type>jar</type>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-core</artifactId>
+ <version>4.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-queryparser</artifactId>
+ <version>4.0.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-analyzers-common</artifactId>
+ <version>4.0.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.junit</groupId>
+ <artifactId>arquillian-junit-container</artifactId>
+ <version>1.0.3.Final</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.arquillian.container</groupId>
+ <artifactId>arquillian-weld-se-embedded-1.1</artifactId>
+ <version>1.0.0.CR4</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>${com.h2database.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>2.2</version>
+ <type>jar</type>
+ </dependency>
+ </dependencies>
+ <!-- Repositories -->
+ <repositories>
+ <repository>
+ <id>jboss-public-repository-group</id>
+ <name>JBoss Public Repository Group</name>
+ <url>http://repository.jboss.org/nexus/content/groups/public/</url>
+ <layout>default</layout>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>daily</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
@ge0ffrey
Drools and jBPM member
ge0ffrey added a note Nov 6, 2012

the top level pom in this repo (jbpm's pom.xml) already declares the repositories element

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+
+</project>
View
24 ...owledge-services/src/main/java/org/droolsjbpm/services/api/KnowledgeAdminDataService.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.api;
+
+/**
+ *
+ * @author salaboy
+ */
+public interface KnowledgeAdminDataService {
+ int removeAllData();
+}
View
51 ...pm-knowledge-services/src/main/java/org/droolsjbpm/services/api/KnowledgeDataService.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.api;
+
+import java.util.Collection;
+import org.droolsjbpm.services.impl.model.NodeInstanceDesc;
+import org.droolsjbpm.services.impl.model.ProcessDesc;
+import org.droolsjbpm.services.impl.model.ProcessInstanceDesc;
+import org.droolsjbpm.services.impl.model.VariableStateDesc;
+
+/**
+ *
+ * @author salaboy
+ */
+public interface KnowledgeDataService {
+ Collection<ProcessInstanceDesc> getProcessInstances();
+
+ Collection<ProcessInstanceDesc> getProcessInstancesBySessionId(String sessionId);
+
+ Collection<ProcessDesc> getProcessesBySessionId(String sessionId);
+
+ Collection<ProcessDesc> getProcesses();
+
+ ProcessInstanceDesc getProcessInstanceById(int sessionId, long processId);
+
+ Collection<NodeInstanceDesc> getProcessInstanceHistory(int sessionId, long processId);
+
+ Collection<NodeInstanceDesc> getProcessInstanceHistory(int sessionId, long processId, boolean completed);
+
+ Collection<NodeInstanceDesc> getProcessInstanceFullHistory(int sessionId, long processId);
+
+ Collection<NodeInstanceDesc> getProcessInstanceActiveNodes(int sessionId, long processId);
+
+ Collection<VariableStateDesc> getVariablesCurrentState(long processInstanceId);
+
+
+
+}
View
53 ...-knowledge-services/src/main/java/org/droolsjbpm/services/api/KnowledgeDomainService.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.api;
+
+import java.util.Collection;
+import java.util.Map;
+import org.drools.runtime.StatefulKnowledgeSession;
+
+/**
+ *
+ * @author salaboy
+ */
+public interface KnowledgeDomainService {
+
+ void registerSession(String businessKey, StatefulKnowledgeSession ksession);
+
+ StatefulKnowledgeSession getSession(long sessionId);
+
+ StatefulKnowledgeSession getSessionByBusinessKey(String businessKey);
+
+ Collection<StatefulKnowledgeSession> getSessions();
+
+ int getAmountOfSessions();
+
+ Collection<String> getSessionsNames();
+
+ Long getId();
+
+ void setId(Long id);
+
+ String getDomainName();
+
+ void setDomainName(String domainName);
+
+ Long getParentId();
+
+ void setParentId(Long parentId);
+
+ Map<String, String> getAvailableProcesses();
+}
View
24 ...roolsjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/api/SearchService.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.api;
+
+/**
+ *
+ * @author salaboy
+ */
+public class SearchService {
+
+}
View
25 ...oolsjbpm-knowledge-services/src/main/java/org/droolsjbpm/services/api/SessionLocator.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.api;
+
+/**
+ *
+ * @author salaboy
+ */
+public interface SessionLocator {
+ String getSessionName();
+ String getSessionAddress();
+}
View
37 ...-knowledge-services/src/main/java/org/droolsjbpm/services/api/bpmn2/BPMN2DataService.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.api.bpmn2;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import org.droolsjbpm.services.impl.model.ProcessDesc;
+import org.jbpm.task.TaskDef;
+
+/**
+ *
+ * @author salaboy
+ */
+public interface BPMN2DataService {
+ Map<String, String> getAssociatedEntities(String bpmn2Content);
+ List<String> getAssociatedDomainObjects(String bpmn2Content);
+ Map<String, String> getProcessData(String bpmn2Content);
+ List<String> getAssociatedForms(String bpmn2Content);
+ Collection<TaskDef> getAllTasksDef(String bpmn2Content);
+ ProcessDesc getProcessDesc(String bpmn2Content);
+ Map<String, String> getTaskInputMappings(String bpmn2Content, String taskName);
+ Map<String, String> getTaskOutputMappings(String bpmn2Content, String taskName);
+}
View
42 ...ge-services/src/main/java/org/droolsjbpm/services/impl/KnowledgeAdminDataServiceImpl.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import org.droolsjbpm.services.api.KnowledgeAdminDataService;
+import org.jboss.seam.transaction.Transactional;
+
+/**
+ *
+ * @author salaboy
+ */
+@Transactional
+@ApplicationScoped
+public class KnowledgeAdminDataServiceImpl implements KnowledgeAdminDataService{
+ @Inject EntityManager em;
+
+ public int removeAllData() {
+ int deleted = 0;
+ deleted += em.createQuery("delete from NodeInstanceDesc nid").executeUpdate();
+ deleted += em.createQuery("delete from ProcessInstanceDesc pid").executeUpdate();
+ deleted += em.createQuery("delete from ProcessDesc pd").executeUpdate();
+ deleted += em.createQuery("delete from VariableStateDesc vsd").executeUpdate();
+ return deleted;
+ }
+
+}
View
143 ...owledge-services/src/main/java/org/droolsjbpm/services/impl/KnowledgeDataServiceImpl.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import org.droolsjbpm.services.api.KnowledgeDataService;
+import org.droolsjbpm.services.api.SessionLocator;
+import org.droolsjbpm.services.impl.model.NodeInstanceDesc;
+import org.droolsjbpm.services.impl.model.ProcessDesc;
+import org.droolsjbpm.services.impl.model.ProcessInstanceDesc;
+import org.droolsjbpm.services.impl.model.VariableStateDesc;
+
+/**
+ *
+ * @author salaboy
+ */
+@ApplicationScoped
+public class KnowledgeDataServiceImpl implements KnowledgeDataService {
+
+ Map<String, SessionLocator> ksessionLocators = new HashMap<String, SessionLocator>();
+ @Inject
+ private EntityManager em;
+
+ @PostConstruct
+ public void init() {
+ }
+
+ public Collection<ProcessInstanceDesc> getProcessInstances() {
+ List<ProcessInstanceDesc> processInstances = em.createQuery("select pi FROM ProcessInstanceDesc pi where pi.pk = (select max(pid.pk) FROM ProcessInstanceDesc pid WHERE pid.id = pi.id ) ").getResultList();
+
+ return processInstances;
+ }
+
+ public Collection<ProcessInstanceDesc> getProcessInstancesBySessionId(String sessionId) {
+ List<ProcessInstanceDesc> processInstances = em.createQuery("select pi FROM ProcessInstanceDesc pi where pi.sessionId=:sessionId, pi.pk = (select max(pid.pk) FROM ProcessInstanceDesc pid WHERE pid.id = pi.id )")
+ .setParameter("sessionId", sessionId).getResultList();
+
+ return processInstances;
+ }
+
+ public Collection<ProcessDesc> getProcessesBySessionId(String sessionId) {
+ List<ProcessDesc> processes = em.createQuery("select pd from ProcessDesc pd where pd.sessionId=:sessionId GROUP BY pd.id ORDER BY pd.dataTimeStamp DESC")
+ .setParameter("sessionId", sessionId).getResultList();
+ return processes;
+ }
+
+ public Collection<ProcessDesc> getProcesses() {
+ List<ProcessDesc> processes = em.createQuery("select pd from ProcessDesc pd GROUP BY pd.id ORDER BY pd.dataTimeStamp DESC").getResultList();
+ return processes;
+ }
+
+ public ProcessInstanceDesc getProcessInstanceById(int sessionId, long processId) {
+ List<ProcessInstanceDesc> processInstances = em.createQuery("select pid from ProcessInstanceDesc pid where pid.id=:processId AND pid.sessionId=:sessionId ORDER BY pid.dataTimeStamp DESC")
+ .setParameter("processId", processId)
+ .setParameter("sessionId", sessionId)
+ .setMaxResults(1).getResultList();
+
+ return processInstances.get(0);
+ }
+
+ public Collection<NodeInstanceDesc> getProcessInstanceHistory(int sessionId, long processId) {
+ return getProcessInstanceHistory(sessionId, processId, false);
+ }
+
+ public Collection<VariableStateDesc> getVariablesCurrentState(long processInstanceId) {
+ List<VariableStateDesc> variablesState = em.createQuery("select vs FROM VariableStateDesc vs where vs.processInstanceId =:processInstanceId AND vs.pk = (select max(vss.pk) FROM VariableStateDesc vss WHERE vss.id = vs.id ) ")
+ .setParameter("processInstanceId", processInstanceId)
+ .getResultList();
+
+ return variablesState;
+ }
+
+ public Collection<NodeInstanceDesc> getProcessInstanceHistory(int sessionId, long processId, boolean completed) {
+ List<NodeInstanceDesc> nodeInstances = em.createQuery("select nid from NodeInstanceDesc nid where nid.processInstanceId=:processId AND nid.sessionId=:sessionId AND nid.completed =:completed ORDER BY nid.dataTimeStamp DESC")
+ .setParameter("processId", processId)
+ .setParameter("sessionId", sessionId)
+ .setParameter("completed", completed)
+ .getResultList();
+
+ return nodeInstances;
+ }
+
+ public Collection<NodeInstanceDesc> getProcessInstanceFullHistory(int sessionId, long processId) {
+ List<NodeInstanceDesc> nodeInstances = em.createQuery("select nid from NodeInstanceDesc nid where nid.processInstanceId=:processId AND nid.sessionId=:sessionId ORDER BY nid.dataTimeStamp DESC")
+ .setParameter("processId", processId)
+ .setParameter("sessionId", sessionId)
+ .getResultList();
+
+ return nodeInstances;
+ }
+
+ public Collection<NodeInstanceDesc> getProcessInstanceActiveNodes(int sessionId, long processId) {
+ List<NodeInstanceDesc> completedNodeInstances = em.createQuery("select nid from NodeInstanceDesc nid where nid.processInstanceId=:processId AND nid.sessionId=:sessionId AND nid.completed =:completed ORDER BY nid.dataTimeStamp DESC")
+ .setParameter("processId", processId)
+ .setParameter("sessionId", sessionId)
+ .setParameter("completed", true)
+ .getResultList();
+
+ List<NodeInstanceDesc> activeNodeInstances = em.createQuery("select nid from NodeInstanceDesc nid where nid.processInstanceId=:processId AND nid.sessionId=:sessionId AND nid.completed =:completed ORDER BY nid.dataTimeStamp DESC")
+ .setParameter("processId", processId)
+ .setParameter("sessionId", sessionId)
+ .setParameter("completed", false)
+ .getResultList();
+
+ List<NodeInstanceDesc> uncompletedNodeInstances = new ArrayList<NodeInstanceDesc>(activeNodeInstances.size() - completedNodeInstances.size());
+ for(NodeInstanceDesc nid : activeNodeInstances){
+ boolean completed = false;
+ for(NodeInstanceDesc cnid : completedNodeInstances){
+
+ if(nid.getNodeId() == cnid.getNodeId()){
+ completed = true;
+ }
+ }
+ if(!completed){
+ uncompletedNodeInstances.add(nid);
+ }
+ }
+
+
+ return uncompletedNodeInstances;
+ }
+}
View
167 ...ledge-services/src/main/java/org/droolsjbpm/services/impl/KnowledgeDomainServiceImpl.java
@@ -0,0 +1,167 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import org.apache.commons.io.IOUtils;
+import org.drools.KnowledgeBase;
+import org.drools.KnowledgeBaseFactory;
+import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderFactory;
+import org.drools.builder.ResourceType;
+import org.drools.io.impl.ByteArrayResource;
+import org.drools.io.impl.ClassPathResource;
+import org.drools.logger.KnowledgeRuntimeLoggerFactory;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.droolsjbpm.services.api.KnowledgeDomainService;
+import org.droolsjbpm.services.impl.event.listeners.CDIKbaseEventListener;
+import org.droolsjbpm.services.impl.event.listeners.CDIProcessEventListener;
+import org.jbpm.task.wih.CDIHTWorkItemHandler;
+import sun.reflect.generics.reflectiveObjects.NotImplementedException;
+
+/**
+ *
+ * @author salaboy
+ */
+@ApplicationScoped
+public class KnowledgeDomainServiceImpl implements KnowledgeDomainService{
+
+ private Map<String, StatefulKnowledgeSession> ksessions = new HashMap<String, StatefulKnowledgeSession>();
+
+ @Inject
+ private CDIHTWorkItemHandler handler;
+
+ @Inject
+ private CDIProcessEventListener processListener;
+
+ @Inject
+ private CDIKbaseEventListener kbaseEventListener;
+ // This must be replaced by the VFS
+ private Map<String, String> availableProcesses = new HashMap<String, String>();
+
+ private long id;
+ private String domainName;
+ private long parentId;
+
+ public KnowledgeDomainServiceImpl() {
+ this.id = 0;
+ this.domainName = "My Business Unit";
+ }
+
+
+
+ @PostConstruct
+ public void init(){
+ kbaseEventListener.setDomainName(domainName);
+ processListener.setDomainName(domainName);
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+ String processLocation = "example/humanTask.bpmn";
+ String processId = "org.jbpm.writedocument";
+
+
+ ClassPathResource classPathResource = new ClassPathResource(processLocation);
+
+ StringWriter writer = new StringWriter();
+ try {
+ IOUtils.copy(classPathResource.getInputStream(), writer, "UTF-8");
+ } catch (IOException ex) {
+ Logger.getLogger(KnowledgeDomainServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
+ }
+ String processString = writer.toString();
+ availableProcesses.put(processId, processString);
+
+ kbuilder.add(new ByteArrayResource(processString.getBytes()), ResourceType.BPMN2);
+
+ KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
+ kbase.addEventListener(kbaseEventListener);
+ kbase.addKnowledgePackages(kbuilder.getKnowledgePackages());
+ StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
+
+ ksession.addEventListener(processListener);
+ KnowledgeRuntimeLoggerFactory.newConsoleLogger(ksession);
+
+ handler.setSession(ksession);
+ handler.init();
+ ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
+
+ ksessions.put("default", ksession);
+
+
+
+ }
+
+ public void registerSession(String businessKey, StatefulKnowledgeSession ksession) {
+ ksessions.put(businessKey, ksession);
+ }
+
+ public StatefulKnowledgeSession getSession(long sessionId) {
+ throw new NotImplementedException();
+ }
+
+ public StatefulKnowledgeSession getSessionByBusinessKey(String businessKey) {
+ return ksessions.get(businessKey);
+ }
+
+ public Collection<StatefulKnowledgeSession> getSessions() {
+ return ksessions.values();
+ }
+
+ public Collection<String> getSessionsNames() {
+ return ksessions.keySet();
+ }
+
+ public int getAmountOfSessions() {
+ return ksessions.size();
+ }
+
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getDomainName() {
+ return domainName;
+ }
+
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+ public Long getParentId() {
+ return parentId;
+ }
+
+ public void setParentId(Long parentId) {
+ this.parentId = parentId;
+ }
+
+ public Map<String, String> getAvailableProcesses() {
+ return availableProcesses;
+ }
+
+}
View
126 ...jbpm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/SearchServiceImpl.java
@@ -0,0 +1,126 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import org.apache.lucene.analysis.core.SimpleAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.index.AtomicReader;
+import org.apache.lucene.index.DirectoryReader;
+import org.apache.lucene.index.Fields;
+import org.apache.lucene.index.IndexWriter;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.IndexableField;
+import org.apache.lucene.index.SlowCompositeReaderWrapper;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.index.TermsEnum;
+import org.apache.lucene.queryparser.classic.ParseException;
+import org.apache.lucene.queryparser.classic.QueryParser;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.ScoreDoc;
+import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.store.FSDirectory;
+import org.apache.lucene.util.Version;
+import org.droolsjbpm.services.impl.model.NodeInstanceDesc;
+
+
+/**
+ *
+ * @author salaboy
+ */
+public class SearchServiceImpl {
+
+ private IndexWriter iw = null;
+ private IndexSearcher is = null;
+
+ public SearchServiceImpl() {
+ try {
+ SimpleAnalyzer analyzer = new SimpleAnalyzer(Version.LUCENE_40);
+ iw = new IndexWriter(FSDirectory.open(new File("index/")), new IndexWriterConfig(Version.LUCENE_40, analyzer));
+ } catch (IOException ex) {
+ Logger.getLogger(SearchServiceImpl.class.getName()).log(Level.SEVERE, null, ex);
+ }
+
+ }
+
+ public void index(NodeInstanceDesc node) throws IOException {
+ Document d = new Document();
+
+ d.add(new StringField("processName", node.getName(), Field.Store.YES));
+ d.add(new StringField("nodeId", String.valueOf(node.getNodeId()), Field.Store.YES));
+ d.add(new StringField("processInstanceId", String.valueOf(node.getProcessInstanceId()), Field.Store.YES));
+ d.add(new StringField("sessionId", String.valueOf(node.getSessionId()), Field.Store.YES));
+ //d.add(new TextField()); if I need to store large texts that requires tokenization
+ // To support any value search
+ d.add(new StringField("all", String.valueOf(node.getSessionId()), Field.Store.NO));
+ d.add(new StringField("all", String.valueOf(node.getProcessInstanceId()), Field.Store.NO));
+ d.add(new StringField("all", String.valueOf(node.getNodeId()), Field.Store.NO));
+ d.add(new StringField("all", String.valueOf(node.getName()), Field.Store.NO));
+ // for suggestion
+ d.add(new StringField("suggest", node.getName(), Field.Store.NO));
+
+ iw.updateDocument(new Term("processName"), d);
+
+ DirectoryReader ireader = DirectoryReader.open(iw, true);
+ is = new IndexSearcher(ireader);
+
+ // iw.commit(); this should be executed ever X minutes
+
+ }
+
+ public void commit() throws IOException{
+ iw.commit();
+ }
+
+ // q= nodeId:1 OR sessionId:10
+ // q= 1234324
+ public List<Map<String, String>> search(String query, int nroOfResults) throws ParseException, IOException {
+ SimpleAnalyzer analyzer = new SimpleAnalyzer(Version.LUCENE_40);
+
+ QueryParser parser = new QueryParser(Version.LUCENE_40, "all", analyzer);
+ TopDocs search = is.search(parser.parse(query), nroOfResults);
+ List<Map<String, String>> docs = new ArrayList<Map<String, String>>(search.scoreDocs.length);
+ for(ScoreDoc d : search.scoreDocs){
+ Document doc = is.doc(d.doc);
+ Map<String, String> myDoc = new HashMap<String, String>();
+ for(IndexableField f : doc){
+ myDoc.put(f.name(), f.stringValue());
+ }
+ docs.add(myDoc);
+ }
+ return docs;
+
+ }
+
+//
+// public List<String> suggest(String query) throws IOException{
+// AtomicReader ar = SlowCompositeReaderWrapper.wrap(is.getIndexReader());
+// Fields fields = ar.fields();
+// TermsEnum iterator = fields.terms("suggest").iterator(null);
+//
+//
+//
+// }
+}
View
34 ...bpm-knowledge-services/src/main/java/org/droolsjbpm/services/impl/SessionLocatorImpl.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl;
+
+import org.droolsjbpm.services.api.SessionLocator;
+
+/**
+ *
+ * @author salaboy
+ */
+public class SessionLocatorImpl implements SessionLocator{
+
+ public String getSessionName() {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ public String getSessionAddress() {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+}
View
206 ...ledge-services/src/main/java/org/droolsjbpm/services/impl/bpmn2/BPMN2DataServiceImpl.java
@@ -0,0 +1,206 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl.bpmn2;
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.PostConstruct;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import org.drools.builder.KnowledgeBuilder;
+import org.drools.builder.KnowledgeBuilderFactory;
+import org.drools.builder.ResourceType;
+import org.drools.compiler.BPMN2ProcessFactory;
+import org.drools.compiler.BPMN2ProcessProvider;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.io.impl.ByteArrayResource;
+import org.droolsjbpm.services.api.bpmn2.BPMN2DataService;
+import org.droolsjbpm.services.impl.model.ProcessDesc;
+import org.droolsjbpm.services.impl.model.VariableStateDesc;
+import org.jbpm.task.TaskDef;
+import org.jbpm.task.api.TaskServiceEntryPoint;
+
+/**
+ *
+ * @author salaboy
+ */
+@ApplicationScoped
+public class BPMN2DataServiceImpl implements BPMN2DataService {
+
+ @Inject
+ private TaskServiceEntryPoint taskService;
+ @Inject
+ private BPMN2DataServiceSemanticModule module;
+ private BPMN2ProcessProvider provider;
+
+ @Inject
+ private ProcessDescRepoHelper repo;
+
+ public BPMN2DataServiceImpl() {
+ }
+
+ @PostConstruct
+ public void init() {
+ module.setRepo(repo);
+ provider = new BPMN2ProcessProvider() {
+ @Override
+ public void configurePackageBuilder(PackageBuilder packageBuilder) {
+ PackageBuilderConfiguration conf = packageBuilder.getPackageBuilderConfiguration();
+ if (conf.getSemanticModules().getSemanticModule("http://www.jboss.org/bpmn2-data-services") == null) {
+ conf.addSemanticModule(module);
+ }
+ }
+ };
+ }
+
+ public Map<String, String> getTaskInputMappings(String bpmn2Content, String taskName){
+ if (bpmn2Content == null || "".equals(bpmn2Content)) {
+ throw new IllegalStateException("The Process Content cannot be Empty!");
+ }
+ BPMN2ProcessProvider originalProvider = BPMN2ProcessFactory.getBPMN2ProcessProvider();
+ if (originalProvider != provider) {
+ BPMN2ProcessFactory.setBPMN2ProcessProvider(provider);
+ }
+
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+
+ kbuilder.add(new ByteArrayResource(bpmn2Content.getBytes()), ResourceType.BPMN2);
+ if (kbuilder.hasErrors()) {
+ throw new IllegalStateException("Process Cannot be Parsed!");
+ }
+
+ BPMN2ProcessFactory.setBPMN2ProcessProvider(originalProvider);
+
+ return repo.getTaskInputMappings().get(taskName);
+ }
+
+ public Map<String, String> getTaskOutputMappings(String bpmn2Content, String taskName){
+ if (bpmn2Content == null || "".equals(bpmn2Content)) {
+ throw new IllegalStateException("The Process Content cannot be Empty!");
+ }
+ BPMN2ProcessProvider originalProvider = BPMN2ProcessFactory.getBPMN2ProcessProvider();
+ if (originalProvider != provider) {
+ BPMN2ProcessFactory.setBPMN2ProcessProvider(provider);
+ }
+
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+
+ kbuilder.add(new ByteArrayResource(bpmn2Content.getBytes()), ResourceType.BPMN2);
+ if (kbuilder.hasErrors()) {
+ throw new IllegalStateException("Process Cannot be Parsed!");
+ }
+
+ BPMN2ProcessFactory.setBPMN2ProcessProvider(originalProvider);
+
+ return repo.getTaskOutputMappings().get(taskName);
+ }
+
+
+ public Collection<TaskDef> getAllTasksDef(String bpmn2Content){
+ if (bpmn2Content == null || "".equals(bpmn2Content)) {
+ throw new IllegalStateException("The Process Content cannot be Empty!");
+ }
+ BPMN2ProcessProvider originalProvider = BPMN2ProcessFactory.getBPMN2ProcessProvider();
+ if (originalProvider != provider) {
+ BPMN2ProcessFactory.setBPMN2ProcessProvider(provider);
+ }
+
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+
+ kbuilder.add(new ByteArrayResource(bpmn2Content.getBytes()), ResourceType.BPMN2);
+ if (kbuilder.hasErrors()) {
+ throw new IllegalStateException("Process Cannot be Parsed!");
+ }
+
+ BPMN2ProcessFactory.setBPMN2ProcessProvider(originalProvider);
+
+ return repo.getTasks().values();
+ }
+
+ public Map<String, String> getAssociatedEntities(String bpmn2Content) {
+ if (bpmn2Content == null || "".equals(bpmn2Content)) {
+ throw new IllegalStateException("The Process Content cannot be Empty!");
+ }
+ BPMN2ProcessProvider originalProvider = BPMN2ProcessFactory.getBPMN2ProcessProvider();
+ if (originalProvider != provider) {
+ BPMN2ProcessFactory.setBPMN2ProcessProvider(provider);
+ }
+
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+
+ kbuilder.add(new ByteArrayResource(bpmn2Content.getBytes()), ResourceType.BPMN2);
+ if (kbuilder.hasErrors()) {
+ throw new IllegalStateException("Process Cannot be Parsed!");
+ }
+
+ BPMN2ProcessFactory.setBPMN2ProcessProvider(originalProvider);
+
+ return repo.getTaskAssignments();
+ }
+
+ public List<String> getAssociatedDomainObjects(String bpmn2Content) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ public Map<String, String> getProcessData(String bpmn2Content) {
+ if (bpmn2Content == null || "".equals(bpmn2Content)) {
+ throw new IllegalStateException("The Process Content cannot be Empty!");
+ }
+ BPMN2ProcessProvider originalProvider = BPMN2ProcessFactory.getBPMN2ProcessProvider();
+ if (originalProvider != provider) {
+ BPMN2ProcessFactory.setBPMN2ProcessProvider(provider);
+ }
+
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+
+ kbuilder.add(new ByteArrayResource(bpmn2Content.getBytes()), ResourceType.BPMN2);
+ if (kbuilder.hasErrors()) {
+ throw new IllegalStateException("Process Cannot be Parsed!");
+ }
+
+ BPMN2ProcessFactory.setBPMN2ProcessProvider(originalProvider);
+
+ return repo.getInputs();
+ }
+
+ public List<String> getAssociatedForms(String processId) {
+ throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
+ }
+
+ public ProcessDesc getProcessDesc(String bpmn2Content){
+ if (bpmn2Content == null || "".equals(bpmn2Content)) {
+ throw new IllegalStateException("The Process Content cannot be Empty!");
+ }
+ BPMN2ProcessProvider originalProvider = BPMN2ProcessFactory.getBPMN2ProcessProvider();
+ if (originalProvider != provider) {
+ BPMN2ProcessFactory.setBPMN2ProcessProvider(provider);
+ }
+
+ KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
+
+ kbuilder.add(new ByteArrayResource(bpmn2Content.getBytes()), ResourceType.BPMN2);
+ if (kbuilder.hasErrors()) {
+ throw new IllegalStateException("Process Cannot be Parsed!");
+ }
+
+ BPMN2ProcessFactory.setBPMN2ProcessProvider(originalProvider);
+
+ return repo.getProcess();
+ }
+
+}
View
56 ...ices/src/main/java/org/droolsjbpm/services/impl/bpmn2/BPMN2DataServiceSemanticModule.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2011 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl.bpmn2;
+
+import javax.annotation.PostConstruct;
+import javax.inject.Inject;
+import org.jbpm.bpmn2.xml.BPMNSemanticModule;
+
+public class BPMN2DataServiceSemanticModule extends BPMNSemanticModule {
+
+
+ private ProcessDescRepoHelper repo;
+
+ @Inject
+ private HumanTaskGetInformationHandler taskHandler;
+ @Inject
+ private ProcessGetInformationHandler processHandler;
+ @Inject
+ private ProcessGetInputHandler processInputHandler;
+
+ public BPMN2DataServiceSemanticModule() {
+ super();
+
+ }
+
+ @PostConstruct
+ public void init(){
+
+ addHandler("userTask", taskHandler);
+ addHandler("process", processHandler);
+ addHandler("property", processInputHandler);
+ }
+
+ public void setRepo(ProcessDescRepoHelper repo) {
+ this.repo = repo;
+ taskHandler.setRepo(repo);
+ processHandler.setRepo(repo);
+ processInputHandler.setRepo(repo);
+ }
+
+
+
+}
View
103 ...ices/src/main/java/org/droolsjbpm/services/impl/bpmn2/HumanTaskGetInformationHandler.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2011 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl.bpmn2;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+
+import org.jbpm.bpmn2.xml.UserTaskHandler;
+import org.jbpm.task.TaskDef;
+import org.jbpm.task.api.TaskServiceEntryPoint;
+import org.jbpm.workflow.core.node.HumanTaskNode;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+
+@ApplicationScoped
+public class HumanTaskGetInformationHandler extends UserTaskHandler {
+
+ private ProcessDescRepoHelper repo;
+
+ /**
+ * Creates a new {@link HumanTaskGetInformationHandler} instance.
+ *
+ * @param humanTaskRepository the {@link HumanTaskRepository}.
+ */
+ public HumanTaskGetInformationHandler() {
+ }
+
+ /**
+ * Reads the io specification and put the information in the
+ * {@link HumanTaskRepository}.
+ */
+ @Override
+ protected void readIoSpecification(org.w3c.dom.Node xmlNode,
+ Map<String, String> dataInputs, Map<String, String> dataOutputs) {
+ dataInputs.clear();
+ dataOutputs.clear();
+
+ org.w3c.dom.Node subNode = xmlNode.getFirstChild();
+ while (subNode instanceof Element) {
+ String subNodeName = subNode.getNodeName();
+ if ("dataInput".equals(subNodeName)) {
+ String id = ((Element) subNode).getAttribute("id");
+ String inputName = ((Element) subNode).getAttribute("name");
+ dataInputs.put(id, inputName);
+ }
+ if ("dataOutput".equals(subNodeName)) {
+ String id = ((Element) subNode).getAttribute("id");
+ String outputName = ((Element) subNode).getAttribute("name");
+ dataOutputs.put(id, outputName);
+ }
+ subNode = subNode.getNextSibling();
+ }
+ NamedNodeMap map = xmlNode.getParentNode().getAttributes();
+ Node nodeName = map.getNamedItem("name");
+ String name = nodeName.getNodeValue();
+ TaskDef task = new TaskDef();
+ task.setName(name);
+
+ Map<String, String> inputParams = new HashMap<String, String>();
+
+
+ for (Map.Entry<String, String> in : dataInputs.entrySet()) {
+ inputParams.put(in.getKey(), in.getValue());
+
+ }
+ Map<String, String> outputParams = new HashMap<String, String>();
+ for (Map.Entry<String, String> out : dataOutputs.entrySet()) {
+ outputParams.put(out.getKey(), out.getValue());
+ }
+
+ repo.getTasks().put(task.getName(), task);
+ repo.getTaskInputMappings().put(task.getName(), inputParams);
+ repo.getTaskOutputMappings().put(task.getName(), outputParams);
+ }
+
+ @Override
+ protected String readPotentialOwner(org.w3c.dom.Node xmlNode, HumanTaskNode humanTaskNode) {
+ String userOrGroup = xmlNode.getFirstChild().getFirstChild().getFirstChild().getTextContent();
+ repo.getTaskAssignments().put(humanTaskNode.getName(), userOrGroup);
+ return userOrGroup;
+ }
+
+ public void setRepo(ProcessDescRepoHelper repo) {
+ this.repo = repo;
+ }
+}
View
67 ...edge-services/src/main/java/org/droolsjbpm/services/impl/bpmn2/ProcessDescRepoHelper.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl.bpmn2;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.droolsjbpm.services.impl.model.ProcessDesc;
+import org.jbpm.task.TaskDef;
+
+/**
+ *
+ * @author salaboy
+ */
+public class ProcessDescRepoHelper {
+
+ private ProcessDesc process;
+ private Map<String, TaskDef> tasks = new HashMap<String, TaskDef>();
+ private Map<String, Map<String, String>> taskInputMappings = new HashMap<String, Map<String, String>>();
+ private Map<String, Map<String, String>> taskOutputMappings = new HashMap<String, Map<String, String>>();
+ private Map<String, String> inputs = new HashMap<String, String>();
+ private Map<String, String> taskAssignments = new HashMap<String, String>();
+
+ public ProcessDescRepoHelper() {
+ }
+
+ public void setProcess(ProcessDesc process) {
+ this.process = process;
+ }
+
+
+ public ProcessDesc getProcess() {
+ return process;
+ }
+
+ public Map<String, TaskDef> getTasks() {
+ return tasks;
+ }
+
+ public Map<String, Map<String, String>> getTaskInputMappings() {
+ return taskInputMappings;
+ }
+
+ public Map<String, Map<String, String>> getTaskOutputMappings() {
+ return taskOutputMappings;
+ }
+
+ public Map<String, String> getInputs() {
+ return inputs;
+ }
+
+ public Map<String, String> getTaskAssignments() {
+ return taskAssignments;
+ }
+}
View
59 ...rvices/src/main/java/org/droolsjbpm/services/impl/bpmn2/ProcessGetInformationHandler.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2011 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl.bpmn2;
+
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import org.drools.xml.ExtensibleXmlParser;
+import org.droolsjbpm.services.impl.model.ProcessDesc;
+import org.jboss.seam.transaction.Transactional;
+import org.jbpm.bpmn2.xml.ProcessHandler;
+import org.jbpm.task.api.TaskServiceEntryPoint;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+@Transactional
+public class ProcessGetInformationHandler extends ProcessHandler {
+
+ @Inject
+ private TaskServiceEntryPoint taskService;
+ @Inject
+ private EntityManager em;
+ private ProcessDescRepoHelper repo;
+
+ public ProcessGetInformationHandler() {
+ }
+
+ @Override
+ public Object start(String uri, String localName, Attributes attrs,
+ ExtensibleXmlParser parser) throws SAXException {
+ final String processId = attrs.getValue("id");
+ final String processName = attrs.getValue("name");
+ final String packageName = attrs.getValue("http://www.jboss.org/drools", "packageName");
+ final String processType = attrs.getValue("type");
+ final String namespace = attrs.getValue("namespace");
+ final String version = attrs.getValue("version");
+
+ repo.setProcess(new ProcessDesc(processId, processName, version, packageName, processType, "", namespace, ""));
+
+ return super.start(uri, localName, attrs, parser);
+ }
+
+
+ public void setRepo(ProcessDescRepoHelper repo) {
+ this.repo = repo;
+ }
+}
View
54 ...dge-services/src/main/java/org/droolsjbpm/services/impl/bpmn2/ProcessGetInputHandler.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2011 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl.bpmn2;
+
+import org.drools.xml.ExtensibleXmlParser;
+import org.drools.xml.Handler;
+import org.jbpm.bpmn2.xml.PropertyHandler;
+import org.jbpm.process.core.context.variable.Variable;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+
+
+public class ProcessGetInputHandler extends PropertyHandler implements Handler {
+
+
+ private ProcessDescRepoHelper repo;
+
+ public ProcessGetInputHandler() {
+ super();
+
+ }
+
+ @Override
+ public Object start(final String uri, final String localName,
+ final Attributes attrs, final ExtensibleXmlParser parser)
+ throws SAXException {
+ Object result = super.start(uri, localName, attrs, parser);
+ if(result instanceof Variable){
+ repo.getInputs().put(((Variable)result).getName(), ((Variable)result).getType().getStringType());
+ }
+
+ return result;
+ }
+
+ public void setRepo(ProcessDescRepoHelper repo) {
+ this.repo = repo;
+ }
+
+
+}
View
139 ...ces/src/main/java/org/droolsjbpm/services/impl/event/listeners/CDIKbaseEventListener.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl.event.listeners;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import org.drools.event.knowledgebase.AfterFunctionRemovedEvent;
+import org.drools.event.knowledgebase.AfterKnowledgeBaseLockedEvent;
+import org.drools.event.knowledgebase.AfterKnowledgeBaseUnlockedEvent;
+import org.drools.event.knowledgebase.AfterKnowledgePackageAddedEvent;
+import org.drools.event.knowledgebase.AfterKnowledgePackageRemovedEvent;
+import org.drools.event.knowledgebase.AfterProcessAddedEvent;
+import org.drools.event.knowledgebase.AfterProcessRemovedEvent;
+import org.drools.event.knowledgebase.AfterRuleAddedEvent;
+import org.drools.event.knowledgebase.AfterRuleRemovedEvent;
+import org.drools.event.knowledgebase.BeforeFunctionRemovedEvent;
+import org.drools.event.knowledgebase.BeforeKnowledgeBaseLockedEvent;
+import org.drools.event.knowledgebase.BeforeKnowledgeBaseUnlockedEvent;
+import org.drools.event.knowledgebase.BeforeKnowledgePackageAddedEvent;
+import org.drools.event.knowledgebase.BeforeKnowledgePackageRemovedEvent;
+import org.drools.event.knowledgebase.BeforeProcessAddedEvent;
+import org.drools.event.knowledgebase.BeforeProcessRemovedEvent;
+import org.drools.event.knowledgebase.BeforeRuleAddedEvent;
+import org.drools.event.knowledgebase.BeforeRuleRemovedEvent;
+import org.drools.event.knowledgebase.KnowledgeBaseEventListener;
+import org.jboss.seam.transaction.Transactional;
+import org.drools.definition.process.Process;
+import org.droolsjbpm.services.impl.helpers.ProcessDescFactory;
+/**
+ *
+ * @author salaboy
+ */
+@Transactional
+@ApplicationScoped
+public class CDIKbaseEventListener implements KnowledgeBaseEventListener{
+
+ @Inject
+ private EntityManager em;
+
+ private String domainName;
+
+ public void beforeKnowledgePackageAdded(BeforeKnowledgePackageAddedEvent bkpae) {
+
+ }
+
+ public void afterKnowledgePackageAdded(AfterKnowledgePackageAddedEvent akpae) {
+
+ }
+
+ public void beforeKnowledgePackageRemoved(BeforeKnowledgePackageRemovedEvent bkpre) {
+
+ }
+
+ public void afterKnowledgePackageRemoved(AfterKnowledgePackageRemovedEvent akpre) {
+
+ }
+
+ public void beforeKnowledgeBaseLocked(BeforeKnowledgeBaseLockedEvent bkble) {
+
+ }
+
+ public void afterKnowledgeBaseLocked(AfterKnowledgeBaseLockedEvent akble) {
+
+ }
+
+ public void beforeKnowledgeBaseUnlocked(BeforeKnowledgeBaseUnlockedEvent bkbue) {
+
+ }
+
+ public void afterKnowledgeBaseUnlocked(AfterKnowledgeBaseUnlockedEvent akbue) {
+
+ }
+
+ public void beforeRuleAdded(BeforeRuleAddedEvent brae) {
+
+ }
+
+ public void afterRuleAdded(AfterRuleAddedEvent arae) {
+
+ }
+
+ public void beforeRuleRemoved(BeforeRuleRemovedEvent brre) {
+
+ }
+
+ public void afterRuleRemoved(AfterRuleRemovedEvent arre) {
+
+ }
+
+ public void beforeFunctionRemoved(BeforeFunctionRemovedEvent bfre) {
+
+ }
+
+ public void afterFunctionRemoved(AfterFunctionRemovedEvent afre) {
+
+ }
+
+ public void beforeProcessAdded(BeforeProcessAddedEvent bpae) {
+
+ }
+
+ public void afterProcessAdded(AfterProcessAddedEvent apae) {
+ Process process = apae.getProcess();
+ em.persist(ProcessDescFactory.newProcessDesc(this.domainName, process));
+ }
+
+ public void beforeProcessRemoved(BeforeProcessRemovedEvent bpre) {
+
+ }
+
+ public void afterProcessRemoved(AfterProcessRemovedEvent apre) {
+
+ }
+
+ public String getDomainName() {
+ return domainName;
+ }
+
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+
+
+}
View
120 ...s/src/main/java/org/droolsjbpm/services/impl/event/listeners/CDIProcessEventListener.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl.event.listeners;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.persistence.EntityManager;
+import org.drools.event.process.ProcessCompletedEvent;
+import org.drools.event.process.ProcessEventListener;
+import org.drools.event.process.ProcessNodeLeftEvent;
+import org.drools.event.process.ProcessNodeTriggeredEvent;
+import org.drools.event.process.ProcessStartedEvent;
+import org.drools.event.process.ProcessVariableChangedEvent;
+import org.drools.runtime.StatefulKnowledgeSession;
+import org.drools.runtime.process.NodeInstance;
+import org.drools.runtime.process.ProcessInstance;
+import org.droolsjbpm.services.impl.helpers.NodeInstanceDescFactory;
+import org.droolsjbpm.services.impl.helpers.ProcessInstanceDescFactory;
+import org.droolsjbpm.services.impl.model.VariableStateDesc;
+import org.jboss.seam.transaction.Transactional;
+
+/**
+ *
+ * @author salaboy
+ */
+@ApplicationScoped // This should be something like DomainScoped
+@Transactional
+public class CDIProcessEventListener implements ProcessEventListener {
+ @Inject
+ private EntityManager em;
+
+ private String domainName;
+
+ public CDIProcessEventListener() {
+ }
+
+
+
+ public void beforeProcessStarted(ProcessStartedEvent pse) {
+ //do nothing
+ ProcessInstance processInstance = pse.getProcessInstance();
+ int sessionId = ((StatefulKnowledgeSession)pse.getKnowledgeRuntime()).getId();
+ em.persist(ProcessInstanceDescFactory.newProcessInstanceDesc(domainName, sessionId, processInstance));
+ }
+
+ public void afterProcessStarted(ProcessStartedEvent pse) {
+
+ }
+
+ public void beforeProcessCompleted(ProcessCompletedEvent pce) {
+ //do nothing
+ ProcessInstance processInstance = pce.getProcessInstance();
+ int sessionId = ((StatefulKnowledgeSession)pce.getKnowledgeRuntime()).getId();
+ em.persist(ProcessInstanceDescFactory.newProcessInstanceDesc(domainName, sessionId, processInstance));
+ }
+
+ public void afterProcessCompleted(ProcessCompletedEvent pce) {
+
+ }
+
+ public void beforeNodeTriggered(ProcessNodeTriggeredEvent pnte) {
+ //do nothing
+ int sessionId = ((StatefulKnowledgeSession)pnte.getKnowledgeRuntime()).getId();
+ long processInstanceId = pnte.getProcessInstance().getId();
+ NodeInstance nodeInstance = pnte.getNodeInstance();
+ em.persist(NodeInstanceDescFactory.newNodeInstanceDesc(domainName, sessionId, processInstanceId, nodeInstance, false));
+ }
+
+ public void afterNodeTriggered(ProcessNodeTriggeredEvent pnte) {
+
+ }
+
+ public void beforeNodeLeft(ProcessNodeLeftEvent pnle) {
+ // do nothing
+ }
+
+ public void afterNodeLeft(ProcessNodeLeftEvent pnle) {
+ int sessionId = ((StatefulKnowledgeSession)pnle.getKnowledgeRuntime()).getId();
+ long processInstanceId = pnle.getProcessInstance().getId();
+ NodeInstance nodeInstance = pnle.getNodeInstance();
+ em.persist(NodeInstanceDescFactory.newNodeInstanceDesc(domainName, sessionId, processInstanceId, nodeInstance, true));
+ }
+
+ public void beforeVariableChanged(ProcessVariableChangedEvent pvce) {
+ //do nothing
+ int sessionId = ((StatefulKnowledgeSession)pvce.getKnowledgeRuntime()).getId();
+ long processInstanceId = pvce.getProcessInstance().getId();
+ String variableId = pvce.getVariableId();
+ String variableInstanceId = pvce.getVariableInstanceId();
+ String oldValue = (pvce.getOldValue() != null)?pvce.getOldValue().toString():"";
+ String newValue = (pvce.getNewValue() != null)?pvce.getNewValue().toString():"";
+ em.persist(new VariableStateDesc(variableId, variableInstanceId, oldValue,
+ newValue, domainName, sessionId, processInstanceId));
+ }
+
+ public void afterVariableChanged(ProcessVariableChangedEvent pvce) {
+
+
+ }
+
+ public void setDomainName(String domainName) {
+ this.domainName = domainName;
+ }
+
+
+
+}
View
35 ...-services/src/main/java/org/droolsjbpm/services/impl/helpers/NodeInstanceDescFactory.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2012 JBoss by Red Hat.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.droolsjbpm.services.impl.helpers;
+
+import org.drools.runtime.process.NodeInstance;
+import org.droolsjbpm.services.impl.model.NodeInstanceDesc;
+
+/**
+ *
+ * @author salaboy
+ */
+public class NodeInstanceDescFactory {
+ public static NodeInstanceDesc newNodeInstanceDesc(String domainName, int sessionId, long processInstanceId,
+ NodeInstance nodeInstance, boolean completed){
+ return new NodeInstanceDesc(nodeInstance.getId(),
+ nodeInstance.getNodeId(),
+ nodeInstance.getNode().getName(),