use of org.apache.karaf.examples.command.api.Booking in project karaf by apache.
the class ListCommand method execute.
@Override
public Object execute() throws Exception {
ShellTable table = new ShellTable();
table.column("ID");
table.column("Flight");
table.column("Customer");
for (Booking booking : bookingService.list()) {
table.addRow().addContent(booking.getId(), booking.getFlight(), booking.getCustomer());
}
table.print(System.out);
return null;
}
use of org.apache.karaf.examples.command.api.Booking in project karaf by apache.
the class AddCommand method execute.
@Override
public Object execute() throws Exception {
Booking booking = new Booking();
if (id == 0) {
Random random = new Random();
id = Long.valueOf(random.nextInt(9000000) + 1000000);
}
booking.setId(id);
booking.setCustomer(customer);
booking.setFlight(flight);
bookingService.add(booking);
return null;
}
Aggregations