Adding a mechanism to avoid to archive multiple times the same resource for a single archive set.
This commit is contained in:
parent
cf97a98416
commit
3d18e9d8a4
|
@ -2,6 +2,67 @@
|
|||
|
||||
<p:param name="data" type="input"/>
|
||||
|
||||
<!-- Look if the resource has already been archived for that set -->
|
||||
<p:processor name="oxf:pipeline">
|
||||
<p:input name="config" href="/data-access.xpl"/>
|
||||
<p:input name="data" transform="oxf:xslt" href="#data">
|
||||
<config xsl:version="2.0">
|
||||
<relpath>
|
||||
<xsl:value-of select="/action/@directory"/>
|
||||
<xsl:text>index.xml</xsl:text>
|
||||
</relpath>
|
||||
<operation>read</operation>
|
||||
<type>xquery</type>
|
||||
<parameter name="url" type="string">
|
||||
<xsl:value-of select="/action/@url"/>
|
||||
</parameter>
|
||||
</config>
|
||||
</p:input>
|
||||
<p:input name="param">
|
||||
<xquery><![CDATA[
|
||||
|
||||
boolean(//archive[@url = $(url)])
|
||||
|
||||
]]></xquery>
|
||||
</p:input>
|
||||
<p:output name="data" id="duplicate" debug="duplicate"/>
|
||||
</p:processor>
|
||||
|
||||
<p:choose href="#duplicate">
|
||||
|
||||
<p:when test="/*/* = 'true'">
|
||||
<!-- Already archived, nothing to do -->
|
||||
<!-- Update the queue -->
|
||||
<p:processor name="oxf:pipeline">
|
||||
<p:input name="config" href="/data-access.xpl"/>
|
||||
<p:input name="data" transform="oxf:xslt" href="#data">
|
||||
<config xsl:version="2.0">
|
||||
<relpath>queue.xml</relpath>
|
||||
<operation>write</operation>
|
||||
<type>xquery</type>
|
||||
<parameter name="uuid" type="string">
|
||||
<xsl:value-of select="/action/@uuid"/>
|
||||
</parameter>
|
||||
</config>
|
||||
</p:input>
|
||||
<p:input name="param">
|
||||
<xquery><![CDATA[
|
||||
|
||||
for $a in /queue/action where $a/@uuid = $(uuid) return
|
||||
update
|
||||
delete $a
|
||||
|
||||
]]></xquery>
|
||||
</p:input>
|
||||
<p:output name="data" id="response4" debug="response"/>
|
||||
</p:processor>
|
||||
<p:processor name="oxf:null-serializer">
|
||||
<p:input name="data" href="#response4"/>
|
||||
</p:processor>
|
||||
</p:when>
|
||||
|
||||
<p:otherwise>
|
||||
<!-- Otherwise, archive the resource... -->
|
||||
<!-- Fetch the resource -->
|
||||
<p:processor name="oxf:url-generator">
|
||||
<p:input name="config" transform="oxf:xslt" href="#data">
|
||||
|
@ -251,5 +312,9 @@ for $a in /queue/action where $a/@uuid = $(uuid) return
|
|||
</p:otherwise>
|
||||
|
||||
</p:choose>
|
||||
</p:otherwise>
|
||||
</p:choose>
|
||||
|
||||
|
||||
|
||||
</p:config>
|
||||
|
|
Loading…
Reference in New Issue