insertMode = true;
}
AdminBean adminBean = getAdminBean(request);
Site site = adminBean.getSite();
ShippingType shippingType = new ShippingType();
if (!insertMode) {
shippingType = ShippingTypeDAO.load(site.getSiteId(), Format.getLong(form.getShippingTypeId()));
}
ActionMessages errors = validate(form);
if (errors.size() != 0) {
saveMessages(request, errors);
return mapping.findForward("error");
}
if (insertMode) {
shippingType.setRecCreateBy(adminBean.getUser().getUserId());
shippingType.setRecCreateDatetime(new Date(System.currentTimeMillis()));
shippingType.setSystemRecord(Constants.VALUE_NO);
}
shippingType.setSite(site);
shippingType.setShippingTypeName(form.getShippingTypeName());
shippingType.setRecUpdateBy(adminBean.getUser().getUserId());
shippingType.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
if (insertMode) {
em.persist(shippingType);
}
else {
// em.update(shippingType);
}
form.setMode("U");
form.setShippingTypeId(shippingType.getShippingTypeId().toString());
FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
return mapping.findForward("success");
}