CrudEventBuilder

public final class CrudEventBuilder

The MDSCrudEvents class is responsible for creating MDS CRUD events.

Methods

buildEventParams

public static Map<String, Object> buildEventParams(String module, String namespace, String entity, String entityClassName, Long id)

Builds parameters for a Motech CRUD event.

Parameters:
  • module – module name of an entity
  • namespace – namespace of an entity
  • entity – entity name
  • entityClassName – entity class name
  • id – id of the affected instance
Returns:

constructed parameters for the events

createSubject

public static String createSubject(EntityInfo entity, String action)

Creates subject for a Motech event, sent upon encounter of a CRUD event in MDS.

Parameters:
  • entity – entity information
  • action – String representation of a CRUD event type
Returns:

Constructed subject for the event

createSubject

public static String createSubject(String module, String namespace, String entity, CrudEventType action)

Creates subject for a Motech Event, sent upon encounter of a CRUD event in MDS.

Parameters:
  • module – module name of an entity
  • namespace – namespace of an entity
  • entity – entity name
  • action – CRUD event type
Returns:

Constructed subject for the Motech Event

createSubject

public static String createSubject(String module, String namespace, String entity, String action)

Creates subject for a Motech Event, sent upon encounter of a CRUD event in MDS.

Parameters:
  • module – module name of an entity
  • namespace – namespace of an entity
  • entity – entity name
  • action – String representation of a CRUD event type
Returns:

Constructed subject for the Motech Event

setEntityData

public static void setEntityData(Map<String, Object> params, String module, String namespace, String entityName, String entityClassName)

Sets properties in the given java.util.Map.

Parameters:
  • params – a java.util.Map to write properties in
  • module – module name of an entity
  • namespace – namespace of an entity
  • entityName – entity name
  • entityClassName – entity class name