<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<section id="Core.OrganizationServiceInitializer">
  <title>Organization Service Initializer</title>

  <para>Use the Organization Service Initializer to create users, groups and
  membership types by default.</para>

  <programlisting language="xml">&lt;external-component-plugins&gt;
    &lt;target-component&gt;org.exoplatform.services.organization.OrganizationService&lt;/target-component&gt;
    &lt;component-plugin&gt;
      &lt;name&gt;init.service.listener&lt;/name&gt;
      &lt;set-method&gt;addListenerPlugin&lt;/set-method&gt;
      &lt;type&gt;org.exoplatform.services.organization.OrganizationDatabaseInitializer&lt;/type&gt;
      &lt;description&gt;this listener populate organization data for the first launch&lt;/description&gt;
      &lt;init-params&gt;
        &lt;value-param&gt;
          &lt;name&gt;checkDatabaseAlgorithm&lt;/name&gt;
          &lt;description&gt;check database&lt;/description&gt;
          &lt;value&gt;entry&lt;/value&gt;
        &lt;/value-param&gt;
        &lt;value-param&gt;
          &lt;name&gt;printInformation&lt;/name&gt;
          &lt;description&gt;Print information init database&lt;/description&gt;
          &lt;value&gt;false&lt;/value&gt;
        &lt;/value-param&gt;
        &lt;object-param&gt;
          &lt;name&gt;configuration&lt;/name&gt;
          &lt;description&gt;description&lt;/description&gt;
          &lt;object type="org.exoplatform.services.organization.OrganizationConfig"&gt;
            &lt;field name="membershipType"&gt;
              &lt;collection type="java.util.ArrayList"&gt;
                &lt;value&gt;
                  &lt;object type="org.exoplatform.services.organization.OrganizationConfig$MembershipType"&gt;
                    &lt;field name="type"&gt;
                      &lt;string&gt;manager&lt;/string&gt;
                    &lt;/field&gt;
                    &lt;field name="description"&gt;
                      &lt;string&gt;manager membership type&lt;/string&gt;
                    &lt;/field&gt;
                  &lt;/object&gt;
                &lt;/value&gt;
              &lt;/collection&gt;
            &lt;/field&gt;
            
            &lt;field name="group"&gt;
              &lt;collection type="java.util.ArrayList"&gt;
                &lt;value&gt;
                  &lt;object type="org.exoplatform.services.organization.OrganizationConfig$Group"&gt;
                    &lt;field name="name"&gt;
                      &lt;string&gt;platform&lt;/string&gt;
                    &lt;/field&gt;
                    &lt;field name="parentId"&gt;
                      &lt;string&gt;&lt;/string&gt;
                    &lt;/field&gt;
                    &lt;field name="description"&gt;
                      &lt;string&gt;the /platform group&lt;/string&gt;
                    &lt;/field&gt;
                    &lt;field name="label"&gt;
                      &lt;string&gt;Platform&lt;/string&gt;
                    &lt;/field&gt;
                  &lt;/object&gt;
                &lt;/value&gt;
                &lt;value&gt;
                  &lt;object type="org.exoplatform.services.organization.OrganizationConfig$Group"&gt;
                    &lt;field name="name"&gt;
                      &lt;string&gt;administrators&lt;/string&gt;
                    &lt;/field&gt;
                    &lt;field name="parentId"&gt;
                      &lt;string&gt;/platform&lt;/string&gt;
                    &lt;/field&gt;
                    &lt;field name="description"&gt;
                      &lt;string&gt;the /platform/administrators group&lt;/string&gt;
                    &lt;/field&gt;
                    &lt;field name="label"&gt;
                      &lt;string&gt;Administrators&lt;/string&gt;
                    &lt;/field&gt;
                  &lt;/object&gt;
                &lt;/value&gt;
               &lt;/collection&gt;
            &lt;/field&gt;
            
            &lt;field name="user"&gt;
              &lt;collection type="java.util.ArrayList"&gt;
                &lt;value&gt;
                  &lt;object type="org.exoplatform.services.organization.OrganizationConfig$User"&gt;
                    &lt;field name="userName"&gt;
                      &lt;string&gt;root&lt;/string&gt;
                    &lt;/field&gt;
                    &lt;field name="password"&gt;
                      &lt;string&gt;exo&lt;/string&gt;
                    &lt;/field&gt;
                    &lt;field name="firstName"&gt;
                      &lt;string&gt;Root&lt;/string&gt;
                    &lt;/field&gt;
                    &lt;field name="lastName"&gt;
                      &lt;string&gt;Root&lt;/string&gt;
                    &lt;/field&gt;
                    &lt;field name="email"&gt;
                      &lt;string&gt;root@localhost&lt;/string&gt;
                    &lt;/field&gt;
                    &lt;field name="groups"&gt;
                      &lt;string&gt;
                        manager:/platform/administrators
                      &lt;/string&gt;
                    &lt;/field&gt;
                  &lt;/object&gt;
                &lt;/value&gt;
              &lt;/collection&gt;
            &lt;/field&gt;
          &lt;/object&gt;
        &lt;/object-param&gt;
      &lt;/init-params&gt;
    &lt;/component-plugin&gt;
  &lt;/external-component-plugins&gt;</programlisting>

  <para>Params for membership type:</para>

  <itemizedlist>
    <listitem>
      <para>type: The membership type's name.</para>
    </listitem>

    <listitem>
      <para>description: The membership type's description.</para>
    </listitem>
  </itemizedlist>

  <para>Params for group:</para>

  <itemizedlist>
    <listitem>
      <para>name: The group's name</para>
    </listitem>

    <listitem>
      <para>parentId: The id of the parent group. If the parent id is null, it
      means that the group is at the first level. The parentId should have the
      form: /ancestor/parent</para>
    </listitem>

    <listitem>
      <para>description: The group's description</para>
    </listitem>

    <listitem>
      <para>label: The group's label</para>
    </listitem>
  </itemizedlist>

  <para>Params for user:</para>

  <itemizedlist>
    <listitem>
      <para>userName: The user's name</para>
    </listitem>

    <listitem>
      <para>password: The user's password</para>
    </listitem>

    <listitem>
      <para>firstName: The user's first name</para>
    </listitem>

    <listitem>
      <para>lastName: The user's last name</para>
    </listitem>

    <listitem>
      <para>email: The user's email</para>
    </listitem>

    <listitem>
      <para>groups: The user's membership types and groups in which he
      consist.</para>
    </listitem>
  </itemizedlist>
</section>
