2.3.2. Custom Organization Service implementation instructions

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

Basic entities implementation

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

Note

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

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

Unit handlers implementation

After you have created basic Organization Service unit instances, you need to create classes to handle them (for example, to persist changes, to add listener). For that purpose, you need to implement several interfaces correspondingly:

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

Extending BaseOrganizationService class

Finally, you need to create your main custom Organization Service class. It must extend org.exoplatform.services.organization.BaseOrganizationService. The 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 this class at Github server: JCROrganizationServiceImpl.

Verification of compliance

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

  • groupId - org.exoplatform.core

  • artifactId - exo.core.component.organization.tests

    You can find the source code of TCK tests package here.

Note

To run unit tests, you may need to configure the following Maven plugins:

Check the pom.xml file to find out one of the ways to configure the Maven project object model. See Organization Service TCK tests for more details.

Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus