<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<con:PluginConfig xmlns:con="com.priint.pubserver.config.manager/20130620">
    <con:name>productListRuleConfig.xml</con:name>
    <con:type>productListRule</con:type>
    <con:custom>
        <productListRuleSets>

            <!-- AccPackGeneric -->
            <!--
                productListRuleSet:
                + configId: _renderingruleset document parameter
                + mode: planning or bucket
                 ++ planning mode can work if products are buckets or planning string id
                 ++ bucket mode only work if products are bucket string id
                 ++ dummy mode only work if no products are planned
                + log: 0=no write log, 1=write log
                + logPath: path of file log supported varriable of comet plugin
             -->
            <productListRuleSet configId="AccPackGeneric" mode="planning" log="1" logPath="$DESKTOP/product-list-rule.log">
                <!--
                    productListRules:
                    + exclusive: true=each bucket/planning matched only one <productListRule>, false=each bucket/planning matched several <productListRule>
                    + defaultPageTemplate: page template name for building products
                    + defaultPageItem: template name for building products
                 -->
                <productListRules exclusive="true" defaultPageTemplate="{page template ID or Name}">
                    <!-- page template(ID or name) from document parameter, it override default page template of above rules -->
                    <pageTemplate>
                        <documentParameter identifier="_priint_pageTemplate"/>
                    </pageTemplate>
                    <!--
                    productListRule:
                    + sort: sort asc list rule
                    + pageTemplate: each rule can define another page template that override defaultPageTemplate, useful when we need a page break for each rule
                     -->
                    <productListRule sort="1" pageTemplate="{page template ID or Name}" masterPage="{name of master page}">
                        <!--
                         conditionList(optional): or=match one of all <condition>, and=match all <condition>
                         -->
                        <conditionList operator="or">
                            <!-- filter by entity or label or bucket/planning-->
                            <condition sort="1">
                                <entity>
                                    <entityIdentifier>product</entityIdentifier>
                                    <label>^(?!Logistic).*$</label>
                                </entity>
                            </condition>
                            <!-- filter by entity or label or media asset -->
                            <condition sort="2">
                                <mediaAsset>
                                    <entityIdentifier>imageHAUPTBILD</entityIdentifier>
                                    <label>HAUPTBILD B(.*)</label>
                                </mediaAsset>
                            </condition>
                            <!--
                                filter by template name of root planning record
                                rootTemplate='PLANNED_TEMPLATE' or rootTemplate=<template name>
                            -->
                            <condition sort="3">
                                <planning>
                                    <entityIdentifier>Facet_VR_Group</entityIdentifier>
                                    <rootTemplate>Tafel 2x1 8er</rootTemplate>
                                </planning>
                            </condition>
                            <!-- filter by metadata of root plannning record -->
                            <condition sort="4">
                                <planningMetadata>
                                    <metaDataEntityIdentifier>planning_layout</metaDataEntityIdentifier>
                                    <value>1 Spaltig</value>
                                </planningMetadata>
                            </condition>
                        </conditionList>
                        <actionList>
                            <!-- add a dummy bucket within a template -->
                            <action method="addDummyBucket">
                                <pageItemIds>
                                    <when assignTemplate="IndexAZ Lang 2" />
                                </pageItemIds>
                            </action>

                            <!--
                                method=addCurrentBucket: add current planning/bucket to result list, support filter sub-planning/child bucket by <entity>
                             -->
                            <action method="addCurrentBucket">
                                <entity>
                                    <entityIdentifier>article</entityIdentifier>
                                </entity>
                                <pageItemIds>
                                    <when assignTemplate="{template ID or Name}"/>
                                </pageItemIds>
                            </action>
                             <!--
                                method=addChildBucket: add sub-planning/ child bucket to result list, support filter sub-planning/child bucket by <entity>
                             -->
                            <action method="addChildBucket">
                                <entity>
                                    <entityIdentifier>article</entityIdentifier>
                                    <entityLevel>1</entityLevel>
                                </entity>
                                <!-- if pageItemIds is epmty we use PLANNED_TEMPLATE -->
                                <pageItemIds>
                                    <!--
                                        general assigned template condition, the template was assigned to planning record/bucket is higher priority before fixed template
                                    -->
                                    <!-- assign fixed template -->
                                    <when assignTemplate="EA_HQ_NSHQ"/>
                                    <!-- assign template from planned template of planning/bucket  -->
                                    <when assignTemplate="PLANNED_TEMPLATE"/>
                                    <!--
                                        assign fixed template support page break
                                        pageBreak:
                                        + type=left(0), type=any(1), type=right(2)
                                        + value:true=add page break, false=does not add page break
                                     -->
                                    <when assignTemplate="EA_HQ_NSHQ">
                                        <pageBreak type="any" value="true" />
                                    </when>
                                    <!--
                                        match all condition
                                        type="MEDIA_ASSET/KEYVALUE": check entity of media asset/key value
                                        level: level of media asset/key value, root bucket/planning is level 0
                                        ifEmpty: true if planning/bucket does not have any media asset/key value object
                                        metadata: support condition by metadata of media asset/key value
                                    -->
                                    <when assignTemplate="EA_HQ_NSHQ">
                                        <when type="MEDIA_ASSET" level="2" ifEmpty="true">
                                        <!--
                                            entity: filter by list entity identifier within OR operation
                                         -->
                                            <entity>
                                                <entityIdentifier>imageHAUPTBILD</entityIdentifier>
                                                 <entityIdentifier>imageNEBENTBILD</entityIdentifier>
                                            </entity>
                                            <metaData>
                                                <entityIdentifier>imageSize</entityIdentifier>
                                                <key>BKC_DVS_BITMAP_ORIENTATION_BBM</key>
                                                <value>L</value>
                                            </metaData>
                                        </when>
                                    </when>
                                </pageItemIds>
                            </action>
                        </actionList>
                    </productListRule>
                </productListRules>
            </productListRuleSet>
        </productListRuleSets>
    </con:custom>
    <con:dependencies/>
    <con:instances/>
</con:PluginConfig>
