ilscipio/scipio-erp

View on GitHub
applications/solr/servicedef/services_entity.xml

Summary

Maintainability
Test Coverage
<?xml version="1.0" encoding="UTF-8"?>
<!--
This file is subject to the terms and conditions defined in the
files 'LICENSE' and 'NOTICE', which are part of this source
code package.
-->

<services xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="http://www.ofbiz.org/dtds/services.xsd">

    <description>Content Component Services</description>
    <vendor>Ilscipio GmbH</vendor>

    <!-- ========================================================= -->
    <!-- Indexing and document building -->
    <!-- ========================================================= -->

    <service name="scheduleEntityIndexing" engine="java" location="com.ilscipio.scipio.solr.EntityIndexer" invoke="scheduleEntityIndexing"
             use-transaction="false" log="quiet" log-eca="quiet"><!-- sync service -->
        <description>Registers entity ID or values for indexing queueing at the end of the transaction or in global queue
            immediately if no transaction or requested.</description>
        <attribute mode="IN" name="event" type="String" optional="true" default-value="trans-commit">
            <description>Supported: trans-commit (default - appends to transaction, only indexes if committed), global-queue (skips transaction queue and appends to global EntityIndexer queue)</description>
        </attribute>
        <attribute mode="IN" name="entityName" type="String" optional="true"/><!-- NOTE: Technically usually required -->
        <attribute mode="IN" name="idField" type="Object" optional="true"/>
        <attribute mode="IN" name="relationName" type="String" optional="true"/>
        <attribute mode="IN" name="topics" type="Collection" optional="true">
            <description>Names of subscriber topics to limit which subscribers are triggered</description>
        </attribute>
        <attribute mode="IN" name="action" type="String" optional="true"><!-- default-value="auto" -->
            <description>Supported values: add (same as addToSolr), remove (same as removeFromSolr),
                auto (default - this either adds or removes based on whether or not the productId still exists in the database)</description>
        </attribute>
        <attribute mode="IN" name="instance" type="Map" optional="true"/><!-- type="org.ofbiz.entity.GenericEntity" -->
        <attribute mode="IN" name="id" type="String" optional="true"/>
        <attribute mode="IN" name="entitiesToIndex" type="Object" optional="true">
            <description>Map of entity names to ordered maps of entity PKs to EntityIndexer.Entry instances, used for trans-commit event</description>
        </attribute>
        <attribute mode="IN" name="flush" type="String" optional="true">
            <description>Whether to force-flush any of the queued entities. Values: auto (default), all (flush all products in global queue a.s.a.p. including these)</description><!-- TODO: more modes possible later -->
        </attribute>
    </service>

    <service name="runEntityIndexing" engine="java" location="com.ilscipio.scipio.solr.EntityIndexer" invoke="runEntityIndexing"
             use-transaction="false" log="quiet"><!-- async service -->
        <description>Processes entity ID or values for indexing from EntityIndexer global queue
            NOTE: There is only ever one implementation running for each entity at a time, internally locked, and
            this service should only be called internally.</description>
        <attribute mode="IN" name="entityName" type="String" optional="true"/>
        <attribute mode="IN" name="entityNames" type="Collection" optional="true"/>
    </service>

    <service name="scheduleAllEntityIndexing" engine="java" location="com.ilscipio.scipio.solr.EntityIndexer" invoke="scheduleAllEntityIndexing"
             use-transaction="true"><!-- sync service -->
        <description>Registers all found entities for indexing queueing in global queue immediately.</description>
        <attribute mode="IN" name="entityName" type="String" optional="true"/><!-- NOTE: Technically usually required -->
        <attribute mode="IN" name="idField" type="Object" optional="true"/>
        <attribute mode="IN" name="topics" type="Collection" optional="true">
            <description>Names of subscriber topics to limit which subscribers are triggered</description>
        </attribute>
        <attribute mode="IN" name="action" type="String" optional="true"><!-- default-value="auto" -->
            <description>Supported values: add (same as addToSolr), remove (same as removeFromSolr),
                auto (default - this either adds or removes based on whether or not the productId still exists in the database)</description>
        </attribute>
        <attribute mode="IN" name="flush" type="String" optional="true">
            <description>Whether to force-flush any of the queued entities. Values: auto (default), all (flush all products in global queue a.s.a.p. including these)</description><!-- TODO: more modes possible later -->
        </attribute>
        <attribute mode="IN" name="maxRows" type="Integer" optional="true"/>
    </service>

    <service name="scheduleProductIndexing" engine="java" location="com.ilscipio.scipio.solr.EntityIndexer" invoke="scheduleEntityIndexing"
             use-transaction="false" log="quiet" log-eca="quiet"><!-- async service -->
        <description>Registers product ID or values for indexing queueing at the end of the transaction or in global queue
            immediately if no transaction or requested. Replaces registerUpdateToSolr.</description>
        <implements service="scheduleEntityIndexing"/>
        <attribute mode="IN" name="productId" optional="true" type="String"/>
        <attribute mode="IN" name="updateVariants" optional="true" type="Boolean" default-value="false">
            <description>If true, also update the variant products immediately associated to this one (added 2018-07-19).
                (NOTE: ignored if effective action is product removal)</description>
        </attribute>
        <attribute mode="IN" name="updateVariantsDeep" optional="true" type="Boolean" default-value="false">
            <description>If true, also update the variant products associated to this one (added 2018-07-19), and their variants, etc.
                (NOTE: ignored if effective action is product removal)</description>
        </attribute>
        <attribute mode="IN" name="updateVirtual" optional="true" type="Boolean" default-value="false">
            <description>If true, also update the virtual product immediately associated to this one (added 2018-07-25).
                (NOTE: ignored if effective action is product removal)</description>
        </attribute>
        <attribute mode="IN" name="updateVirtualDeep" optional="true" type="Boolean" default-value="false">
            <description>If true, also update the virtual product associated to this one (added 2018-07-25), and its virtuals, etc.
                (NOTE: ignored if effective action is product removal)</description>
        </attribute>
        <override name="entityName" optional="true" default-value="Product"/>
        <override name="idField" type="Object" optional="true" default-value="productId"/>
    </service>

    <service name="scheduleAllProductIndexing" engine="java" location="com.ilscipio.scipio.solr.EntityIndexer" invoke="scheduleAllEntityIndexing"
             use-transaction="true">
        <description>Registers all found products for indexing queueing in global queue immediately.</description>
        <implements service="scheduleAllEntityIndexing"/>
        <override name="entityName" optional="true" default-value="Product"/>
        <override name="idField" type="Object" optional="true" default-value="productId"/>
    </service>

    <!-- ========================================================= -->
    <!-- Consumer interfaces (solr/google commit) for produced documents -->
    <!-- ========================================================= -->

    <service name="entityIndexingConsumer" engine="interface">
        <attribute mode="IN" name="docs" type="Collection" optional="true">
            <description>Collection of EntityIndexer.DocEntry</description>
        </attribute>
        <attribute mode="IN" name="docsToRemove" type="Collection" optional="true">
            <description>Collection of EntityIndexer.Entry</description>
        </attribute>
        <attribute mode="IN" name="refEntries" type="Collection" optional="true">
            <description>Collection of the original entity primary key PKs that triggered this consume, before expansion, for error handling</description>
        </attribute>
        <attribute mode="IN" name="onError" type="String" optional="true">
            <description>ignore (default), requeue-all (requeue products for all consumers - e.g. solr and google),
                requeue-topic (requeue products for current consumer - solr or google)</description>
        </attribute>
    </service>

    <service name="productIndexingConsumer" engine="interface">
        <implements service="entityIndexingConsumer"/>
        <attribute mode="IN" name="docs" type="Collection" optional="true">
            <description>Collection of ProductIndexer.ProductDocEntry</description>
        </attribute>
        <attribute mode="IN" name="docsToRemove" type="Collection" optional="true">
            <description>Collection of ProductIndexer.ProductEntry</description>
        </attribute>
        <attribute mode="IN" name="docs" type="Collection" optional="true">
            <description>Collection of ProductIndexer.ProductDocEntry</description>
        </attribute>
    </service>

</services>