JdoListenerRegistryService

public interface JdoListenerRegistryService

Gives access to the registry of listeners for persistence events.

Methods

getEntitiesListenerStr

String getEntitiesListenerStr()

Gets entities from listeners in one string, where every entity name is in a new line.

Returns:the entities from listeners

getListeners

List<MotechLifecycleListener> getListeners()

Gets the listeners from the registry.

Returns:the list of listeners

getListeners

List<MotechLifecycleListener> getListeners(String entity, InstanceLifecycleListenerType type)

Gets the list of listeners for the given entity and type of persistence event.

Parameters:
  • entity – the class name of persistence object
  • type – the type of persistence event
Returns:

the list of listeners

getMethods

Set<String> getMethods(MotechLifecycleListener listener, InstanceLifecycleListenerType type)

Gets the list of methods from the listener for the given type of persistence event.

Parameters:
  • listener – the listener for persistence object
  • type – the type of persistence event
Returns:

the list of methods

registerEntityWithListeners

void registerEntityWithListeners(String entity)

Adds the given entity to the list of entities for which there may exist instance lifecycle listeners.

Parameters:
  • entity – the class name of the entity to add

registerListener

void registerListener(MotechLifecycleListener listener)

Registers the listener. If the registry already has listener for this type of persistence event, the methods from the given listener will be added to the existed one.

Parameters:
  • listener – the listener to be registered

removeInactiveListeners

void removeInactiveListeners(String entitiesNames)

Removes inactive listeners in the registry. This method checks if entities in listeners are still persistable classes.

Parameters:
  • entitiesNames – the names of all active entities

removeListener

void removeListener(MotechLifecycleListener listener)

Removes the listener from the registry.

Parameters:
  • listener – the listener to be removed

updateEntityNames

void updateEntityNames()

Updates entity names for package listeners