/**
  * @throws PureException
  * @see com.pureinfo.ark.interaction.list.ISearchAction#getTitle()
  */
 public String getTitle() throws PureException {
   if (request.getParameter("paperForm") != null) {
     return "论文(著作)列表";
   }
   String sProductForm = request.getParameter("dp_productForm");
   if (sProductForm != null && sProductForm.length() > 0) {
     return ProductConstants.getDescByForm(sProductForm) + "列表";
   }
   return "成果列表";
 }
 protected String getScenery() {
   String sForm = request.getParameter("dp_productForm");
   if (request.getParameter("paperForm") != null) {
     return "tutorial_list";
   }
   if (sForm != null) {
     try {
       return ProductConstants.getSeneryPrefixByForm(sForm) + "_list";
     } catch (PureException ex) {
       return "list";
     }
   }
   return "list";
 }
  /** @see com.pureinfo.ark.interaction.ActionBase#beforeExecution() */
  protected ActionForward beforeExecution() throws PureException {
    Product product = (Product) getSearchBean();
    SRMWebUtil.propertyAndOrSearch((SearchForm) form, request);

    String sProductForm = product.getProductForm();

    // 1. to validate the authorization
    IAuth2Mgr authMgr = Auth2Helper.getManager();
    ISQLLogic logic = authMgr.getSQLLogicRule(loginUser, product, ArkActionTypes.LIST);
    if (logic == SQLLogicString.FALSE) {
      String sDesc =
          (StringUtils.isEmpty(sProductForm)) ? "成果" : ProductConstants.getDescByForm(sProductForm);
      throw new PureException(ArkExceptionTypes.AUTH_NO_RIGHT, "对不起,您没有权限查看" + sDesc + "列表!");
    }

    // 2. to add the restriction
    QueryFilter filter = ((SearchForm) form).getQueryFilter();
    OrganizationHelper.addOrgTypeFilter(filter, request);
    /** 此处需要讨论 if (logic != SQLLogicString.TRUE) { filter.addCondition(logic); } */

    // 3. to parse some special parameters
    int nCurrRange = this.getRange();

    // 获奖与鉴定的年份小搜索是具体的年份

    if (StringUtils.isNotEmpty(sProductForm)) {
      if (sProductForm.equals(ProductConstants.SPRODUCT_FORM_HONOR)) {
        if (nCurrRange != 0) {
          filter.addCondition("year(publish_date)=" + nCurrRange);
          // filter.addOrder("{this.rank}");
        }
      } else if (sProductForm.equals(ProductConstants.SPRODUCT_FORM_APPRAISE)) {
        if (nCurrRange != 0) {
          filter.addCondition("{this.publicationYear}=" + nCurrRange);
        }
      } else {
        if (!(nCurrRange == RANGE_ALL)) {
          filter.addPropertyCondition(
              "this",
              "publishDate",
              SQLOperator.BETWEEN,
              new Date[] {getBeginYear(), getEndYear()});
        }
      }
    } else {
      String sPaperForm = request.getParameter("paperForm");
      if (sPaperForm != null) {
        if (sPaperForm.equals(ProductConstants.SPRODUCT_FORM_HONOR)) {
          filter.addPropertyCondition("this", "productForm", SQLOperator.EQUAL, sPaperForm);
          // filter.addOrder("{this.rank}");
        } else {
          String[] _sPaper =
              new String[] {
                ProductConstants.SPRODUCT_FORM_PAPER, ProductConstants.SPRODUCT_FORM_MONOGRAPH
              };
          filter.addPropertyCondition("this", "productForm", SQLOperator.IN, _sPaper);
          // 显示范围
          filter.addPropertyCondition(
              "this", "publishDate", SQLOperator.GREATER_OR_EQUAL, getBeginYear());
          filter.addPropertyCondition(
              "this", "publishDate", SQLOperator.LESS_OR_EQUAL, getEndYear());
        }
        String sOrderBy = request.getTrimedParameter("orderBy");
        if (sOrderBy == null || sOrderBy.length() == 0) {
          filter.setOrder("{this.lastModifiedTime} DESC, " + filter.getOrder());
        }
      }
    }

    // set default order for honor list and appraise list
    if (ProductConstants.SPRODUCT_FORM_HONOR.equals(sProductForm)
        || ProductConstants.SPRODUCT_FORM_APPRAISE.equals(sProductForm)) {
      String sOrderBy = request.getTrimedParameter("orderBy");
      if (sOrderBy == null || sOrderBy.length() == 0) {
        // filter.setOrder("YEAR({this.publishDate})
        // DESC,{this.level}");
        filter.setOrder("{this.rank},YEAR({this.publishDate}),{this.level}");
      }
    }

    return super.beforeExecution();
  }