public ActionForward comment(ActionMapping actionMapping,
ActionForm actionForm,
HttpServletRequest request,
HttpServletResponse response) throws Throwable {
OrderMaintActionForm form = (OrderMaintActionForm) actionForm;
EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
OrderHeader orderHeader = (OrderHeader) em.find(OrderHeader.class, Format.getLong(form.getOrderHeaderId()));
String orderTrackingMessage = form.getOrderTrackingMessage();
if (!Format.isNullOrEmpty(orderTrackingMessage)) {
AdminBean adminBean = getAdminBean(request);
User user = adminBean.getUser();
OrderTracking orderTracking = new OrderTracking();
orderTracking.setOrderTrackingCode("");
orderTracking.setOrderTrackingMessage(orderTrackingMessage);
if (form.isOrderTrackingInternal()) {
orderTracking.setOrderTrackingInternal(String.valueOf(Constants.VALUE_YES));
}
else {
orderTracking.setOrderTrackingInternal(String.valueOf(Constants.VALUE_NO));
}
orderTracking.setRecUpdateBy(user.getUserId());
orderTracking.setRecUpdateDatetime(new Date());
orderTracking.setRecCreateBy(user.getUserId());
orderTracking.setRecCreateDatetime(new Date());
orderTracking.setOrderHeader(orderHeader);
em.persist(orderTracking);
orderHeader.getOrderTrackings().add(orderTracking);
/*
Vector<OrderTracking> temp = new Vector<OrderTracking>();
Iterator<?> trackingIterator<?> = orderHeader.getOrderTrackings().iterator();
while (trackingIterator.hasNext()) {
OrderTracking ot = (OrderTracking) trackingIterator.next();
temp.add(ot);
}
orderHeader.getOrderTrackings().removeAll(temp);
orderHeader.getOrderTrackings().add(orderTracking);
trackingIterator<?> = temp.iterator();
while (trackingIterator.hasNext()) {
OrderTracking ot = (OrderTracking) trackingIterator.next();
orderHeader.getOrderTrackings().add(ot);
}
*/
}
form.setOrderTrackingMessage("");
form.setOrderTrackingInternal(false);
initOrder(form, orderHeader, null, null, null, request);
ActionForward actionForward = actionMapping.findForward("success");
return actionForward;
}