Class SocialTool


  • public class SocialTool
    extends java.lang.Object
    Social tool
    • Method Summary

      Modifier and Type Method Description
      static SocialPost.Author accept​(Grant g, java.lang.String followerId)
      Accept to be followed
      static java.util.Map<java.lang.String,​java.lang.Long> countAuditPosts()
      Count opened posts for qudit
      static long countFollows​(Grant g, boolean followed, java.lang.String status)  
      static long countPosts​(Grant g, java.lang.String target, java.lang.String rowId, java.lang.String authorId, boolean act, boolean audit)
      Count posts
      static void delete​(Grant g, java.lang.String id)
      Delete a message (by the owner only)
      static void deleteAudit​(java.util.Map<java.lang.String,​java.lang.String> map)
      Delete audit messages
      static void deleteMessage​(java.lang.String filter)
      Delete message
      static SocialPost.Author deny​(Grant g, java.lang.String followerId)
      Deny to be followed
      static SocialPost.Author follow​(Grant g, java.lang.String followedId)
      Request to follow someone
      static SocialPost get​(Grant g, java.lang.String id)
      Get a post
      static void like​(Grant g, java.lang.String id)
      Like a message
      static void notification​(Grant g, java.lang.String postId, java.lang.String message, java.lang.String author, java.lang.String target, java.lang.String id)  
      static void post​(Grant g, java.lang.String message, boolean pub)
      Post a new message
      static void post​(Grant g, java.lang.String message, ObjectDB target)
      Post a new message
      static java.lang.String post​(Grant g, java.lang.String id, java.lang.String message, boolean pub, java.lang.String target, java.lang.String rowId)
      Post or update a message (by the owner only)
      static void post​(Grant g, java.lang.String type, java.lang.String author, ObjectDB target)
      Post a new public activity on object
      static java.lang.String post​(Grant g, java.lang.String userId, java.lang.String id, java.lang.String message, boolean pub, java.lang.String target, java.lang.String rowId, java.lang.String level, java.lang.String status)
      Post or update a message (by the owner only)
      static java.lang.String postAudit​(java.lang.String level, java.lang.String msg, java.lang.String object, java.lang.String rowId)
      Post one audit for designers
      static java.util.List<SocialPost> search​(Grant g, java.lang.String target, java.lang.String rowId, int page, boolean act, boolean audit, java.lang.String level)
      Search posts
      static java.util.Map<java.lang.String,​java.lang.String> searchAudit​(java.lang.String msg)
      Search audit posts from designer
      static java.util.List<SocialPost.Author> searchAuthor​(Grant g, java.lang.String req, java.lang.String object, boolean all)
      Search users to follow
      static java.util.List<SocialPost.Author> searchFollows​(Grant g, boolean followed, java.lang.String status)  
      static SocialPost.Author unfollow​(Grant g, java.lang.String followedId)
      Unfollow someone
      static void unlike​(Grant g, java.lang.String id)
      Unlike a message
      static void updateStatus​(Grant g, java.lang.String id, java.lang.String status)
      Update a message status
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • countPosts

        public static long countPosts​(Grant g,
                                      java.lang.String target,
                                      java.lang.String rowId,
                                      java.lang.String authorId,
                                      boolean act,
                                      boolean audit)
        Count posts
        Parameters:
        g - User rights
        target - Optional target object
        rowId - Optional related ID
        authorId - Optional user ID
        act - true to include activity messages
        audit - true to list audit messages only
        Returns:
        Posts count with user rights
      • search

        public static java.util.List<SocialPost> search​(Grant g,
                                                        java.lang.String target,
                                                        java.lang.String rowId,
                                                        int page,
                                                        boolean act,
                                                        boolean audit,
                                                        java.lang.String level)
        Search posts
        Parameters:
        g - User rights (to limit search to public and followed posts)
        target - Optional object
        rowId - Optional row ID
        page - Pagination
        act - true to include activity messages
        audit - true to list audit messages only
        level - optional filter on level or closed status
        Returns:
        List of visible posts for the user
      • get

        public static SocialPost get​(Grant g,
                                     java.lang.String id)
        Get a post
        Parameters:
        g - User rights (to limit search to public and followed posts)
        id - row ID
        Returns:
        SocialPost
      • post

        public static void post​(Grant g,
                                java.lang.String message,
                                boolean pub)
        Post a new message
        Parameters:
        g - User rights
        message - Message
        pub - Public or followers only
      • post

        public static void post​(Grant g,
                                java.lang.String message,
                                ObjectDB target)
        Post a new message
        Parameters:
        g - Author
        message - Message
        target - Optional target object
      • post

        public static void post​(Grant g,
                                java.lang.String type,
                                java.lang.String author,
                                ObjectDB target)
        Post a new public activity on object
        Parameters:
        type - Message type NEW|UPD|DEL|STATUS
        author - Activity author
        target - Current object (must be social)
      • countAuditPosts

        public static java.util.Map<java.lang.String,​java.lang.Long> countAuditPosts()
        Count opened posts for qudit
        Returns:
        3 posts count info + warn + error + closed
      • postAudit

        public static java.lang.String postAudit​(java.lang.String level,
                                                 java.lang.String msg,
                                                 java.lang.String object,
                                                 java.lang.String rowId)
        Post one audit for designers
        Parameters:
        level - Audit level
        msg - Audit message
        object - Impacted object
        rowId - Impacted object row ID
        Returns:
        new post ID
      • searchAudit

        public static java.util.Map<java.lang.String,​java.lang.String> searchAudit​(java.lang.String msg)
        Search audit posts from designer
        Parameters:
        msg - optional message to search
        Returns:
        Map message = Id
      • deleteAudit

        public static void deleteAudit​(java.util.Map<java.lang.String,​java.lang.String> map)
        Delete audit messages
        Parameters:
        map - Map of fixed messages
      • post

        public static java.lang.String post​(Grant g,
                                            java.lang.String id,
                                            java.lang.String message,
                                            boolean pub,
                                            java.lang.String target,
                                            java.lang.String rowId)
        Post or update a message (by the owner only)
        Parameters:
        g - User rights
        id - Message rowId (create if null, update if set)
        message - Message
        pub - Public or followers only
        target - optional object name
        rowId - optional object id
        Returns:
        Post id
      • post

        public static java.lang.String post​(Grant g,
                                            java.lang.String userId,
                                            java.lang.String id,
                                            java.lang.String message,
                                            boolean pub,
                                            java.lang.String target,
                                            java.lang.String rowId,
                                            java.lang.String level,
                                            java.lang.String status)
        Post or update a message (by the owner only)
        Parameters:
        g - User rights to create the POST
        userId - Author user ID
        id - Message rowId (create if null, update if set)
        message - Message
        pub - Public or followers only
        target - optional object name
        rowId - optional object id
        level - optional level
        status - optional status
        Returns:
        Post id
      • notification

        public static void notification​(Grant g,
                                        java.lang.String postId,
                                        java.lang.String message,
                                        java.lang.String author,
                                        java.lang.String target,
                                        java.lang.String id)
      • updateStatus

        public static void updateStatus​(Grant g,
                                        java.lang.String id,
                                        java.lang.String status)
        Update a message status
        Parameters:
        g - User rights
        id - Message rowId
        status - Status
      • delete

        public static void delete​(Grant g,
                                  java.lang.String id)
        Delete a message (by the owner only)
        Parameters:
        g - User rights
        id - Message rowId
      • deleteMessage

        public static void deleteMessage​(java.lang.String filter)
        Delete message
        Parameters:
        filter - Message filter
      • like

        public static void like​(Grant g,
                                java.lang.String id)
        Like a message
        Parameters:
        g - User rights
        id - Message rowId
      • unlike

        public static void unlike​(Grant g,
                                  java.lang.String id)
        Unlike a message
        Parameters:
        g - User rights
        id - Message rowId
      • countFollows

        public static long countFollows​(Grant g,
                                        boolean followed,
                                        java.lang.String status)
      • searchFollows

        public static java.util.List<SocialPost.Author> searchFollows​(Grant g,
                                                                      boolean followed,
                                                                      java.lang.String status)
      • follow

        public static SocialPost.Author follow​(Grant g,
                                               java.lang.String followedId)
        Request to follow someone
      • unfollow

        public static SocialPost.Author unfollow​(Grant g,
                                                 java.lang.String followedId)
        Unfollow someone
      • accept

        public static SocialPost.Author accept​(Grant g,
                                               java.lang.String followerId)
        Accept to be followed
      • searchAuthor

        public static java.util.List<SocialPost.Author> searchAuthor​(Grant g,
                                                                     java.lang.String req,
                                                                     java.lang.String object,
                                                                     boolean all)
        Search users to follow