コード例 #1
0
  /**
   * Returns the objects collection.
   *
   * @param
   */
  protected IObjects getIObjects(int _nMaxSize) throws PureException {
    SearchForm thisform = (SearchForm) form;

    // 1. to get the query filter
    QueryFilter filter = thisform.getQueryFilter();
    if (filter.getSelect() == null) {
      filter.addPropertySelect("this", "*");
    }

    // 2. to render SQL
    IContentMgr mgr =
        ArkContentHelper.getContentMgrOf(thisform.getEntityMetadata().getEntityClass());
    List params = new ArrayList();
    String strSQL = filter.toSQL(params);
    if (this.isFromTemp()) {
      strSQL = strSQL.replaceAll("\\{this\\}", mgr.getTempTable(true) + " this");
    }
    logger.debug("SQL=" + strSQL);

    // 3. to execute the query
    IStatement query = null;
    try {
      query = mgr.createQuery(strSQL, 0);
      filter.registerEntitiesInQuery(query);
      query.setParameters(0, params);
      if (_nMaxSize > 0) {
        query.setMaxSize(_nMaxSize);
      }
      return query.executeQuery();
    } finally {
      params.clear();
      if (query != null) query.clear();
    }
  }
コード例 #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();
 }