Package ejava.examples.txagent.ejb
Class BookingAgentEJB
- java.lang.Object
-
- ejava.examples.txagent.ejb.BookingAgentEJB
-
- All Implemented Interfaces:
BookingAgent,BookingAgentLocal,BookingAgentRemote
public class BookingAgentEJB extends Object implements BookingAgentRemote, BookingAgentLocal
This class provides a few conveniences methods to help inspect the impact of the actions taken with the stateful AgentReservationSession bean. It is stateless and can answer questions and perform cleanup actions associated with Bookings.
-
-
Field Summary
Fields Modifier and Type Field Description private BookingAgentagentprivate SessionContextctxprivate EntityManageremprivate HotelRegistrationRemotehotelprivate static org.slf4j.Loggerlog
-
Constructor Summary
Constructors Constructor Description BookingAgentEJB()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcleanupBooking(String confirmation)voidclose()This method is called whenever the bean is ejected from the container; which isn't too often for stateless session beans under normal circumstances.BookinggetBookingByConfirmation(String confirmation)List<Booking>getBookings(int index, int count)voidinit()This method creates the business logic, assigns a DAO, and registers the EntityManager for the DAO(s) to use.
-
-
-
Field Detail
-
log
private static final org.slf4j.Logger log
-
hotel
private HotelRegistrationRemote hotel
-
em
private EntityManager em
-
ctx
private SessionContext ctx
-
agent
private BookingAgent agent
-
-
Method Detail
-
init
@PostConstruct public void init()
This method creates the business logic, assigns a DAO, and registers the EntityManager for the DAO(s) to use.
-
close
@PreDestroy public void close()
This method is called whenever the bean is ejected from the container; which isn't too often for stateless session beans under normal circumstances.
-
getBookingByConfirmation
public Booking getBookingByConfirmation(String confirmation) throws AgentReservationException
- Specified by:
getBookingByConfirmationin interfaceBookingAgent- Throws:
AgentReservationException
-
getBookings
public List<Booking> getBookings(int index, int count) throws AgentReservationException
- Specified by:
getBookingsin interfaceBookingAgent- Throws:
AgentReservationException
-
cleanupBooking
public void cleanupBooking(String confirmation) throws AgentReservationException
- Specified by:
cleanupBookingin interfaceBookingAgent- Throws:
AgentReservationException
-
-