org.mycore.user
Class MCRUserObject

java.lang.Object
  extended by org.mycore.user.MCRUserObject
Direct Known Subclasses:
MCRGroup, MCRUser

abstract class MCRUserObject
extends Object

This is the abstract super class of MCRUser and MCRGroup

Version:
$Revision: 14994 $ $Date: 2009-03-24 13:01:57 +0100 (Tue, 24 Mar 2009) $
Author:
Detlev Degenhardt, Jens Kupferschmidt
See Also:
MCRUser, MCRGroup

Field Summary
protected static MCRConfiguration config
           
protected  Timestamp creationDate
          The date and time of creation of the user object in the MyCoRe system
protected  String creator
          Specifies the user responsible for the creation of this user object
protected  String description
          Description of the user object
static int description_len
          The maximum length of a decription
protected  String ID
          The ID of the MyCoRe user object (either user ID or group ID)
static int id_len
          The maximum length of user and group names
protected static Logger logger
           
protected  Timestamp modifiedDate
          The date and time of the last modification of this user object
static int password_len
          The maximum length of a password
static int privilege_len
          The maximum length of a privilege
 
Constructor Summary
MCRUserObject()
          The constructor for an empty object.
 
Method Summary
 void debugDefault()
          This method sends debug data to the logger (for the debug mode).
 Timestamp getCreationDate()
           
 String getCreator()
           
 String getDescription()
           
abstract  String getID()
          This method must be implemented by a subclass and returns the the ID of the object.
 Timestamp getModifiedDate()
           
abstract  boolean isValid()
          This method checks if all required fields have been provided.
 void setCreationDate()
          This method sets the attribute creationDate to the time the method is called.
 void setCreationDate(Timestamp time)
          This method sets the attribute creationDate to the time provided as a parameter.
 void setCreator(String creator)
          This method sets the creator.
 void setDescription(String value)
           
 void setModifiedDate()
          This method sets the attribute modifiedDate to the time the method is called.
 void setModifiedDate(Timestamp time)
          This method sets the attribute modifiedDate to the time provided as a parameter.
abstract  Document toJDOMDocument()
          This method must be implemented by a subclass and then returns the user or group object as a JDOM document.
abstract  Element toJDOMElement()
          This method must be implemented by a subclass and then returns the user or group object as a JDOM element.
 String toString()
          This method is only used for providing error messages in the access control component and should be removed later.
protected static String trim(String s)
          This helper method replaces null with an empty string and trims whitespace from non-null strings.
protected static String trim(String s, int len)
          This helper method replaces null with an empty string and trims whitespace from non-null strings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static Logger logger

config

protected static MCRConfiguration config

id_len

public static final int id_len
The maximum length of user and group names

See Also:
Constant Field Values

password_len

public static final int password_len
The maximum length of a password

See Also:
Constant Field Values

description_len

public static final int description_len
The maximum length of a decription

See Also:
Constant Field Values

privilege_len

public static final int privilege_len
The maximum length of a privilege

See Also:
Constant Field Values

ID

protected String ID
The ID of the MyCoRe user object (either user ID or group ID)


creator

protected String creator
Specifies the user responsible for the creation of this user object


creationDate

protected Timestamp creationDate
The date and time of creation of the user object in the MyCoRe system


modifiedDate

protected Timestamp modifiedDate
The date and time of the last modification of this user object


description

protected String description
Description of the user object

Constructor Detail

MCRUserObject

public MCRUserObject()
The constructor for an empty object. Only the logger is defined.

Method Detail

setCreationDate

public final void setCreationDate(Timestamp time)
This method sets the attribute creationDate to the time provided as a parameter.

Parameters:
time - Timestamp to set the creation date

setCreationDate

public final void setCreationDate()
This method sets the attribute creationDate to the time the method is called.


setModifiedDate

public final void setModifiedDate(Timestamp time)
This method sets the attribute modifiedDate to the time provided as a parameter.

Parameters:
time - Timestamp to set the modified date

setModifiedDate

public final void setModifiedDate()
This method sets the attribute modifiedDate to the time the method is called.


setCreator

public final void setCreator(String creator)
This method sets the creator.

Parameters:
creator - the creator of a user or group

getCreationDate

public final Timestamp getCreationDate()
Returns:
This method returns the creation date (timestamp) of the user object.

getModifiedDate

public final Timestamp getModifiedDate()
Returns:
This method returns the time of the last modifications (timestamp) of the user object.

getCreator

public final String getCreator()
Returns:
This method returns the user ID of the creator of this user object.

getDescription

public final String getDescription()
Returns:
This method returns the description of the user object.

setDescription

public final void setDescription(String value)

toJDOMDocument

public abstract Document toJDOMDocument()
                                 throws MCRException
This method must be implemented by a subclass and then returns the user or group object as a JDOM document.

Throws:
MCRException

toJDOMElement

public abstract Element toJDOMElement()
                               throws MCRException
This method must be implemented by a subclass and then returns the user or group object as a JDOM element.

Throws:
MCRException

getID

public abstract String getID()
This method must be implemented by a subclass and returns the the ID of the object.


trim

protected static final String trim(String s)
This helper method replaces null with an empty string and trims whitespace from non-null strings.


trim

protected static final String trim(String s,
                                   int len)
This helper method replaces null with an empty string and trims whitespace from non-null strings.


isValid

public abstract boolean isValid()
This method checks if all required fields have been provided. In a later stage of the software development a User Policy object will be asked, which fields exactly are the required fields. This will be configurable.

Returns:
returns true if all required fields have been provided

debugDefault

public final void debugDefault()
This method sends debug data to the logger (for the debug mode).


toString

public String toString()
This method is only used for providing error messages in the access control component and should be removed later.

Overrides:
toString in class Object