com.arsdigita.kernel
Class User

java.lang.Object
  extended bycom.arsdigita.domain.DomainObject
      extended bycom.arsdigita.domain.ObservableDomainObject
          extended bycom.arsdigita.kernel.ACSObject
              extended bycom.arsdigita.kernel.Party
                  extended bycom.arsdigita.kernel.User

public class User
extends Party

Represents a user.

Version:
1.0
Author:
Phong Nguyen

Field Summary
static String BASE_DATA_OBJECT_TYPE
          Every instance of group must encapsulate a data object whose object type is either this base type or a subtype of this base type.
static String versionId
           
 
Fields inherited from class com.arsdigita.kernel.ACSObject
CONTAINER, DEFAULT_DOMAIN_CLASS, DISPLAY_NAME, ID, OBJECT_TYPE
 
Constructor Summary
User()
          Default constructor.
User(BigDecimal id)
          Deprecated. Use retrieve(BigDecimal) instead. This constructor will eventually be made protected.
User(DataObject userData)
          Deprecated. Use retrieve(DataObject)
User(ObjectType type)
          Constructor in which the contained DataObject is initialized with a new DataObject with an ObjectType specified by type.
User(OID oid)
          Deprecated. Use retrieve(OID) instead. This constructor will eventually be made protected.
User(String typeName)
          Constructor in which the contained DataObject is initialized with a new DataObject with an ObjectType specified by the string typeName.
User(String givenName, String familyName, String email)
          Convenience constructor
 
Method Summary
protected  void afterSave()
           
protected  void beforeSave()
          Persists any changes made to this object.
 void clearUserFromGroups()
           
 void delete()
          Deletes this user.
 GroupCollection getAllGroups()
          Returns all groups that the user is a direct or indirect member of.
protected  String getBaseDataObjectType()
          Returns the base data object type for this domain object class.
 GroupCollection getGroups()
          Returns the groups that this user is a direct member of.
 String getName()
          Returns the name of this user.
 PersonName getPersonName()
          Returns the name of this user as a PersonName object.
 String getScreenName()
          Returns the screen name for this user.
protected  void initialize()
          Called from base class (DomainObject) constructors.
static User retrieve(BigDecimal id)
          Retrieves a user with the given ID.
static User retrieve(DataObject userData)
          Returns a user for the given data object.
static User retrieve(OID oid)
          Retrieves a user with the given OID.
static UserCollection retrieveAll()
          Retrieves all users.
 void setPrimaryEmail(EmailAddress emailAddress)
          Marks the specified emailAddress as this user's primary email address.
 void setScreenName(String screenName)
          Sets the screen name for this user.
protected  void validatePrimaryEmail()
           
protected  void validateScreenName()
           
 
Methods inherited from class com.arsdigita.kernel.Party
addEmailAddress, getAlternateEmails, getDisplayName, getEmailAddresses, getPrimaryEmail, getURI, removeEmailAddress, retrieveAllParties, setURI
 
Methods inherited from class com.arsdigita.kernel.ACSObject
assertPrivilege, checkPrivilege, doCreateCheck, doWriteCheck, getContainer, getDefaultDomainClass, getID, getSpecificObjectType, getSpecificOID, gimmeContainer, isContainerModified, setID, setID
 
Methods inherited from class com.arsdigita.domain.ObservableDomainObject
addObserver, getObservers
 
Methods inherited from class com.arsdigita.domain.DomainObject
add, add, addToAssociation, afterDelete, beforeDelete, clear, disconnect, equals, get, getObjectType, getOID, getSession, hashCode, isDeleted, isDisconnected, isModified, isNew, isPropertyModified, isValid, remove, remove, remove, removeFromAssociation, save, set, setAssociation, setAssociation, specializeDataObject, specializeDataObject, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values

BASE_DATA_OBJECT_TYPE

public static final String BASE_DATA_OBJECT_TYPE
Every instance of group must encapsulate a data object whose object type is either this base type or a subtype of this base type.

See Also:
Constant Field Values
Constructor Detail

User

public User(DataObject userData)
Deprecated. Use retrieve(DataObject)


User

public User()
Default constructor. The contained DataObject is initialized with a new DataObject with an ObjectType of "User".

See Also:
Party.Party(String), DataObject, ObjectType

User

public User(String givenName,
            String familyName,
            String email)
Convenience constructor

Parameters:
givenName - User's first name
familyName - User's last name
email - User's email address

User

public User(String typeName)
Constructor in which the contained DataObject is initialized with a new DataObject with an ObjectType specified by the string typeName.

Parameters:
typeName - the name of the ObjectType of the contained DataObject
See Also:
Party.Party(ObjectType), DataObject, ObjectType

User

public User(ObjectType type)
     throws DataObjectNotFoundException
Constructor in which the contained DataObject is initialized with a new DataObject with an ObjectType specified by type.

Parameters:
type - the ObjectType of the contained DataObject
See Also:
Party.Party(ObjectType), DataObject, ObjectType

User

public User(OID oid)
     throws DataObjectNotFoundException
Deprecated. Use retrieve(OID) instead. This constructor will eventually be made protected.

Constructor. The contained DataObject is retrieved from the persistent storage mechanism with an OID specified by oid.

Parameters:
oid - the OID for the retrieved DataObject
See Also:
retrieve(OID), Party.Party(OID), DataObject, OID

User

public User(BigDecimal id)
     throws DataObjectNotFoundException
Deprecated. Use retrieve(BigDecimal) instead. This constructor will eventually be made protected.

Constructor. The contained DataObject is retrieved from the persistent storage mechanism with an OID specified by id and User.BASE_DATA_OBJECT_TYPE.

Parameters:
id - the id for the retrieved DataObject
See Also:
retrieve(BigDecimal), Party.Party(OID), BASE_DATA_OBJECT_TYPE, DataObject, OID
Method Detail

getBaseDataObjectType

protected String getBaseDataObjectType()
Description copied from class: DomainObject
Returns the base data object type for this domain object class. Intended to be overrided by subclasses whenever the subclass will only work if their primary data object is of a certain base type.

Overrides:
getBaseDataObjectType in class Party

retrieve

public static User retrieve(BigDecimal id)
                     throws DataObjectNotFoundException
Retrieves a user with the given ID. Use this method instead of new User(BigDecimal). This method uses the domain object factory to produce the appropriate user class for the data object of type User.BASE_DATA_OBJECT_TYPE identified by ID.

Parameters:
id - the ID for the DataObject to retrieve
Returns:
the user with the specified ID.
Throws:
DataObjectNotFoundException
See Also:
Party.Party(OID), BASE_DATA_OBJECT_TYPE, DataObject, OID

retrieve

public static User retrieve(OID oid)
                     throws DataObjectNotFoundException
Retrieves a user with the given OID. Use this method instead of the new User(OID) method. This method uses the domain object factory to produce the appropriate user class.

Parameters:
oid - the OID for the retrieved User DataObject
Returns:
the user with the specified OID.
Throws:
DataObjectNotFoundException - when no user could be retrieved with the given OID.
See Also:
Party.Party(OID), DataObject, OID, DomainObjectFactory.newInstance(OID)

retrieve

public static User retrieve(DataObject userData)
Returns a user for the given data object. Use this method instead of the new User(DataObject) method. This method uses the domain object factory to produce the appropriate user class.

Parameters:
userData - the user DataObject
Returns:
the user for the given data object.

retrieveAll

public static UserCollection retrieveAll()
Retrieves all users.

Returns:
a collection of all users.

initialize

protected void initialize()
Called from base class (DomainObject) constructors.

Overrides:
initialize in class ACSObject

getScreenName

public String getScreenName()
Returns the screen name for this user.

Returns:
the screen name for the user.

setScreenName

public void setScreenName(String screenName)
Sets the screen name for this user.

Parameters:
screenName - the screen name to set for this user

getPersonName

public PersonName getPersonName()
Returns the name of this user as a PersonName object.

Returns:
the name of this user as a PersonName object.
See Also:
PersonName

getName

public String getName()
Returns the name of this user.

Specified by:
getName in class Party
Returns:
the name of this user.

setPrimaryEmail

public void setPrimaryEmail(EmailAddress emailAddress)
Marks the specified emailAddress as this user's primary email address. If this party does not already have the specified emailAddress as an email address, it will be added using the addEmailAddress() method.

Overrides:
setPrimaryEmail in class Party
Parameters:
emailAddress - the email address to set as primary
See Also:
Party.addEmailAddress(com.arsdigita.kernel.EmailAddress), EmailAddress

getAllGroups

public GroupCollection getAllGroups()
Returns all groups that the user is a direct or indirect member of. For example, if the user is in groups A and B, and group A is a subgroup of group C, this method returns groups A, B, and C.

Returns:
the groups that this user is a direct or indirect member of.

getGroups

public GroupCollection getGroups()
Returns the groups that this user is a direct member of.

Returns:
the groups that user is a direct member of.

beforeSave

protected void beforeSave()
                   throws PersistenceException
Persists any changes made to this object.

Overrides:
beforeSave in class ACSObject
Throws:
PersistenceException
See Also:
DataObject.save()

afterSave

protected void afterSave()
Overrides:
afterSave in class DomainObject

delete

public void delete()
            throws PersistenceException
Deletes this user. The EmailAddress service may retain persistent data about the email addresses that belonged to this user (for example, bouncing status).

Overrides:
delete in class DomainObject
Throws:
PersistenceException
See Also:
DataObject.delete()

clearUserFromGroups

public void clearUserFromGroups()
                         throws PersistenceException
Throws:
PersistenceException

validatePrimaryEmail

protected void validatePrimaryEmail()

validateScreenName

protected void validateScreenName()


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC