Package loxia.struts2.taglib.model

Examples of loxia.struts2.taglib.model.Button


      logger.error("Session timeout.");
      throw new BusinessException(PreserveErrorCode.SESSION_TIMEOUT);
    }
   
    if(needCheck){
      BaseProfileAction act = (BaseProfileAction)action;
                 
      LoxiaUserDetails userDetails = (LoxiaUserDetails)authentication.getPrincipal();
      logger.debug("Current Principal:" + userDetails);
      String entryAcl = act.getAcl();
      if(entryAcl != null){
        userDetails.setCurrentOu(null);
        logger.debug("Function Entrance... Organization need to repick");
       
        for(GrantedAuthority auth: userDetails.getAuthorities()){
          LoxiaGrantedAuthority lauth = (LoxiaGrantedAuthority)auth;
          if(lauth.getAuthority().equals(entryAcl)){
            userDetails.setCurrentAuthority(lauth);
            break;
          }
        }
        if(userDetails.getCurrentAuthority() == null ||
            userDetails.getCurrentAuthority().getOuIds().size() == 0){
          logger.error("No sufficicent privilege.");
          throw new BusinessException(PreserveErrorCode.NO_SUFFICICENT_PRIVILEGE);
        }else{
          if(userDetails.getCurrentAuthority().
              getOuIds().size() == 1){
            userDetails.setCurrentOu(operatingUnitDao.getByPrimaryKey(
                userDetails.getCurrentAuthority().getOuIds().iterator().next()));
          }else{
            logger.debug("Redirect Invocation");
           
            String url = request.getRequestURI();
            Enumeration<String> paramNames = request.getParameterNames();
            StringBuffer paramsSb = new StringBuffer();
            while (paramNames.hasMoreElements()) {
              String name = (String) paramNames.nextElement();
              if (!"acl".equalsIgnoreCase(name)){
                paramsSb.append(name + "=" + request.getParameter(name) + "&");
              }
            }
            if (paramsSb.length() > 0){
              paramsSb.deleteCharAt(paramsSb.length()-1);
              url = url + "?" + paramsSb.toString();
            }
            request.getSession().setAttribute(BaseAction.FOLLOWING_URL_AFTER_OPERATING_UNIT_PICKUP, url);
            response.sendRedirect(request.getContextPath() + "/operatingunitpickup.do");
            return null;
          }
        }
      }else{
        if(act.getSelectedOuId() != null){
          //set Current OperatingUint in up
          userDetails.setCurrentOu(operatingUnitDao.getByPrimaryKey(act.getSelectedOuId()));
        }else{
          if(!userDetails.checkAuthority(acl.value())){
            logger.error("No sufficicent privilege.");
            throw new BusinessException(PreserveErrorCode.NO_SUFFICICENT_PRIVILEGE);
          }
View Full Code Here


    }
   
    if(authentication != null && authentication.getPrincipal()instanceof LoxiaUserDetails){   
      LoxiaUserDetails userDetails = (LoxiaUserDetails)authentication.getPrincipal();
      if(action instanceof LoxiaUserDetailsAware){
        LoxiaUserDetailsAware aware = (LoxiaUserDetailsAware)action;
        aware.setLoxiaUserDetails(userDetails);
      }
      if(userDetails.getCurrentOu() == null){
        logger.debug("Set CurrentOu for develope purpose. Current Ou:{}",userDetails.getUser().getOu().getName());
        userDetails.setCurrentOu(userDetails.getUser().getOu());
      }
View Full Code Here

  @Override
  public boolean preHandle(HttpServletRequest request,
      HttpServletResponse response, Object handler) throws Exception {
    if(handler instanceof LoxiaUserDetailsAware){
      LoxiaUserDetailsAware aware = (LoxiaUserDetailsAware)handler;
     
      Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
      if(authentication != null && authentication.getPrincipal()instanceof LoxiaUserDetails){
        LoxiaUserDetails userDetails = (LoxiaUserDetails)authentication.getPrincipal();
        aware.setLoxiaUserDetails(userDetails);
      }     
    }
    return true;
  }
View Full Code Here

  @SuppressWarnings("unchecked")
  @Override
  protected void doExecute(String finalLocation, ActionInvocation invocation)
      throws Exception {
    Map request  = (Map)invocation.getInvocationContext().get("request");
    TableModel tableModel = (TableModel)request.get("exceltable");
   
    HttpServletResponse response = (HttpServletResponse) invocation.getInvocationContext().get(HTTP_RESPONSE);
    response.setHeader("Content-Disposition", "attachment;filename=" + tableModel.getModelName() + ".xls");
   
   
    if(tableModel != null){
      logger.debug("Output Excel {}.xls", tableModel.getModelName());
      TableModelUtils.outputExcel(response.getOutputStream(), tableModel);
    }
  }
View Full Code Here

    protected String target;
    protected String popfor;

    @Override
  public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
    return new Button(stack,req,res);
  }
View Full Code Here

    return new Button(stack,req,res);
  }
 
    protected void populateParams() {
        super.populateParams();
        Button button = (Button)component;
        button.setButtonType(buttonType);
        button.setHref(href);
        button.setTarget(target);
        button.setPopfor(popfor);
    }
View Full Code Here

    protected String min;
    protected String max;
 
  @Override
  public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
    return new DateField(stack,req,res);
  }
View Full Code Here

    return new DateField(stack,req,res);
  }
 
  protected void populateParams() {
        super.populateParams();
        DateField dateField = ((DateField) component);
        dateField.setMin(min);
        dateField.setMax(max);
  }
View Full Code Here

    return new NumberField(stack,req,res);
  }
 
  protected void populateParams() {
        super.populateParams();
        Dropdown dropdown = ((Dropdown) component);
        dropdown.setEditable(editable);
        dropdown.setChoice(choice);
        dropdown.setFindMode(findMode);
  }
View Full Code Here

  private static final long serialVersionUID = -8099901188906859982L;

  @Override
  public Component getBean(ValueStack stack, HttpServletRequest req, HttpServletResponse res) {
    // TODO Auto-generated method stub
    return new EditTable(stack,req,res);
  }
View Full Code Here

TOP

Related Classes of loxia.struts2.taglib.model.Button

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.