-
Notifications
You must be signed in to change notification settings - Fork 13
Home
The detailed HOL script is available here.
initNewItem() method implementation in the OrderEdit screen:
@Override
protected void initNewItem(Order item) {
super.initNewItem(item);
item.setStatus(OrderStatus.NEW);
}
Inject the ordersDS datasource to the OrderBrowse screen controller:
@Inject
private CollectionDatasource<Order, UUID> ordersDs;
onBtnNewStatusClick() method implementation:
public void onBtnSetNewStatusClick(Component source) {
Order o = ordersDs.getItem();
if (o != null) {
o.setStatus(OrderStatus.NEW);
ordersDs.commit();
}
}
onBtnSetInProgressStatusClick() method implementation:
public void onBtnSetInProgressStatusClick(Component source) {
Order o = ordersDs.getItem();
if (o != null) {
o.setStatus(OrderStatus.IN_PROGRESS);
ordersDs.commit();
}
}
onBtnSetReadyStatusClick() method implementation:
public void onBtnSetReadyStatusClick(Component source) {
Order o = ordersDs.getItem();
if (o != null) {
o.setStatus(OrderStatus.READY);
ordersDs.commit();
}
}
caclulateAmount() method implementation:
@Override
public BigDecimal calculateOrderAmount(Order order) {
BigDecimal amount = new BigDecimal(0);
if (order.getHoursSpent() != null) {
amount = amount.add(new BigDecimal(order.getHoursSpent())
.multiply(order.getMechanic().getHourlyRate()));
}
if (order.getParts() != null) {
for (SparePart part : order.getParts()) {
amount = amount.add(part.getPrice());
}
}
return amount;
}
Injecting OrderService into OrderEditor:
@Inject
private OrderService orderService;
Overriding the preCommit() method in OrderEditor:
@Override
protected boolean preCommit() {
getItem().setAmount(orderService.calculateOrderAmount(getItem()));
return super.preCommit();
}
Login request:
http://localhost:8080/app/dispatch/api/login?u=admin&p=admin
Request all orders, which have the NEW(10) OrderStatus:
http://localhost:8080/app/dispatch/api/query.json?e=workshop$Order&q=select+o+from+workshop$Order+o+where+o.status=10&s=[INSERT YOUR SESSION ID FROM THE RESPONSE]
-
DEFINING DATA MODEL AND CREATING THE DATABASE
3.1 Client Entity
3.2 Mechanic Entity
3.3 SparePart Entity
3.4 OrderStatus Enum
3.5 Order Entity
-
4.2 Client CRUD UI
4.3 Mechanic CRUD UI
4.4 Order CRUD UI
-
5.1 Generic Filter
5.2 Security Setup
5.3 Audit
-
6.1 Integration with IDE and Project Structure
6.2 Customization of Existing Screens and Hot Deploy
6.3 Business Logic Development
6.4 REST API