org.liquidsite.core.content
Class Group

java.lang.Object
  extended byorg.liquidsite.core.content.PersistentObject
      extended byorg.liquidsite.core.content.Group

public class Group
extends PersistentObject

A system group.


Field Summary
static java.lang.String NAME_CHARS
          The permitted group name characters.
 
Fields inherited from class org.liquidsite.core.content.PersistentObject
BINDERS, LOWER_CASE, NUMBERS, UPPER_CASE
 
Constructor Summary
Group(ContentManager manager, Domain domain, java.lang.String name)
          Creates a new group with default values.
 
Method Summary
 void addUser(User user)
          Adds the specified user to this group.
protected  void doDelete(DataSource src, User user)
          Deletes the object data from the database.
protected  void doInsert(DataSource src, User user, boolean restore)
          Inserts the object data into the database.
protected  void doUpdate(DataSource src, User user)
          Updates the object data in the database.
protected  void doValidate()
          Validates the object data before writing to the database.
 boolean equals(Group obj)
          Checks if this group equals another group.
 boolean equals(java.lang.Object obj)
          Checks if this group equals another object.
 java.lang.String getComment()
          Returns the group comment.
 java.lang.String getDescription()
          Returns the group description.
 Domain getDomain()
          Returns the group domain.
 java.lang.String getDomainName()
          Returns the group domain name
 java.lang.String getName()
          Returns the group name.
 int getUserCount()
          Returns the number of users that belong to this group.
 User[] getUsers(int startPos, int maxLength)
          Returns the users that belong to this group.
 boolean isPublic()
          Checks if this group is public.
 void removeUser(User user)
          Removes the specified user from this group.
 void setComment(java.lang.String comment)
          Sets the group comment.
 void setDescription(java.lang.String description)
          Sets the the group description.
 void setPublic(boolean value)
          Sets the public group flag.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class org.liquidsite.core.content.PersistentObject
decodeMap, delete, delete, encodeMap, getContentManager, hasAdminAccess, hasPublishAccess, hasReadAccess, hasWriteAccess, isPersistent, restore, restore, save, save, validateChars, validateSize
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME_CHARS

public static final java.lang.String NAME_CHARS
The permitted group name characters.

See Also:
Constant Field Values
Constructor Detail

Group

public Group(ContentManager manager,
             Domain domain,
             java.lang.String name)
Creates a new group with default values.

Parameters:
manager - the content manager to use
domain - the domain
name - the group name
Method Detail

equals

public boolean equals(java.lang.Object obj)
Checks if this group equals another object. This method will only return true if the other object is a group with the same domain and group name.

Parameters:
obj - the object to compare with
Returns:
true if the other object is an identical group, or false otherwise

equals

public boolean equals(Group obj)
Checks if this group equals another group. This method will only return true if the other object is a group with the same domain and group name.

Parameters:
obj - the object to compare with
Returns:
true if the other object is an identical group, or false otherwise

toString

public java.lang.String toString()
Returns a string representation of this object.

Returns:
a string representation of this object

getDomain

public Domain getDomain()
                 throws ContentException
Returns the group domain.

Returns:
the group domain
Throws:
ContentException - if no content manager is available

getDomainName

public java.lang.String getDomainName()
Returns the group domain name

Returns:
the group domain name

getName

public java.lang.String getName()
Returns the group name.

Returns:
the group name

getDescription

public java.lang.String getDescription()
Returns the group description.

Returns:
the group description

setDescription

public void setDescription(java.lang.String description)
Sets the the group description.

Parameters:
description - the new group description

isPublic

public boolean isPublic()
Checks if this group is public. A public group allows users to add or remove themselves to or from the group. This is used in the template API to allow users administer some of their group memberships. The public groups should not be security related, but only used for other things such as mailing list membership and similar.

Returns:
true if this group is public, or false otherwise

setPublic

public void setPublic(boolean value)
Sets the public group flag. A public group allows users to add or remove themselves to or from the group. This is used in the template API to allow users administer some of their group memberships. The public groups should not be security related, but only used for other things such as mailing list membership and similar.

Parameters:
value - the new flag value

getComment

public java.lang.String getComment()
Returns the group comment.

Returns:
the group comment

setComment

public void setComment(java.lang.String comment)
Sets the group comment.

Parameters:
comment - the new group comment

getUserCount

public int getUserCount()
                 throws ContentException
Returns the number of users that belong to this group. This method will only count the users registered to this group in the database.

Returns:
the number of users that belong to this group
Throws:
ContentException - if the database couldn't be accessed properly

getUsers

public User[] getUsers(int startPos,
                       int maxLength)
                throws ContentException
Returns the users that belong to this group. This method will only return the users registered to this group in the database. Also, only a limited interval of the matching users will be returned.

Parameters:
startPos - the list interval start position
maxLength - the list interval maximum length
Returns:
an array of users belonging to this group
Throws:
ContentException - if the database couldn't be accessed properly

addUser

public void addUser(User user)
Adds the specified user to this group. This action will not take effect until this object is saved.

Parameters:
user - the user object

removeUser

public void removeUser(User user)
Removes the specified user from this group. This action will not take effect until this object is saved.

Parameters:
user - the user object

doValidate

protected void doValidate()
                   throws ContentException
Validates the object data before writing to the database.

Specified by:
doValidate in class PersistentObject
Throws:
ContentException - if the object data wasn't valid

doInsert

protected void doInsert(DataSource src,
                        User user,
                        boolean restore)
                 throws ContentException
Inserts the object data into the database. If the restore flag is set, no automatic changes should be made to the data before writing to the database.

Specified by:
doInsert in class PersistentObject
Parameters:
src - the data source to use
user - the user performing the operation
restore - the restore flag
Throws:
ContentException - if the database couldn't be accessed properly

doUpdate

protected void doUpdate(DataSource src,
                        User user)
                 throws ContentException
Updates the object data in the database.

Specified by:
doUpdate in class PersistentObject
Parameters:
src - the data source to use
user - the user performing the operation
Throws:
ContentException - if the database couldn't be accessed properly

doDelete

protected void doDelete(DataSource src,
                        User user)
                 throws ContentException
Deletes the object data from the database.

Specified by:
doDelete in class PersistentObject
Parameters:
src - the data source to use
user - the user performing the operation
Throws:
ContentException - if the database couldn't be accessed properly