コード例 #1
0
  /** @see com.pureinfo.ark.interaction.ActionBase#beforeExecution() */
  protected ActionForward beforeExecution() throws PureException {
    QueryFilter filter = ((SearchForm) form).getQueryFilter();

    OrganizationHelper.addOrgTypeFilter(filter, request);
    String sProductForm = request.getParameter("dp_productForm");
    if (sProductForm == null || sProductForm.trim().length() == 0) {
      String[] _sPaper =
          new String[] {
            ProductConstants.SPRODUCT_FORM_PAPER, ProductConstants.SPRODUCT_FORM_MONOGRAPH
          };
      filter.addPropertyCondition("this", "productForm", SQLOperator.IN, _sPaper);
    }

    String sAuthorName = request.getParameter("productUser_userName", "作者");
    if (sAuthorName != null && (sAuthorName = sAuthorName.trim()).length() > 0) {
      int nSearchAuthorType =
          request.getInt("searchAuthorType", "作者排名", SRMConstants.SEARCH_AUTHOR_TYPE_ALL);
      switch (nSearchAuthorType) {
        case SRMConstants.SEARCH_AUTHOR_TYPE_FIRST:
          {
            filter.addPropertyCondition(
                "productUser", "orderNo", SQLOperator.EQUAL, new Integer(1));
            break;
          }
        case SRMConstants.SEARCH_AUTHOR_TYPE_OTHER:
          {
            filter.addPropertyCondition(
                "productUser", "orderNo", SQLOperator.GREATER, new Integer(1));
            break;
          }
      }
    }

    String sAppend = request.getParameter("appendix");
    if (sAppend != null) {
      if (sAppend.equals("1")) { // 有附件
        filter.setDistinct(true);
        if (isFromAll()) { // 全部
          filter.addCondition(
              "exists (select appendix.host_Id from "
                  + "ark_appendix appendix where appendix.host_id={this.id} and appendix.host_type="
                  + SRMTypes.PRODUCT
                  + ")");
        } else if (isFromTemp()) { // 临时表
          filter.addPropertyCondition("appendix", "temp", SQLOperator.EQUAL, Boolean.TRUE);
        } else { // 正式表
          filter.addPropertyCondition("appendix", "formal", SQLOperator.EQUAL, Boolean.TRUE);
        }
      } else if (sAppend.equals("2")) { // 无附件
        filter.addCondition(
            " not exists (select appendix.host_Id from "
                + "ark_appendix appendix where appendix.host_id={this.id} and appendix.host_type="
                + SRMTypes.PRODUCT
                + ")");
      }
    }
    request.setAttribute(
        "URL", "../product/product-net-search.jsp?type=" + ProductConstants.PRODUCT_FORM_APPRAISE);
    return null;
  }
コード例 #2
0
 /** @see com.pureinfo.ark.interaction.ActionBase#beforeExecution() */
 protected ActionForward beforeExecution() throws PureException {
   QueryFilter filter = ((SearchForm) form).getQueryFilter();
   filter.setDistinct(true);
   filter.addPropertySelect("this", "*");
   filter.addPropertyCondition(
       "person", "personId", SQLOperator.EQUAL, new Integer(loginUser.getId()));
   filter.addCondition("{person.personType}=1");
   return super.beforeExecution();
 }
コード例 #3
0
 /**
  * @param _sFilter
  * @param _sLoginUser
  * @throws PureException
  */
 public void prepareQueryFilter4List(QueryFilter _sFilter, IUser _sLoginUser)
     throws PureException {
   ISQLLogic logic =
       Auth2Helper.getManager().getSQLLogicRule(_sLoginUser, new Team(), ArkActionTypes.LIST);
   if (logic == SQLLogicString.FALSE) {
     return;
   }
   if (logic != SQLLogicString.TRUE) {
     _sFilter.addCondition(logic);
   }
 }
コード例 #4
0
 /**
  * 待审核列表
  *
  * @param _sFilter
  * @param _sLoginUser
  * @throws PureException
  */
 public void prepareQueryFilter4AuditList(QueryFilter _sFilter, IUser _sLoginUser)
     throws PureException {
   ISQLLogic logic =
       Auth2Helper.getManager()
           .getSQLLogicRule(_sLoginUser, new Team(), ArkActionTypes.AUDIT_LIST);
   if (logic == SQLLogicString.FALSE) {
     throw new PureException(ArkExceptionTypes.AUTH_NO_RIGHT, "您没有权限");
   }
   if (logic != SQLLogicString.TRUE) {
     _sFilter.addCondition(logic);
   }
 }
 /** @see com.pureinfo.ark.interaction.ActionBase#beforeExecution() */
 protected ActionForward beforeExecution() throws PureException {
   QueryFilter filter = ((SearchForm) form).getQueryFilter();
   filter.addCondition("{this.contractId}=0 or {this.contractId} IS NULL");
   filter.addPropertyCondition(
       "this", "lStatus", SQLOperator.LESS, new Integer(ProjectConstants.STATUS_FINISHED));
   SRMUser user = (SRMUser) loginUser;
   boolean bAdmin2 = user.isAdmin2();
   if (bAdmin2) {
     filter.addPropertyCondition(
         "this", "college", SQLOperator.EQUAL, new Integer(user.getCollegeId()));
   }
   return super.beforeExecution();
 }
コード例 #6
0
 protected ActionForward beforeExecution() throws PureException {
   QueryFilter filter = ((SearchForm) form).getQueryFilter();
   filter.addCondition("{this.productId} <= 0");
   SRMWebUtil.propertyAndOrSearch((SearchForm) form, request);
   return super.beforeExecution();
 }
コード例 #7
0
  /** @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();
  }