Menu

TkOAViewObjectImpl

Barry Goodsell

TkOAViewObjectImpl

Package [com.oaframework.toolkit.common.server]
Extends oracle.apps.fnd.framework.server.OAViewObjectImpl

This class provides methods to assist in the construction of complex WHERE clauses. Your VO's initQuery() method should call the methods from this class as follows:

  • clearWhereClauses() to clear any existing WHERE clauses and bind values
  • addClause() to add new WHERE clauses and bind values; this can be called as many times as necessary
  • applyWhereClauses() to apply the WHERE clauses and perform variable binding
  • executeQuery() to execute the Query

For further details see the Example

clearWhereClauses()

This methods clears down any previously set WHERE clauses ands calls the standard setWhereClauseParams() to clear down any existing bind values.

addClause()

This method is overloaded 5 times to provide a variety WHERE clause syntax.

addClause(String clause)

The clause is added to the WHERE clause with no modification

addClause(String clause, String value)

The clause must contain a placeholder <1> which is replaced by a suitably numbered bind variable and added to the WHERE clause. The value is stored and will be bound to the Query later by bindParameters()

addClause(String clause, Number value)

The clause must contain a placeholder <1> which is replaced by a suitably numbered bind variable and added to the WHERE clause. The value is stored and will be bound to the Query later by bindParameters()

addClause(String clause, String value1, String value2)

The clause must contain placeholder <1> and <2> which are replaced by a suitably numbered bind variables and added to the WHERE clause. value1 and value2 are stored and will be bound to the Query later by bindParameters(). This overload would normally be used for BETWEEN clauses.

addClause(String clause, Number value1, Number value2)

The clause must contain placeholder <1> and <2> which are replaced by a suitably numbered bind variables and added to the WHERE clause. value1 and value2 are stored and will be bound to the Query later by bindParameters(). This overload would normally be used for BETWEEN clauses.

applyWhereClauses()

Applies the current WHERE clauses to the VO and bind the supplied values to any bind variables.

getWhereClause()

Returns the current complete WHERE clause

getClauseCount()

Returns the number of clauses that comprise the current WHERE clause

getBindCount()

Returns the number of bind variables contained in the current WHERE clause.

bindParameters()

Bind the previously supplied values to the variables in the current WHERE clause. This method is not normally called directly.

Example

public void initQuery(Number userId, String status, Number lowValue, Number highValue)
{
  clearWhereClauses();
  addClause("enabled = 'Y'");
  addClause("user_id = &lt;1&gt;", userId);
  addClause("status = &lt;1&gt;", status);
  addClause("total_value BETWEEN &lt;1&gt; AND &lt;2&gt;", lowValue, highValue);
  applyWhereClauses();
  executeQuery();
}

Calling this method will result in the following WHERE clause:

enabled = 'Y' AND user_id = :1 AND status = :2 AND total_value BETWEEN :3 AND :4

Related

Wiki: com.oaframework.toolkit.common.server

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.