Intégration with the CRM plugin desk feature
Introduction
The plugin-crmclient allows to make Web Service REST calls to one / more webapps containing CRM.
Technical description of the plugin-crmclient
The interface ICRMClientService
The plugin-crmclient offers a ICRMClientService interface to make WS calls to:
- notify a CRM user account
- update a CRM request
Currently (version 1.0.2), the plugin-crmclient offers only one implementation of this interface : CRMClientWebService to make WS calls to a webapp CRM.
This solution makes it possible in the future to add new implementations, such as for example a CRMClientLocalService which could realize the notification and the update of a request without going through WS calls.
Asynchronous service processing
To compensate for network problems or other technical problems, WS calls are processed asynchronously. In other words, the service will not immediately make WS calls to notify/update a resource. It will record the actions to execute in the database (crm_client_crm_item and crm_client_crm_queue tables). Then, a Lutece daemon (crmClientSender) will perform these tasks.
Integration into a plugin
Dependency on the plugin-crmclient
In order to use the service to make Web Service calls in your plugin, it is necessary to add the plugin-crmclient as dependency in the pom.xml file of your plugin:
<dependency> <groupId>fr.paris.lutece.plugins</groupId> <artifactId>plugin-crmclient</artifactId> <version>[0.0.9,)</version> <type>lutece-plugin</type> </dependency>
Integration of the service ICRMClientService
The integration of the service must be at the level of a plugin service. There are two scenarios for the integration of the service:
- Service is declared by Spring
In this case, just add an injection:
public class MyService implements IMyService { @Inject private ICRMClientService _crmClientService; ... }
- Service is not declared by Spring
In this case, call SpringContextService to retrieve the service:
public class MyService { private ICRMClientService _crmClientService = SpringContextService.getBean (ICRMClientService.BEAN_SERVICE); ... }
Notify a CRM account
To notify a CRM account, the ICRMClientService interface offers 2 notify methods:
void notify( String strIdDemand, String strObject, String strMessage, String strSender );
This method allows you to notify using the default value of the webapp CRM as the default value defined in the crmclient.properties file.
void notify( striDDemand String, strObject String, strMessage String, strSender String, strCRMWebAppBaseURL String );
This method is used to specify the URL of another CRM webapp that is defined in the crmclient.properties file.
Warning The value of the base URL must respect the syntax http://<domainname>/<nomcontext> (Example : http://localhost:8080/lutece**).
Update a CRM request
To update a CRM request, the ICRMClientService interface also offers 2 sendUpdateDemand methods:
void sendUpdateDemand( String strIdDemand, String strStatusText );
This method allows you to update using the default value of the webapp CRM as the default value defined in the crmclient.properties file.
void sendUpdateDemand( String strIdDemand, String strStatusText, String strCRMWebAppBaseURL );
This method is used to specify the URL of another CRM webapp that is defined in the crmclient.properties file.
Warning The value of the base URL must respect the syntax http://<domainname>/<nomcontext> (Example : http://localhost:8080/lutece**).