Преглед на файлове

Obsluga ant obiektu dla triggerow - propozycja ogolna z przykladami

a.binder преди 9 години
родител
ревизия
d44c890287

+ 39 - 0
SE/schema/ant-object/default_db.TEST_PERMS/TestPermsAnt/Triggers/After/INPUT/CRM_UI_MSGS/1_custom/default.xsl

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:default_objects="https://biuro.biall-net.pl/wfs/default_objects"
+    xmlns:default_db__x3A__TestPermsAnt="https://biuro.biall-net.pl/wfs/default_db/table/TestPermsAnt.xsd"
+    xmlns:default_db__x3A__CRM_UI_MSGS="https://biuro.biall-net.pl/wfs/default_db/table/CRM_UI_MSGS.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <!-- example trigger to inform some user about change in exact record  -->
+    
+    <xsl:template match="*[ID=10]"  mode="default_db__x3A__CRM_UI_MSGS:INPUT" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/table/TestPermsAnt.xsd">
+        <!-- to allow another templates to work -->
+        <Transaction
+            xmlns="http://www.opengis.net/wfs"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            version="1.0.0"
+            service="WFS"
+            xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
+            xmlns:gml="http://www.opengis.net/gml">
+            <Insert xmlns="http://www.opengis.net/wfs">
+                <p5_default_db:P5Automation1OrangeRaportSimple>
+                    <DEVICE_ID>1</DEVICE_ID>
+                    <IdPort>1</IdPort>
+                    <InputValued>2.2</InputValued>
+                    <PortCustName>Water Level</PortCustName>
+                </p5_default_db:P5Automation1OrangeRaportSimple>
+            </Insert>
+            <Insert xmlns="http://www.opengis.net/wfs">
+                <p5_default_db:P5Automation1OrangeRaportSimple>
+                    <DEVICE_ID>1</DEVICE_ID>
+                    <IdPort>2</IdPort>
+                    <InputValued>100</InputValued>
+                    <PortCustName>Battery Status</PortCustName>
+                </p5_default_db:P5Automation1OrangeRaportSimple>
+            </Insert>
+        </Transaction>        
+    </xsl:template>
+</xsl:stylesheet>

+ 56 - 0
SE/schema/ant-object/default_db.TEST_PERMS/TestPermsAnt/Triggers/After/INPUT/CRM_UI_MSGS/default.xsl

@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:wfs="http://www.opengis.net/wfs"
+    xmlns:ogc="http://www.opengis.net/ogc"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:default_objects="https://biuro.biall-net.pl/wfs/default_objects"
+    xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:default_db__x3A__TestPermsAnt="https://biuro.biall-net.pl/wfs/default_db/table/TestPermsAnt.xsd"
+    xmlns:default_db__x3A__CRM_UI_MSGS="https://biuro.biall-net.pl/wfs/default_db/table/CRM_UI_MSGS.xsd"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <!-- default trigger to enable CRM_UI_MSGS to see some informations from records -->
+    <xsl:output indent="yes"/>
+    <xsl:strip-space elements="*"/>
+    
+    <xsl:param name="trigger_name" select="'CRM_UI_MSGS'"/>
+    <!--<xsl:param name="stream_path" select="'/'"/>-->
+    
+
+    
+    <xsl:template match="wfs:WFS_TransactionResponse" xpath-default-namespace="http://www.opengis.net/wfs"> <!-- TODO tez bez tego na razie: mode="default_db__x3A__CRM_UI_MSGS:INPUT" TODO nie moge matchowac po namespace obiektu xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db/table/TestPermsAnt.xsd" -->
+        <xsl:param name="wfs:Transaction" required="yes"/> <!-- wymagane przekazanie tego co zostało przekazane do transakcji -->
+        <Transaction
+            xmlns="http://www.opengis.net/wfs"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            version="1.0.0"
+            service="WFS"
+            xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
+            xmlns:gml="http://www.opengis.net/gml">
+            <xsl:apply-templates>
+                <xsl:with-param name="wfs:Transaction" select="$wfs:Transaction"/>
+            </xsl:apply-templates>
+        </Transaction>
+    </xsl:template>
+    
+    <xsl:template match="wfs:InsertResult">
+        <xsl:param name="wfs:Transaction" required="yes"/>
+        <Insert xmlns="http://www.opengis.net/wfs">
+            <p5_default_db:CRM_UI_MSGS>
+                <idReplyTo/>
+                <idThread/>
+                <app_className/>
+                <msg>Dodano rekord do tabeli TestPermsAnt<xsl:value-of select="$wfs:Transaction/wfs:Insert[position()=current()/position()]/p5_default_db:TestPermsAnt/Opis"/></msg>
+                <msgType>info</msgType>
+                <uiTargetType>default_db_table_record</uiTargetType>
+                <uiTargetName><xsl:value-of select="@fid"/></uiTargetName>
+                <userTargetName>Stary Opis</userTargetName>
+                <actionExecutedTime>Stary Opis</actionExecutedTime>
+                <actionNotes>Stary Opis</actionNotes>
+            </p5_default_db:CRM_UI_MSGS>
+        </Insert>
+    </xsl:template>
+    
+</xsl:stylesheet>

+ 30 - 0
SE/schema/ant-object/default_db.TEST_PERMS/TestPermsAnt/Triggers/After/INPUT/Transaction.xsl

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    
+    <xsl:import href="Triggers.xsl"/>
+    
+    <xsl:template match="Transaction" xpath-default-namespace="http://www.opengis.net/wfs" priority="1" >
+        <Transaction xmlns="http://www.opengis.net/wfs">
+            <xsl:apply-imports xpath-default-namespace="http://www.opengis.net/wfs"/>
+        </Transaction>
+    </xsl:template>
+    
+    <xsl:template match="Insert" xpath-default-namespace="http://www.opengis.net/wfs" priority="1">
+        <xsl:comment>#16 default template from Transaction.xsl</xsl:comment>
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="Update" xpath-default-namespace="http://www.opengis.net/wfs" priority="1">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="GetFeature" xpath-default-namespace="http://www.opengis.net/wfs" priority="1">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    
+</xsl:stylesheet>

+ 12 - 0
SE/schema/ant-object/default_db.TEST_PERMS/TestPermsAnt/Triggers/After/INPUT/Triggers.xsl

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <!-- default XSL for applying triggers and should be generated by installator -->
+   
+       
+    
+    
+</xsl:stylesheet>

+ 30 - 0
SE/schema/ant-object/default_db.TEST_PERMS/TestPermsAnt/Triggers/Before/INPUT/Transaction.xsl

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <xsl:import href="Triggers.xsl"/>
+    
+    <xsl:template match="Transaction" xpath-default-namespace="http://www.opengis.net/wfs" priority="1" >
+        <Transaction xmlns="http://www.opengis.net/wfs">
+        <xsl:apply-imports xpath-default-namespace="http://www.opengis.net/wfs"/>
+        </Transaction>
+    </xsl:template>
+    
+    <xsl:template match="Insert" xpath-default-namespace="http://www.opengis.net/wfs" priority="1">
+        <xsl:comment>#16 default template from Transaction.xsl</xsl:comment>
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="Update" xpath-default-namespace="http://www.opengis.net/wfs" priority="0">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    <xsl:template match="GetFeature" xpath-default-namespace="http://www.opengis.net/wfs" priority="0">
+        <xsl:copy-of select="."/>
+    </xsl:template>
+    
+    
+    
+</xsl:stylesheet>

+ 40 - 0
SE/schema/ant-object/default_db.TEST_PERMS/TestPermsAnt/Triggers/Before/INPUT/Triggers.xsl

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
+    exclude-result-prefixes="xs"
+    version="2.0">
+    
+    <!-- default XSL for applying triggers and should be generated by installator -->
+    
+  <xsl:template match="Transaction"  xpath-default-namespace="http://www.opengis.net/wfs" priority="2" >
+    <!-- root elemenet jest dodany domyslnie raz - jest inaczej przy apply-imports  -->
+      <xsl:comment>#11 Triggers.xsl</xsl:comment>
+      <!--<xsl:copy-of select="."/>-->
+      <xsl:apply-templates mode="TestPermsAnt"/>
+  </xsl:template>
+   
+   
+  <xsl:template match="Insert" mode="TestPermsAnt"  xpath-default-namespace="http://www.opengis.net/wfs"  priority="2">
+    <Insert xmlns="http://www.opengis.net/wfs">
+      <xsl:apply-templates mode="TestPermsAnt"/>
+    </Insert>
+  </xsl:template>
+  
+  <xsl:template match="*" mode="TestPermsAnt">
+    <xsl:element name="{name()}">
+      <xsl:apply-templates mode="TestPermsAnt_Child" xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db"/>
+    </xsl:element>
+  </xsl:template>
+       
+   
+  <xsl:template match="*" mode="TestPermsAnt_Child">
+    <xsl:copy-of select="."/>
+  </xsl:template>
+  
+   
+  <xsl:template match="WWW" mode="TestPermsAnt_Child" xpath-default-namespace="http://www.opengis.net/wfs">
+    <WWW xsl:xpath-default-namespace="https://biuro.biall-net.pl/wfs/default_db"><xsl:value-of select="concat('http://', .)"/></WWW>
+  </xsl:template>
+    
+</xsl:stylesheet>

+ 16 - 0
SE/schema/ant-object/default_db.TEST_PERMS/TestPermsAnt/example_wfs_transactions/GetFeature.xml

@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wfs:FeatureCollection
+    xmlns:wfs="http://www.opengis.net/wfs" 
+    xmlns="http://www.opengis.net/wfs" 
+    xmlns:gml="http://www.opengis.net/gml" 
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:xlink="http://www.w3.org/1999/xlink" 
+    xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db" 
+    xsi:schemaLocation="https://biuro.biall-net.pl/wfs/default_db https://biuro.biall-net.pl/SE/version-git/wfs-data.php/default_db/?SERVICE=WFS&amp;VERSION=1.0.0&amp;TYPENAME=p5_default_db:TestPermsAnt&amp;REQUEST=DescribeFeatureType">
+    <gml:featureMember>
+        <p5_default_db:TestPermsAnt>
+            <p5_default_db:ID>3</p5_default_db:ID>
+            <!-- This is not correct example file TODO -->
+        </p5_default_db:TestPermsAnt>
+    </gml:featureMember>
+</wfs:FeatureCollection>

+ 18 - 0
SE/schema/ant-object/default_db.TEST_PERMS/TestPermsAnt/example_wfs_transactions/Insert.xml

@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- this is example not correct instance TODO -->
+<Transaction
+    xmlns="http://www.opengis.net/wfs"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    version="1.0.0"
+    service="WFS"
+    xmlns:p5_default_db="https://biuro.biall-net.pl/wfs/default_db"
+    xmlns:gml="http://www.opengis.net/gml">
+    <Insert xmlns="http://www.opengis.net/wfs">
+        <p5_default_db:TestPermsAnt>
+            <OPIS>Stary Opis</OPIS>
+            <test_date>2016-01-01</test_date>
+            <test_price>0</test_price>
+            <WWW>brak</WWW>
+        </p5_default_db:TestPermsAnt>
+    </Insert>
+</Transaction>

+ 14 - 0
SE/schema/ant-object/default_db.TEST_PERMS/TestPermsAnt/example_wfs_transactions/InsertTransactionResponse.xml

@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<wfs:WFS_TransactionResponse version="1.0.0"
+    xmlns:wfs="http://www.opengis.net/wfs"
+    xmlns:ogc="http://www.opengis.net/ogc"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+    <wfs:InsertResult>
+        <ogc:FeatureId fid="TestPermsAnt.1" xmlns:ogc="http://www.opengis.net/ogc"/>
+    </wfs:InsertResult>
+    <wfs:TransactionResult>
+        <wfs:Status>
+            <wfs:SUCCESS/>
+        </wfs:Status>
+    </wfs:TransactionResult>
+</wfs:WFS_TransactionResponse>

+ 15 - 0
SE/schema/ant-object/default_db.TEST_PERMS/TestPermsAnt/example_wfs_transactions/Update.xml

@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Transaction xmlns="http://www.opengis.net/wfs"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    version="1.0.0"
+    xmlns:p5_default_db="https://biuro.biall-net.pl/"
+    service="WFS"
+    xmlns:gml="http://www.opengis.net/gml">
+    <Update xmlns="http://www.opengis.net/wfs" typeName="p5_default_db:TestPermsAnt">
+        <Property xmlns="http://www.opengis.net/wfs">
+            <Name xmlns="http://www.opengis.net/wfs">OPIS</Name>
+            <Value xmlns="http://www.opengis.net/wfs">Nowy Opis zaktualizowany</Value>
+        </Property>
+        <Filter xmlns="http://www.opengis.net/ogc"><FeatureId xmlns="http://www.opengis.net/ogc" fid="TestPermsAnt.1"/></Filter>
+    </Update>
+</Transaction>