public void saveSelected() { if (getCurrent().getId() != null && getCurrent().getId() > 0) { getFacade().edit(current); UtilityController.addSuccessMessage("savedOldSuccessfully"); } else { current.setCreatedAt(Calendar.getInstance(TimeZone.getTimeZone("IST")).getTime()); current.setCreater(getSessionController().getLoggedUser()); getFacade().create(current); UtilityController.addSuccessMessage("savedNewSuccessfully"); } recreateModel(); getItems(); }
public void addToPackage() { if (getCurrentPackege() == null) { UtilityController.addErrorMessage("Please select a package"); return; } if (getCurrentItem() == null) { UtilityController.addErrorMessage("Please select an item"); return; } PackageItem pi = new PackageItem(); pi.setPackege(getCurrentPackege()); pi.setItem(getCurrentItem()); pi.setCreatedAt(Calendar.getInstance(TimeZone.getTimeZone("IST")).getTime()); pi.setCreater(sessionController.loggedUser); getFacade().create(pi); UtilityController.addSuccessMessage("Added"); recreateModel(); }