org.alfresco.repo.site.script
Class Site

java.lang.Object
  extended by org.alfresco.repo.site.script.Site
All Implemented Interfaces:
java.io.Serializable

public class Site
extends java.lang.Object
implements java.io.Serializable

Site JavaScript object

See Also:
Serialized Form

Nested Class Summary
 class Site.CustomProperty
          Custom property helper class
 
Method Summary
 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.
 ScriptNode createContainer(java.lang.String componentId)
          Creates a new site container
 ScriptNode createContainer(java.lang.String componentId, java.lang.String folderType)
          Creates a new site container
 ScriptNode createContainer(java.lang.String componentId, java.lang.String folderType, java.lang.Object permissions)
          Creates a new site container
 void deleteSite()
          Deletes the site
 ScriptNode getContainer(java.lang.String componentId)
          Gets (or creates) the "container" folder for the specified component id
 ScriptableQNameMap getCustomProperties()
          Get a map of the sites custom properties
 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.
 java.lang.String getDescription()
          Get the description
 ScriptInvitation getInvitation(java.lang.String invitationId)
          Get an invitation to this web site
 boolean getIsPublic()
          Deprecated. since version 3.2, replaced by Site.getVisibility()
 java.lang.String getMembersRole(java.lang.String authorityName)
          Gets a user's role on this site.
 ScriptNode getNode()
          Get the site node, null if none
 java.lang.String getShortName()
          Set the short name
 java.lang.String getSiteGroup()
          Get the site group name
 ScriptableHashMap getSitePermissionGroups()
          Gets a map of role name mapping to associated group name.
 java.lang.String getSitePreset()
          Get the site preset
 java.lang.String getTitle()
          Get the title
 java.lang.String getVisibility()
          Get the site visibility
 boolean hasContainer(java.lang.String componentId)
          Determine if the "container" folder for the specified component exists
 ScriptInvitation inviteModerated(java.lang.String inviteeComments, java.lang.String inviteeUserName, java.lang.String inviteeRole)
          Create new moderated invitation to this web site
 ScriptInvitation inviteNominated(java.lang.String inviteeUserName, java.lang.String inviteeRole, java.lang.String serverPath, java.lang.String acceptUrl, java.lang.String rejectUrl)
          Create new nominated invitation to this web site
 ScriptInvitation inviteNominated(java.lang.String inviteeFirstName, java.lang.String inviteeLastName, java.lang.String inviteeEmail, java.lang.String inviteeRole, java.lang.String serverPath, java.lang.String acceptUrl, java.lang.String rejectUrl)
          Create new nominated invitation to this web site
 boolean isMember(java.lang.String authorityName)
          Indicates whether a user is a member of the site.
 ScriptInvitation[] listInvitations()
          list the outstanding invitations for this site Map of name / invitation
 ScriptInvitation[] listInvitations(org.mozilla.javascript.Scriptable props)
          List the open invitations for this web site.
 ScriptableHashMap listMembers(java.lang.String nameFilter, java.lang.String roleFilter)
          Deprecated. Use Site.listMembers(String, String, int, boolean) instead
 ScriptableHashMap listMembers(java.lang.String nameFilter, java.lang.String roleFilter, int size)
          Deprecated. Use Site.listMembers(String, String, int, boolean) instead
 ScriptableHashMap 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.
 void removeMembership(java.lang.String authorityName)
          Removes a user or group membership from a site.
 void resetAllPermissions(ScriptNode node)
          Reset any permissions that have been set on the node.
 void save()
          Saves any outstanding updates to the site details.
 void setDescription(java.lang.String description)
          Set the description
 void setIsPublic(boolean isPublic)
          Deprecated. since version 3.2, replaced by Site.setVisibility(String)
 void setMembership(java.lang.String authorityName, java.lang.String role)
          Sets the membership details for a user.
 void setPermissions(ScriptNode node, java.lang.Object permissions)
          Apply a set of permissions to the node.
 void setTitle(java.lang.String title)
          Set the title
 void setVisibility(java.lang.String visibility)
          Set the site visibility
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 by Site.getVisibility()

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 by Site.setVisibility(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 getSitePermissionGroups()
Gets a map of role name mapping to associated group name.

Returns:
ScriptableMap map of role to group name

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 listMembers(java.lang.String nameFilter,
                                     java.lang.String roleFilter)
Deprecated. Use Site.listMembers(String, String, int, boolean) instead

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.

Parameters:
nameFilter - user name filter
roleFilter - user role filter
Returns:
ScriptableHashMap list of members of site with their roles

listMembers

public ScriptableHashMap listMembers(java.lang.String nameFilter,
                                     java.lang.String roleFilter,
                                     int size)
Deprecated. Use Site.listMembers(String, String, int, boolean) instead

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.

Parameters:
nameFilter - user name filter
roleFilter - user role filter
size - max results size crop if >0
Returns:
ScriptableHashMap list of members of site with their roles

listMembers

public ScriptableHashMap 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 filter
roleFilter - user role filter
size - max results size crop if >0
collapseGroups - true if collapse member groups into user list, false otherwise
Returns:
ScriptableHashMap list of members of site with their roles

getMembersRole

public java.lang.String getMembersRole(java.lang.String authorityName)
Gets a user's role on 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

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 name
role - 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 -
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 id
folderType - 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 id
folderType - 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 -
Returns:
true => "container" folder exists

setPermissions

public void setPermissions(ScriptNode node,
                           java.lang.Object permissions)
Apply a set of permissions to the node.

Parameters:
nodeRef - node reference

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:
nodeRef - node reference

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 getCustomProperties()
Get a map of the sites custom properties

Returns:
ScriptableQNameMap 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 serverPath,
                                        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 serverPath,
                                        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


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.