|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectoracle.jbo.ViewCriteriaRow
public class ViewCriteriaRow
An array containing criteria for the individual attributes of a View Object's WHERE clause.
A ViewCriteriaRow
is entowned by a ViewCriteria
. For an example of a
program that uses ViewCriteriaRow methods, see ViewCriteria
.
ViewCriteriaRow is built as a Row. You get and set attributes through
getAttribute()
and setAttribute()
method.
The attribute value of a ViewCriteriaRow represents a search criterion to be applied for the View Object's attribute. Each attribute criterion may optionally start with a comparison operator. Here are the operators recognized by ViewCriteriaRow: <, >, =, ~, !, LIKE, IS, IN, NOT, NULL, BETWEEN. If an operator is found, no interpretation of the attribute value occurs. I.e., the attribute value is used as is. This means that for a String attribute, one must put "'" around string constants.
If no operator is specified, for char attributes, the LIKE operator is assumed. For non-char attributes, = operator is assumed. The string constant for LIKE comparison may use "*". "*" is translated to "%".
If multiple attribute criteria are specified in this ViewCriteriaRow, i.e.,
setAttribute()
was called on more than one attribute, the attribute criteria are
AND'ed. For example, the following code snippet
// Create and populate criteria rows to support query-by-example. ViewObject empView = appMod.createViewObject("Emp", "mypackage1.EmpView"); ViewCriteria vc = empView.createViewCriteria(); ViewCriteriaRow vcRow = vc.createViewCriteriaRow(); vcRow.setAttribute("Job", "= 'MANAGER'"); vcRow.setAttribute("Deptno", "= 10"); vc.addElement(vcRow);
will result in the following WHERE clause: "( JOB = 'MANAGER' ) AND ( DEPTNO = 10 )".
Using setUpperColumns(boolean)
, you can designate that this ViewCriteriaRow
should apply UPPER to the database column before comparing it to the attribute criterion. Keep
in mind though that the use of UPPER can have a performance consequences for a large data set,
as the database engine may not be able to utilize indices for query optimization.
When multiple ViewCriteriaRow's are added to the ViewCriteria, you can specify whether the WHERE
clause generated by this ViewCriteriaRow should AND or OR with the previous WHERE clause. You do
this through the setConjunction(int)
method. You use VCROW_CONJ_
constants to specify the desired conjunction. Note that VCROW_CONJ_NOT
can be
combined with other VCROW_CONJ_
's through bit-wise OR operator.
VCROW_CONJ_NOT
negates the entire clause generated from this ViewCriteriaRow. For
example,
// Create and populate criteria rows to support query-by-example. ViewObject empView = appMod.createViewObject("Emp", "mypackage1.EmpView"); ViewCriteria vc = empView.createViewCriteria(); ViewCriteriaRow vcRow = vc.createViewCriteriaRow(); vcRow.setAttribute("Job", "MANAGER"); vc.addElement(vcRow); vcRow.setAttribute("Deptno", "= 10"); vcRow.setConjunction(vcRow.VCROW_CONJ_NOT | vcRow.VCROW_CONJ_AND); vc.addElement(vcRow); empView.applyViewCriteria(vc); empView.executeQuery();will result in a WHERE clause like the following: "( JOB LIKE 'MANAGER' ) AND ( NOT ( DEPTNO = 10 ) )."
Field Summary | |
---|---|
static java.lang.Class |
CLASS_INSTANCE
|
static java.lang.String |
VC_CONJUNCTION
|
static java.lang.String |
VC_ITEMS
|
static java.lang.String |
VC_ITEMS_WITH_BINDVARS
|
static java.lang.String |
VC_NESTEDVC
|
static java.lang.String |
VC_PROPERTIES
|
static int |
VCROW_CONJ_AND
Deprecated. use ViewCriteriaComponent.VC_CONJ_AND instead. |
static int |
VCROW_CONJ_NOT
Deprecated. use ViewCriteriaComponent.VC_CONJ_NOT instead. |
static int |
VCROW_CONJ_OR
Deprecated. use ViewCriteriaComponent.VC_CONJ_OR instead. |
Fields inherited from interface oracle.jbo.ViewCriteriaComponent |
---|
VC_CONJ_AND, VC_CONJ_NOT, VC_CONJ_OR, VC_UPPER_COL_DEFAULT, VC_UPPER_COL_FALSE, VC_UPPER_COL_TRUE |
Constructor Summary | |
---|---|
ViewCriteriaRow(ViewCriteria viewCriteria)
Creates a new view criteria row. |
|
ViewCriteriaRow(ViewCriteria viewCriteria,
java.lang.Object[] data)
Creates a new view criteria row. |
Method Summary | |
---|---|
void |
addCriteriaItem(java.lang.String attrName,
ViewCriteriaItem vci)
Add the given criteria item to the row, using the given attribute name. |
void |
copyFrom(ViewCriteriaRow vcr)
|
protected ViewCriteriaItem |
createCriteriaItem(int index,
java.lang.String name,
int kind)
|
ViewCriteriaItem |
ensureCriteriaItem(int index)
|
ViewCriteriaItem |
ensureCriteriaItem(int index,
int kind)
|
ViewCriteriaItem |
ensureCriteriaItem(java.lang.String name)
|
ViewCriteriaItem |
ensureCriteriaItem(java.lang.String name,
int kind)
|
boolean |
equals(java.lang.Object other)
|
protected void |
getAllBindVariables(Map map)
|
java.lang.Object |
getAttribute(int index)
Gets the criterion for a given attribute. |
java.lang.Object |
getAttribute(java.lang.String name)
Gets the criterion for a given attribute. |
static java.lang.String |
getAttributeAlias(java.lang.String attrName,
int index)
Method for encoding an attribute name for use in setting the specific element in its list type attribute value. |
int |
getAttributeCount()
Counts the attribute criteria in the row. |
AttributeHints |
getAttributeHints(int attrIndex)
|
AttributeHints |
getAttributeHints(java.lang.String attrName)
|
int |
getAttributeIndexOf(java.lang.String name)
Gets the attribute index associated with a given attribute name. |
static java.lang.String |
getAttributeNameFromAlias(java.lang.String attrName)
|
java.lang.String[] |
getAttributeNames()
Returns an array of attribute names in this list. |
SecurityHints |
getAttributeSecurityHints(int attrIndex)
|
SecurityHints |
getAttributeSecurityHints(java.lang.String attrName)
|
java.lang.Object[] |
getAttributeValues()
Returns an array of attribute values in this list. |
int |
getConjunction()
|
static java.lang.String |
getConjunctionString(int conj)
|
static int |
getConjunctionValue(java.lang.String sconj)
|
ViewCriteriaItem |
getCriteriaItem(int index)
|
ViewCriteriaItem |
getCriteriaItem(java.lang.String name)
|
ViewCriteriaItem[] |
getCriteriaItemArray()
|
List |
getCriteriaItems()
Returns a list of view criteria items that belong to this row. |
protected List |
getCriteriaItems(boolean flattenCompoundItems,
boolean leafOnly)
Returns a list of view criteria items that belong to this row. |
List |
getCriteriaItemsAndBindVars()
Return a list of view criteria items that belong to this row, plus a list of "where" kind bind variables defined in the owning View Object. |
int |
getEffectiveDateMode()
Get the current effective date mode. |
java.lang.Object |
getExprVarVal(java.lang.String varName)
|
int |
getItemsConjunction()
Method to return the conjunction of the criteria items that belong to this view criteria row, if the conjunction of all view criteria items, ignoring the first item that does not appear in the generated where clause, are the same. |
Key |
getKey()
Returns the row's key. |
protected LocaleContext |
getLocale()
|
java.lang.String |
getName()
|
int |
getNestedVCCount()
|
ViewCriteria |
getNestedViewCriteria()
|
java.lang.String |
getOperator(int index)
|
java.lang.String |
getOperator(java.lang.String attr)
|
java.util.Hashtable |
getProperties()
Return the properties of the ViewCriteria that owns this VC row. |
SecurityHints |
getSecurityHints()
|
StructureDef |
getStructureDef()
Returns the structure of the row. |
int |
getUpperColumnsValue()
|
ViewCriteria |
getViewCriteria()
|
boolean |
hasAttributeListChanged()
API for checking whether the list of attributes for this view criteria row might have beeen changed. |
boolean |
hasData()
|
boolean |
hasSameConjunction()
Method to check whether all items under this row has the same conjunction. |
void |
initUniqueRowName()
Assigns a name that is unique in the View Criteria that this row belongs. |
static boolean |
isAttributeSearchable(AttributeDef def,
LocaleContext locale)
|
boolean |
isAttributeUpdateable(int index)
Tests if an attribute is updateable. |
boolean |
isDead()
An attempt to access a dead view row will lead to a DeadViewRowAccessException. |
boolean |
isUpperColumns()
Returns the upper-columns flag for this ViewCriteriaRow . |
void |
lock()
Locks the row(s) in the source database table. |
protected void |
notifyChanged()
|
void |
refresh(int refreshMode)
Refreshes the row's attributes with values from database. |
void |
remove()
Removes the row from the source database. |
void |
removeAndRetain()
Removes the row from the collection and then retain it for insertion into another location. |
void |
removeCriteriaItem(java.lang.String attrName,
ViewCriteriaItem vci)
Remove the given criteria item with the given attribute name from the row. |
void |
removeFromCollection()
Removes the row from the collection. |
void |
setAttribute(int index,
java.lang.Object value)
Sets the criterion for a given attribute. |
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Sets the criterion for a given attribute. |
void |
setAttributeValues(List names,
List values)
Set attribute values for the given list of attributes names. |
void |
setConjunction(int conjunction)
|
void |
setConjunctionOnItems(int conjunction)
Convenience API for setting the conjunction of all items in this row. |
void |
setCriteriaItem(int index,
ViewCriteriaItem crit)
|
void |
setCriteriaItem(java.lang.String name,
ViewCriteriaItem crit)
|
void |
setEffectiveDateMode(int mode)
Set the Effective Date mode in which the row updates need to be carried out. |
void |
setExprVarVal(java.lang.String varName,
java.lang.Object val)
|
void |
setName(java.lang.String name)
|
void |
setNewRowState(byte state)
Sets a new unposted row, created in this transaction, to either STATUS_NEW or STATUS_INITIALIZED mode. |
void |
setOperator(int index,
java.lang.String oper)
|
void |
setOperator(java.lang.String attr,
java.lang.String oper)
|
void |
setUpperColumns(boolean b)
Sets the upper-columns flag for this ViewCriteriaRow . |
protected void |
setUpperColumnsValue(int val)
|
java.lang.String |
toString()
|
void |
validate()
Invokes the validation methods defined for the row's Entity Object. |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.Class CLASS_INSTANCE
public static int VCROW_CONJ_OR
ViewCriteriaComponent.VC_CONJ_OR
instead.VCROW_CONJ_...
constants are used to specify the conjuction for this
ViewCriteriaRow. See above for further explanation.
VCROW_CONJ_OR
will add the clause generated by this ViewCriterRow with an OR
conjunction.
public static int VCROW_CONJ_AND
ViewCriteriaComponent.VC_CONJ_AND
instead.VCROW_CONJ_...
constants are used to specify the conjuction for this
ViewCriteriaRow. See above for further explanation.
VCROW_CONJ_AND
will add the clause generated by this ViewCriterRow with an AND
conjunction.
public static int VCROW_CONJ_NOT
ViewCriteriaComponent.VC_CONJ_NOT
instead.VCROW_CONJ_...
constants are used to specify the conjuction for this
ViewCriteriaRow. See above for further explanation.
VCROW_CONJ_NOT
will negate the clause generated by this ViewCriterRow.
VCROW_CONJ_NOT
may be combined with other VCROW_CONJ_...
constants through a bit-wise OR operator.
public static final java.lang.String VC_ITEMS
public static final java.lang.String VC_ITEMS_WITH_BINDVARS
public static final java.lang.String VC_CONJUNCTION
public static final java.lang.String VC_NESTEDVC
public static final java.lang.String VC_PROPERTIES
Constructor Detail |
---|
public ViewCriteriaRow(ViewCriteria viewCriteria)
viewCriteria
- the ViewCriteria
that is to contain the ViewCriteriaRow
.public ViewCriteriaRow(ViewCriteria viewCriteria, java.lang.Object[] data)
viewCriteria
- the ViewCriteria
that is to contain the ViewCriteriaRow
data
- an array of attribute criteria to be initially assigned to this
ViewCriteriaRow
.Method Detail |
---|
protected void notifyChanged()
public int getNestedVCCount()
public ViewCriteria getNestedViewCriteria()
public java.util.Hashtable getProperties()
protected void getAllBindVariables(Map map)
public int getConjunction()
getConjunction
in interface ViewCriteriaComponent
public void setConjunction(int conjunction)
setConjunction
in interface ViewCriteriaComponent
public boolean isUpperColumns()
ViewCriteriaRow
. If this flag is
true
, UPPER SQL operator will be applied to all CHAR/VARCHAR columns when the
SQL WHERE clause is generated.
The default is false
.
isUpperColumns
in interface ViewCriteriaComponent
public void setUpperColumns(boolean b)
ViewCriteriaRow
. If this flag is
true
, UPPER SQL operator will be applied to all CHAR/VARCHAR columns when the
SQL WHERE clause is generated.
setUpperColumns
in interface ViewCriteriaComponent
b
- a new flag value for upper'ing columns.public int getUpperColumnsValue()
getUpperColumnsValue
in interface ViewCriteriaComponent
protected void setUpperColumnsValue(int val)
public java.lang.String getName()
public void setName(java.lang.String name)
public java.lang.String getOperator(int index)
public java.lang.String getOperator(java.lang.String attr)
public void setOperator(java.lang.String attr, java.lang.String oper)
public void setOperator(int index, java.lang.String oper)
public ViewCriteria getViewCriteria()
public boolean hasSameConjunction()
public int getItemsConjunction()
public void setConjunctionOnItems(int conjunction)
conjunction
- The conjunction that the items should be using.public boolean hasAttributeListChanged()
public java.lang.Object getAttribute(int index)
getAttribute
in interface AttributeList
index
- the attribute's index.
public final java.lang.Object getAttribute(java.lang.String name)
getAttribute
in interface AttributeList
name
- the attribute's name.
public void setAttributeValues(List names, List values)
setAttributeValues
in interface Row
public void setAttribute(int index, java.lang.Object value)
setAttribute
in interface AttributeList
index
- the attribute's index.value
- a new criterion for the attribute.public final void setAttribute(java.lang.String name, java.lang.Object value)
setAttribute
in interface AttributeList
name
- the attribute's name.value
- a new criterion for the attribute.public int getAttributeCount()
getAttributeCount
in interface AttributeList
public int getAttributeIndexOf(java.lang.String name)
getAttributeIndexOf
in interface AttributeList
name
- the attribute name.
public java.lang.String[] getAttributeNames()
AttributeList
getAttributeNames
in interface AttributeList
public java.lang.Object[] getAttributeValues()
AttributeList
getAttributeValues
in interface AttributeList
public AttributeHints getAttributeHints(java.lang.String attrName)
public AttributeHints getAttributeHints(int attrIndex)
public Key getKey()
getKey
in interface Row
null
.public void validate()
validate
in interface Row
JboException
- a runtime exception, if the recipient wishes the property change to be rolled back.EntityImpl.validate()
,
ViewRowImpl.validate()
public void lock()
lock
in interface Row
JboException
- a runtime exception, if an exception occurs during access.public void remove()
remove
in interface Row
JboException
- a runtime exception, if an exception occurs during access.public void removeFromCollection()
Row
This method differs from
in that it just removes the row from
the collection. It does not remove the underlying Entity row(s) or database row(s). However,
once the row is removed, it cannot be used any more. If you want to remove the row from the
collection and insert it elsewhere, call Row.remove()
.
Row.removeAndRetain()
removeFromCollection
in interface Row
public void removeAndRetain()
Row
This method differs from
in that it just removes the row from
the collection. It does not remove the underlying Entity row(s) or database row(s).
Row.remove()
This method also differs from
in that after the
row is removed from the collection, it can be inserted back into the collection at another
location.
Row.removeFromCollection()
removeAndRetain
in interface Row
public void refresh(int refreshMode)
Row
refreshMode
should be
a combination of REFRESH_...
. See REFRESH_...
constants for
further information.
refresh
in interface Row
refreshMode
- the refresh mode.public boolean isAttributeUpdateable(int index)
isAttributeUpdateable
in interface Row
index
- the index of the attribute.
true
if the row is marked UPDATEABLE
, or if the row is
marked UPDATEABLE_WHILE_NEW
and the current row is new.public StructureDef getStructureDef()
Row
getStructureDef
in interface Row
public void setEffectiveDateMode(int mode)
Row
setEffectiveDateMode
in interface Row
mode
- One of the effective date mode constants.Row.EFFDT_NONE_MODE
,
Row.EFFDT_UPDATE_CORRECTION
,
Row.EFFDT_UPDATE_MODE
,
Row.EFFDT_UPDATE_OVERRIDE_MODE
,
Row.EFFDT_UPDATE_CHANGE_INSERT_MODE
,
Row.EFFDT_DELETE_MODE
,
Row.EFFDT_DELETE_NEXT_CHANGE_MODE
,
Row.EFFDT_DELETE_FUTURE_CHANGE_MODE
,
Row.EFFDT_DELETE_ZAP_MODE
public int getEffectiveDateMode()
Row
getEffectiveDateMode
in interface Row
Row.setEffectiveDateMode(int)
public final boolean hasData()
public void setNewRowState(byte state)
Row
This method should be used to create a row and then to mark it temporary (STATUS_INITIALIZED) so that an app can use the created Row to fill UIs like Table UIs with valid default values for rows. Then when the Row values are updated, UIs should once again call this method to turn the Row into new (STATUS_NEW) state before any setAttribute calls on the Row, so that the changes are validated and posted.
When a created row is in STATUS_NEW (by default) state and this method is called to turn the row in to STATUS_INITIALIZED, all updateable entities that this row comprises of, de=registers themselves from their respective transaction and validation managers. Assocation and ViewLink finders will not find/include these rows. Only the collection into which this row was inserted into will contain a reference to this row and when that collection is re-executed this row cannot be reached via the framework. To include this row again an app should call this method again with STATUS_NEW as the method-argument
When this row is in STATUS_INITIALIZED state and this method is called with STATUS_NEW state then, this new row is added back into it's relevant transaction and validation manager and will then participate in validation, transaction cycles.
Note that incase of composition if a master/detail hierarchy is being created with the intention of making them temporary (STATUS_INITIALIZED) then the logic should be: Create Master row, insert Master row into a collection, create Detail row insert detail row into a relevant collection, make detail row initialized, create/insert/change-to-initialized more detail rows and at the end set the master row as initialized.
setNewRowState
in interface Row
state
- This could be STATUS_NEW or STATUS_INITIALIZED.public boolean isDead()
Row
isDead
in interface Row
true
if the row is dead.public void copyFrom(ViewCriteriaRow vcr)
protected ViewCriteriaItem createCriteriaItem(int index, java.lang.String name, int kind)
public ViewCriteriaItem ensureCriteriaItem(int index, int kind)
public ViewCriteriaItem ensureCriteriaItem(java.lang.String name, int kind)
public ViewCriteriaItem ensureCriteriaItem(int index)
public ViewCriteriaItem ensureCriteriaItem(java.lang.String name)
public ViewCriteriaItem getCriteriaItem(int index)
public ViewCriteriaItem getCriteriaItem(java.lang.String name)
public ViewCriteriaItem[] getCriteriaItemArray()
public void setCriteriaItem(int index, ViewCriteriaItem crit)
public void setCriteriaItem(java.lang.String name, ViewCriteriaItem crit)
public void addCriteriaItem(java.lang.String attrName, ViewCriteriaItem vci)
attrName
- vci
- public void removeCriteriaItem(java.lang.String attrName, ViewCriteriaItem vci)
attrName
- vci
- public java.lang.String toString()
toString
in class java.lang.Object
public static int getConjunctionValue(java.lang.String sconj)
public static java.lang.String getConjunctionString(int conj)
public java.lang.Object getExprVarVal(java.lang.String varName)
getExprVarVal
in interface ExprValueSupplier
public void setExprVarVal(java.lang.String varName, java.lang.Object val)
setExprVarVal
in interface ExprValueSupplier
public static java.lang.String getAttributeAlias(java.lang.String attrName, int index)
attrName
- the name of the attribute with list type valueindex
- the element in the value list whose value is to be set when the encoded attribute
name is passed to setAttribute
public static java.lang.String getAttributeNameFromAlias(java.lang.String attrName)
public static boolean isAttributeSearchable(AttributeDef def, LocaleContext locale)
public List getCriteriaItemsAndBindVars()
protected LocaleContext getLocale()
public List getCriteriaItems()
protected List getCriteriaItems(boolean flattenCompoundItems, boolean leafOnly)
flattenCompoundItems
- whether compound vc items should be included in the return list as is, or if the vc
items that are found inside a compound vc item should be included in the return list.
If this flag is true, the method would extract the vc items from any compound vc
item, so the return list may include more than one vc item for the same attribute. If
this flag is false, the method would return the compound vc item and the return list
would only include at most one vc item, which may be a compound item, for the same
attribute.leafOnly
- true if the result should only include leaf vc items, ie, items that does not contain
nested viewcriteria as values. For items that contains nested vc values, the method
would include in the result the leaf vc items of the nested vc. false if vc items
containing nested vc value should be included in the result.
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public SecurityHints getAttributeSecurityHints(java.lang.String attrName)
public SecurityHints getAttributeSecurityHints(int attrIndex)
public SecurityHints getSecurityHints()
public void initUniqueRowName()
|
Oracle Fusion Middleware Java API Reference for Oracle ADF Mobile Client 11g Release 1 (11.1.1) E17503-02 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |