DataServiceHelper

public final class DataServiceHelper

The DataServiceHelper is a helper class that simplifies retrieving Data Service for a given entity.

See also: org.motechproject.mds.service.MotechDataService, org.motechproject.mds.domain.Entity

Methods

getDataService

public static MotechDataService getDataService(BundleContext bundleContext, String entityClass)

Retrieves org.motechproject.mds.service.MotechDataService implementation for the given entity class. It will throw org.motechproject.mds.ex.entity.ServiceNotFoundException, in case a service for the given entity class cannot be found.

Parameters:
  • bundleContext – context of a bundle
  • entityClass – fully qualified class name of an entity
Returns:

generated org.motechproject.mds.service.MotechDataService implementation

getDataService

public static MotechDataService getDataService(BundleContext bundleContext, Entity entity)

Retrieves org.motechproject.mds.service.MotechDataService implementation for the given entity. It will throw org.motechproject.mds.ex.entity.ServiceNotFoundException, in case a service for the given entity class cannot be found.

Parameters:
  • bundleContext – context of a bundle
  • entity – entity representation, to retrieve its service for
Returns:

generated org.motechproject.mds.service.MotechDataService implementation