Package it.hotel.model.user

Examples of it.hotel.model.user.IUser


   * @return
   */
  public int doStartTag() {
    WebApplicationContext context = WebApplicationContextUtils.getWebApplicationContext(pageContext.getServletContext());
    UserContainer container = (UserContainer) context.getBean("userContainer");
    IUser user = container.getUser();
      try {
        pageContext.getOut().print(user.getUserName());
      } catch (IOException e) {
        SystemUtils.logThrowable(e, this, "doStartTag");
      }
    return SKIP_BODY;
  }
View Full Code Here


   * @param req
   * @param resp
   * @return
   */
  public ModelAndView list(HttpServletRequest req, HttpServletResponse resp) {
    IUser user = userContainer.getUser();
    if (req.getParameter("sort") == null){
      ArrayList<Typology> typologies = (ArrayList<Typology>)manager.getTypologiesFromStructure(user.getStructureId());
          return new ModelAndView("hotel.typology.list", "elements", typologies);
    }else{
      ArrayList<Typology> typologies = (ArrayList<Typology>)manager.getTypologiesFromStructure(user.getStructureId());
          return new ModelAndView("hotel.typology.list", "elements", typologies);

    }
    }
View Full Code Here

import junit.framework.TestCase;

public class TestUser extends TestCase{

  public void testUser() throws Exception {
    IUser user = new User();
    user.setEmail("blah@mail.com");
    user.setStructureId(2);
    user.setName("dharmesh");
    user.setPassword("password");
    user.setPasswordConfirm("password");
    Role role = new Role();
    role.setDescription("guest");
    role.setName("guest");
    user.setRole(role);
    user.setUserName("dappers");
    user.setSurname("dillip");
    user.setLanguage("it");
   
    assertEquals("blah@mail.com",user.getEmail());
    assertEquals(2,user.getStructureId());
    assertEquals("dharmesh", user.getName());
    assertEquals("password", user.getPassword());
    assertEquals("password", user.getPasswordConfirm());
    assertEquals(role, user.getRole());
    assertEquals("dillip", user.getSurname());
    assertEquals("it",user.getLanguage());
    assertTrue(user.isGuest());
 
  }
View Full Code Here

    UserContainer container = (UserContainer) context.getBean("userContainer");
    IStructureManager structureManager = (IStructureManager) context.getBean("localizedStructureManager");
    ILocaleContainer localeContainer = (ILocaleContainer) context.getBean("localeContainer");
   
    try {
        IUser user = container.getUser();
        Collection<Structure> structures = structureManager.fastGetAll();
        if (structures.isEmpty()){
          return SKIP_BODY;
        }
       
        String form = "<form name=\"selectHotel\" method=\"post\" action=\"/hotel/Hotel/change.htm\">";
        form = form + "<table><tr><td><select name=\"structureId\">";
        for (Structure structure :structures){
          if (structure.getId() == user.getStructureId()){
            form = form + "<option value=\"" + structure.getId() + "\" selected=\"selected\">" + structure.getName() + "</option>";
          }
          else{
            form = form + "<option value=\"" + structure.getId() + "\">" + structure.getName() + "</option>";
          }
View Full Code Here

    assertTrue(user.isGuest());
 
  }
 
  public void testHasPermissionAsSuperUser() throws Exception {
    IUser user = new User();
   
    Role role = new Role();
    role.setDescription("something");
    role.setName("something");
    role.addPermission(Permission.SUPERUSER);
    user.setRole(role);
    assertTrue(user.hasPermission("blah"));
   
  }
View Full Code Here

    assertTrue(user.hasPermission("blah"));
   
  }
 
  public void testHasPermission() throws Exception {
    IUser user = new User();
   
    Role role = new Role();
    role.setDescription("something");
    role.setName("something");
    role.addPermission("blah");
    user.setRole(role);
    assertTrue(user.hasPermission("blah"));
  }
View Full Code Here

    assertTrue(user.hasPermission("blah"));
  }
 
  public void testClone() throws Exception {
   
    IUser user = new User();
    user.setEmail("blah@mail.com");
    user.setStructureId(2);
    user.setName("dharmesh");
    user.setPassword("password");
    user.setPasswordConfirm("password");
    Role role = new Role();
    role.setDescription("guest");
    role.setName("guest");
    user.setRole(role);
    user.setUserName("dappers");
    user.setSurname("dillip");
    user.setLanguage("it");
   
    IUser user2 = (IUser) user.clone();
    assertEquals("blah@mail.com",user2.getEmail());
    assertEquals(2,user2.getStructureId());
    assertEquals("dharmesh", user2.getName());
    assertEquals("password", user2.getPassword());
    assertEquals("password", user2.getPasswordConfirm());
    assertEquals(role.getClass(), user2.getRole().getClass());
    assertEquals("dillip", user2.getSurname());
    assertEquals("it",user2.getLanguage());
    assertTrue(user2.isGuest());
   
  }
View Full Code Here

  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);
View Full Code Here

    mvc.addObject("hotelFacilities",hotelFacilities);
    return mvc;
 
 
  public ModelAndView update(HttpServletRequest req, HttpServletResponse resp){
    IUser user = userContainer.getUser();
    int hotelId = user.getStructureId();
    String[] codes = req.getParameterValues("facility");
    Structure structure = (Structure) structureManager.get(hotelId);
    Set<Facility> hotelFacilities = new HashSet<Facility>();
    Facility fac = new Facility();
   
View Full Code Here

 
  /**
   * @param
   */
  public void validate(Object command, Errors errors) {
      IUser utente = (IUser)command;
      isEmpty(utente, errors);
      isPswIncorrect(utente, errors);
      try {
        isUserAlreadyAssign(utente, errors);
      } catch (SystemException e) {
View Full Code Here

TOP

Related Classes of it.hotel.model.user.IUser

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.