protected IFacilityManager facilityManager = null;
protected ILocaleContainer localeContainer = null;
public ModelAndView edit(HttpServletRequest req, HttpServletResponse resp){
IUser user = userContainer.getUser();
String sid = req.getParameter("id");
if (sid != null && user.getRole().hasPermission("SUPERUSER")){
String locale = req.getParameter("locale");
String oldLocale = localeContainer.getLocale();
if (locale != null){
localeContainer.setLocale(locale);
}
int id = Integer.parseInt(req.getParameter("id"));
Facility facility = (Facility) facilityManager.get(id);
if (locale != null){
facility.setLocale(locale);
}
else{
facility.setLocale(oldLocale);
}
localeContainer.setLocale(oldLocale);
ModelAndView mav = new ModelAndView("hotel.facility.new","facility",facility);
return mav;
}
int hotelId = user.getStructureId();
Collection<Facility> facilities = (Collection<Facility>) facilityManager.getAll();
Collection<Facility> hotelFacilities = ((Structure) structureManager.get(hotelId)).getFacilities();
ModelAndView mvc = new ModelAndView("hotel.facility.edit");
mvc.addObject("allFacilities",facilities);
mvc.addObject("hotelFacilities",hotelFacilities);