Ejemplo n.º 1
0
 public PageOutcome getRedirectWithViewParams(String action) {
   PageOutcome outcome = getRedirectWithViewParams();
   if (StringUtils.isNotEmpty(action))
     outcome = outcome.addParam("action", encodeActionParam(action));
   return outcome;
 }
Ejemplo n.º 2
0
  /**
   * Creates an Oracle specific select statement that supports special features of the Oracle DBMS
   * like e.g. CONNECT BY PRIOR
   *
   * @param buf the SQL statement
   */
  @Override
  public synchronized void getSelect(StringBuilder buf) {
    List<DBAliasExpr> aliases = new ArrayList<DBAliasExpr>();
    resetParamUsage();
    if (select == null) throw new ObjectNotValidException(this);

    // Prepares statement
    if ((limitRows != null) || (skipRows != null)) {
      // add aliases
      Iterator<DBColumnExpr> iter = select.iterator();
      int i = 0;
      while (iter.hasNext()) {
        i++;
        aliases.add(new DBAliasExpr(iter.next(), "alias" + i));
      }

      buf.append("SELECT * FROM (\r\n");
    }

    buf.append("SELECT ");
    if (StringUtils.isNotEmpty(optimizerHint)) { // Append an optimizer hint
      // to the select
      // statement e.g. SELECT
      // /*+ RULE */
      buf.append("/*+ ").append(optimizerHint).append(" */ ");
    }
    if (selectDistinct) buf.append("DISTINCT ");

    // Add Select Expressions
    if ((limitRows != null) || (skipRows != null)) {
      addListExpr(buf, aliases, CTX_ALL, ", ");
      buf.append(", row_number() over (");
      insertOrderBy(buf);
      buf.append(") as rownumber ");
    } else {
      addListExpr(buf, select, CTX_ALL, ", ");
    }

    addFrom(buf);
    // Where

    addWhere(buf);
    // Connect By
    if (connectBy != null) { // Add 'Connect By Prior' Expression
      buf.append("\r\nCONNECT BY PRIOR ");
      connectBy.addSQL(buf, CTX_DEFAULT | CTX_NOPARENTHESES);
      // Start With
      if (startWith != null) { // Add 'Start With' Expression
        buf.append("\r\nSTART WITH ");
        startWith.addSQL(buf, CTX_DEFAULT);
      }
    }
    // Grouping
    addGrouping(buf);
    // Order
    if ((skipRows == null) && (limitRows == null)) {
      insertOrderBy(buf);
    } else {
      buf.append(") WHERE (");
      if (skipRows != null) {
        buf.append("rownumber>" + skipRows.toString());
      }

      if (limitRows != null) {
        if (skipRows != null) {
          buf.append(" AND ");
        }
        Integer outputLimit = new Integer(limitRows.intValue());
        if (skipRows != null) {
          outputLimit += skipRows;
        }

        buf.append("rownumber<=" + outputLimit.toString());
      }
      buf.append("\r\n)");
    }
  }
Ejemplo n.º 3
0
 public PageOutcome getOutcome(String action) {
   PageOutcome outcome = getOutcome();
   if (StringUtils.isNotEmpty(action))
     outcome = outcome.addParam("action", encodeActionParam(action));
   return outcome;
 }