org.sakaiproject.component.legacy.site
Class BaseSite

java.lang.Object
  extended byorg.sakaiproject.component.legacy.site.BaseSite
All Implemented Interfaces:
AuthzGroup, Comparable, Edit, Entity, Serializable, Site

public class BaseSite
extends Object
implements Site

BaseSite is a base implementation of the Site API Site.

Author:
Sakai Software Development Team
See Also:
Serialized Form

Field Summary
protected  boolean m_active
          Active flag.
protected  AuthzGroup m_azg
          The azg from the AuthzGroupService that is my AuthzGroup impl.
protected  boolean m_azgChanged
          Set to true if we have changed our azg, so it need to be written back on save.
protected  Time m_createdTime
          The time created.
protected  String m_createdUserId
          The created user id.
protected  Collection m_deletedGroups
          List of groups deleted in this edit pass.
protected  String m_description
          The site description.
protected  String m_event
          The event code for this edit.
protected  ResourceVector m_groups
          The list of site groups for this site.
protected  boolean m_groupsLazy
          Set true while the groups have not yet been read in for a site.
protected  String m_icon
          The icon url.
protected  String m_id
          The site id.
protected  String m_info
          The site info url.
protected  boolean m_joinable
          Is this site joinable.
protected  String m_joinerRole
          The name of the role given to users who join a joinable site.
protected  Time m_lastModifiedTime
          The time last modified.
protected  String m_lastModifiedUserId
          The last modified user id.
protected  ResourceVector m_pages
          The list of site pages for this site.
protected  boolean m_pagesLazy
          Set true while the pages have not yet been read in for a site.
protected  ResourcePropertiesEdit m_properties
          The properties.
protected  boolean m_published
          Published or not.
protected  boolean m_pubView
          The pubView flag.
protected  String m_shortDescription
          The site short description.
protected  String m_skin
          The skin to use for this site.
protected  String m_title
          The site title.
protected  String m_type
          The site type.
 
Fields inherited from interface org.sakaiproject.service.legacy.entity.Entity
SEPARATOR
 
Constructor Summary
BaseSite(Element el)
          Construct from an existing definition, in xml.
BaseSite(Site other)
          Construct from another Site, exact.
BaseSite(Site other, boolean exact)
          Construct from another Site.
BaseSite(String id)
          Construct.
BaseSite(String id, String title, String type, String shortDesc, String description, String iconUrl, String infoUrl, String skin, boolean published, boolean joinable, boolean pubView, String joinRole, boolean isSpecial, boolean isUser, String createdBy, Time createdOn, String modifiedBy, Time modifiedOn)
          ReConstruct.
 
Method Summary
protected  void activate()
          Enable editing.
 Group addGroup()
          Add a new group. The Id is generated, the rest of the fields can be set using calls to the Group object returned.
 void addMember(String userId, String roleId, boolean active, boolean provided)
          Add a member to the AuthzGroup.
 SitePage addPage()
          Create a new site page and add it to this site.
 Role addRole(String id)
          Create a new Role within this AuthzGroup.
 Role addRole(String id, Role other)
          Create a new Role within this AuthzGroup, as a copy of this other role
protected  void closeEdit()
          Close the edit object - it cannot be used after this.
 int compareTo(Object obj)
           
 boolean equals(Object obj)
           
protected  AuthzGroup getAzg()
          Access (find if needed) the azg from the AuthzGroupService that implements my grouping.
 User getCreatedBy()
          
 Time getCreatedTime()
          
 String getDescription()
           
protected  String getEvent()
          Access the event code for this edit.
 Group getGroup(String id)
          Get a site group
 Collection getGroups()
          Get a collection of the groups in a Site.
 Collection getGroupsWithMember(String userId)
          Get a collection of the groups in a Site that have this user as a member.
 Collection getGroupsWithMemberHasRole(String userId, String role)
          Get a collection of the groups in a Site that have this user as a member with this role.
 String getIconUrl()
           
 String getIconUrlFull()
          
 String getId()
          Access the id of the entity.
 String getInfoUrl()
           
 String getInfoUrlFull()
          
 String getJoinerRole()
           
 String getMaintainRole()
          Access the name of the role to use for giving a user membership with "maintain" access.
 Member getMember(String userId)
          Access the user's membership record for this AuthzGroup; the role, and status flags.
 Set getMembers()
          Access all Membership records defined for this AuthzGroup.
 User getModifiedBy()
          
 Time getModifiedTime()
          
 List getOrderedPages()
          
 SitePage getPage(String id)
          Access the SitePage that has this id, if one is defined, else return null.
 List getPages()
          
 ResourceProperties getProperties()
          Access the entity's properties.
 ResourcePropertiesEdit getPropertiesEdit()
          Access the resource's properties for modification
 String getProviderGroupId()
          Access the group id for the GroupProvider for this AuthzGroup.
 String getReference()
          Access the internal reference which can be used to access the entity from within the system.
 String getReference(String rootProperty)
          Access the alternate internal reference which can be used to access the entity from within the system.
 Role getRole(String id)
          Access a Role defined in this AuthzGroup.
 Set getRoles()
          Access all Roles defined for this AuthzGroup.
 Set getRolesIsAllowed(String function)
          Access all roles that have been granted permission to this function.
 String getShortDescription()
           
 String getSkin()
           
 String getTitle()
           
 ToolConfiguration getTool(String id)
          Access the ToolConfiguration that has this id, if one is defined, else return null. The tool may be on any SitePage in the site.
 ToolConfiguration getToolForCommonId(String commonToolId)
          Get the first tool placed on the site on any page with the specified common Tool id (such as sakai.chat)
 Collection getTools(String commonToolId)
          Get all the tools placed in the site on any page for a particular common Tool Id.
 Collection getTools(String[] toolIds)
          Get all the tools placed in the site on any page that are of any of these tool ids.
 String getType()
          Access the site type.
 String getUrl()
          Access the URL which can be used to access the entity.
 String getUrl(String rootProperty)
          Access the alternate URL which can be used to access the entity.
 Role getUserRole(String userId)
          Access the active role for this user's membership.
 Set getUsers()
          Access all users who have active role membership in the AuthzGroup.
 Set getUsersHasRole(String role)
          Access all users who have an active role membership with this role.
 Set getUsersIsAllowed(String function)
          Access all users who have an active role membership to a role that is allowed this function.
 boolean hasGroups()
          Does the site have any groups defined?
 int hashCode()
           
 boolean hasRole(String userId, String role)
          Test if this user has a membership in this AuthzGroup that has this role and is active.
 boolean isActiveEdit()
          Check to see if the edit is still active, or has already been closed.
 boolean isAllowed(String userId, String function)
          Test if this user is allowed to perform the function in this AuthzGroup.
 boolean isEmpty()
          Is this AuthzGroup empty of any roles or membership?
 boolean isJoinable()
           
 boolean isPublished()
          
 boolean isPubView()
          Check if the site is marked for viewing.
 boolean isType(Object type)
          Test if the site is of this type.
 boolean keepIntersection(AuthzGroup other)
          Adjust membership so that active members are all active in other, and inactive members are all defined in other
 void loadAll()
          Make sure pages and tools, groups and properties are loaded, not lazy
 void regenerateIds()
          Generate a new set of pages and tools that have new, unique ids.
 void removeGroup(Group group)
          Remove this group from the groups for this site.
 void removeMember(String userId)
          Remove membership for for this user from the AuthzGroup.
 void removeMembers()
          Remove all membership from this AuthzGroup.
 void removePage(SitePage page)
          Remove a site page from this site.
 void removeRole(String role)
          Remove this Role from this AuthzGroup.
 void removeRoles()
          Remove all Roles from this AuthzGroup.
protected  void set(BaseSite other, boolean exact)
          Set me to be a deep copy of other (all but my id.)
 void setDescription(String description)
          Set the Description of the site. Used to give a longer text description of the site.
protected  void setEvent(String event)
          Set the event code for this edit.
 void setIconUrl(String url)
          Set the url of an icon for the site.
 void setInfoUrl(String url)
          Set the url for information about the site.
 void setJoinable(boolean joinable)
          Set the joinable status of the site.
 void setJoinerRole(String role)
          Set the joiner role for a site.
 void setMaintainRole(String role)
          Set the role name to use for "maintain" access.
 void setProviderGroupId(String id)
          Set the external group id for the GroupProvider for this AuthzGroup (set to null to have none).
 void setPublished(boolean published)
          Set the published state of this site.
 void setPubView(boolean pubView)
          Set the site view.
 void setShortDescription(String shortDescripion)
          Set the short Description of the site. Used to give a short text description of the site.
 void setSkin(String skin)
          Set the skin to use for this site.
 void setTitle(String title)
          Set the human readable Title of the site.
 void setType(String type)
          Set the site type.
 Element toXml(Document doc, Stack stack)
          Serialize the entity into XML, adding an element to the doc under the top of the stack element.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_event

protected String m_event
The event code for this edit.


m_active

protected boolean m_active
Active flag.


m_deletedGroups

protected Collection m_deletedGroups
List of groups deleted in this edit pass.


m_id

protected String m_id
The site id.


m_title

protected String m_title
The site title.


m_shortDescription

protected String m_shortDescription
The site short description.


m_description

protected String m_description
The site description.


m_joinerRole

protected String m_joinerRole
The name of the role given to users who join a joinable site.


m_joinable

protected boolean m_joinable
Is this site joinable.


m_published

protected boolean m_published
Published or not.


m_icon

protected String m_icon
The icon url.


m_info

protected String m_info
The site info url.


m_properties

protected ResourcePropertiesEdit m_properties
The properties.


m_pages

protected ResourceVector m_pages
The list of site pages for this site.


m_pagesLazy

protected boolean m_pagesLazy
Set true while the pages have not yet been read in for a site.


m_skin

protected String m_skin
The skin to use for this site.


m_pubView

protected boolean m_pubView
The pubView flag.


m_type

protected String m_type
The site type.


m_createdUserId

protected String m_createdUserId
The created user id.


m_lastModifiedUserId

protected String m_lastModifiedUserId
The last modified user id.


m_createdTime

protected Time m_createdTime
The time created.


m_lastModifiedTime

protected Time m_lastModifiedTime
The time last modified.


m_groups

protected ResourceVector m_groups
The list of site groups for this site.


m_groupsLazy

protected boolean m_groupsLazy
Set true while the groups have not yet been read in for a site.


m_azg

protected AuthzGroup m_azg
The azg from the AuthzGroupService that is my AuthzGroup impl.


m_azgChanged

protected boolean m_azgChanged
Set to true if we have changed our azg, so it need to be written back on save.

Constructor Detail

BaseSite

public BaseSite(String id)
Construct.

Parameters:
id - The site id.

BaseSite

public BaseSite(Site other)
Construct from another Site, exact.


BaseSite

public BaseSite(Site other,
                boolean exact)
Construct from another Site.

Parameters:
exact - If true, we copy ids - else we generate new ones for site, page and tools.

BaseSite

public BaseSite(Element el)
Construct from an existing definition, in xml.

Parameters:
el - The message in XML in a DOM element.

BaseSite

public BaseSite(String id,
                String title,
                String type,
                String shortDesc,
                String description,
                String iconUrl,
                String infoUrl,
                String skin,
                boolean published,
                boolean joinable,
                boolean pubView,
                String joinRole,
                boolean isSpecial,
                boolean isUser,
                String createdBy,
                Time createdOn,
                String modifiedBy,
                Time modifiedOn)
ReConstruct.

Parameters:
id -
title -
type -
shortDesc -
description -
iconUrl -
infoUrl -
skin -
published -
joinable -
pubView -
joinRole -
isSpecial -
isUser -
createdBy -
createdOn -
modifiedBy -
modifiedOn -
Method Detail

set

protected void set(BaseSite other,
                   boolean exact)
Set me to be a deep copy of other (all but my id.)

Parameters:
exact - If true, we copy ids - else we generate new ones for site, page and tools.

getId

public String getId()
Description copied from interface: Entity
Access the id of the entity.

Specified by:
getId in interface Entity
Returns:
The id.

getUrl

public String getUrl()
Description copied from interface: Entity
Access the URL which can be used to access the entity.

Specified by:
getUrl in interface Entity
Returns:
The URL which can be used to access the entity.

getReference

public String getReference()
Description copied from interface: Entity
Access the internal reference which can be used to access the entity from within the system.

Specified by:
getReference in interface Entity
Returns:
The the internal reference which can be used to access the entity from within the system.

getReference

public String getReference(String rootProperty)
Description copied from interface: Entity
Access the alternate internal reference which can be used to access the entity from within the system.

Specified by:
getReference in interface Entity
Parameters:
rootProperty - The name of the entity property whose value controls which alternate reference is requested. If null, the native 'raw' reference is requested.
Returns:
The the alternate internal reference which can be used to access the entity from within the system.

getUrl

public String getUrl(String rootProperty)
Description copied from interface: Entity
Access the alternate URL which can be used to access the entity.

Specified by:
getUrl in interface Entity
Parameters:
rootProperty - The name of the entity property whose value controls which alternate reference URL is requested. If null, the native 'raw' URL is requested.
Returns:
The alternate URL which can be used to access the entity.

getProperties

public ResourceProperties getProperties()
Description copied from interface: Entity
Access the entity's properties.

Specified by:
getProperties in interface Entity
Returns:
The entity's properties.

getCreatedBy

public User getCreatedBy()

Specified by:
getCreatedBy in interface Site
Returns:
the user who created this.

getModifiedBy

public User getModifiedBy()

Specified by:
getModifiedBy in interface Site
Returns:
the user who last modified this.

getCreatedTime

public Time getCreatedTime()

Specified by:
getCreatedTime in interface Site
Returns:
the time created.

getModifiedTime

public Time getModifiedTime()

Specified by:
getModifiedTime in interface Site
Returns:
the time last modified.

getTitle

public String getTitle()
Specified by:
getTitle in interface Site
Returns:
The human readable Title of the site.

getShortDescription

public String getShortDescription()
Specified by:
getShortDescription in interface Site
Returns:
A short text Description of the site.

getDescription

public String getDescription()
Specified by:
getDescription in interface Site
Returns:
A longer text Description of the site.

isJoinable

public boolean isJoinable()
Specified by:
isJoinable in interface Site
Returns:
true if this Site can be joined by anyone, false if not.

getJoinerRole

public String getJoinerRole()
Specified by:
getJoinerRole in interface Site
Returns:
the role name given to users who join a joinable site.

isPublished

public boolean isPublished()

Specified by:
isPublished in interface Site
Returns:
true if the site is published, false if not.

getSkin

public String getSkin()
Specified by:
getSkin in interface Site
Returns:
the skin to use for this site.

getIconUrl

public String getIconUrl()
Specified by:
getIconUrl in interface Site
Returns:
The Site's icon URL.

getIconUrlFull

public String getIconUrlFull()

Specified by:
getIconUrlFull in interface Site
Returns:
The Site's icon URL as a full URL.

getInfoUrl

public String getInfoUrl()
Specified by:
getInfoUrl in interface Site
Returns:
The Site's info display URL.

getInfoUrlFull

public String getInfoUrlFull()

Specified by:
getInfoUrlFull in interface Site
Returns:
The Site's info display URL as a full URL.

getPages

public List getPages()

Specified by:
getPages in interface Site
Returns:
the List (SitePage) of Site Pages.

getGroups

public Collection getGroups()
Get a collection of the groups in a Site.

Specified by:
getGroups in interface Site
Returns:
A collection (Group) of groups defined in the site, empty if there are none.

getGroupsWithMember

public Collection getGroupsWithMember(String userId)
Get a collection of the groups in a Site that have this user as a member.

Specified by:
getGroupsWithMember in interface Site
Parameters:
userId - The user id.
Returns:
A collection (Group) of groups defined in the site that have this user as a member, empty if there are none.

getGroupsWithMemberHasRole

public Collection getGroupsWithMemberHasRole(String userId,
                                             String role)
Get a collection of the groups in a Site that have this user as a member with this role.

Specified by:
getGroupsWithMemberHasRole in interface Site
Parameters:
userId - The user id.
role - The role.
Returns:
A collection (Group) of groups defined in the site that have this user as a member with this role, empty if there are none.

hasGroups

public boolean hasGroups()
Does the site have any groups defined?

Specified by:
hasGroups in interface Site
Returns:
true if the site and has any groups, false if not.

loadAll

public void loadAll()
Make sure pages and tools, groups and properties are loaded, not lazy

Specified by:
loadAll in interface Site

getOrderedPages

public List getOrderedPages()

Specified by:
getOrderedPages in interface Site
Returns:
The pages ordered by the tool order constraint for this site's type (as tool category).

getPage

public SitePage getPage(String id)
Access the SitePage that has this id, if one is defined, else return null.

Specified by:
getPage in interface Site
Parameters:
id - The id of the SitePage.
Returns:
The SitePage that has this id, if one is defined, else return null.

getTool

public ToolConfiguration getTool(String id)
Access the ToolConfiguration that has this id, if one is defined, else return null. The tool may be on any SitePage in the site.

Specified by:
getTool in interface Site
Parameters:
id - The id of the tool.
Returns:
The ToolConfiguration that has this id, if one is defined, else return null.

getTools

public Collection getTools(String commonToolId)
Get all the tools placed in the site on any page for a particular common Tool Id.

Specified by:
getTools in interface Site
Parameters:
commonToolId - The tool id (String, such as sakai.chat, not a tool configuration / placement uuid) to search for.
Returns:
A Collection (ToolConfiguration) of all the tools placed in the site on any page that are of this tool id (may be empty).

getToolForCommonId

public ToolConfiguration getToolForCommonId(String commonToolId)
Get the first tool placed on the site on any page with the specified common Tool id (such as sakai.chat)

Specified by:
getToolForCommonId in interface Site
Parameters:
commonToolId - The common ToolID to search for (i.e. sakai.chat)
Returns:
ToolConfiguration for the tool which has the ID (if any) or null if no tools match.

getTools

public Collection getTools(String[] toolIds)
Get all the tools placed in the site on any page that are of any of these tool ids.

Specified by:
getTools in interface Site
Parameters:
toolIds - The tool id array (String, such as sakai.chat, not a tool configuration / placement uuid) to search for.
Returns:
A Collection (ToolConfiguration) of all the tools placed in the site on any page that are of this tool id (may be empty).

getGroup

public Group getGroup(String id)
Get a site group

Specified by:
getGroup in interface Site
Parameters:
id - The group id (or reference).
Returns:
The Group object if found, or null if not found.

getType

public String getType()
Access the site type.

Specified by:
getType in interface Site
Returns:
The site type.

isType

public boolean isType(Object type)
Description copied from interface: Site
Test if the site is of this type. It is if the param is null.

Specified by:
isType in interface Site
Parameters:
type - A String type to match, or a String[], List or Set of Strings, any of which can match.
Returns:
true if the site is of the type(s) specified, false if not.

equals

public boolean equals(Object obj)

hashCode

public int hashCode()

compareTo

public int compareTo(Object obj)
Specified by:
compareTo in interface Comparable

isPubView

public boolean isPubView()
Check if the site is marked for viewing.

Specified by:
isPubView in interface Site
Returns:
True if the site is marked for viewing, false if not

toXml

public Element toXml(Document doc,
                     Stack stack)
Serialize the entity into XML, adding an element to the doc under the top of the stack element.

Specified by:
toXml in interface Entity
Parameters:
doc - The DOM doc to contain the XML (or null for a string return).
stack - The DOM elements, the top of which is the containing element of the new "entity" element.
Returns:
The newly added element.

setTitle

public void setTitle(String title)
Set the human readable Title of the site.

Specified by:
setTitle in interface Site
Parameters:
title - the new title.

setShortDescription

public void setShortDescription(String shortDescripion)
Set the short Description of the site. Used to give a short text description of the site.

Specified by:
setShortDescription in interface Site
Parameters:
shortDescripion - The new short description.

setDescription

public void setDescription(String description)
Set the Description of the site. Used to give a longer text description of the site.

Specified by:
setDescription in interface Site
Parameters:
description - The new description.

setJoinable

public void setJoinable(boolean joinable)
Set the joinable status of the site.

Specified by:
setJoinable in interface Site
Parameters:
joinable - represents whether the site is joinable (true) or not (false).

setJoinerRole

public void setJoinerRole(String role)
Set the joiner role for a site.

Specified by:
setJoinerRole in interface Site
Parameters:
role - the joiner role for a site.

setPublished

public void setPublished(boolean published)
Set the published state of this site.

Specified by:
setPublished in interface Site

setSkin

public void setSkin(String skin)
Set the skin to use for this site.

Specified by:
setSkin in interface Site
Parameters:
skin - The skin to use for this site.

setIconUrl

public void setIconUrl(String url)
Set the url of an icon for the site.

Specified by:
setIconUrl in interface Site
Parameters:
url - The new icon's url.

setInfoUrl

public void setInfoUrl(String url)
Set the url for information about the site.

Specified by:
setInfoUrl in interface Site
Parameters:
url - The new information url.

addPage

public SitePage addPage()
Create a new site page and add it to this site.

Specified by:
addPage in interface Site
Returns:
The SitePage object for the new site page.

removePage

public void removePage(SitePage page)
Description copied from interface: Site
Remove a site page from this site.

Specified by:
removePage in interface Site
Parameters:
page - The SitePage to remove.

getEvent

protected String getEvent()
Access the event code for this edit.

Returns:
The event code for this edit.

setEvent

protected void setEvent(String event)
Set the event code for this edit.

Parameters:
event - The event code for this edit.

getPropertiesEdit

public ResourcePropertiesEdit getPropertiesEdit()
Description copied from interface: Edit
Access the resource's properties for modification

Specified by:
getPropertiesEdit in interface Edit
Returns:
The resource's properties.

setType

public void setType(String type)
Set the site type.

Specified by:
setType in interface Site
Parameters:
type - The site type.

setPubView

public void setPubView(boolean pubView)
Set the site view.

Specified by:
setPubView in interface Site
Parameters:
pubView - The site view setting.

activate

protected void activate()
Enable editing.


isActiveEdit

public boolean isActiveEdit()
Description copied from interface: Edit
Check to see if the edit is still active, or has already been closed.

Specified by:
isActiveEdit in interface Edit
Returns:
true if the edit is active, false if it's been closed.

closeEdit

protected void closeEdit()
Close the edit object - it cannot be used after this.


regenerateIds

public void regenerateIds()
Description copied from interface: Site
Generate a new set of pages and tools that have new, unique ids. Good if the site had non-unique-system-wide ids for pages and tools. The Site Id does not change.

Specified by:
regenerateIds in interface Site

addGroup

public Group addGroup()
Add a new group. The Id is generated, the rest of the fields can be set using calls to the Group object returned.

Specified by:
addGroup in interface Site

removeGroup

public void removeGroup(Group group)
Remove this group from the groups for this site.

Specified by:
removeGroup in interface Site
Parameters:
group - The group to remove.

getAzg

protected AuthzGroup getAzg()
Access (find if needed) the azg from the AuthzGroupService that implements my grouping.

Returns:
My azg.

addMember

public void addMember(String userId,
                      String roleId,
                      boolean active,
                      boolean provided)
Description copied from interface: AuthzGroup
Add a member to the AuthzGroup.

Specified by:
addMember in interface AuthzGroup
Parameters:
userId - The user.
active - The active flag.
provided - If true, from an external provider.

addRole

public Role addRole(String id)
             throws IdUsedException
Description copied from interface: AuthzGroup
Create a new Role within this AuthzGroup.

Specified by:
addRole in interface AuthzGroup
Parameters:
id - The role id.
Returns:
the new Role.
Throws:
IdUsedException - if the id is already a Role in this AuthzGroup.

addRole

public Role addRole(String id,
                    Role other)
             throws IdUsedException
Description copied from interface: AuthzGroup
Create a new Role within this AuthzGroup, as a copy of this other role

Specified by:
addRole in interface AuthzGroup
Parameters:
id - The role id.
other - The role to copy.
Returns:
the new Role.
Throws:
IdUsedException - if the id is already a Role in this AuthzGroup.

getMaintainRole

public String getMaintainRole()
Description copied from interface: AuthzGroup
Access the name of the role to use for giving a user membership with "maintain" access.

Specified by:
getMaintainRole in interface AuthzGroup
Returns:
The name of the "maintain" role.

getMember

public Member getMember(String userId)
Description copied from interface: AuthzGroup
Access the user's membership record for this AuthzGroup; the role, and status flags.

Specified by:
getMember in interface AuthzGroup
Parameters:
userId - The user id.
Returns:
The Membership record for the user in this AuthzGroup, or null if the use is not a member.

getMembers

public Set getMembers()
Description copied from interface: AuthzGroup
Access all Membership records defined for this AuthzGroup.

Specified by:
getMembers in interface AuthzGroup
Returns:
The set of Membership records (Membership) defined for this AuthzGroup.

getProviderGroupId

public String getProviderGroupId()
Description copied from interface: AuthzGroup
Access the group id for the GroupProvider for this AuthzGroup.

Specified by:
getProviderGroupId in interface AuthzGroup
Returns:
The the group id for the GroupProvider for this AuthzGroup, or null if none defined.

getRole

public Role getRole(String id)
Description copied from interface: AuthzGroup
Access a Role defined in this AuthzGroup.

Specified by:
getRole in interface AuthzGroup
Parameters:
id - The role id.
Returns:
The Role, if found, or null, if not.

getRoles

public Set getRoles()
Description copied from interface: AuthzGroup
Access all Roles defined for this AuthzGroup.

Specified by:
getRoles in interface AuthzGroup
Returns:
The set of roles (Role) defined for this AuthzGroup.

getRolesIsAllowed

public Set getRolesIsAllowed(String function)
Description copied from interface: AuthzGroup
Access all roles that have been granted permission to this function.

Specified by:
getRolesIsAllowed in interface AuthzGroup
Parameters:
function - The function to check.
Returns:
The Set of role names (String) that have been granted permission to this function.

getUserRole

public Role getUserRole(String userId)
Description copied from interface: AuthzGroup
Access the active role for this user's membership.

Specified by:
getUserRole in interface AuthzGroup
Parameters:
userId - The user id.
Returns:
The Role for this user's membership, or null if the user has no active membership.

getUsers

public Set getUsers()
Description copied from interface: AuthzGroup
Access all users who have active role membership in the AuthzGroup.

Specified by:
getUsers in interface AuthzGroup
Returns:
The Set of users ids (String) who have active role membership in the AuthzGroup.

getUsersHasRole

public Set getUsersHasRole(String role)
Description copied from interface: AuthzGroup
Access all users who have an active role membership with this role.

Specified by:
getUsersHasRole in interface AuthzGroup
Returns:
The Set of user ids (String) who have an active role membership with this role.

getUsersIsAllowed

public Set getUsersIsAllowed(String function)
Description copied from interface: AuthzGroup
Access all users who have an active role membership to a role that is allowed this function.

Specified by:
getUsersIsAllowed in interface AuthzGroup
Parameters:
function - The function to check.
Returns:
The Set of user ids (String) who have an active role membership to a role that is allowed this function.

hasRole

public boolean hasRole(String userId,
                       String role)
Description copied from interface: AuthzGroup
Test if this user has a membership in this AuthzGroup that has this role and is active.

Specified by:
hasRole in interface AuthzGroup
Parameters:
userId - The user id.
role - The role name.
Returns:
true if the User has has a membership in this AuthzGroup that has this role and is active.

isAllowed

public boolean isAllowed(String userId,
                         String function)
Description copied from interface: AuthzGroup
Test if this user is allowed to perform the function in this AuthzGroup.

Specified by:
isAllowed in interface AuthzGroup
Parameters:
userId - The user id.
function - The function to open.
Returns:
true if this user is allowed to perform the function in this AuthzGroup, false if not.

isEmpty

public boolean isEmpty()
Description copied from interface: AuthzGroup
Is this AuthzGroup empty of any roles or membership?

Specified by:
isEmpty in interface AuthzGroup
Returns:
true if the AuthzGroup is empty, false if not.

removeMember

public void removeMember(String userId)
Description copied from interface: AuthzGroup
Remove membership for for this user from the AuthzGroup.

Specified by:
removeMember in interface AuthzGroup
Parameters:
userId - The user.

removeMembers

public void removeMembers()
Description copied from interface: AuthzGroup
Remove all membership from this AuthzGroup.

Specified by:
removeMembers in interface AuthzGroup

removeRole

public void removeRole(String role)
Description copied from interface: AuthzGroup
Remove this Role from this AuthzGroup. Any grants of this Role in the AuthzGroup are also removed.

Specified by:
removeRole in interface AuthzGroup
Parameters:
role - The role name.

removeRoles

public void removeRoles()
Description copied from interface: AuthzGroup
Remove all Roles from this AuthzGroup.

Specified by:
removeRoles in interface AuthzGroup

setMaintainRole

public void setMaintainRole(String role)
Description copied from interface: AuthzGroup
Set the role name to use for "maintain" access.

Specified by:
setMaintainRole in interface AuthzGroup
Parameters:
role - The name of the "maintain" role.

setProviderGroupId

public void setProviderGroupId(String id)
Description copied from interface: AuthzGroup
Set the external group id for the GroupProvider for this AuthzGroup (set to null to have none).

Specified by:
setProviderGroupId in interface AuthzGroup
Parameters:
id - The external group id for the GroupProvider, or null if there is to be none.

keepIntersection

public boolean keepIntersection(AuthzGroup other)
Description copied from interface: AuthzGroup
Adjust membership so that active members are all active in other, and inactive members are all defined in other

Specified by:
keepIntersection in interface AuthzGroup
Parameters:
other - The other azg to adjust to.
Returns:
true if any changes were made, false if not.