|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.shale.view.AbstractFacesBean
org.apache.shale.view.AbstractApplicationBean
org.apache.shale.examples.mailreaderjpa.Logic
public class Logic
Business logic for this example application. This bean is designed to be a managed bean with scope "application", so the implementation of each public method must be done in a threadsafe manner.
USAGE NOTE: The public methods of this class may throw unchecked exceptions if the underlying persistence framework has problems. If you intend to create graceful UIs for such exceptions, be sure to enclose calls to these methods in try/catch blocks.
Constructor Summary | |
---|---|
Logic()
|
Method Summary | |
---|---|
org.apache.mailreaderjpa.User |
authenticate(String username,
String password)
Authenticate the specified logon credentials, returning a corresponding User if they are valid or null otherwise. |
void |
bootstrap()
Bootstrap the contents of the database, if necessary. |
void |
createSubscription(org.apache.mailreaderjpa.Subscription subscription)
Add the specified Subscription to the persistent database. |
void |
createUser(org.apache.mailreaderjpa.User user)
Add the specified User (and any associated child
Subscription s) to the persistent database. |
void |
deleteSubscription(org.apache.mailreaderjpa.Subscription subscription)
Delete the specified Subscription from the persistent database. |
void |
deleteUser(org.apache.mailreaderjpa.User user)
Delete the specified User (and any associated child
Subscription s) from the persistent database. |
void |
destroy()
On application shutdown, close the entity manager factory. |
org.apache.mailreaderjpa.Protocol |
findProtocolById(int id)
Return the Protocol with the specified id, if any;
otherwise, return null . |
org.apache.mailreaderjpa.Subscription |
findSubscriptionById(int id)
Return the Subscription with the specified id, if any;
otherwise, return null . |
org.apache.mailreaderjpa.User |
findUserById(int id)
Return the User with the specified id, if any;
otherwise, return null . |
org.apache.mailreaderjpa.User |
findUserByUsername(String username)
Return the User with the specified username, if any;
otherwise, return null . |
List<org.apache.mailreaderjpa.Protocol> |
getProtocols()
Return a List of the valid Protocol s for
this application. |
void |
init()
Log initialization of this business logic bean. |
org.apache.mailreaderjpa.Subscription |
updateSubscription(org.apache.mailreaderjpa.Subscription subscription)
Update the specified Subscription in the persistent database. |
org.apache.mailreaderjpa.User |
updateUser(org.apache.mailreaderjpa.User user)
Update the specified User (and any associated child
Subscription s) in the persistent database. |
Methods inherited from class org.apache.shale.view.AbstractFacesBean |
---|
erase, error, error, fatal, fatal, getApplication, getApplicationMap, getBean, getExternalContext, getFacesContext, getLifecycle, getRequestHeaderMap, getRequestMap, getRequestParameter, getRequestParameterMap, getRequestParameterValues, getSessionMap, getValue, info, info, log, log, retrieveData, saveData, setBean, setValue, warn, warn |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Logic()
Method Detail |
---|
public void init()
Log initialization of this business logic bean.
init
in class org.apache.shale.view.AbstractApplicationBean
public void destroy()
On application shutdown, close the entity manager factory.
destroy
in class org.apache.shale.view.AbstractApplicationBean
public List<org.apache.mailreaderjpa.Protocol> getProtocols()
Return a List
of the valid Protocol
s for
this application. If no valid protocols are defined, a zero length
list will be returned.
public org.apache.mailreaderjpa.User authenticate(String username, String password)
Authenticate the specified logon credentials, returning a corresponding
User
if they are valid or null
otherwise.
username
- Username to authenticatepassword
- Password to authenticatepublic void bootstrap()
Bootstrap the contents of the database, if necessary. This is strictly a convenience mechanism so that the out-of-the-box content of the data matches that in the original demo. This is not typical of what you would need in a normal application.
public void createSubscription(org.apache.mailreaderjpa.Subscription subscription)
Add the specified Subscription
to the persistent database.
subscription
- Subscription to be addedpublic void createUser(org.apache.mailreaderjpa.User user)
Add the specified User
(and any associated child
Subscription
s) to the persistent database.
user
- User to be addedpublic void deleteSubscription(org.apache.mailreaderjpa.Subscription subscription)
Delete the specified Subscription
from the persistent database.
subscription
- Subscription to be deletedpublic void deleteUser(org.apache.mailreaderjpa.User user)
Delete the specified User
(and any associated child
Subscription
s) from the persistent database.
user
- User to be deletedpublic org.apache.mailreaderjpa.Protocol findProtocolById(int id)
Return the Protocol
with the specified id, if any;
otherwise, return null
.
id
- Protocol id to look uppublic org.apache.mailreaderjpa.Subscription findSubscriptionById(int id)
Return the Subscription
with the specified id, if any;
otherwise, return null
.
id
- Subscription id to look uppublic org.apache.mailreaderjpa.User findUserById(int id)
Return the User
with the specified id, if any;
otherwise, return null
.
id
- User id to look uppublic org.apache.mailreaderjpa.User findUserByUsername(String username)
Return the User
with the specified username, if any;
otherwise, return null
.
username
- Username to look uppublic org.apache.mailreaderjpa.Subscription updateSubscription(org.apache.mailreaderjpa.Subscription subscription)
Update the specified Subscription
in the persistent database.
subscription
- Subscription to be updated
public org.apache.mailreaderjpa.User updateUser(org.apache.mailreaderjpa.User user)
Update the specified User
(and any associated child
Subscription
s) in the persistent database.
user
- User to be updated
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |