<?xml version="1.0" encoding="UTF-8"?>
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_3.xsd http://www.exoplatform.org/xml/ns/kernel_1_3.xsd"
  xmlns="http://www.exoplatform.org/xml/ns/kernel_1_3.xsd">

  <component>
    <key>org.exoplatform.documents.service.DocumentFileService</key>
    <type>org.exoplatform.documents.service.DocumentFileServiceImpl</type>
  </component>

  <component>
    <type>org.exoplatform.documents.rest.DocumentFileRest</type>
  </component>

  <component>
    <type>org.exoplatform.documents.service.DocumentWebSocketService</type>
  </component>

  <component>
    <key>org.exoplatform.documents.service.PublicDocumentAccessService</key>
    <type>org.exoplatform.documents.service.PublicDocumentAccessServiceImpl</type>
  </component>

  <component>
    <key>org.exoplatform.documents.service.ExternalDownloadService</key>
    <type>org.exoplatform.documents.service.ExternalDownloadServiceImpl</type>
  </component>

  <component>
    <type>org.exoplatform.documents.dao.PublicDocumentAccessDAO</type>
  </component>

  <component>
    <key>org.exoplatform.documents.storage.PublicDocumentAccessStorage</key>
    <type>org.exoplatform.documents.storage.PublicDocumentAccessStorageImpl</type>
  </component>

  <external-component-plugins>
    <target-component>org.exoplatform.services.listener.ListenerService</target-component>
    <component-plugin>
      <name>share_document_event</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.documents.listener.ShareDocumentNotificationListener</type>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.services.listener.ListenerService</target-component>
    <component-plugin>
      <name>bulk_actions_document_event</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.documents.listener.BulkActionDocumentListener</type>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.services.listener.ListenerService</target-component>
    <component-plugin>
      <name>rename_file_event</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.documents.listener.AttachmentsActivityCacheUpdater</type>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.services.listener.ListenerService</target-component>
    <component-plugin>
      <name>add_tag_document</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.documents.listener.AnalyticsAddTagListener</type>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.social.core.space.spi.SpaceService</target-component>
    <component-plugin>
      <name>SpaceIndexingListenerImpl</name>
      <set-method>addSpaceListener</set-method>
      <type>org.exoplatform.documents.storage.jcr.listener.RestrictContentCreationSpaceListener</type>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.web.filter.ExtensibleFilter</target-component>
    <component-plugin>
      <name>Documents preview filter</name>
      <set-method>addFilterDefinitions</set-method>
      <type>org.exoplatform.web.filter.FilterDefinitionPlugin</type>
      <priority>2</priority>
      <init-params>
        <object-param>
          <name>Registered document filter definition</name>
          <object type="org.exoplatform.web.filter.FilterDefinition">
            <field name="filter">
              <object type="org.exoplatform.documents.filter.DocumentPreviewFilter" />
            </field>
            <field name="patterns">
              <collection type="java.util.ArrayList" item-type="java.lang.String">
                <value>
                  <string>/.*/documents.*</string>
                </value>
                <value>
                  <string>/.*/drives.*</string>
                </value>
                <value>
                  <string>/.*/oeditor.*</string>
                </value>
              </collection>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
    <component-plugin>
      <name>Documents mode preview redirect handler</name>
      <set-method>addFilterDefinitions</set-method>
      <type>org.exoplatform.web.filter.FilterDefinitionPlugin</type>
      <priority>2</priority>
      <init-params>
        <object-param>
          <name>Registered document mode preview redirect handler</name>
          <object type="org.exoplatform.web.filter.FilterDefinition">
            <field name="filter">
              <object type="org.exoplatform.documents.filter.DocumentModeRedirectHandler" />
            </field>
            <field name="patterns">
              <collection type="java.util.ArrayList" item-type="java.lang.String">
                <value>
                  <string>/.*/oeditor.*</string>
                </value>
              </collection>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.services.thumbnail.ImageThumbnailService</target-component>
    <component-plugin>
      <name>documents-images</name>
      <set-method>addPlugin</set-method>
      <type>org.exoplatform.documents.plugins.DocumentsImageThumbnailPlugin</type>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.social.core.search.SearchService</target-component>
    <component-plugin>
      <name>
        FileSearchConnector</name>
      <set-method>addConnector</set-method>
      <type>org.exoplatform.social.core.search.SearchConnectorPlugin</type>
      <description>Files Search connector</description>
      <init-params>
        <object-param>
          <name>FileSearchConnector</name>
          <description>Files Search connector</description>
          <object type="org.exoplatform.social.core.search.SearchConnector">
            <field name="name">
              <string>files</string>
            </field>
            <field name="uri">
              <string><![CDATA[/portal/rest/search/documents/recent?limit={limit}&q={keyword}&sort=relevancy]]></string>
            </field>
            <field name="enabled">
              <boolean>${exo.search.file.enabled:true}</boolean>
            </field>
            <field name="favoritesEnabled">
              <boolean>true</boolean>
            </field>
            <field name="tagsEnabled">
              <boolean>true</boolean>
            </field>
            <field name="spaceFilterEnabled">
              <boolean>true</boolean>
            </field>
            <field name="jsModule">
              <string>SHARED/FileSearch</string>
            </field>
            <field name="i18nBundle">
              <string>locale.portlet.Documents</string>
            </field>
            <field name="uiComponent">
              <string>file-search-card</string>
            </field>
            <field name="icon">
              <string>fas fa-file-alt</string>
            </field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>

</configuration>
