JBoss.orgCommunity Documentation

Chapter 73. Organization Service

73.1. Organizational Model
73.1.1. User
73.1.2. Group
73.1.3. Membership
73.2. Custom Organization Service implementation instructions
73.2.1. Basic entities implementation
73.2.2. Unit handlers implementation
73.2.3. Extending BaseOrganizationService class
73.2.4. Verification of compliance
73.3. Related articles and how-tos

OrganizationService is the service that allows to access the Organization model. This model is composed of:

It is the basis of eXo personalization and authorizations in eXo and is used to all over the platform. The model is abstract and does not rely on any specific storage. Multiple implementations exist in eXo:

To create a custom organization service you need to implement a several interfaces and extend some classes which will be listed below.

First of all you need to create classes implementing the following interfaces (each of which represent a basic unit of organization service):

Note

After each set method is called the developer must call UserHandler.saveUser (GroupHandler.saveGroup, MembershipHandler.saveMembership etc.) method to persist the changes.

You can find examples of the mentioned above implementations at subversion server:

After you created basic organization service unit instances you need to create classess to handle them e.g. to persist changes, to add listener etc. For that purpose you need to implement a several interfaces correspondingly:

You can find examples of the mentioned above implementations at subversion server:

Finally you need to create your main custom organization service class. It must extend org.exoplatform.services.organization.BaseOrganizationService. BaseOrganizationService class contains organization service unit handlers as protected fields, so you can initialize them in accordance to your purposes. It also has org.exoplatform.services.organization.OrganizationService interface methods' implementations. This is the class you need to mention in the configuration file if you want to use your custom organization service.

You can find example of such class at subversion server: JCROrganizationServiceImpl.

Make sure that your custom organization service implementation is fully compliant with Organization Service TCK tests. Tests are available as maven artifact:

groupId - org.exoplatform.core

artifactId - exo.core.component.organization.tests

You can find TCK tests package source code here

Note

In order to be able to run unit tests you may need to configure the following maven plugins:

Check pom.xml file to find out one of the ways to configure maven project object model. More detailed description you can find in the dedicated chapter called "Organization Service TCK tests configuration"