Pet Project Plugin

Hey Tim

Pet project of mine to enable notifications to 3rd party platforms for various events in Open via a plugin.

My initial plan was to implement messaging notices - 

I assume the expected way would be to implement an IArchetypeListener and add it too the IArchetype service directly OR is it better to utilize the new plugin interface IMObjectListener ?

Sort of replicating the MessageMonitor but allowing notices to be sent to a 3rd party service.

I noticed the only time your using that IMObjectListener currently is to reload the plugin in the configuration is changed, but I assume it could be used to monitor any object type for changes.

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: Pet Project Plugin

The IMObjectListener is the correct interface. Just be aware that you won't get any updates when your plugin isn't registered.

Re: Pet Project Plugin

By registered I assume you meant the class needs to register with the Archetype service? 

 

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Pet Project Plugin

No. You need to implement the IMObjectListener interface, and add the annotation:

   @Component(service = IMObjectListener.class, immediate = true)

There's a few more requirements to make it an OSGi bundle, so I've put together a small sample here:

https://bitbucket.org/OpenVPMS/openvpms/src/1b7f0c8801e7/openvpms-plugin...

Re: Pet Project Plugin

Tim I was going to suggest that you may also need to add the ability of a plugin to insert a configuration archetype easily...some thing generic like `entity.insuranceService*` covers for the insurance plugins.   

Otherwise I am unsure how any plugin other than an insurance service would utilize the ConfigurableService interface -

its easy enough to insert the archetype with the archetype installer

but I wasnt  sure the system would add it to the organization page drop down.   

The configuration archetype should appear in the Administration - Organization drop down I would have thought.

Regards
 
Ben 
OpenVPMS Installer and Helper 
Ph: +61423044823 
Email: info[at]charltonit.com[dot]au

Re: Pet Project Plugin

If you use the latest code from master, you can define an entity.plugin* archetype and it will be configurable in Administration -> Organisation. E.g.:

<archetype name="entity.pluginSampleService.1.0" latest="true"
               type="org.openvpms.component.business.domain.im.common.Entity"
               displayName="Sample Plugin Configuration">
        <node name="id" path="/id" type="java.lang.Long" hidden="true" readOnly="true"/>
        <node name="name" type="java.lang.String" path="/name" minCardinality="1" maxLength="100"
              readOnly="true" defaultValue="'Sample Plugin Configuration'"/>
        <node name="description" type="java.lang.String" path="/description"
              defaultValue="'Sample plugin configuration'"/>
        <node name="active" path="/active" type="java.lang.Boolean" defaultValue="true()"/>
</archetype>
Syndicate content