Class Site
- java.lang.Object
-
- org.alfresco.repo.site.script.Site
-
- All Implemented Interfaces:
java.io.Serializable
public class Site extends java.lang.Object implements java.io.SerializableSite JavaScript object- Author:
- Roy Wetherall
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classSite.CustomPropertyCustom property helper class
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ScriptNodeaquireContainer(java.lang.String componentId)Gets and if missing, creates a new site container.ScriptNodeaquireContainer(java.lang.String componentId, java.lang.String folderType)Gets and if missing, creates a new site container.ScriptNodeaquireContainer(java.lang.String componentId, java.lang.String folderType, java.lang.Object properties)Gets and if missing, creates a new site container.ScriptNodecreateAndSaveContainer(java.lang.String containerId, java.lang.String containerType, java.lang.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.ScriptNodecreateContainer(java.lang.String componentId)Creates a new site containerScriptNodecreateContainer(java.lang.String componentId, java.lang.String folderType)Creates a new site containerScriptNodecreateContainer(java.lang.String componentId, java.lang.String folderType, java.lang.Object permissions)Creates a new site containervoiddeleteSite()Deletes the siteScriptNodegetContainer(java.lang.String componentId)Gets (or creates) the "container" folder for the specified component idjava.util.DategetCreatedDate()Get the site created dateScriptableQNameMap<java.lang.String,Site.CustomProperty>getCustomProperties()Get a map of the sites custom propertiesSite.CustomPropertygetCustomProperty(java.lang.String name)Get the value of a custom property, null if the custom property has not been set or doesn't exist.java.lang.StringgetDescription()Get the descriptionScriptInvitation<?>getInvitation(java.lang.String invitationId)Get an invitation to this web sitebooleangetIsPublic()Deprecated.since version 3.2, replaced bygetVisibility()java.util.DategetLastModifiedDate()Get the site last modified datejava.lang.StringgetMembersRole(java.lang.String authorityName)Gets a user's role in this site.SiteMemberInfogetMembersRoleInfo(java.lang.String authorityName)Gets extended information on the user's role in this site.ScriptNodegetNode()Get the site node, null if nonejava.lang.StringgetShortName()Set the short namejava.lang.StringgetSiteGroup()Get the site group nameScriptableHashMap<java.lang.String,java.lang.String>getSitePermissionGroups()Gets a map of role name mapping to associated group name.java.lang.StringgetSitePreset()Get the site presetjava.lang.StringgetTitle()Get the titlejava.lang.StringgetVisibility()Get the site visibilitybooleanhasContainer(java.lang.String componentId)Determine if the "container" folder for the specified component existsScriptInvitation<?>inviteModerated(java.lang.String inviteeComments, java.lang.String inviteeUserName, java.lang.String inviteeRole)Create new moderated invitation to this web siteScriptInvitation<?>inviteNominated(java.lang.String inviteeUserName, java.lang.String inviteeRole, java.lang.String acceptUrl, java.lang.String rejectUrl)Create new nominated invitation to this web siteScriptInvitation<?>inviteNominated(java.lang.String inviteeFirstName, java.lang.String inviteeLastName, java.lang.String inviteeEmail, java.lang.String inviteeRole, java.lang.String acceptUrl, java.lang.String rejectUrl)Create new nominated invitation to this web sitebooleanisMember(java.lang.String authorityName)Indicates whether a user is a member of the site.booleanisMemberOfGroup(java.lang.String authorityName)Indicates whether a user belongs to a group with access rights to the site or notScriptInvitation<?>[]listInvitations()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.ScriptableHashMap<java.lang.String,java.lang.String>listMembers(java.lang.String nameFilter, java.lang.String roleFilter)Deprecated.UselistMembers(String, String, int, boolean)insteadScriptableHashMap<java.lang.String,java.lang.String>listMembers(java.lang.String nameFilter, java.lang.String roleFilter, int size)Deprecated.UselistMembers(String, String, int, boolean)insteadScriptableHashMap<java.lang.String,java.lang.String>listMembers(java.lang.String nameFilter, java.lang.String roleFilter, int size, boolean collapseGroups)Gets a map of members of the site with their role within the site.voidremoveMembership(java.lang.String authorityName)Removes a user or group membership from a site.voidresetAllPermissions(ScriptNode node)Reset any permissions that have been set on the node.voidsave()Saves any outstanding updates to the site details.voidsetDescription(java.lang.String description)Set the descriptionvoidsetIsPublic(boolean isPublic)Deprecated.since version 3.2, replaced bysetVisibility(String)voidsetMembership(java.lang.String authorityName, java.lang.String role)Sets the membership details for a user.voidsetPermissions(ScriptNode node, java.lang.Object permissions)Apply a set of permissions to the node.voidsetTitle(java.lang.String title)Set the titlevoidsetVisibility(java.lang.String visibility)Set the site visibility
-
-
-
Method Detail
-
getSitePreset
public java.lang.String getSitePreset()
Get the site preset- Returns:
- String the site preset
-
getShortName
public java.lang.String getShortName()
Set the short name- Returns:
- String the short name
-
getTitle
public java.lang.String getTitle()
Get the title- Returns:
- String the site title
-
setTitle
public void setTitle(java.lang.String title)
Set the title- Parameters:
title- the title
-
getDescription
public java.lang.String getDescription()
Get the description- Returns:
- String the description
-
setDescription
public void setDescription(java.lang.String description)
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
public java.lang.String getVisibility()
Get the site visibility- Returns:
- String site visibility
-
setVisibility
public void setVisibility(java.lang.String visibility)
Set the site visibility- Parameters:
visibility- site visibility (public|moderated|private)
-
getNode
public ScriptNode getNode()
Get the site node, null if none- Returns:
- ScriptNode site node
-
getSiteGroup
public java.lang.String getSiteGroup()
Get the site group name- Returns:
- String site group name
-
getSitePermissionGroups
public ScriptableHashMap<java.lang.String,java.lang.String> getSitePermissionGroups()
Gets a map of role name mapping to associated group name.- Returns:
- map of role to group name
-
getCreatedDate
public java.util.Date getCreatedDate()
Get the site created date- Returns:
Datesite created date
-
getLastModifiedDate
public java.util.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
public ScriptableHashMap<java.lang.String,java.lang.String> listMembers(java.lang.String nameFilter, java.lang.String roleFilter)
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
public ScriptableHashMap<java.lang.String,java.lang.String> listMembers(java.lang.String nameFilter, java.lang.String roleFilter, int size)
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<java.lang.String,java.lang.String> listMembers(java.lang.String nameFilter, java.lang.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
public java.lang.String getMembersRole(java.lang.String authorityName)
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
public SiteMemberInfo getMembersRoleInfo(java.lang.String authorityName)
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
public boolean isMemberOfGroup(java.lang.String authorityName)
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
public boolean isMember(java.lang.String authorityName)
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
public void setMembership(java.lang.String authorityName, java.lang.String role)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
public void removeMembership(java.lang.String authorityName)
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
public ScriptNode getContainer(java.lang.String componentId)
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
public ScriptNode createContainer(java.lang.String componentId)
Creates a new site container- Parameters:
componentId- component id- Returns:
- ScriptNode the created container
-
createContainer
public ScriptNode createContainer(java.lang.String componentId, java.lang.String folderType)
Creates a new site container- Parameters:
componentId- component idfolderType- folder type to create- Returns:
- ScriptNode the created container
-
createContainer
public ScriptNode createContainer(java.lang.String componentId, java.lang.String folderType, java.lang.Object permissions)
Creates a new site container- Parameters:
componentId- component idfolderType- folder type to create- Returns:
- ScriptNode the created container
-
aquireContainer
public ScriptNode aquireContainer(java.lang.String componentId)
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
public ScriptNode aquireContainer(java.lang.String componentId, java.lang.String folderType)
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
public ScriptNode aquireContainer(java.lang.String componentId, java.lang.String folderType, java.lang.Object properties)
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(java.lang.String containerId, java.lang.String containerType, java.lang.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
public boolean hasContainer(java.lang.String componentId)
Determine if the "container" folder for the specified component exists- Parameters:
componentId- String- Returns:
- true => "container" folder exists
-
setPermissions
public void setPermissions(ScriptNode node, java.lang.Object permissions)
Apply a set of permissions to the node.- Parameters:
node- nodepermissions- permissions
-
resetAllPermissions
public void resetAllPermissions(ScriptNode node)
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
public Site.CustomProperty getCustomProperty(java.lang.String name)
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
public ScriptableQNameMap<java.lang.String,Site.CustomProperty> getCustomProperties()
Get a map of the sites custom properties- Returns:
- map of names and values
-
inviteModerated
public ScriptInvitation<?> inviteModerated(java.lang.String inviteeComments, java.lang.String inviteeUserName, java.lang.String inviteeRole)
Create new moderated invitation to this web site- Returns:
- the new invitation
-
inviteNominated
public ScriptInvitation<?> inviteNominated(java.lang.String inviteeFirstName, java.lang.String inviteeLastName, java.lang.String inviteeEmail, java.lang.String inviteeRole, java.lang.String acceptUrl, java.lang.String rejectUrl)
Create new nominated invitation to this web site- Returns:
- the new invitation
-
inviteNominated
public ScriptInvitation<?> inviteNominated(java.lang.String inviteeUserName, java.lang.String inviteeRole, java.lang.String acceptUrl, java.lang.String rejectUrl)
Create new nominated invitation to this web site- Returns:
- the new invitation
-
getInvitation
public ScriptInvitation<?> getInvitation(java.lang.String invitationId)
Get an invitation to this web site- Returns:
- the invitation or null if it does not exist
-
listInvitations
public ScriptInvitation<?>[] listInvitations()
list the outstanding invitations for this site Map of name / invitation
-
listInvitations
public ScriptInvitation<?>[] listInvitations(org.mozilla.javascript.Scriptable props)
List the open invitations for this web site. props specifies optional properties to be searched.- Parameters:
props- inviteeUserName- Returns:
- the invitations
-
-