Add properties to an already existing Replicable entity
You have 2 posibilities.
- Make use of the
public Map<String, Object> getMongoProperties(String domain)
. Use this method if the properties you add are not common to multiple entities. If this is the case ... - Add the properties in a DataSet. You can create a separate one or make use of an already existing one.
Examples are all over the place. For instance, take a look at OpenAcdAgent. It has a bunch of "proprietary" properties and also some common with other OpenACD objects, written in the OpenACD DataSet.
Make an entity Replicable
- you must make sure the entity implements Replicable interface. Implement all methods with relevant info.
- make sure the replication is triggered when saving and deleting. One thing to take into account is that the replication is not triggered if the save method is called something other than saveObject(Object) (replace Object with any name), because only the methods with that name are intercepted. (Similar with delete.) Another option is to publish an event, but the recommended way is the interceptor way.
- make sure the entities are retrieved by an ReplicableProvider. The recommended way to do that is to create a separate ReplicableProvider implementation to implement the getReplicables method.