Class Site
- All Implemented Interfaces:
Serializable
- Author:
- Roy Wetherall
- See Also:
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionaquireContainer(String componentId) Gets and if missing, creates a new site container.aquireContainer(String componentId, String folderType) Gets and if missing, creates a new site container.aquireContainer(String componentId, String folderType, Object properties) Gets and if missing, creates a new site container.createAndSaveContainer(String containerId, String containerType, String description) This method creates a container of the specified id and type, sets the cm:description on that container node to the specified value and saves the container node updates to the repository.createContainer(String componentId) Creates a new site containercreateContainer(String componentId, String folderType) Creates a new site containercreateContainer(String componentId, String folderType, Object permissions) Creates a new site containervoidDeletes the sitegetContainer(String componentId) Gets (or creates) the "container" folder for the specified component idGet the site created dateGet a map of the sites custom propertiesgetCustomProperty(String name) Get the value of a custom property, null if the custom property has not been set or doesn't exist.Get the descriptiongetInvitation(String invitationId) Get an invitation to this web sitebooleanDeprecated.Get the site last modified dategetMembersRole(String authorityName) Gets a user's role in this site.getMembersRoleInfo(String authorityName) Gets extended information on the user's role in this site.getNode()Get the site node, null if noneSet the short nameGet the site group nameGets a map of role name mapping to associated group name.Get the site presetgetTitle()Get the titleGet the site visibilitybooleanhasContainer(String componentId) Determine if the "container" folder for the specified component existsinviteModerated(String inviteeComments, String inviteeUserName, String inviteeRole) Create new moderated invitation to this web siteinviteNominated(String inviteeUserName, String inviteeRole, String acceptUrl, String rejectUrl) Create new nominated invitation to this web siteinviteNominated(String inviteeFirstName, String inviteeLastName, String inviteeEmail, String inviteeRole, String acceptUrl, String rejectUrl) Create new nominated invitation to this web sitebooleanIndicates whether a user is a member of the site.booleanisMemberOfGroup(String authorityName) Indicates whether a user belongs to a group with access rights to the site or notScriptInvitation<?>[]list the outstanding invitations for this site Map of name / invitationScriptInvitation<?>[]listInvitations(org.mozilla.javascript.Scriptable props) List the open invitations for this web site. props specifies optional properties to be searched.listMembers(String nameFilter, String roleFilter) Deprecated.UselistMembers(String, String, int, boolean)insteadlistMembers(String nameFilter, String roleFilter, int size) Deprecated.UselistMembers(String, String, int, boolean)insteadlistMembers(String nameFilter, String roleFilter, int size, boolean collapseGroups) Gets a map of members of the site with their role within the site.voidremoveMembership(String authorityName) Removes a user or group membership from a site.voidReset any permissions that have been set on the node.voidsave()Saves any outstanding updates to the site details.voidsetDescription(String description) Set the descriptionvoidsetIsPublic(boolean isPublic) Deprecated.since version 3.2, replaced bysetVisibility(String)voidsetMembership(String authorityName, String role) Sets the membership details for a user.voidsetPermissions(ScriptNode node, Object permissions) Apply a set of permissions to the node.voidSet the titlevoidsetVisibility(String visibility) Set the site visibility
-
Method Details
-
getSitePreset
Get the site preset- Returns:
- String the site preset
-
getShortName
Set the short name- Returns:
- String the short name
-
getTitle
Get the title- Returns:
- String the site title
-
setTitle
Set the title- Parameters:
title- the title
-
getDescription
Get the description- Returns:
- String the description
-
setDescription
Set the description- Parameters:
description- the description
-
getIsPublic
public boolean getIsPublic()Deprecated.since version 3.2, replaced bygetVisibility()Gets whether the site is public or not- Returns:
- true is public false otherwise
-
setIsPublic
public void setIsPublic(boolean isPublic) Deprecated.since version 3.2, replaced bysetVisibility(String)Set whether the site is public or not- Parameters:
isPublic- true the site is public false otherwise
-
getVisibility
Get the site visibility- Returns:
- String site visibility
-
setVisibility
Set the site visibility- Parameters:
visibility- site visibility (public|moderated|private)
-
getNode
Get the site node, null if none- Returns:
- ScriptNode site node
-
getSiteGroup
Get the site group name- Returns:
- String site group name
-
getSitePermissionGroups
Gets a map of role name mapping to associated group name.- Returns:
- map of role to group name
-
getCreatedDate
Get the site created date- Returns:
Datesite created date
-
getLastModifiedDate
Get the site last modified date- Returns:
Datesite last modified date
-
save
public void save()Saves any outstanding updates to the site details.If properties of the site are changed and save is not called, those changes will be lost.
-
deleteSite
public void deleteSite()Deletes the site -
listMembers
Deprecated.UselistMembers(String, String, int, boolean)insteadGets a map of members of the site with their role within the site. This list can be filtered by name and/or role.If no name or role filter is specified all members of the site are listed.
This list includes both users and groups.
- Parameters:
nameFilter- user name filterroleFilter- user role filter- Returns:
- list of members of site with their roles
-
listMembers
Deprecated.UselistMembers(String, String, int, boolean)insteadGets a map of members of the site with their role within the site. This list can be filtered by name and/or role.If no name or role filter is specified all members of the site are listed.
This list includes both users and groups.
- Parameters:
nameFilter- user name filterroleFilter- user role filtersize- max results size crop if >0- Returns:
- list of members of site with their roles
-
listMembers
public ScriptableHashMap<String,String> listMembers(String nameFilter, String roleFilter, int size, boolean collapseGroups) Gets a map of members of the site with their role within the site. This list can be filtered by name and/or role.If no name or role filter is specified all members of the site are listed.
This list includes both users and groups if collapseGroups is set to false, otherwise all groups that are members are collapsed into their component users and listed.
- Parameters:
nameFilter- user name filterroleFilter- user role filtersize- max results size crop if >0collapseGroups- true if collapse member groups into user list, false otherwise- Returns:
- list of members of site with their roles
-
getMembersRole
Gets a user's role in this site.If the user is not a member of the site then null is returned.
- Parameters:
authorityName- authority name- Returns:
- String user's role or null if not a member
-
getMembersRoleInfo
Gets extended information on the user's role in this site.If the user is not a member of the site then null is returned.
- Parameters:
authorityName- authority name- Returns:
- SiteMemberInfo user's role information or null if not a member
-
isMemberOfGroup
Indicates whether a user belongs to a group with access rights to the site or not- Parameters:
authorityName- user name- Returns:
- boolean true if the user belongs to a group with access rights, false otherwise
-
isMember
Indicates whether a user is a member of the site.- Parameters:
authorityName- user name- Returns:
- boolean true if the user is a member of the site, false otherwise
-
setMembership
Sets the membership details for a user.If the user is not already a member of the site then they are added with the role given. If the user is already a member of the site then their role is updated to the new role.
Only a site manager can modify memberships and there must be at least one site manager at all times.
- Parameters:
authorityName- authority namerole- site role
-
removeMembership
Removes a user or group membership from a site.Only a site manager can remove a user's membership and the last site manager can not be removed.
- Parameters:
authorityName- authority name
-
getContainer
Gets (or creates) the "container" folder for the specified component id- Parameters:
componentId- String- Returns:
- node representing the "container" folder (or null, if for some reason the container can not be created - probably due to permissions)
-
createContainer
Creates a new site container- Parameters:
componentId- component id- Returns:
- ScriptNode the created container
-
createContainer
Creates a new site container- Parameters:
componentId- component idfolderType- folder type to create- Returns:
- ScriptNode the created container
-
createContainer
Creates a new site container- Parameters:
componentId- component idfolderType- folder type to create- Returns:
- ScriptNode the created container
-
aquireContainer
Gets and if missing, creates a new site container. The Site container is created in a new readwrite txn.- Parameters:
componentId- component id- Returns:
- ScriptNode the created container
-
aquireContainer
Gets and if missing, creates a new site container. The Site container is created in a new readwrite txn.- Parameters:
componentId- component idfolderType- folder type to create- Returns:
- ScriptNode the created container
-
aquireContainer
Gets and if missing, creates a new site container. The Site container is created in a new readwrite txn.- Parameters:
componentId- component idfolderType- folder type to create- Returns:
- ScriptNode the created container
-
createAndSaveContainer
public ScriptNode createAndSaveContainer(String containerId, String containerType, String description) This method creates a container of the specified id and type, sets the cm:description on that container node to the specified value and saves the container node updates to the repository. All of this is run as system.- Parameters:
containerId- an id for the container node.containerType- the type for the container node.description- a value for the cm:description property on the container node.- Returns:
- the newly created and saved container
ScriptNode. - Since:
- 3.4
-
hasContainer
Determine if the "container" folder for the specified component exists- Parameters:
componentId- String- Returns:
- true => "container" folder exists
-
setPermissions
Apply a set of permissions to the node.- Parameters:
node- nodepermissions- permissions
-
resetAllPermissions
Reset any permissions that have been set on the node.All permissions will be deleted and the node set to inherit permissions.
- Parameters:
node- node
-
getCustomProperty
Get the value of a custom property, null if the custom property has not been set or doesn't exist.- Parameters:
name- qname of the property- Returns:
- Serializable value of the property, null if not set
-
getCustomProperties
Get a map of the sites custom properties- Returns:
- map of names and values
-
inviteModerated
public ScriptInvitation<?> inviteModerated(String inviteeComments, String inviteeUserName, String inviteeRole) Create new moderated invitation to this web site- Returns:
- the new invitation
-
inviteNominated
public ScriptInvitation<?> inviteNominated(String inviteeFirstName, String inviteeLastName, String inviteeEmail, String inviteeRole, String acceptUrl, String rejectUrl) Create new nominated invitation to this web site- Returns:
- the new invitation
-
inviteNominated
public ScriptInvitation<?> inviteNominated(String inviteeUserName, String inviteeRole, String acceptUrl, String rejectUrl) Create new nominated invitation to this web site- Returns:
- the new invitation
-
getInvitation
Get an invitation to this web site- Returns:
- the invitation or null if it does not exist
-
listInvitations
list the outstanding invitations for this site Map of name / invitation -
listInvitations
List the open invitations for this web site. props specifies optional properties to be searched.- Parameters:
props- inviteeUserName- Returns:
- the invitations
-
getVisibility()