Package loxia.model

Examples of loxia.model.OperatingUnit


      throws UsernameNotFoundException, DataAccessException {
    User user = userDao.findByLoginName(userName);
    if(user == null) throw new UsernameNotFoundException(userName + " is not existed.");
    LoxiaUserDetails result = new LoxiaUserDetails();
    User u = new User();
    OperatingUnit ou = new OperatingUnit();
    OperatingUnitType ouType = new OperatingUnitType();
    try {
      PropertyUtils.copyProperties(user.getOu().getType(), ouType);
      ou.setId(user.getOu().getId());
      ou.setCode(user.getOu().getCode());
      ou.setName(user.getOu().getName());
      ou.setIsAvailable(user.getOu().getIsAvailable());
      u.setId(user.getId());
      u.setLoginName(user.getLoginName());
      u.setUserName(user.getUserName());
      u.setPassword(user.getPassword());
      u.setIsAccNonExpired(user.getIsAccNonExpired());
      u.setIsAccNonLocked(user.getIsAccNonLocked());
      u.setIsPwdNonExpired(user.getIsPwdNonExpired());
      u.setIsAvailable(user.getIsAvailable());
      u.setIsSystem(user.getIsSystem());
    } catch (Exception e) {
      e.printStackTrace();
      throw new RuntimeException("Copy bean values error.");
    }
    ou.setType(ouType);
    u.setOu(ou);
    result.setUser(u);
   
    List<LoxiaGrantedAuthority> authorities = new ArrayList<LoxiaGrantedAuthority>();
    Map<String,Set<Long>> map = new HashMap<String, Set<Long>>();
View Full Code Here


    MethodSignature ms = (MethodSignature)pjp.getSignature();
    Acl acl = ms.getMethod().getAnnotation(Acl.class);
   
    logger.debug("Acl found: {}", Arrays.asList(acl.value()));
    OperatingUnitDao operatingUnitDao = (OperatingUnitDao)context.getBean("loxiaOperatingUnitDao");
    OperatingUnit currentOu = null;
    Annotation[][] paramAnnos = ms.getMethod().getParameterAnnotations();
    for(int i=0; i < paramAnnos.length; i++){
      for(int j=0; j< paramAnnos[i].length; j++){
        if(paramAnnos[i][j] != null && paramAnnos[i][j] instanceof CurrentOu){
          Long ouId = null;
          if(pjp.getArgs()[i] instanceof OperatingUnit){
            ouId = ((OperatingUnit)pjp.getArgs()[i]).getId();
          }else if(pjp.getArgs()[i] instanceof Long){
            ouId = (Long)pjp.getArgs()[i];
          }else
            throw new IllegalArgumentException("Current Ou setting error.");
          if(ouId != null)
            currentOu = operatingUnitDao.getByPrimaryKey(ouId);
          if(currentOu == null)
            throw new IllegalArgumentException("Current Ou is null.");
          break;
        }
      }
      if(currentOu != null) break;
    }     
         
    if(currentOu != null){
      logger.debug("New current ou is set:{}[{}]", currentOu.getName(), currentOu.getId());
      controller.setCurrentOperatingUnit(currentOu);
    }else{
      logger.debug("Current ou isn't changed.");
    }
   
View Full Code Here

TOP

Related Classes of loxia.model.OperatingUnit

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.