Created
January 16, 2024 16:13
-
-
Save rogerblanton/5ddd91e2e491d4a093b4075cecdd568a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" | |
xmlns:jcr="http://www.jcp.org/jcr/1.0" | |
jcr:primaryType="sling:OsgiConfig" | |
path="/etc/sling/slingpiper.config.xml"> | |
<!-- Define the Sling Pipe configuration --> | |
<sling:config | |
jcr:primaryType="sling:OsgiConfig" | |
enabled="{Boolean}true"> | |
<!-- Define the Sling Pipe statements --> | |
<statements jcr:primaryType="nt:unstructured"> | |
<!-- Query to find assets with JobID property --> | |
<query | |
jcr:primaryType="nt:unstructured" | |
path="/content/dam" | |
type="nt:file" | |
statement="SELECT * FROM [nt:base] WHERE ISDESCENDANTNODE('/content/dam') AND [jobID] IS NOT NULL"> | |
<!-- Capture folderName and jobID variables from the query result --> | |
<variable | |
jcr:primaryType="nt:unstructured" | |
name="folderName" | |
expression="${jobID}"/> | |
<variable | |
jcr:primaryType="nt:unstructured" | |
name="jobID" | |
expression="${jobID}"/> | |
</query> | |
<!-- Loop over the result set and execute the following statements --> | |
<loop | |
jcr:primaryType="nt:unstructured" | |
path="/content/dam/%folderName%" | |
type="nt:file"> | |
<!-- Create a folder with JobID as folder name --> | |
<createFolder | |
jcr:primaryType="nt:unstructured" | |
path="/content/dam/%folderName%" | |
type="sling:Folder"/> | |
<!-- Move assets with JobID metadata to the folder --> | |
<move | |
jcr:primaryType="nt:unstructured" | |
source="/content/dam" | |
type="nt:file" | |
condition="%jobID%='%folderName%'" | |
destination="/content/dam/%folderName%"/> | |
</loop> | |
</statements> | |
</sling:config> | |
</jcr:root> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment