From: <pka...@us...> - 2009-07-31 21:50:18
|
Revision: 413 http://cse-ip.svn.sourceforge.net/cse-ip/?rev=413&view=rev Author: pkasprzak Date: 2009-07-31 21:50:05 +0000 (Fri, 31 Jul 2009) Log Message: ----------- * Logging improvements * Differentiate update / nothing to do * Prepare course-object for distribution Modified Paths: -------------- trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/AddCourse.bpel Modified: trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/AddCourse.bpel =================================================================== --- trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/AddCourse.bpel 2009-07-31 21:40:29 UTC (rev 412) +++ trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/AddCourse.bpel 2009-07-31 21:50:05 UTC (rev 413) @@ -11,20 +11,17 @@ xmlns:x="http://docs.oasis-open.org/wsbpel/2.0/process/executable" xmlns:dt="http://cse.campussource.de/schema/DataTypes" xmlns:tns="http://enterprise.netbeans.org/bpel/ObjectProcessor/AddCourse" - xmlns:ns0="http://cse.campussource.de/ejb/DependencyManager"> + xmlns:ns0="http://cse.campussource.de/ejb/DependencyManager" + xmlns:sxed2="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Editor2"> - <import namespace="http://j2ee.netbeans.org/wsdl/ObjectProcessor/AddCourse" location="AddCourse.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> - <import namespace="http://cse.campussource.de/ejb/EntityManager" location="Common/EntityManager.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> - <import namespace="http://cse.campussource.de/ejb/RelationManager" location="Common/RelationManager.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> - <import namespace="http://cse.campussource.de/ejb/IdentityManager" location="Common/IdentityManager.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> -<!-- - <import namespace="http://j2ee.netbeans.org/wsdl/Common/DependencyManagerNotification" location="Common/DependencyManagerNotification.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> ---> + <import namespace="http://j2ee.netbeans.org/wsdl/ObjectProcessor/AddCourse" location="AddCourse.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> + <import namespace="http://cse.campussource.de/ejb/EntityManager" location="Common/EntityManager.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> + <import namespace="http://cse.campussource.de/ejb/RelationManager" location="Common/RelationManager.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> + <import namespace="http://cse.campussource.de/ejb/IdentityManager" location="Common/IdentityManager.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> + <import namespace="http://cse.campussource.de/ejb/DependencyManager" location="Common/DependencyManager.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> + <import namespace="http://cse.campussource.de/ejb/SystemManager" location="Common/SystemManager.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> + <import namespace="http://cse.campussource.de/ejb/LoggingManager" location="Common/LoggingManager.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> - <import namespace="http://cse.campussource.de/ejb/DependencyManager" location="Common/DependencyManager.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> - <import namespace="http://cse.campussource.de/ejb/SystemManager" location="Common/SystemManager.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> - <import namespace="http://cse.campussource.de/ejb/LoggingManager" location="Common/LoggingManager.wsdl" importType="http://schemas.xmlsoap.org/wsdl/"/> - <partnerLinks> <partnerLink name="LoggingManager" xmlns:tns="http://cse.campussource.de/ejb/LoggingManager" partnerLinkType="tns:LoggingManagerLinkType" partnerRole="LoggingManagerRole"/> @@ -68,7 +65,8 @@ <variable name="DebugIn" xmlns:tns="http://cse.campussource.de/ejb/LoggingManager" messageType="tns:debug"/> <!-- CSE-id of the course --> - <variable name="CseId" type="xsd:integer"/> + <variable name="EntityId" type="xsd:integer"/> + <variable name="Event" type="xsd:string"/> </variables> @@ -108,18 +106,37 @@ inputVariable="ExistsIn" outputVariable="ExistsOut"/> - <assign name="saveExistingCseId"> + <assign name="saveExistingEntityId"> <copy> <from>$ExistsOut.parameters/return</from> - <to>$CseId</to> + <to>$EntityId</to> </copy> </assign> <if> - <condition>$CseId = 0</condition> + <condition>$EntityId = 0</condition> + <!-- Object new => persist it, etc. --> <sequence name="CourseIsNew"> + <assign name="initCourseNew"> + <copy> + <from>'CREATE'</from> + <to>$Event</to> + </copy> + </assign> + + <assign> + <copy> + <from>concat('Course [', $ProcessCourseIn.courseMessage/dt:course/dt:attribute[dt:name = 'clientId']/dt:value, '] is new => CREATE')</from> + <to>$DebugIn.parameters/message</to> + </copy> + </assign> + <invoke partnerLink="LoggingManager" operation="debug" + xmlns:tns="http://cse.campussource.de/ejb/LoggingManager" + portType="tns:LoggingManager" + inputVariable="DebugIn"/> + <assign name="preparePersistCourse"> <copy> <from>$ProcessCourseIn.courseMessage/dt:course</from> @@ -133,17 +150,17 @@ inputVariable="PersistCourseIn" outputVariable="PersistCourseOut"/> - <assign name="saveCreatedCseId"> + <assign name="saveCreatedEntityId"> <copy> <from>$PersistCourseOut.parameters/return</from> - <to>$CseId</to> + <to>$EntityId</to> </copy> </assign> <assign name="prepareCreateMapping"> <!-- Set cse-id --> <copy> - <from variable="CseId"/> + <from variable="EntityId"/> <to>$CreateMappingIn.parameters/cseId/text()</to> </copy> <!-- Set system --> @@ -169,24 +186,34 @@ <else> <sequence name="CourseAlreadyExists"> - <assign name="setCseId"> + <assign name="initCourseExists"> <copy> - <from variable="CseId"/> - <to>$ProcessCourseIn.courseMessage/dt:course/dt:busId</to> + <from>'NONE'</from> + <to>$Event</to> </copy> </assign> - <empty name="peristUpdatedAttributes"> - <documentation>-> EntityManager: persist any attributes that have changed and report if attributes have changed + <assign> + <copy> + <from>concat('Course [', $ProcessCourseIn.courseMessage/dt:course/dt:attribute[dt:name = 'clientId']/dt:value, '] already exists => UPDATE')</from> + <to>$DebugIn.parameters/message</to> + </copy> + </assign> + <invoke partnerLink="LoggingManager" operation="debug" + xmlns:tns="http://cse.campussource.de/ejb/LoggingManager" + portType="tns:LoggingManager" + inputVariable="DebugIn"/> --> also upgrade ENTITY-TYPE to ENTITY (from proxy) + <assign name="setEntityId"> + <copy> + <from variable="EntityId"/> + <to>$ProcessCourseIn.courseMessage/dt:course/dt:busId</to> + </copy> + </assign> -if changed: => UPDATE_EVENT (regardless of relations) + <empty name="peristUpdatedAttributes"></empty> -if not changed => check if relations have changed (if they have => update; else process finished)</documentation> - </empty> - <assign name="prepareUpdateAttributes"> <copy> <from>x:doXslTransform('urn:stylesheets:prepareUpdateAttributesCall.xsl', $ProcessCourseIn.courseMessage/dt:course)</from> @@ -199,6 +226,20 @@ portType="tns:EntityManager" inputVariable="UpdateAttributesIn" outputVariable="UpdateAttributesOut"/> + + <!-- Check, if attributes have changed --> + <if> + <condition>$UpdateAttributesOut.parameters/return</condition> + + <!-- Change in attributes => set event to UPDATE --> + <assign name="setEventToUpdate"> + <copy> + <from>'UPDATE'</from> + <to>$Event</to> + </copy> + </assign> + </if> + </sequence> </else> @@ -206,7 +247,7 @@ <assign name="prepareProcessRelations"> <copy> - <from variable="CseId"/> + <from variable="EntityId"/> <to>$ProcessCourseRelationsIn.parameters/cseId</to> </copy> <copy> @@ -225,9 +266,17 @@ inputVariable="ProcessCourseRelationsIn" outputVariable="ProcessCourseRelationsOut"/> + <!-- Check, if relations have changed --> + <if> + <condition>not($ProcessCourseRelationsOut.parameters/return) and $Event = 'NONE'</condition> + + <!-- Entity already exists, attributes have not changed, relations also have not changed => nothing to do, exit process --> + <exit name="exitProcess"/> + </if> + <assign name="prepareWaitForDependencies"> <copy> - <from variable="CseId"/> + <from variable="EntityId"/> <to>$WaitForDependenciesIn.parameters/entityId</to> </copy> </assign> @@ -279,11 +328,12 @@ <scope name="SystemScope"> <variables> + <variable name="GetCourseContextOut" xmlns:tns="http://cse.campussource.de/ejb/EntityManager" messageType="tns:getCourseContextResponse"/> + <variable name="GetCourseContextIn" xmlns:tns="http://cse.campussource.de/ejb/EntityManager" messageType="tns:getCourseContext"/> + <variable name="NotifyIn" messageType="ns0:notifyRequest"/> - <variable name="NotifyIn" messageType="ns0:notifyRequest"/> - - <variable name="System" type="xsd:string"/> - <variable name="EntityId" type="xsd:int"/> + <variable name="System" type="xsd:string"/> + <variable name="EntityId" type="xsd:int"/> </variables> <sequence> @@ -332,10 +382,22 @@ portType="tns:LoggingManager" inputVariable="DebugIn"/> + <assign name="prepareGetCourseContext"> + <copy> + <from variable="System"/> + <to>$GetCourseContextIn.parameters/system</to> + </copy> + <copy> + <from variable="EntityId"/> + <to>$GetCourseContextIn.parameters/entityId</to> + </copy> + </assign> - <empty name="loadContext"> - <documentation>Load context for this entity for distribution (e.g. relations / parent objects / paths) and return it as xml (e.g. messages-object)</documentation> - </empty> + <invoke name="getCourseContext" partnerLink="EntityManager" operation="getCourseContext" + xmlns:tns="http://cse.campussource.de/ejb/EntityManager" + portType="tns:EntityManager" + inputVariable="GetCourseContextIn" + outputVariable="GetCourseContextOut"/> <empty name="distributeMessages"> <documentation>Send courseMessage + context to outboundadapter (synchronisouly)</documentation> @@ -347,7 +409,7 @@ <assign> <copy> - <from>concat('Process finished (', $CseId, ')')</from> + <from>concat('Process finished (', $EntityId, ')')</from> <to>$DebugIn.parameters/message</to> </copy> </assign> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |