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 BookingAgent
agent
private SessionContext
ctx
private EntityManager
em
private HotelRegistrationRemote
hotel
private static org.slf4j.Logger
log
-
Constructor Summary
Constructors Constructor Description BookingAgentEJB()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
cleanupBooking(String confirmation)
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.Booking
getBookingByConfirmation(String confirmation)
List<Booking>
getBookings(int index, int count)
void
init()
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:
getBookingByConfirmation
in interfaceBookingAgent
- Throws:
AgentReservationException
-
getBookings
public List<Booking> getBookings(int index, int count) throws AgentReservationException
- Specified by:
getBookings
in interfaceBookingAgent
- Throws:
AgentReservationException
-
cleanupBooking
public void cleanupBooking(String confirmation) throws AgentReservationException
- Specified by:
cleanupBooking
in interfaceBookingAgent
- Throws:
AgentReservationException
-
-