Interface PreferenceService

  • All Known Subinterfaces:
    FavoriteService

    public interface PreferenceService
    User's preferences are stored as technical Document.
    - Those document should be of DocumentClass defined by InternalFeatures.USER_PREFERENCES_CLASS.
    - Those documents reference authorities who can access to preferences. Those authorities can be either user identifier or profiles or groups.
    See Also:
    AuthenticatedUser, DocumentService
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      com.flower.docs.domain.document.Document create​(java.lang.String content)
      Creates preferences for current user
      com.flower.docs.domain.document.Document create​(java.lang.String content, java.util.List<com.flower.docs.domain.common.Id> authorities)
      Creates preferences for given authorities
      void delete​(java.util.List<com.flower.docs.domain.common.Id> ids)
      Deletes several preferences
      java.util.List<com.flower.docs.domain.document.Document> get()
      Gets preferences for current user
      java.util.List<com.flower.docs.domain.document.Document> get​(java.util.List<com.flower.docs.domain.common.Id> authorities)
      Gets preferences for given authorities
      void update​(com.flower.docs.domain.common.Id id, java.lang.String content)
      Updates preferences
    • Method Detail

      • create

        com.flower.docs.domain.document.Document create​(java.lang.String content,
                                                        java.util.List<com.flower.docs.domain.common.Id> authorities)
                                                 throws com.flower.docs.domain.exception.TechnicalException,
                                                        com.flower.docs.domain.exception.FunctionalException
        Creates preferences for given authorities
        Parameters:
        content - The content as string
        authorities - The authorities who should access to preferences
        Returns:
        The created document holding preferences
        Throws:
        com.flower.docs.domain.exception.TechnicalException
        com.flower.docs.domain.exception.FunctionalException
      • create

        com.flower.docs.domain.document.Document create​(java.lang.String content)
                                                 throws com.flower.docs.domain.exception.TechnicalException,
                                                        com.flower.docs.domain.exception.FunctionalException
        Creates preferences for current user
        Parameters:
        content - The content as string
        Returns:
        The created document holding preferences
        Throws:
        com.flower.docs.domain.exception.TechnicalException
        com.flower.docs.domain.exception.FunctionalException
      • get

        java.util.List<com.flower.docs.domain.document.Document> get​(java.util.List<com.flower.docs.domain.common.Id> authorities)
                                                              throws com.flower.docs.domain.exception.TechnicalException,
                                                                     com.flower.docs.domain.exception.FunctionalException
        Gets preferences for given authorities
        Parameters:
        authorities - The authorities
        Returns:
        The stored preferences
        Throws:
        com.flower.docs.domain.exception.TechnicalException
        com.flower.docs.domain.exception.FunctionalException
      • get

        java.util.List<com.flower.docs.domain.document.Document> get()
                                                              throws com.flower.docs.domain.exception.TechnicalException,
                                                                     com.flower.docs.domain.exception.FunctionalException
        Gets preferences for current user
        Parameters:
        type - The type of preference
        Returns:
        The stored preferences
        Throws:
        com.flower.docs.domain.exception.TechnicalException
        com.flower.docs.domain.exception.FunctionalException
      • update

        void update​(com.flower.docs.domain.common.Id id,
                    java.lang.String content)
             throws com.flower.docs.domain.exception.TechnicalException,
                    com.flower.docs.domain.exception.FunctionalException
        Updates preferences
        Parameters:
        id - The document identifier holding preferences
        type - The type of preference
        content - The preference content as String
        Throws:
        com.flower.docs.domain.exception.TechnicalException
        com.flower.docs.domain.exception.FunctionalException
      • delete

        void delete​(java.util.List<com.flower.docs.domain.common.Id> ids)
             throws com.flower.docs.domain.exception.TechnicalException,
                    com.flower.docs.domain.exception.FunctionalException
        Deletes several preferences
        Parameters:
        ids - The document identifiers holding preferences
        Throws:
        com.flower.docs.domain.exception.TechnicalException
        com.flower.docs.domain.exception.FunctionalException