UserPreferencesService

public interface UserPreferencesService

The UserPreferencesService provides API for managing the entity user preferences (grid size, visible fields).

See also: org.motechproject.mds.domain.UserPreferences

Methods

getEntityPreferences

List<UserPreferencesDto> getEntityPreferences(Long entityId)

Returns preferences for entity with the given id.

Parameters:
  • entityId – the id of the entity for the preferences
Returns:

list of user preferences for the entity

getUserPreferences

UserPreferencesDto getUserPreferences(Long entityId, String username)

Returns preferences for given user and entity. If preferences don’t exist then default ones will be created.

Parameters:
  • entityId – the id of the entity for the preferences
  • username – the owner of the preferences
Returns:

user preferences for the entity and username

removeUserPreferences

void removeUserPreferences(Long entityId, String username)

Removes user preferences for entity with the given id.

Parameters:
  • entityId – he id of entity
  • username – the owner of the preferences

selectField

void selectField(Long entityId, String username, String fieldName)

Adds field with the given name to the user visible fields. If preferences don’t exist then default ones will be created.

Parameters:
  • entityId – the id of the entity for the preferences
  • username – the owner of the preferences
  • fieldName – the name of the field to add

selectFields

void selectFields(Long entityId, String username)

Adds all entity fields to the user visible fields. If preferences don’t exist then default ones will be created.

Parameters:
  • entityId – the id of the entity for the preferences
  • username – the owner of the preferences

unselectField

void unselectField(Long entityId, String username, String fieldName)

Removes field with the given name from the user visible fields. If preferences don’t exist then default ones will be created.

Parameters:
  • entityId – the id of the entity for the preferences
  • username – the owner of the preferences
  • fieldName – the name of the field to remove

unselectFields

void unselectFields(Long entityId, String username)

Removes all entity fields from the user visible fields. If preferences don’t exist then default ones will be created.

Parameters:
  • entityId – the id of the entity for the preferences
  • username – the owner of the preferences

updateGridSize

void updateGridSize(Long entityId, String username, Integer newSize)

Updates grid size preferences for given user and entity. If preferences don’t exist then default ones will be created.

Parameters:
  • entityId – the id of the entity for the preferences
  • username – the owner of the preferences
  • newSize – the new size og the grid