public final class GroupManager extends Object
Modifier and Type | Field and Description |
---|---|
protected PSSession |
_session
The user connecting to the server.
|
Constructor and Description |
---|
GroupManager(PSSession session)
Creates a new manager for PageSeeder groups.
|
Modifier and Type | Method and Description |
---|---|
void |
addSubGroup(PSGroup group,
PSGroup subgroup)
Adds a group as a subgroup of another.
|
void |
addSubGroup(PSGroup group,
PSGroup subgroup,
PSNotification notification,
PSRole role,
boolean listed)
Adds a group as a subgroup of another.
|
PSThreadStatus |
archiveGroup(PSGroup group,
PSMember editor)
Archives the specified group in PageSeeder.
|
void |
createGroup(PSGroup group,
PSMember creator)
Creates the specified group in PageSeeder using default PageSeeder options.
|
void |
createGroup(PSGroup group,
PSMember creator,
GroupOptions options)
Creates the specified group in PageSeeder.
|
void |
createGroupFolder(PSGroup group,
String url)
Creates the group folder.
|
void |
createGroupFolder(PSGroup group,
String url,
boolean isPublic)
Deprecated.
Use
createGroupFolder(PSGroup, String) instead |
void |
createPersonalGroup(PSMember member)
Creates a personal group for specified member.
|
void |
createProject(PSProject project,
PSMember creator)
Creates the specified project in PageSeeder.
|
void |
createProject(PSProject project,
PSMember creator,
GroupOptions options)
Creates the specified project in PageSeeder.
|
void |
deleteSubGroup(PSGroup group,
PSGroup subgroup)
Removes a subgroup from another group.
|
void |
editGroup(PSGroup group,
PSMember editor)
Edit the specified group in PageSeeder (name not included, use
renameGroup(PSGroup, PSMember, String) to rename a group). |
void |
editGroup(PSGroup group,
PSMember editor,
GroupOptions options)
Edit the specified group in PageSeeder (name not included, use
renameGroup(PSGroup, PSMember, String) to rename a group). |
List<PSGroup> |
findGroups(PSMember member,
String prefix,
boolean includeAll)
Returns the list of projects and groups (max 1000) for the given member.
|
List<PSGroup> |
findGroups(PSMember member,
String prefix,
int max,
boolean includeAll)
Returns the list of projects and groups for the given member.
|
PSGroup |
get(String name)
Returns the group for the specified name.
|
static PSEntityCache<PSGroup> |
getCache()
Returns the internal cache used for the groups.
|
static PSEntityCache<PSGroupFolder> |
getFoldersCache()
Returns the internal cache used for group folders.
|
PSGroupFolder |
getGroupFolder(PSGroup group,
String url)
Returns the group folder for the specified URL.
|
static String |
getHostURL()
Deprecated.
Use
PSConfig.getDefault().getHostURL() ; |
PSProject |
getProject(String name)
Returns the project for the specified name.
|
void |
groupIsArchived(PSGroup group)
Should be called when the archive group thread is completed, to update the local cache
|
void |
groupIsRenamed(PSGroup group)
Should be called when the rename group thread is completed, to update the local cache
|
List<PSGroup> |
listProjectTree(PSMember member,
String nameprefix,
int max)
Returns the list of projects and groups for the given member.
|
List<PSGroup> |
listProjectTree(PSMember member,
String nameprefix,
int max,
boolean showGroup,
boolean showAll)
Returns the list of projects and groups for the given member.
|
List<PSGroup> |
listSubGroups(PSGroup group)
Returns the list of subgroups for the specified group.
|
void |
putResource(PSProject project,
PSResource resource,
boolean overwrite)
Put a resource on the project.
|
PSThreadStatus |
renameGroup(PSGroup group,
PSMember editor,
String newname)
Renames the specified group in PageSeeder.
|
PSSession |
session() |
protected final PSSession _session
public GroupManager(PSSession session)
session
- A valid session to connect to PageSeeder.public void createGroup(PSGroup group, PSMember creator) throws FailedPrecondition, APIException
The member creating the group will automatically be made a member of the group.
group
- The group to createcreator
- The member creating the requestFailedPrecondition
- Should a precondition fail to create a groupAPIException
- If an error occurs while communicating with PageSeeder.NullPointerException
- If either the group or member is null
.public void createGroup(PSGroup group, PSMember creator, GroupOptions options) throws FailedPrecondition, APIException
The optional group options parameters can be used to specify additional option to create the group or set some group properties.
group
- The group to createcreator
- The member making the requestoptions
- The group creation options (including group properties)FailedPrecondition
- Should a precondition fail to create a groupAPIException
- If an error occurs while communicating with PageSeeder.NullPointerException
- If either the group or member is null
.public void createProject(PSProject project, PSMember creator) throws FailedPrecondition, APIException
project
- The project to createcreator
- The member making the requestFailedPrecondition
- Should a precondition fail to create a projectAPIException
- If an error occurs while communicating with PageSeeder.NullPointerException
- If either the project or member is null
.public void createProject(PSProject project, PSMember creator, GroupOptions options) throws FailedPrecondition, APIException
The optional project options parameters can be used to specify additional option to create the project or set some group properties.
project
- The project to createcreator
- The member making the requestoptions
- The group creation options (including group properties)FailedPrecondition
- Should a precondition fail to create a projectAPIException
- If an error occurs while communicating with PageSeeder.NullPointerException
- If either the project or member is null
.public void createGroupFolder(PSGroup group, String url, boolean isPublic) throws InvalidEntityException, APIException
createGroupFolder(PSGroup, String)
insteadgroup
- The group where the group folder should be created.url
- The URL of the group folder.isPublic
- true
for a public group folder.InvalidEntityException
- If the group is invalid.APIException
- If an error occurs while communicating with PageSeeder.public void createGroupFolder(PSGroup group, String url) throws InvalidEntityException, APIException
group
- The group where the group folder should be created.url
- The url of the group folder.InvalidEntityException
- If the group is invalid.APIException
- If an error occurs while communicating with PageSeeder.public void createPersonalGroup(PSMember member) throws APIException
member
- The member needs to create a personal group.APIException
- If an error occurs while communicating with PageSeeder.public PSThreadStatus renameGroup(PSGroup group, PSMember editor, String newname) throws FailedPrecondition, APIException
Renaming a group is an asynchronous operation on PageSeeder so this method returns a PSThreadStatus
object.
The groupIsRenamed(PSGroup)
must be called when the thread is completed successfully.
group
- The group to renameeditor
- The member making the requestnewname
- The new group nameFailedPrecondition
- Should a precondition failAPIException
- If an error occurs while communicating with PageSeeder.NullPointerException
- If the group, editor or newname is null
.public void groupIsRenamed(PSGroup group)
group
- the group that was renamedNullPointerException
- If the group is null
.public PSThreadStatus archiveGroup(PSGroup group, PSMember editor) throws FailedPrecondition, APIException
Archiving a group is an asynchronous operation on PageSeeder so this method returns a PSThreadStatus
object.
The groupIsArchived(PSGroup)
must be called when the thread is completed successfully.
group
- The group to archiveeditor
- The member making the requestFailedPrecondition
- Should a precondition failAPIException
- If an error occurs while communicating with PageSeeder.NullPointerException
- If the group or editor is null
.public void groupIsArchived(PSGroup group)
group
- the group that was archivedNullPointerException
- If the group is null
.public void editGroup(PSGroup group, PSMember editor) throws FailedPrecondition, APIException
renameGroup(PSGroup, PSMember, String)
to rename a group).group
- The group to editeditor
- The member making the requestFailedPrecondition
- Should a precondition fail to edit the groupAPIException
- If an error occurs while communicating with PageSeeder.NullPointerException
- If the group or editor is null
.public void editGroup(PSGroup group, PSMember editor, GroupOptions options) throws FailedPrecondition, APIException
renameGroup(PSGroup, PSMember, String)
to rename a group).
The optional group options parameters can be used to specify additional options to edit the group or set some group properties.
group
- The group to editeditor
- The member making the requestoptions
- The group creation options (including group properties)FailedPrecondition
- Should a precondition fail to edit the groupAPIException
- If an error occurs while communicating with PageSeeder.NullPointerException
- If the group or editor is null
.public PSGroup get(String name) throws APIException
name
- The name of the group.APIException
- If an error occurs while communicating with PageSeeder.NullPointerException
- If either the name of the group is null
.public PSProject getProject(String name) throws APIException
name
- The name of the project.null
.APIException
- If an error occurs while communicating with PageSeeder.NullPointerException
- If either the name of the group is null
.public PSGroupFolder getGroupFolder(PSGroup group, String url) throws APIException
group
- The group the group folder belongs tourl
- The URL of the group foldernull
.APIException
public void addSubGroup(PSGroup group, PSGroup subgroup) throws APIException
group
- The group accepting the subgroup.subgroup
- The subgroup to add to the group.APIException
public void addSubGroup(PSGroup group, PSGroup subgroup, PSNotification notification, PSRole role, boolean listed) throws APIException
group
- The group accepting the subgroup.subgroup
- The subgroup to add to the group.notification
- The notification options for users added via the subgroup.role
- The role for users added via the subgroup.listed
- Whether users added via the subgroup should have their email address listed.APIException
public void deleteSubGroup(PSGroup group, PSGroup subgroup) throws APIException
group
- The "parent" group.subgroup
- The subgroup to remove.APIException
public List<PSGroup> listSubGroups(PSGroup group) throws APIException
group
- The group.APIException
public List<PSGroup> listProjectTree(PSMember member, String nameprefix, int max) throws APIException
member
- The member making the request.nameprefix
- the prefix of project/group.max
- the maximum number of projects/groups to return (may be more results as ancestors are added).APIException
public List<PSGroup> listProjectTree(PSMember member, String nameprefix, int max, boolean showGroup, boolean showAll) throws APIException
member
- The member making the request.nameprefix
- the prefix of project/group.max
- the maximum number of projects/groups to return (may be more results as ancestors are added).showGroup
- whether to return groupsshowAll
- Whether to return all projects/groups for server (Administrator only)APIException
public List<PSGroup> findGroups(PSMember member, String prefix, boolean includeAll) throws APIException
member
- The memberprefix
- The prefix of project/group nameincludeAll
- Whether to return all projects/groups for server (Administrator only)APIException
public List<PSGroup> findGroups(PSMember member, String prefix, int max, boolean includeAll) throws APIException
member
- The memberprefix
- The prefix of project/group namemax
- The maximum number of projects/groups to return.includeAll
- Whether to return all projects/groups for server (Administrator only)APIException
public void putResource(PSProject project, PSResource resource, boolean overwrite) throws FailedPrecondition, APIException
Implementation note: this method only supports text resources, not binary resources.
project
- The project the resource is associated with.resource
- The actual resourceoverwrite
- true
to overwrite the resource; false
otherwise.FailedPrecondition
- If the location is empty;
or the project is not identifiable;
or the content is binary;
or the content is empty.APIException
- For any other error communicating with PageSeeder.public static PSEntityCache<PSGroup> getCache()
public static PSEntityCache<PSGroupFolder> getFoldersCache()
@Deprecated public static String getHostURL()
PSConfig.getDefault().getHostURL()
;public PSSession session()
Copyright © 2016 Allette Systems. All rights reserved.