if(hasErrors()){
return INPUT;
}
Warehouse warehouse;
if(getWarehouse().getId() == null || "".equalsIgnoreCase(getWarehouse().getId())){
warehouse = new Warehouse();
logInfo = new LogInformation();
logInfo.setCreateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setCreateDate(new Timestamp(System.currentTimeMillis()));
} else {
warehouse = (Warehouse) manager.getById(Warehouse.class, getWarehouse().getId());
logInfo = warehouse.getLogInformation();
}
logInfo.setActiveFlag(getActive());
logInfo.setLastUpdateBy(sessionCredentials.getCurrentUser().getId());
logInfo.setLastUpdateDate(new Timestamp(System.currentTimeMillis()));
warehouse.setLogInformation(logInfo);
warehouse.setSearchKey(getWarehouse().getSearchKey());
warehouse.setName(getWarehouse().getName());
warehouse.setDescription(getWarehouse().getDescription());
warehouse.setInTransit(getWarehouse().getInTransit());
warehouse.setAddress(getAddress());
warehouse.setSourceWarehouse(getSourceWarehouse());
warehouse.setReplenishmentClass(getWarehouse().getReplenishmentClass());
manager.save(warehouse);
setWarehouse(warehouse);
return SUCCESS;
}