|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.primix.vlib.ejb.impl.OperationsBean
Implementation of the IOperations
stateless session bean.
Implenents a number of stateless operations for the front end.
Field Summary | |
static java.lang.String |
MAIL_QUEUE_JNDI_NAME
|
Fields inherited from interface com.primix.vlib.ejb.IMailMessageConstants |
CONTENT, EMAIL_ADDRESS, SUBJECT |
Constructor Summary | |
OperationsBean()
|
Method Summary | |
java.lang.Integer |
addBook(java.util.Map attributes)
Adds a new book, verifying that the publisher and holder actually exist. |
java.lang.Integer |
addBook(java.util.Map attributes,
java.lang.String publisherName)
Adds a book, which will be owned and held by the specified owner. |
protected void |
addSubstringSearch(StatementAssembly assembly,
java.lang.String column,
java.lang.String value)
|
Book |
borrowBook(java.lang.Integer bookPrimaryKey,
java.lang.Integer borrowerPrimaryKey)
Finds the book and borrower (by thier primary keys) and updates the book. |
protected StatementAssembly |
buildBaseBookQuery()
|
protected StatementAssembly |
buildBasePersonQuery()
|
protected void |
close(java.sql.Connection connection,
IStatement statement,
java.sql.ResultSet resultSet)
Closes the resultSet (if not null), then the statement (if not null), then the Connection (if not null). |
protected Book |
convertRowToBook(java.sql.ResultSet set,
java.lang.Object[] columns)
Translates the next row from the result set into a Book . |
protected Person |
convertRowToPerson(java.sql.ResultSet set,
java.lang.Object[] columns)
Translates the next row from the result set into a Person . |
Book |
deleteBook(java.lang.Integer bookPrimaryKey)
|
void |
ejbActivate()
Does nothing, not invoked in stateless session beans. |
void |
ejbCreate()
Sets up the bean. |
void |
ejbPassivate()
Does nothing, not invoked in stateless session beans. |
void |
ejbRemove()
Closes the mail queue session, if it has been opened. |
Book |
getBook(java.lang.Integer primaryKey)
Retrieves a single Book by its primary key. |
java.util.Map |
getBookAttributes(java.lang.Integer primaryKey)
|
protected java.sql.Connection |
getConnection()
Gets a new connection from the data source. |
protected QueueSender |
getMailQueueSender()
|
protected QueueSession |
getMailQueueSession()
|
Person |
getPerson(java.lang.Integer primaryKey)
Gets the Person for primary key. |
java.util.Map |
getPersonAttributes(java.lang.Integer primaryKey)
|
Person[] |
getPersons()
Fetchs all IPerson beans in the database and converts them
to Person objects. |
Publisher[] |
getPublishers()
|
Person |
login(java.lang.String email,
java.lang.String password)
|
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)
|
protected void |
sendMail(java.lang.String emailAddress,
java.lang.String subject,
java.lang.String content)
|
void |
setSessionContext(SessionContext value)
|
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. |
void |
updateBook(java.lang.Integer bookPK,
java.util.Map attributes,
java.lang.String publisherName)
Updates a book, adding a new Publisher at the same time. |
void |
updatePerson(java.lang.Integer primaryKey,
java.util.Map attributes)
|
void |
updatePersons(Person[] updated,
java.lang.Integer[] resetPassword,
java.lang.Integer[] deleted,
java.lang.Integer adminPK)
|
void |
updatePublishers(Publisher[] updated,
java.lang.Integer[] deleted)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String MAIL_QUEUE_JNDI_NAME
Constructor Detail |
public OperationsBean()
Method Detail |
public void ejbCreate()
DataSource
for the bean
as jdbc/dataSource
within the ENC; this data source is
later used by getConnection()
.public void ejbRemove()
ejbRemove
in interface SessionBean
public void ejbPassivate()
ejbPassivate
in interface SessionBean
public void setSessionContext(SessionContext value)
setSessionContext
in interface SessionBean
public void ejbActivate()
ejbActivate
in interface SessionBean
public Book borrowBook(java.lang.Integer bookPrimaryKey, java.lang.Integer borrowerPrimaryKey) throws FinderException, java.rmi.RemoteException, BorrowException
The attributes of the borrowed book is returned.
public java.lang.Integer addBook(java.util.Map attributes) throws CreateException, java.rmi.RemoteException
public java.lang.Integer addBook(java.util.Map attributes, java.lang.String publisherName) throws CreateException, java.rmi.RemoteException
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 newly created book, as a Map
of attributes.
public void updateBook(java.lang.Integer bookPK, java.util.Map attributes) throws FinderException, java.rmi.RemoteException
Returns the updated book.
bookPK
- The primary key of the book to update.public void updateBook(java.lang.Integer bookPK, java.util.Map attributes, java.lang.String publisherName) throws CreateException, FinderException, java.rmi.RemoteException
bookPK
- The primary key of the book to update.attributes
- attributes to changepublisherName
- The name of the new publisher.FinderException
- if the book, holder or publisher can not be located.CreateException
- if the IPublisher
can not be created.public void updatePerson(java.lang.Integer primaryKey, java.util.Map attributes) throws FinderException, java.rmi.RemoteException
public Publisher[] getPublishers()
public Person[] getPersons()
IPerson
beans in the database and converts them
to Person
objects.
Returns the Person
s sorted by last name, then first.public Person getPerson(java.lang.Integer primaryKey) throws FinderException
Person
for primary key.FinderException
- if the Person does not exist.public Person login(java.lang.String email, java.lang.String password) throws java.rmi.RemoteException, LoginException
public java.util.Map getPersonAttributes(java.lang.Integer primaryKey) throws FinderException, java.rmi.RemoteException
public Book getBook(java.lang.Integer primaryKey) throws FinderException
Book
by its primary key.FinderException
- if the Book does not exist.public java.util.Map getBookAttributes(java.lang.Integer primaryKey) throws FinderException, java.rmi.RemoteException
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
IPerson
.public Book deleteBook(java.lang.Integer bookPrimaryKey) throws RemoveException, java.rmi.RemoteException
public void transferBooks(java.lang.Integer newOwnerPrimaryKey, java.lang.Integer[] books) throws FinderException, java.rmi.RemoteException
public void updatePublishers(Publisher[] updated, java.lang.Integer[] deleted) throws FinderException, RemoveException, java.rmi.RemoteException
public void updatePersons(Person[] updated, java.lang.Integer[] resetPassword, java.lang.Integer[] deleted, java.lang.Integer adminPK) throws FinderException, RemoveException, java.rmi.RemoteException
protected Book convertRowToBook(java.sql.ResultSet set, java.lang.Object[] columns) throws java.sql.SQLException
Book
.
This works with queries generated by buildBaseBookQuery()
.
protected StatementAssembly buildBaseBookQuery()
protected void addSubstringSearch(StatementAssembly assembly, java.lang.String column, java.lang.String value)
protected void close(java.sql.Connection connection, IStatement statement, java.sql.ResultSet resultSet)
protected java.sql.Connection getConnection()
protected StatementAssembly buildBasePersonQuery()
protected Person convertRowToPerson(java.sql.ResultSet set, java.lang.Object[] columns) throws java.sql.SQLException
Person
.
This works with queries generated by buildBasePersonQuery()
.
public Book returnBook(java.lang.Integer bookPrimaryKey) throws java.rmi.RemoteException, FinderException
protected QueueSession getMailQueueSession() throws NamingException, JMSException
protected QueueSender getMailQueueSender() throws NamingException, JMSException
protected void sendMail(java.lang.String emailAddress, java.lang.String subject, java.lang.String content) throws EJBException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |