From: <pka...@us...> - 2009-07-24 11:58:51
|
Revision: 366 http://cse-ip.svn.sourceforge.net/cse-ip/?rev=366&view=rev Author: pkasprzak Date: 2009-07-24 11:58:32 +0000 (Fri, 24 Jul 2009) Log Message: ----------- * Further work on AddCourse.bpel (still unfinished) * Added XSLT: Category / Course / Account -> Entity (for generic attribute updates) Modified Paths: -------------- trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/AddCourse.bpel Added Paths: ----------- trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/course-example.xml trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/toEntity.xsl Modified: trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/AddCourse.bpel =================================================================== --- trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/AddCourse.bpel 2009-07-24 11:55:46 UTC (rev 365) +++ trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/AddCourse.bpel 2009-07-24 11:58:32 UTC (rev 366) @@ -7,65 +7,157 @@ xmlns:sxed="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Editor" xmlns:sxat="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/Attachment" xmlns:sxeh="http://www.sun.com/wsbpel/2.0/process/executable/SUNExtension/ErrorHandling" + xmlns:dt="http://cse.campussource.de/schema/DataTypes" xmlns:tns="http://enterprise.netbeans.org/bpel/ObjectProcessor/AddCourse"> - <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://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/"/> + <partnerLinks> + <partnerLink name="EntityManager" xmlns:tns="http://cse.campussource.de/ejb/EntityManager" partnerLinkType="tns:EntityManagerLinkType" partnerRole="EntityManagerRole"/> + <partnerLink name="RelationManager" xmlns:tns="http://cse.campussource.de/ejb/RelationManager" partnerLinkType="tns:RelationManagerLinkType" partnerRole="RelationManagerRole"/> + <partnerLink name="IdentityManager" xmlns:tns="http://cse.campussource.de/ejb/IdentityManager" partnerLinkType="tns:IdentityManagerLinkType" partnerRole="IdentityManagerRole"/> + <partnerLink name="ClientAdapter" xmlns:tns="http://j2ee.netbeans.org/wsdl/ObjectProcessor/AddCourse" partnerLinkType="tns:AddCourse" myRole="AddCoursePortTypeRole"/> + </partnerLinks> - <partnerLinks> - <partnerLink name="EntityManager" xmlns:tns="http://cse.campussource.de/ejb/EntityManager" partnerLinkType="tns:EntityManagerLinkType" partnerRole="EntityManagerRole"/> - <partnerLink name="RelationManager" xmlns:tns="http://cse.campussource.de/ejb/RelationManager" partnerLinkType="tns:RelationManagerLinkType" partnerRole="RelationManagerRole"/> - <partnerLink name="ClientAdapter" xmlns:tns="http://j2ee.netbeans.org/wsdl/ObjectProcessor/AddCourse" partnerLinkType="tns:AddCourse" myRole="AddCoursePortTypeRole"/> - </partnerLinks> + <variables> + <variable name="TestOut" xmlns:tns="http://cse.campussource.de/ejb/EntityManager" messageType="tns:testResponse"/> + <variable name="TestIn" xmlns:tns="http://cse.campussource.de/ejb/EntityManager" messageType="tns:test"/> + <variable name="CreateMappingIn" xmlns:tns="http://cse.campussource.de/ejb/IdentityManager" messageType="tns:createMapping"/> + <variable name="PersistCourseOut" xmlns:tns="http://cse.campussource.de/ejb/EntityManager" messageType="tns:persistCourseResponse"/> + <variable name="PersistCourseIn" xmlns:tns="http://cse.campussource.de/ejb/EntityManager" messageType="tns:persistCourse"/> + <variable name="ExistsOut" xmlns:tns="http://cse.campussource.de/ejb/EntityManager" messageType="tns:existsResponse"/> + <variable name="ExistsIn" xmlns:tns="http://cse.campussource.de/ejb/EntityManager" messageType="tns:exists"/> + <variable name="ProcessCourseIn" xmlns:tns="http://j2ee.netbeans.org/wsdl/ObjectProcessor/AddCourse" messageType="tns:processCourseRequest"/> - <variables> - <variable name="ExistsOut" xmlns:tns="http://cse.campussource.de/ejb/EntityManager" messageType="tns:existsResponse"/> - <variable name="ExistsIn" xmlns:tns="http://cse.campussource.de/ejb/EntityManager" messageType="tns:exists"/> - <variable name="ProcessCourseIn" xmlns:tns="http://j2ee.netbeans.org/wsdl/ObjectProcessor/AddCourse" messageType="tns:processCourseRequest"/> - </variables> + <!-- CSE-id of the course --> + <variable name="CseId" type="xsd:integer"/> + </variables> - <sequence> - <receive name="start" createInstance="yes" partnerLink="ClientAdapter" operation="processCourse" + <sequence> + <receive name="start" createInstance="yes" partnerLink="ClientAdapter" operation="processCourse" xmlns:tns="http://j2ee.netbeans.org/wsdl/ObjectProcessor/AddCourse" portType="tns:AddCoursePortType" variable="ProcessCourseIn"/> -<!-- - <assign name="Assign1"> - <copy> - </assign> ---> - <invoke name="checkIfAlreadyExists" partnerLink="EntityManager" operation="exists" + <assign name="prepareCheckIfAlreadyExists"> + <!-- Set system --> + <copy> + <from>$ProcessCourseIn.courseMessage/dt:source</from> + <to>$ExistsIn.parameters/system</to> + </copy> + <!-- Set systemId --> + <copy> + <from>$ProcessCourseIn.courseMessage/dt:course/dt:attribute[dt:name = 'clientId']/dt:value</from> + <to>$ExistsIn.parameters/systemId</to> + </copy> + </assign> + + <invoke name="checkIfCourseExists" partnerLink="EntityManager" operation="exists" xmlns:tns="http://cse.campussource.de/ejb/EntityManager" portType="tns:EntityManager" inputVariable="ExistsIn" outputVariable="ExistsOut"/> - <if name="If1"> - <condition>1</condition> - <empty name="Empty1"/> - <else> - <empty name="Empty2"/> - </else> - </if> - <empty name="saveOrUpdateEntityData"> - <documentation>Check entity vs persistence (save / or update [attribute changes?])</documentation> - </empty> - <empty name="handleIds"> - <documentation>Save clientId / generate busId</documentation> - </empty> - <empty name="checkDeps"> - <documentation>Check deps asynchronisly (i.e.) wait for callback, when deps are satisfied + <assign name="saveExistingCseId"> + <copy> + <from>$ExistsOut.parameters/return</from> + <to>$CseId</to> + </copy> + </assign> + + <if> + <condition>$CseId = 0</condition> + <!-- Object new => persist it, etc. --> + <sequence name="CourseIsNew"> + + <assign name="preparePersistCourse"> + <copy> + <from>$ProcessCourseIn.courseMessage/dt:course</from> + <to>$PersistCourseIn.parameters/course</to> + </copy> + </assign> + + <invoke name="persistCourse" partnerLink="EntityManager" operation="persistCourse" + xmlns:tns="http://cse.campussource.de/ejb/EntityManager" + portType="tns:EntityManager" + inputVariable="PersistCourseIn" + outputVariable="PersistCourseOut"/> + + <assign name="saveCreatedCseId"> + <copy> + <from>$PersistCourseOut.parameters/return</from> + <to>$CseId</to> + </copy> + </assign> + + <assign name="prepareCreateMapping"> + <!-- Set cse-id --> + <copy> + <from>$CseId</from> + <to>$CreateMappingIn.parameters/cseId</to> + </copy> + <!-- Set system --> + <copy> + <from>$ProcessCourseIn.courseMessage/dt:source</from> + <to>$CreateMappingIn.parameters/system</to> + </copy> + <!-- Set id of the object in the system --> + <copy> + <from>$ProcessCourseIn.courseMessage/dt:course/dt:attribute[dt:name = 'clientId']/dt:value</from> + <to>$CreateMappingIn.parameters/systemId</to> + </copy> + </assign> + + <invoke name="createMapping" partnerLink="IdentityManager" operation="createMapping" + xmlns:tns="http://cse.campussource.de/ejb/IdentityManager" + portType="tns:IdentityManager" + inputVariable="CreateMappingIn"/> + + + </sequence> + + <else> + <sequence name="CourseAlreadyExists"> + <empty name="peristUpdatedAttributes"> + <documentation>-> EntityManager: persist any attributes that have changed and report if attributes have changed + +-> also upgrade ENTITY-TYPE to ENTITY (from proxy) + +if changed: => UPDATE_EVENT (regardless of relations) + +if not changed => check if relations have changed (if they have => update; else process finished)</documentation> + </empty> + </sequence> + </else> + + </if> + + <empty name="checkRelations"> + <documentation>check if relations have changed (and persist changes); + +if they have => UPDATE event +else: => keep current event</documentation> + </empty> + <empty name="saveOrUpdateEntityData"> + <documentation>Check entity vs persistence (save / or update [attribute changes?])</documentation> + </empty> + <empty name="handleIds"> + <documentation>Save clientId / generate busId</documentation> + </empty> + <empty name="checkDeps"> + <documentation>Check deps asynchronisly (i.e.) wait for callback, when deps are satisfied IN: OBJ_ID [course], OBJ_TYPE [type] -OUT: -> callback</documentation> - </empty> - <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> - <empty name="distributeMessages"> - <documentation>Send courseMessage + context to outboundadapter (synchronisouly)</documentation> - </empty> - <empty name="finish"/> - </sequence> +OUT: -> callback + </documentation> + </empty> + <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> + <empty name="distributeMessages"> + <documentation>Send courseMessage + context to outboundadapter (synchronisouly)</documentation> + </empty> + <empty name="finish"/> + </sequence> </process> Added: trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/course-example.xml =================================================================== --- trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/course-example.xml (rev 0) +++ trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/course-example.xml 2009-07-24 11:58:32 UTC (rev 366) @@ -0,0 +1,42 @@ +<?xml version="1.0" encoding="windows-1252"?> + +<!-- + Document : CDDM.xml + Created on : 24. Juli 2009, 11:33 + Author : pete + Description: + Purpose of the document follows. +--> + +<ns0:course xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' + xmlns:ns0='http://cse.campussource.de/schema/DataTypes' + xsi:schemaLocation='http://cse.campussource.de/schema/DataTypes CDDM.xsd'> + <ns0:busId>5</ns0:busId> + <ns0:eventTime>2000-01-20T12:00:00</ns0:eventTime> + <ns0:attribute> + <ns0:name>attribute1</ns0:name> + <ns0:value>value1</ns0:value> + <ns0:transient>false</ns0:transient> + </ns0:attribute> + <ns0:attribute> + <ns0:name>attribute2</ns0:name> + <ns0:value>value2</ns0:value> + <ns0:transient>false</ns0:transient> + </ns0:attribute> + <ns0:attribute> + <ns0:name>attribute3</ns0:name> + <ns0:value>value3</ns0:value> + <ns0:transient>false</ns0:transient> + </ns0:attribute> + <ns0:categories> + <ns0:category>1</ns0:category> + <ns0:category>2</ns0:category> + <ns0:category>3</ns0:category> + </ns0:categories> + <ns0:parent>5</ns0:parent> + <ns0:workgroups> + <ns0:workgroup>1</ns0:workgroup> + <ns0:workgroup>2</ns0:workgroup> + <ns0:workgroup>3</ns0:workgroup> + </ns0:workgroups> +</ns0:course> Added: trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/toEntity.xsl =================================================================== --- trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/toEntity.xsl (rev 0) +++ trunk/sandbox/lsf-adapter-demo/ObjectProcessor/src/toEntity.xsl 2009-07-24 11:58:32 UTC (rev 366) @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- + Document : toEntity.xsl.xsl + Created on : 24. Juli 2009, 11:24 + Author : pete + Description: + Purpose of transformation follows. +--> + +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:dt="http://cse.campussource.de/schema/DataTypes" + xmlns="http://cse.campussource.de/schema/DataTypes" + version="1.0"> + + <xsl:output method="xml" + media-type="text/xml" + indent="yes" + encoding="UTF-8" + omit-xml-declaration="no"/> + + <xsl:template match="/"> + <xsl:element name="entity"> + <xsl:copy-of select="//dt:busId"/> + <xsl:copy-of select="//dt:eventTime"/> + <xsl:copy-of select="//dt:attribute"/> + </xsl:element> + </xsl:template> + +</xsl:stylesheet> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |