com.primix.vlib.ejb
Interface IOperations

All Superinterfaces:
EJBObject, java.rmi.Remote

public interface IOperations
extends EJBObject

Remote interface to the Operations stateless session bean. A repository for simple operations such as adding a new book or borrowing an existing book.

Version:
$Id: IOperations.java,v 1.12 2001/08/03 21:29:33 hship Exp $
Author:
Howard Ship

Method Summary
 java.lang.Integer addBook(java.util.Map attributes)
          Adds a book which will be owned and held by the specified owner.
 java.lang.Integer addBook(java.util.Map attributes, java.lang.String publisherName)
          Adds a book, which will be owned and help by the specified owner.
 Book borrowBook(java.lang.Integer bookPrimaryKey, java.lang.Integer borrowerPrimaryKey)
          Locates the book and the borrower, then sets the holder of the book to the borrower and increments the lend count on the book.
 Book deleteBook(java.lang.Integer bookPrimaryKey)
          Deletes a Book.
 Book getBook(java.lang.Integer primaryKey)
          Retrieves a single Book by its primary key.
 java.util.Map getBookAttributes(java.lang.Integer primaryKey)
          Retrieves the attributes of a IBook as a Map.
 Person getPerson(java.lang.Integer primaryKey)
          Retrieves a single Person by its primary key.
 java.util.Map getPersonAttributes(java.lang.Integer primaryKey)
          Retrieves the attributes of a IPerson as a Map.
 Person[] getPersons()
          Retrieves the light-weight version of all the IPerson beans, sorted by last name, then by first name.
 Publisher[] getPublishers()
          Retrieves the light-weight version of all IPublisher beans, sorted by name.
 Person login(java.lang.String email, java.lang.String password)
          Attempts to login the user in.
 Person registerNewUser(java.lang.String firstName, java.lang.String lastName, java.lang.String email, java.lang.String password)
          Attempts to register a new user, first checking that the e-mail and names are unique.
 Book returnBook(java.lang.Integer bookPrimaryKey)
          Returns a book to its owner.
 void transferBooks(java.lang.Integer newOwnerPrimaryKey, java.lang.Integer[] books)
          Transfers a number of books to a new owner.
 void updateBook(java.lang.Integer bookPK, java.util.Map attributes)
          Updates a book to an existing publisher.
 void updateBook(java.lang.Integer bookPK, java.util.Map attributes, java.lang.String publisherName)
          Updates a book for a unknown publisher.
 void updatePerson(java.lang.Integer personPK, java.util.Map attributes)
          Updates a Person.
 void updatePersons(Person[] updated, java.lang.Integer[] resetPassword, java.lang.Integer[] deleted, java.lang.Integer adminPK)
          Updates a list of Persons.
 void updatePublishers(Publisher[] updated, java.lang.Integer[] deleted)
          Updates the list of Publishers in the database.
 
Methods inherited from interface javax.ejb.EJBObject
getEJBHome, getHandle, getPrimaryKey, isIdentical, remove
 

Method Detail

borrowBook

public Book borrowBook(java.lang.Integer bookPrimaryKey,
                       java.lang.Integer borrowerPrimaryKey)
                throws BorrowException,
                       FinderException,
                       java.rmi.RemoteException
Locates the book and the borrower, then sets the holder of the book to the borrower and increments the lend count on the book.

addBook

public java.lang.Integer addBook(java.util.Map attributes)
                          throws CreateException,
                                 java.rmi.RemoteException
Adds a book which will be owned and held by the specified owner.

Returns the primary key of the newly created book.


addBook

public java.lang.Integer addBook(java.util.Map attributes,
                                 java.lang.String publisherName)
                          throws CreateException,
                                 java.rmi.RemoteException
Adds a book, which will be owned and help by the specified owner.

The publisherName may either be the name of a known publisher, or a new name. A new IPublisher will be created as necessary.

Returns the primary key of the newly created book.


updateBook

public void updateBook(java.lang.Integer bookPK,
                       java.util.Map attributes)
                throws FinderException,
                       java.rmi.RemoteException
Updates a book to an existing publisher.

updateBook

public void updateBook(java.lang.Integer bookPK,
                       java.util.Map attributes,
                       java.lang.String publisherName)
                throws CreateException,
                       FinderException,
                       java.rmi.RemoteException
Updates a book for a unknown publisher.

updatePerson

public void updatePerson(java.lang.Integer personPK,
                         java.util.Map attributes)
                  throws FinderException,
                         java.rmi.RemoteException
Updates a Person. Returns the attributes of the update person.

getPublishers

public Publisher[] getPublishers()
                          throws java.rmi.RemoteException
Retrieves the light-weight version of all IPublisher beans, sorted by name.

getPersons

public Person[] getPersons()
                    throws java.rmi.RemoteException
Retrieves the light-weight version of all the IPerson beans, sorted by last name, then by first name.

getPerson

public Person getPerson(java.lang.Integer primaryKey)
                 throws FinderException,
                        java.rmi.RemoteException
Retrieves a single Person by its primary key.
Throws:
FinderException - if the Person does not exist.

login

public Person login(java.lang.String email,
                    java.lang.String password)
             throws LoginException,
                    java.rmi.RemoteException
Attempts to login the user in.
Throws:
LoginException - if the email address is invalid, the password is invalid, or the user may not log in for other reasons.

getPersonAttributes

public java.util.Map getPersonAttributes(java.lang.Integer primaryKey)
                                  throws FinderException,
                                         java.rmi.RemoteException
Retrieves the attributes of a IPerson as a Map.

getBook

public Book getBook(java.lang.Integer primaryKey)
             throws FinderException,
                    java.rmi.RemoteException
Retrieves a single Book by its primary key. Returns the book's attributes as a Map.
Throws:
FinderException - if the Book does not exist.

getBookAttributes

public java.util.Map getBookAttributes(java.lang.Integer primaryKey)
                                throws FinderException,
                                       java.rmi.RemoteException
Retrieves the attributes of a IBook as a Map.

registerNewUser

public Person registerNewUser(java.lang.String firstName,
                              java.lang.String lastName,
                              java.lang.String email,
                              java.lang.String password)
                       throws RegistrationException,
                              CreateException,
                              java.rmi.RemoteException
Attempts to register a new user, first checking that the e-mail and names are unique. Returns the primary key of the new IPerson.

returnBook

public Book returnBook(java.lang.Integer bookPrimaryKey)
                throws java.rmi.RemoteException,
                       FinderException
Returns a book to its owner.
Throws:
FinderException - if the book is not known.

deleteBook

public Book deleteBook(java.lang.Integer bookPrimaryKey)
                throws RemoveException,
                       java.rmi.RemoteException
Deletes a Book.

transferBooks

public void transferBooks(java.lang.Integer newOwnerPrimaryKey,
                          java.lang.Integer[] books)
                   throws FinderException,
                          java.rmi.RemoteException
Transfers a number of books to a new owner.

updatePublishers

public void updatePublishers(Publisher[] updated,
                             java.lang.Integer[] deleted)
                      throws FinderException,
                             RemoveException,
                             java.rmi.RemoteException
Updates the list of Publishers in the database.
Parameters:
updated - an array of Publisher used to update existing publishers (used to change their names). May be null or empty.
deleted - an array of Integer, the primary key of any publisher to be deleted. No check is made that existing books aren't tied to this Publisher. May be null or empty.

updatePersons

public void updatePersons(Person[] updated,
                          java.lang.Integer[] resetPassword,
                          java.lang.Integer[] deleted,
                          java.lang.Integer adminPK)
                   throws FinderException,
                          RemoveException,
                          java.rmi.RemoteException
Updates a list of Persons. Main functionality is to allow an administrator to edit the following attributes of a Person:

Explicitly, names and email addresses may not be changed.

In addition, users may be deleted entirely, or may have their password reset.

Parameters:
updated - a list of persons to update. May be null or empty.
resetPassword - a list of primary keys; corresponding Persons will have thier password reset. May be null or empty.
deleted - a list of persons to delete. Books owned by any of these persons are transfered to the administrator. May be null or empty.
adminPk - the administrator performing the operation; books may be transferred to this person.