org.dspace.eperson
Class EPerson

java.lang.Object
  extended by org.dspace.content.DSpaceObject
      extended by org.dspace.eperson.EPerson

public class EPerson
extends DSpaceObject

Class representing an e-person.

Version:
$Revision: 4742 $
Author:
David Stuve

Field Summary
static int EMAIL
          The e-mail field (for sorting)
static int ID
          The e-mail field (for sorting)
static int LANGUAGE
          The e-mail field (for sorting)
static int LASTNAME
          The last name (for sorting)
static int NETID
          The netid field (for sorting)
 
Method Summary
 boolean canLogIn()
          Can the user log in?
 boolean checkPassword(String attempt)
          Check EPerson's password
static EPerson create(Context context)
          Create a new eperson
 void delete()
          Delete an eperson
static EPerson find(Context context, int id)
          Get an EPerson from the database.
static EPerson[] findAll(Context context, int sortField)
          Find all the epeople that match a particular query ID LASTNAME EMAIL NETID
static EPerson findByEmail(Context context, String email)
          Find the eperson by their email address
static EPerson findByNetid(Context context, String netid)
          Find the eperson by their netid
 Vector<String> getDeleteConstraints()
          Check for presence of EPerson in tables that have constraints on EPersons.
 String getEmail()
          Get the e-person's email address
 String getFirstName()
          Get the eperson's first name.
 String getFullName()
          Get the e-person's full name, combining first and last name in a displayable string.
 String getHandle()
          Get the Handle of the object.
 int getID()
          Get the e-person's internal identifier
 String getLanguage()
          Get the e-person's language
 String getLastName()
          Get the eperson's last name.
 String getMetadata(String field)
          Get the value of a metadata field
 String getName()
          Get a proper name for the object.
 String getNetid()
          Get the e-person's netid
 boolean getRequireCertificate()
          Get require certificate or not
 boolean getSelfRegistered()
          Can the user log in?
 int getType()
          return type found in Constants
 boolean obsolete_equals(Object other)
          Return true if other is the same EPerson as this object, false otherwise
static EPerson[] search(Context context, String query)
          Find the epeople that match the search query across firstname, lastname or email
static EPerson[] search(Context context, String query, int offset, int limit)
          Find the epeople that match the search query across firstname, lastname or email.
static int searchResultCount(Context context, String query)
          Returns the total number of epeople returned by a specific query, without the overhead of creating the EPerson objects to store the results.
 void setCanLogIn(boolean login)
          Indicate whether the user can log in
 void setEmail(String s)
          Set the EPerson's email
 void setFirstName(String firstname)
          Set the eperson's first name
 void setLanguage(String language)
          Set the EPerson's language.
 void setLastName(String lastname)
          Set the eperson's last name
 void setMetadata(String field, String value)
          Set a metadata value
 void setNetid(String s)
          Set the EPerson's netid
 void setPassword(String s)
          Set the EPerson's password
 void setRequireCertificate(boolean isrequired)
          Set require cert yes/no
 void setSelfRegistered(boolean sr)
          Indicate whether the user self-registered
 void update()
          Update the EPerson
 
Methods inherited from class org.dspace.content.DSpaceObject
addDetails, clearDetails, find, getAdminObject, getDetails, getParentObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMAIL

public static final int EMAIL
The e-mail field (for sorting)

See Also:
Constant Field Values

LASTNAME

public static final int LASTNAME
The last name (for sorting)

See Also:
Constant Field Values

ID

public static final int ID
The e-mail field (for sorting)

See Also:
Constant Field Values

NETID

public static final int NETID
The netid field (for sorting)

See Also:
Constant Field Values

LANGUAGE

public static final int LANGUAGE
The e-mail field (for sorting)

See Also:
Constant Field Values
Method Detail

find

public static EPerson find(Context context,
                           int id)
                    throws SQLException
Get an EPerson from the database.

Parameters:
context - DSpace context object
id - ID of the EPerson
Returns:
the EPerson format, or null if the ID is invalid.
Throws:
SQLException

findByEmail

public static EPerson findByEmail(Context context,
                                  String email)
                           throws SQLException,
                                  AuthorizeException
Find the eperson by their email address

Returns:
EPerson
Throws:
SQLException
AuthorizeException

findByNetid

public static EPerson findByNetid(Context context,
                                  String netid)
                           throws SQLException
Find the eperson by their netid

Parameters:
context - DSpace context
netid - Network ID
Returns:
corresponding EPerson, or null
Throws:
SQLException

search

public static EPerson[] search(Context context,
                               String query)
                        throws SQLException
Find the epeople that match the search query across firstname, lastname or email

Parameters:
context - DSpace context
query - The search string
Returns:
array of EPerson objects
Throws:
SQLException

search

public static EPerson[] search(Context context,
                               String query,
                               int offset,
                               int limit)
                        throws SQLException
Find the epeople that match the search query across firstname, lastname or email. This method also allows offsets and limits for pagination purposes.

Parameters:
context - DSpace context
query - The search string
offset - Inclusive offset
limit - Maximum number of matches returned
Returns:
array of EPerson objects
Throws:
SQLException

searchResultCount

public static int searchResultCount(Context context,
                                    String query)
                             throws SQLException
Returns the total number of epeople returned by a specific query, without the overhead of creating the EPerson objects to store the results.

Parameters:
context - DSpace context
query - The search string
Returns:
the number of epeople mathching the query
Throws:
SQLException

findAll

public static EPerson[] findAll(Context context,
                                int sortField)
                         throws SQLException
Find all the epeople that match a particular query

Returns:
array of EPerson objects
Throws:
SQLException

create

public static EPerson create(Context context)
                      throws SQLException,
                             AuthorizeException
Create a new eperson

Parameters:
context - DSpace context object
Throws:
SQLException
AuthorizeException

delete

public void delete()
            throws SQLException,
                   AuthorizeException,
                   EPersonDeletionException
Delete an eperson

Throws:
SQLException
AuthorizeException
EPersonDeletionException

getID

public int getID()
Get the e-person's internal identifier

Specified by:
getID in class DSpaceObject
Returns:
the internal identifier

getLanguage

public String getLanguage()
Get the e-person's language

Returns:
language

setLanguage

public void setLanguage(String language)
Set the EPerson's language. Value is expected to be a Unix/POSIX Locale specification of the form {language} or {language}_{territory}, e.g. "en", "en_US", "pt_BR" (the latter is Brazilian Portugese).

Parameters:
s - language

getHandle

public String getHandle()
Description copied from class: DSpaceObject
Get the Handle of the object. This may return null

Specified by:
getHandle in class DSpaceObject
Returns:
Handle of the object, or null if it doesn't have one

getEmail

public String getEmail()
Get the e-person's email address

Returns:
their email address

setEmail

public void setEmail(String s)
Set the EPerson's email

Parameters:
s - the new email

getNetid

public String getNetid()
Get the e-person's netid

Returns:
their netid

setNetid

public void setNetid(String s)
Set the EPerson's netid

Parameters:
s - the new netid

getFullName

public String getFullName()
Get the e-person's full name, combining first and last name in a displayable string.

Returns:
their full name

getFirstName

public String getFirstName()
Get the eperson's first name.

Returns:
their first name

setFirstName

public void setFirstName(String firstname)
Set the eperson's first name

Parameters:
firstname - the person's first name

getLastName

public String getLastName()
Get the eperson's last name.

Returns:
their last name

setLastName

public void setLastName(String lastname)
Set the eperson's last name

Parameters:
lastname - the person's last name

setCanLogIn

public void setCanLogIn(boolean login)
Indicate whether the user can log in

Parameters:
login - boolean yes/no

canLogIn

public boolean canLogIn()
Can the user log in?

Returns:
boolean, yes/no

setRequireCertificate

public void setRequireCertificate(boolean isrequired)
Set require cert yes/no

Parameters:
isrequired - boolean yes/no

getRequireCertificate

public boolean getRequireCertificate()
Get require certificate or not

Returns:
boolean, yes/no

setSelfRegistered

public void setSelfRegistered(boolean sr)
Indicate whether the user self-registered

Parameters:
sr - boolean yes/no

getSelfRegistered

public boolean getSelfRegistered()
Can the user log in?

Returns:
boolean, yes/no

getMetadata

public String getMetadata(String field)
Get the value of a metadata field

Parameters:
field - the name of the metadata field to get
Returns:
the value of the metadata field
Throws:
IllegalArgumentException - if the requested metadata field doesn't exist

setMetadata

public void setMetadata(String field,
                        String value)
Set a metadata value

Parameters:
field - the name of the metadata field to get
value - value to set the field to
Throws:
IllegalArgumentException - if the requested metadata field doesn't exist

setPassword

public void setPassword(String s)
Set the EPerson's password

Parameters:
s - the new email

checkPassword

public boolean checkPassword(String attempt)
Check EPerson's password

Parameters:
attempt - the password attempt
Returns:
boolean successful/unsuccessful

update

public void update()
            throws SQLException,
                   AuthorizeException
Update the EPerson

Throws:
SQLException
AuthorizeException

obsolete_equals

public boolean obsolete_equals(Object other)
Return true if other is the same EPerson as this object, false otherwise

Parameters:
other - object to compare to
Returns:
true if object passed in represents the same eperson as this object

getType

public int getType()
return type found in Constants

Specified by:
getType in class DSpaceObject
Returns:
type of the object

getDeleteConstraints

public Vector<String> getDeleteConstraints()
                                    throws SQLException
Check for presence of EPerson in tables that have constraints on EPersons. Called by delete() to determine whether the eperson can actually be deleted. An EPerson cannot be deleted if it exists in the item, workflowitem, or tasklistitem tables.

Returns:
Vector of tables that contain a reference to the eperson.
Throws:
SQLException

getName

public String getName()
Description copied from class: DSpaceObject
Get a proper name for the object. This may return null. Name should be suitable for display in a user interface.

Specified by:
getName in class DSpaceObject
Returns:
Name for the object, or null if it doesn't have one


Copyright © 2010 DuraSpace. All Rights Reserved.