本文整理汇总了Java中com.acmeair.entities.Booking类的典型用法代码示例。如果您正苦于以下问题:Java Booking类的具体用法?Java Booking怎么用?Java Booking使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Booking类属于com.acmeair.entities包,在下文中一共展示了Booking类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBookingByNumber
import com.acmeair.entities.Booking; //导入依赖的package包/类
@GET
@Path("/bybookingnumber/{userid}/{number}")
@Produces(MediaType.APPLICATION_JSON)
public BookingInfo getBookingByNumber(
@PathParam("number") String number,
@PathParam("userid") String userid) {
try {
Booking b = bs.getBooking(userid, number);
BookingInfo bi = null;
if (b != null) {
bi = new BookingInfo(b);
}
return bi;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
示例2: getBookingsByUser
import com.acmeair.entities.Booking; //导入依赖的package包/类
@GET
@Path("/byuser/{user}")
@Produces(MediaType.APPLICATION_JSON)
public List<BookingInfo> getBookingsByUser(@PathParam("user") String user) {
try {
List<Booking> list = bs.getBookingsByUser(user);
List<BookingInfo> newList = new ArrayList<BookingInfo>();
for (Booking b : list) {
newList.add(new BookingInfo(b));
}
return newList;
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
示例3: bookFlight
import com.acmeair.entities.Booking; //导入依赖的package包/类
@Transactional(propagation=Propagation.REQUIRED)
@Override
public BookingPK bookFlight(String customerId, FlightPK flightId) {
try {
// We still delegate to the flight and customer service for the map
// access than getting the map instance directly
Flight f = flightService.getFlightByFlightKey(flightId);
Customer c = customerService.getCustomerByUsername(customerId);
Booking newBooking = new Booking(keyGenerator.generate().toString(), new Date(), c, f);
BookingPK key = newBooking.getPkey();
em.persist(newBooking);
return key;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例4: BookingInfo
import com.acmeair.entities.Booking; //导入依赖的package包/类
public BookingInfo(Booking booking){
this.bookingId = booking.getBookingId();
this.flightId = booking.getFlightId();
this.customerId = booking.getCustomerId();
this.dateOfBooking = booking.getDateOfBooking();
this.pkey = new BookingPKInfo(this.customerId, this.bookingId);
}
示例5: getBooking
import com.acmeair.entities.Booking; //导入依赖的package包/类
@Override
public Booking getBooking(String user, String bookingId) {
try {
return bookingRepository.findOne(bookingId);
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例6: getBookingsByUser
import com.acmeair.entities.Booking; //导入依赖的package包/类
@Override
public List<Booking> getBookingsByUser(String user) {
try {
List<BookingImpl> bookingImpls = bookingRepository.findByCustomerId(user);
List<Booking> bookings = new ArrayList<Booking>();
for (Booking b : bookingImpls) {
bookings.add(b);
}
return bookings;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
示例7: getsBookingOfSpecifiedUser
import com.acmeair.entities.Booking; //导入依赖的package包/类
@Test
public void getsBookingOfSpecifiedUser() {
when(bookingRepository.findByCustomerId(booking.getCustomerId())).thenReturn(singletonList(booking));
List<Booking> bookings = bookingService.getBookingsByUser(booking.getCustomerId());
assertThat(bookings, contains(booking));
}
示例8: getBookingsByUser
import com.acmeair.entities.Booking; //导入依赖的package包/类
@Override
public List<Booking> getBookingsByUser(String user) {
Query q = em.createQuery("SELECT obj FROM Booking obj where obj.customer.id=?1");
q.setParameter(1, user);
List<Booking> results = (List<Booking>) q.getResultList();
return results;
}
示例9: cancelBooking
import com.acmeair.entities.Booking; //导入依赖的package包/类
@Transactional(propagation=Propagation.REQUIRED)
@Override
public void cancelBooking(String user, String id) {
Booking booking = getBooking(user, id);
if (booking != null) {
em.remove(booking);
}
}
示例10: getBookingByNumber
import com.acmeair.entities.Booking; //导入依赖的package包/类
@GET
@Path("/bybookingnumber/{userid}/{number}")
@Produces("application/json")
public Booking getBookingByNumber(
@PathParam("number") String number,
@FormParam("userid") String userid) {
try {
Booking b = bs.getBooking(userid, number);
return b;
}
catch (Exception e) {
e.printStackTrace();
return null;
}
}
示例11: getBookingsByUser
import com.acmeair.entities.Booking; //导入依赖的package包/类
@GET
@Path("/byuser/{user}")
@Produces("application/json")
public List<Booking> getBookingsByUser(@PathParam("user") String user) {
try {
return bs.getBookingsByUser(user);
}
catch (Exception e) {
e.printStackTrace();
return null;
}
}
示例12: getBooking
import com.acmeair.entities.Booking; //导入依赖的package包/类
@Override
public Booking getBooking(String user, String id) {
BookingPK key = new BookingPK(user, id);
return em.find(Booking.class, key);
}
示例13: getBooking
import com.acmeair.entities.Booking; //导入依赖的package包/类
Booking getBooking(String user, String id);
示例14: getBookingsByUser
import com.acmeair.entities.Booking; //导入依赖的package包/类
List<Booking> getBookingsByUser(String user);
示例15: getBooking
import com.acmeair.entities.Booking; //导入依赖的package包/类
public abstract Booking getBooking(String user, String id);