use of com.liferay.faces.demos.dto.Customer in project liferay-faces-bridge-impl by liferay.
the class CustomerServiceMockImpl method getCustomer.
public Customer getCustomer(long customerId) {
Customer customer = null;
List<Customer> customers = getAllCustomers();
for (Customer curCustomer : customers) {
if (curCustomer.getCustomerId() == customerId) {
customer = curCustomer;
break;
}
}
return customer;
}
use of com.liferay.faces.demos.dto.Customer in project liferay-faces-bridge-impl by liferay.
the class CustomerServiceMockImpl method postConstruct.
@PostConstruct
public void postConstruct() {
allCustomers = new ConcurrentHashMap<Long, Customer>();
BookingService bookingService = getBookingService();
Customer customer = new Customer(ID_BRIAN_GREEN, "Brian", "Green");
customer.setBookings(bookingService.getBookingsByCustomerId(ID_BRIAN_GREEN));
allCustomers.put(ID_BRIAN_GREEN, customer);
customer = new Customer(ID_LIZ_KESSLER, "Liz", "Kessler");
customer.setBookings(bookingService.getBookingsByCustomerId(ID_LIZ_KESSLER));
allCustomers.put(ID_LIZ_KESSLER, customer);
customer = new Customer(ID_RICH_SHEARER, "Rich", "Shearer");
customer.setBookings(bookingService.getBookingsByCustomerId(ID_RICH_SHEARER));
allCustomers.put(ID_RICH_SHEARER, customer);
}
use of com.liferay.faces.demos.dto.Customer in project liferay-faces-bridge-impl by liferay.
the class CustomerSelectedEventHandler method handleEvent.
public EventNavigationResult handleEvent(FacesContext facesContext, Event event) {
EventNavigationResult eventNavigationResult = null;
String eventQName = event.getQName().toString();
if (eventQName.equals("{http://liferay.com/events}ipc.customerSelected")) {
Serializable value = event.getValue();
// payload from the wrapper.
if (value instanceof EventPayloadWrapper) {
value = ((EventPayloadWrapper) value).getWrapped();
}
Customer customer = (Customer) value;
BookingsModelBean bookingsModelBean = getBookingsModelBean(facesContext);
bookingsModelBean.setCustomer(customer);
String fromAction = null;
String outcome = "ipc.customerSelected";
eventNavigationResult = new EventNavigationResult(fromAction, outcome);
logger.debug("Received event ipc.customerSelected for customerId=[{0}] firstName=[{1}] lastName=[{2}]", new Object[] { customer.getCustomerId(), customer.getFirstName(), customer.getLastName() });
}
return eventNavigationResult;
}
use of com.liferay.faces.demos.dto.Customer in project liferay-faces-bridge-impl by liferay.
the class CustomerEditedEventHandler method handleEvent.
public EventNavigationResult handleEvent(FacesContext facesContext, Event event) {
EventNavigationResult eventNavigationResult = null;
String eventQName = event.getQName().toString();
if (eventQName.equals("{http://liferay.com/events}ipc.customerEdited")) {
Customer customer = (Customer) event.getValue();
getCustomerService(facesContext).save(customer);
logger.debug("Received event ipc.customerEdited for customerId=[{0}] firstName=[{1}] lastName=[{2}]", new Object[] { customer.getCustomerId(), customer.getFirstName(), customer.getLastName() });
}
return eventNavigationResult;
}
use of com.liferay.faces.demos.dto.Customer in project liferay-faces-bridge-impl by liferay.
the class BookingsModelBean method postConstruct.
@PostConstruct
public void postConstruct() {
logger.trace("@PostConstruct annotation worked");
customer = new Customer();
customer.setBookings(new ArrayList<Booking>(5));
}
Aggregations