<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  This file is part of the Meeds project (https://meeds.io/).
  Copyright (C) 2022 Meeds Association
  contact@meeds.io
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 3 of the License, or (at your option) any later version.
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.
  You should have received a copy of the GNU Lesser General Public License
  along with this program; if not, write to the Free Software Foundation,
  Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
-->
<configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd http://www.exoplatform.org/xml/ns/kernel_1_2.xsd"
               xmlns="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd">

  <external-component-plugins>
    <target-component>org.exoplatform.social.core.manager.ActivityManager</target-component>
    <component-plugin>
      <name>ActivityTaskCreationListener</name>
      <set-method>addActivityEventListener</set-method>
      <type>org.exoplatform.task.integration.ActivityTaskCreationListener</type>
    </component-plugin>
    <component-plugin>
      <name>TaskProcessor</name>
      <set-method>addProcessorPlugin</set-method>
      <type>org.exoplatform.task.integration.ActivityTaskProcessor</type>
      <init-params>
        <value-param>
          <name>priority</name>
          <description>priority of this processor (lower are executed first)</description>
          <value>3</value> <!-- Ensure this processor executed before OSHtmlSanitizerProcessor from Social -->
        </value-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.social.core.space.spi.SpaceService</target-component>
    <component-plugin>
      <name>SpaceTaskDataInitializer</name>
      <set-method>registerSpaceListenerPlugin</set-method>
      <type>org.exoplatform.task.integration.SpaceTaskDataInitializer</type>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.social.attachment.AttachmentService</target-component>
    <component-plugin>
      <name>TaskAttachmentPlugin</name>
      <set-method>addPlugin</set-method>
      <type>org.exoplatform.task.integration.TaskAttachmentPlugin</type>
    </component-plugin>
    <component-plugin>
      <name>TaskCommentAttachmentPlugin</name>
      <set-method>addPlugin</set-method>
      <type>org.exoplatform.task.integration.TaskCommentAttachmentPlugin</type>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.services.listener.ListenerService</target-component>
    <component-plugin>
      <name>exo.task.taskCreation</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.task.integration.TaskLoggingListener</type>
    </component-plugin>
    <component-plugin>
      <name>exo.task.taskUpdate</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.task.integration.TaskLoggingListener</type>
    </component-plugin>
    <component-plugin>
      <name>attachment.created</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.task.integration.TaskAttachmentLoggingListener</type>
    </component-plugin>
    <component-plugin>
      <name>attachment.deleted</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.task.integration.TaskAttachmentLoggingListener</type>
    </component-plugin>
    <component-plugin>
      <name>exo.task.taskCommentCreation</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.task.integration.TaskCommentNotificationListener</type>
    </component-plugin>
    <component-plugin>
      <name>exo.project.projectModified</name>
      <set-method>addListener</set-method>
      <type>org.exoplatform.task.integration.ProjectModifiedListener</type>
    </component-plugin>
  </external-component-plugins>

  <external-component-plugins>
    <target-component>org.exoplatform.webui.ext.UIExtensionManager</target-component>
    <component-plugin>
      <name>addTaskCreation</name>
      <!-- The method to call to register a new UI Extension -->
      <set-method>registerUIExtensionPlugin</set-method>
      <type>org.exoplatform.webui.ext.UIExtensionPlugin</type>
      <init-params>
        <object-param>
          <name>PLFQuickAddTask</name>
          <object type="org.exoplatform.webui.ext.UIExtension">
            <!-- The type of extension, here it is the type related to the Action Bar in the File Explorer -->
            <field name="type"><string>org.exoplatform.platform.component.UICreateList</string></field>

            <field name="rank"><int>9</int></field>
            <!-- The name of your action -->
            <field name="name"><string>quickCreateTask</string></field>
            <field name="category"><string>uiIconExt-tasks</string></field>

            <!-- The full qualified name of your webui component -->
            <field name="component"><string>org.exoplatform.task.integration.platform.UICreateTask</string></field>
          </object>
        </object-param>
      </init-params>
    </component-plugin>
  </external-component-plugins>
  
</configuration>
