KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > tapestry > vlib > ejb > IOperations


1 // Copyright 2004 The Apache Software Foundation
2
//
3
// Licensed under the Apache License, Version 2.0 (the "License");
4
// you may not use this file except in compliance with the License.
5
// You may obtain a copy of the License at
6
//
7
// http://www.apache.org/licenses/LICENSE-2.0
8
//
9
// Unless required by applicable law or agreed to in writing, software
10
// distributed under the License is distributed on an "AS IS" BASIS,
11
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
// See the License for the specific language governing permissions and
13
// limitations under the License.
14

15 package org.apache.tapestry.vlib.ejb;
16
17 import java.rmi.RemoteException JavaDoc;
18 import java.util.Map JavaDoc;
19
20 import javax.ejb.CreateException JavaDoc;
21 import javax.ejb.EJBObject JavaDoc;
22 import javax.ejb.FinderException JavaDoc;
23 import javax.ejb.RemoveException JavaDoc;
24
25 /**
26  * Remote interface to the Operations stateless
27  * session bean. A repository for simple operations such as
28  * adding a new book or borrowing an existing book.
29  *
30  * @version $Id: IOperations.java,v 1.4 2004/02/19 17:37:39 hlship Exp $
31  * @author Howard Lewis Ship
32  *
33  **/

34
35 public interface IOperations extends EJBObject JavaDoc
36 {
37     /**
38      * Locates the book and the borrower, then sets the holder of the book
39      * to the borrower and increments the lend count on the book.
40      *
41      **/

42
43     public Book borrowBook(Integer JavaDoc bookdId, Integer JavaDoc borrowerId)
44         throws BorrowException, FinderException JavaDoc, RemoteException JavaDoc;
45
46     /**
47      * Adds a book which will be owned and held by the specified owner.
48      *
49      * <p>Returns the primary key of the newly created book.
50      **/

51
52     public Integer JavaDoc addBook(Map JavaDoc attributes) throws CreateException JavaDoc, RemoteException JavaDoc;
53
54     /**
55      * Adds a book, which will be owned and help by the specified owner.
56      *
57      * <p>The publisherName may either be the name of a known publisher, or
58      * a new name. A new {@link IPublisher} will be created as necessary.
59      *
60      * <p>Returns the primary key of the newly created book.
61      *
62      **/

63
64     public Integer JavaDoc addBook(Map JavaDoc attributes, String JavaDoc publisherName)
65         throws CreateException JavaDoc, RemoteException JavaDoc;
66
67     /**
68      * Updates a book to an existing publisher.
69      *
70      **/

71
72     public void updateBook(Integer JavaDoc bookId, Map JavaDoc attributes) throws FinderException JavaDoc, RemoteException JavaDoc;
73
74     /**
75      * Updates a book for a unknown publisher.
76      *
77      **/

78
79     public void updateBook(Integer JavaDoc bookId, Map JavaDoc attributes, String JavaDoc publisherName)
80         throws CreateException JavaDoc, FinderException JavaDoc, RemoteException JavaDoc;
81
82     /**
83      * Updates a Person. Returns the attributes of the update person.
84      *
85      **/

86
87     public void updatePerson(Integer JavaDoc personId, Map JavaDoc attributes) throws FinderException JavaDoc, RemoteException JavaDoc;
88
89     /**
90      * Retrieves the light-weight version of all {@link IPublisher} beans, sorted by name.
91      *
92      **/

93
94     public Publisher[] getPublishers() throws RemoteException JavaDoc;
95
96     /**
97      * Retrieves the light-weight version of all the {@link IPerson} beans, sorted
98      * by last name, then by first name.
99      *
100      **/

101
102     public Person[] getPersons() throws RemoteException JavaDoc;
103
104     /**
105      * Retrieves a single {@link Person} by its primary key.
106      *
107      * @throws FinderException if the Person does not exist.
108      *
109      **/

110
111     public Person getPerson(Integer JavaDoc personId) throws FinderException JavaDoc, RemoteException JavaDoc;
112
113     /**
114      * Attempts to login the user in.
115      *
116      * @return the user
117      * @throws LoginException if the email address is invalid, the password
118      * is invalid, or the user may not log in for other reasons.
119      *
120      **/

121
122     public Person login(String JavaDoc email, String JavaDoc password) throws LoginException, RemoteException JavaDoc;
123
124     /**
125      * Retrieves the attributes of a {@link IPerson} as a {@link Map}.
126      *
127      **/

128
129     public Map JavaDoc getPersonAttributes(Integer JavaDoc personId) throws FinderException JavaDoc, RemoteException JavaDoc;
130
131     /**
132      * Retrieves a single {@link Book} by its primary key. Returns the
133      * book's attributes as a {@link Map}.
134      *
135      * @throws FinderException if the Book does not exist.
136      *
137      **/

138
139     public Book getBook(Integer JavaDoc bookId) throws FinderException JavaDoc, RemoteException JavaDoc;
140
141     /**
142      * Retrieves the attributes of a {@link IBook} as a {@link Map}.
143      *
144      **/

145
146     public Map JavaDoc getBookAttributes(Integer JavaDoc bookId) throws FinderException JavaDoc, RemoteException JavaDoc;
147
148     /**
149      * Attempts to register a new user, first checking that the
150      * e-mail and names are unique. Returns the primary key of
151      * the new {@link IPerson}.
152      *
153      **/

154
155     public Person registerNewUser(String JavaDoc firstName, String JavaDoc lastName, String JavaDoc email, String JavaDoc password)
156         throws RegistrationException, CreateException JavaDoc, RemoteException JavaDoc;
157
158     /**
159      * Returns a book to its owner.
160      *
161      * @throws FinderException if the book is not known.
162      *
163      **/

164
165     public Book returnBook(Integer JavaDoc bookId) throws RemoteException JavaDoc, FinderException JavaDoc;
166
167     /**
168      * Deletes a Book.
169      *
170      * @return the Book as it was before being deleted.
171      **/

172
173     public Book deleteBook(Integer JavaDoc bookId) throws RemoveException JavaDoc, RemoteException JavaDoc;
174
175     /**
176      * Transfers a number of books to a new owner.
177      *
178      **/

179
180     public void transferBooks(Integer JavaDoc newOwnerId, Integer JavaDoc[] bookIds)
181         throws FinderException JavaDoc, RemoteException JavaDoc;
182
183     /**
184      * Updates the list of Publishers in the database.
185      *
186      *
187      * @param updated an array of {@link Publisher} used to update
188      * existing publishers (used to change their names). May be null or
189      * empty.
190      * @param deleted an array of {@link Integer}, the primary key
191      * of any publisher to be deleted. No check is made that
192      * existing books aren't tied to this Publisher. May be null or
193      * empty.
194      **/

195
196     public void updatePublishers(Publisher[] updated, Integer JavaDoc[] deleted)
197         throws FinderException JavaDoc, RemoveException JavaDoc, RemoteException JavaDoc;
198
199     /**
200      * Updates a list of Persons. Main functionality is to allow
201      * an administrator to edit the following attributes of a Person:
202      * <ul>
203      * <li>admin
204      * <li>lockedOut
205      * </ul>
206      *
207      * <p>Explicitly, names and email addresses may not be changed.
208      *
209      * <p>In addition, users may be deleted entirely, or may have their password reset.
210      *
211      * @param updated a list of persons to update. May be null or empty.
212      * @param resetPassword a list of primary keys; corresponding Persons will
213      * have thier password reset. May be null or empty.
214      * @param newPassword the password to be set for each user in resetPassword
215      * @param deleted a list of persons to delete. Books owned by any of these persons
216      * are transfered to the administrator. May be null or empty.
217      * @param adminId the administrator performing the operation; books may be transferred
218      * to this person.
219      *
220      **/

221
222     public void updatePersons(
223         Person[] updated,
224         Integer JavaDoc[] resetPassword,
225         String JavaDoc newPassword,
226         Integer JavaDoc[] deleted,
227         Integer JavaDoc adminId)
228         throws FinderException JavaDoc, RemoveException JavaDoc, RemoteException JavaDoc;
229
230 }
Popular Tags