Class ScriptGroup

  • All Implemented Interfaces:
    Serializable, Authority

    public class ScriptGroup
    extends Object
    implements Authority, Serializable
    The Script group is a GROUP authority exposed to the scripting API. It provides access to the properties of the group including the children of the group which may be groups or users.
    Author:
    mrogers
    See Also:
    Serialized Form
    • Constructor Detail

      • ScriptGroup

        public ScriptGroup​(String fullName,
                           String displayName,
                           ServiceRegistry serviceRegistry,
                           org.mozilla.javascript.Scriptable scope)
        New script group
        Parameters:
        fullName - String
        displayName - String
        serviceRegistry - ServiceRegistry
        scope - Scriptable
      • ScriptGroup

        public ScriptGroup​(String fullName,
                           ServiceRegistry serviceRegistry,
                           org.mozilla.javascript.Scriptable scope)
        New script group
        Parameters:
        fullName - String
        serviceRegistry - ServiceRegistry
        scope - Scriptable
    • Method Detail

      • deleteGroup

        public void deleteGroup()
        Delete this group
      • setShortName

        public void setShortName​(String shortName)
      • setFullName

        public void setFullName​(String fullName)
      • getFullName

        public String getFullName()
        Get the full internal name, also known as the Authority Name
        Specified by:
        getFullName in interface Authority
      • setDisplayName

        public void setDisplayName​(String displayName)
        Change the display name for this group. Need administrator permission to call this method to change a display name.
        Parameters:
        displayName - String
      • getAllUsers

        public ScriptUser[] getAllUsers()
        Get all users contained in this group
        Returns:
        ScriptUser[]
      • getAllGroups

        public ScriptGroup[] getAllGroups()
        Get all sub groups (all decendants)
        Returns:
        the descenants of this group
      • getChildUsers

        public ScriptUser[] getChildUsers()
        Get child users of this group
      • getChildUsers

        public ScriptUser[] getChildUsers​(ScriptPagingDetails paging,
                                          String sortBy)
        Get child users of this group
        Parameters:
        paging - Paging object with max number to return, and items to skip
        sortBy - What to sort on (authorityName, shortName or displayName)
      • getChildGroups

        public ScriptGroup[] getChildGroups()
      • getChildGroups

        public ScriptGroup[] getChildGroups​(int maxItems,
                                            int skipCount)
        Get child groups of this group
        Parameters:
        maxItems - Maximum number of groups to return.
        skipCount - number of groups to skip before returning the first result.
      • getChildGroups

        public ScriptGroup[] getChildGroups​(ScriptPagingDetails paging,
                                            String sortBy)
        Get child groups of this group
        Parameters:
        paging - Paging object with max number to return, and items to skip
        sortBy - What to sort on (authorityName, shortName or displayName)
      • getChildAuthorities

        public Authority[] getChildAuthorities()
        Get all the children of this group, regardless of type
      • getChildAuthorities

        public Authority[] getChildAuthorities​(ScriptPagingDetails paging,
                                               String sortBy)
        Get all the children of this group, regardless of type
        Parameters:
        paging - Paging object with max number to return, and items to skip
        sortBy - What to sort on (authorityName, shortName or displayName)
      • getParentGroups

        public ScriptGroup[] getParentGroups()
        Get the immediate parents of this group
        Returns:
        the immediate parents of this group
      • getParentGroups

        public ScriptGroup[] getParentGroups​(int maxItems,
                                             int skipCount)
        Get the immediate parents of this group
        Parameters:
        maxItems - Maximum number of groups to return.
        skipCount - number of groups to skip before returning the first result.
        Returns:
        the immediate parents of this group
      • getParentGroups

        public ScriptGroup[] getParentGroups​(ScriptPagingDetails paging,
                                             String sortBy)
        Get the immediate parents of this group
        Parameters:
        paging - Paging object with max number to return, and items to skip
        sortBy - What to sort on (authorityName, shortName or displayName)
        Returns:
        the immediate parents of this group
      • getAllParentGroups

        public ScriptGroup[] getAllParentGroups()
        Get all the parents of this this group
        Returns:
        all the parents of this group
      • getAllParentGroups

        public ScriptGroup[] getAllParentGroups​(int maxItems,
                                                int skipCount)
        Get all the parents of this this group
        Parameters:
        maxItems - Maximum number of groups to return.
        skipCount - number of groups to skip before returning the first result.
        Returns:
        all the parents of this group
      • getAllParentGroups

        public ScriptGroup[] getAllParentGroups​(ScriptPagingDetails paging,
                                                String sortBy)
        Get all the parents of this this group
        Parameters:
        paging - Paging object with max number to return, and items to skip
        sortBy - What to sort on (authorityName, shortName or displayName)
        Returns:
        all the parents of this group
      • getUserCount

        public int getUserCount()
        Get the number of users contained within this group.
        Returns:
        the number of users contained within this group.
      • getGroupCount

        public int getGroupCount()
        Get the number of child groups contained within this group.
        Returns:
        the number of child groups contained within this group.
      • createGroup

        public ScriptGroup createGroup​(String newShortName,
                                       String newDisplayName)
        Create a new group as a child of this group.
        Returns:
        the new group
      • removeGroup

        public void removeGroup​(String newShortName)
        remove sub group from this group
        Parameters:
        newShortName - the shortName of the sub group to remove from this group.
      • removeUser

        public void removeUser​(String newShortName)
        Remove child user from this group
        Parameters:
        newShortName - the shortName of the user to remove from this group.
      • addAuthority

        public void addAuthority​(String fullAuthorityName)
        AddAuthority as a child of this group
        Parameters:
        fullAuthorityName - the full name of the authority to add to this group.
      • removeAuthority

        public void removeAuthority​(String fullAuthorityName)
        Remove child Authority from this group
        Parameters:
        fullAuthorityName - the full name of the authority to remove from this group.
      • getGroupNodeRef

        public org.alfresco.service.cmr.repository.NodeRef getGroupNodeRef()
        Return the NodeRef of the group
        Since:
        4.0
      • getGroupNode

        public ScriptNode getGroupNode()
        Return a ScriptNode wrapping the group
        Since:
        4.0
      • makeScriptGroups

        public static ScriptGroup[] makeScriptGroups​(org.alfresco.query.PagingResults<String> pagedGroups,
                                                     ScriptPagingDetails paging,
                                                     String sortBy,
                                                     boolean sortAsc,
                                                     ServiceRegistry serviceRegistry,
                                                     org.mozilla.javascript.Scriptable scope)
        Returns an array of ScriptGroup objects representing the given paged results.
        Parameters:
        pagedGroups - The paged results
        paging - Object representing the paging details
        sortBy - field for sorting
        sortAsc - sort ascending or not
        serviceRegistry - ServiceRegistry
        scope - Scriptable
        Returns:
        Array of ScriptGroup objects
        Since:
        4.1.4
      • makeScriptGroupsInfo

        public static ScriptGroup[] makeScriptGroupsInfo​(org.alfresco.query.PagingResults<AuthorityInfo> pagedGroups,
                                                         ScriptPagingDetails paging,
                                                         String sortBy,
                                                         boolean sortAsc,
                                                         ServiceRegistry serviceRegistry,
                                                         org.mozilla.javascript.Scriptable scope)
        Returns an array of ScriptGroup objects representing the given paged results.
        Parameters:
        pagedGroups - sorted paged results (the page of results get sorted again taking I18n into account)
        paging - Object representing the paging details
        serviceRegistry - ServiceRegistry
        scope - Scriptable
        Returns:
        Array of ScriptGroup objects
        Since:
        4.1.4
      • getZones

        public Set<String> getZones()
        Gets all the zones of this group
        Specified by:
        getZones in interface Authority
        Returns:
        The name of the zones of this group.
        Since:
        4.1.3