Interface SocialServices<T extends SocialUgc>

  • All Known Implementing Classes:
    SocialServicesImpl

    public interface SocialServices<T extends SocialUgc>
    Defines all Rest Services for Moderation of UGCs.

    Implementers Must

    • Audit all Calls
    • Check that these calls are made with an authenticated user and that the UGC belongs to the user's context.

    • Method Detail

      • vote

        T vote​(String ugcId,
               VoteOptions voteOptions,
               String userId,
               String contextId)
        throws SocialException
        Executes the given UserContentInteraction for the given User Content Action.

        Implementers must check if the current user is allowed to removeWatcher UGC and that the user belongs to the same ugc context

        .
        Parameters:
        ugcId - Id of the UGC.
        voteOptions - Interaction to be executed.
        userId - Id of the user that is interacting with the content.
        contextId - Context of the UGC.
        Returns:
        A new Public (secure) UGC.
        Throws:
        SocialException - if attribute can be deleted.
        IllegalArgumentException - If given UGC does not exist.
      • flag

        T flag​(String ugcId,
               String contextId,
               String reason,
               String userId)
        throws SocialException
        Flags the given UGC, with a given reason why.

        Implementers must check if the current user is allowed to removeWatcher UGC and that the user belongs to the same ugc context

        .
        Parameters:
        ugcId - Id of the UGC to flag.
        reason - The reason for flagging this ugc.
        userId - Id of the user that is flagging this UGC.
        contextId - Context of the UGC.
        Returns:
        A new (updated) Public (secure) UGC.
        Throws:
        SocialException
      • unFlag

        boolean unFlag​(String ugcId,
                       String flagId,
                       String userId,
                       String contextId)
                throws SocialException
        Unflags the given UGC for the given reason.

        Implementers must check if the current user is allowed to removeWatcher UGC and that the user belongs to the same ugc context

        .
        Parameters:
        ugcId - Id of the UGC to unflag.
        flagId - Id of the flag to delete.
        userId - Id of the user that is unflagging this UGC.
        contextId - Context of the UGC.
        Returns:
        A new (updated) Public (secure) UGC.
        Throws:
        SocialException
      • moderate

        T moderate​(String ugcId,
                   ModerationStatus moderationStatus,
                   String userId,
                   String contextId)
            throws SocialException
        Change the moderation Status of the given UGC.
        Parameters:
        ugcId - Id of the UGC to change moderation status.
        moderationStatus - new Moderation Status.
        userId - Id of the user that is changing the status.
        contextId - Context of the UGC.
        Throws:
        SocialException
      • findByModerationStatus

        Iterable<T> findByModerationStatus​(ModerationStatus status,
                                           String thread,
                                           String contextId,
                                           int start,
                                           int limit,
                                           List<org.apache.commons.collections4.keyvalue.DefaultKeyValue<String,​Boolean>> sort)
                                    throws UGCException
        Finds all Comments with the given Moderation status. Optional: filter the thread
        Parameters:
        status - ModerationStatus to filter.
        thread - Thread owner of the comments (optional)
        start - Where to to start the count.
        limit - Amount of Comments to return.
        contextId - Context of the UGC.
        sort - Sort Fields.
        Returns:
        An Iterable with the results.
        Throws:
        UGCException
      • countByModerationStatus

        long countByModerationStatus​(ModerationStatus status,
                                     String thread,
                                     String contextId)
                              throws UGCException
        Counts all Comments with the given Moderation status. Optional: filter the thread
        Parameters:
        status - ModerationStatus to filter.
        thread - Thread owner of the comments (optional)
        contextId - Context of the UGC.
        Returns:
        Number of Results.
        Throws:
        UGCException
      • findAllFlaggedUgs

        Iterable<T> findAllFlaggedUgs​(String context,
                                      int start,
                                      int pageSize,
                                      List<org.apache.commons.collections4.keyvalue.DefaultKeyValue<String,​Boolean>> sortOrder)
        Returns all Flagged UGC
        Parameters:
        context - Context of the UGC
        start - Where to start the count.
        pageSize - Amount of Comments to return
        sortOrder - Sort Fields.
        Returns:
        An Iterable with the results.
      • countAllFlaggedUgs

        long countAllFlaggedUgs​(String context,
                                int start,
                                int pageSize,
                                List<org.apache.commons.collections4.keyvalue.DefaultKeyValue<String,​Boolean>> sortOrder)
      • approveComment

        Map<? extends String,​?> approveComment​(UGC ugc,
                                                     org.craftercms.profile.api.Profile profile)
                                              throws org.craftercms.profile.api.exceptions.ProfileException,
                                                     SocialException
        Throws:
        org.craftercms.profile.api.exceptions.ProfileException
        SocialException