Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

oracle.javatools.db
Class DBObjectCriteria<T extends SystemObject>

java.lang.Object
  extended by oracle.javatools.db.DBObjectCriteria<T>
All Implemented Interfaces:
DBObjectFilter<T>

public class DBObjectCriteria<T extends SystemObject>
extends java.lang.Object
implements DBObjectFilter<T>

A DBObjectCriteria is used when listing objects from a DBObjectProvider to specify the criteria by which the list should be restricted. It is a specialization of a DBObjectFilter, because as well as having a filter's accept capability, information about each criterion is available (type, name, schema) so that the listing of objects can be done efficiently.

The base class supports the following criteria as they are supported by the fundamentals of the object listing - for example they can be used in the actual dictionary SQL queries against the database.

Since:
11.1.1
See Also:
DBObject.getType(), DBObject.getName(), SchemaObject.getSchema()

Nested Class Summary
 
Nested classes/interfaces inherited from interface oracle.javatools.db.DBObjectFilter
DBObjectFilter.IDFilter<T extends DBObject>
 
Field Summary
static java.lang.String LIKE_WILDCARD
           
static char LIKE_WILDCARD_CHAR
           
 
Constructor Summary
DBObjectCriteria(java.lang.Class<? extends T> clz, java.lang.String... types)
          Constructs a new criteria object for the given DBObject implementation.
DBObjectCriteria(T obj)
          Constructs a new criteria object to match the given object by name, type and schema.
 
Method Summary
 boolean accept(T obj)
          Tests the given object to see if it matches all of the criteria and returns true if it does.
 void addFilter(DBObjectFilter<T> filter)
          Adds an extra filter to this object as an auxillary criterion.
static DBObjectCriteria<SystemObject> createCriteria()
          Creates a new, blank criteria that isn't tied to a specific SystemObject subclass.
static DBObjectCriteria<SystemObject> createCriteria(java.lang.String[] types, Schema schema, java.lang.String nameLike)
          Creates a new, blank criteria that isn't tied to a specific SystemObject subclass.
static DBObjectCriteria<SystemObject> createCriteria(java.lang.String type, Schema schema, java.lang.String nameLike)
          Creates a new, blank criteria that isn't tied to a specific SystemObject subclass.
static DBObjectCriteria<SystemObject> createCriteria(java.lang.String type, java.lang.String schemaName, java.lang.String nameLike)
          Creates a new, blank criteria that isn't tied to a specific SystemObject subclass.
 java.lang.String getNameLike()
          Gets the criterion for name restriction.
 java.lang.String getSchemaName()
          Gets the schema name criterion.
 java.lang.String[] getTypeArray()
          Gets the criterion for object type as an array of allowed type Strings.
 java.util.Collection<java.lang.String> getTypes()
          Gets the criterion for object type as a list of allowed type Strings.
 boolean hasExtraCriteria()
          Returns true if this criteria has had at least one extra criterion added via the addFilter method.
 boolean isAllowedName(java.lang.String name)
          Tests whether the given name matches the name like criterion.
 boolean isAllowedSchema(Schema schema)
          Tests whether the given schema matches the "schema name" criterion.
 boolean isAllowedSchemaName(java.lang.String schemaName)
          Tests whether the given schema name matches the "schema name" criterion.
 boolean isAllowedType(java.lang.String type)
          Tests if the given type string passes this criterion.
 boolean isNameWild()
          Tests whether the "name like" criterion will accept more than one specific string.
 boolean isUserOnly()
          Gets the value of the "user only" criterion.
 void setNameLike(java.lang.String nameLike)
          Sets the name criterion.
 void setSchema(Schema schema)
          Sets the schema name criterion using a Schema object.
 void setSchemaName(java.lang.String name)
          Sets the schema name criterion.
 void setTypes(java.util.Collection<java.lang.String> types)
          Sets the object types criterion.
 void setTypes(java.lang.String... types)
          Sets the object types criterion.
 void setUserOnly(boolean userOnly)
          Sets the "user only" criterion.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LIKE_WILDCARD_CHAR

public static final char LIKE_WILDCARD_CHAR
See Also:
Constant Field Values

LIKE_WILDCARD

public static final java.lang.String LIKE_WILDCARD
Constructor Detail

DBObjectCriteria

public DBObjectCriteria(T obj)
Constructs a new criteria object to match the given object by name, type and schema.

Parameters:
obj - the object that the new criteria will match.

DBObjectCriteria

public DBObjectCriteria(java.lang.Class<? extends T> clz,
                        java.lang.String... types)
Constructs a new criteria object for the given DBObject implementation. If the given class has a single associated type (e.g. Table.class => Table.TYPE ) then that type will be added as the type criterion, otherwise all known subclass types of the given class will be added as the type criterion.

To construct a generic criteria use the static createCriteria methods.

Parameters:
clz - the class of object set restrict as a criteria.
Method Detail

getNameLike

public final java.lang.String getNameLike()
Gets the criterion for name restriction. The returned string is expected to be compatible with a database LIKE clause and therefore contain '%' for any wildcard matching.

Returns:
the parameter to LIKE for matching the name

setNameLike

public final void setNameLike(java.lang.String nameLike)
Sets the name criterion.

Parameters:
nameRef - the parameter to LIKE for matching an object name
See Also:
getNameLike()

isNameWild

public final boolean isNameWild()
Tests whether the "name like" criterion will accept more than one specific string.

Returns:
true if the name criterion is not set (i.e. any name will match) or it is set and will match multiple names (i.e. contains a wildcard).

isAllowedName

public final boolean isAllowedName(java.lang.String name)
Tests whether the given name matches the name like criterion.

Parameters:
name - the name to test
Returns:
true if the name is allowed

getTypes

public final java.util.Collection<java.lang.String> getTypes()
Gets the criterion for object type as a list of allowed type Strings.

Returns:
a list of object types that match this criterion

getTypeArray

public final java.lang.String[] getTypeArray()
Gets the criterion for object type as an array of allowed type Strings.

Returns:
an array of object types that match this criterion

isAllowedType

public final boolean isAllowedType(java.lang.String type)
Tests if the given type string passes this criterion.

Parameters:
type - the type to test
Returns:
true if the type passes this criterion
See Also:
getTypes()

setTypes

public final void setTypes(java.util.Collection<java.lang.String> types)
Sets the object types criterion.

Parameters:
types - the allowed object types
See Also:
getTypes()

setTypes

public final void setTypes(java.lang.String... types)
Sets the object types criterion.

Parameters:
types - the allowed object types
See Also:
getTypes()

getSchemaName

public final java.lang.String getSchemaName()
Gets the schema name criterion. Any SchemaObject must have an owning schema whose name matches this criteria. Non-SchemaObjects that are included (by type) will not be required to match this criterion. When listing SchemaObjects the schema name criterion is mandatory.

Returns:
the name of the schema that all SchemaObjects must be in

setSchemaName

public final void setSchemaName(java.lang.String name)
Sets the schema name criterion.

Parameters:
name - the schema name for SchemaObjects to match
See Also:
getSchemaName()

setSchema

public final void setSchema(Schema schema)
Sets the schema name criterion using a Schema object.

Parameters:
schema - the schema for SchemaObjects to match
See Also:
getSchemaName()

isAllowedSchema

public final boolean isAllowedSchema(Schema schema)
Tests whether the given schema matches the "schema name" criterion.

Parameters:
schema - the schema to test
Returns:
true if the schema's name matches the "schema name" criterion.

isAllowedSchemaName

public final boolean isAllowedSchemaName(java.lang.String schemaName)
Tests whether the given schema name matches the "schema name" criterion.

Parameters:
schemaName - the schema name to test
Returns:
true if the schema's name matches the "schema name" criterion.

isUserOnly

public final boolean isUserOnly()
Gets the value of the "user only" criterion. The meaning of this varies, for example for an online database this is used to list schemas that contain objects visible to the user.

Returns:
whether to restrict the user only criterion.

setUserOnly

public final void setUserOnly(boolean userOnly)
Sets the "user only" criterion.

Parameters:
userOnly - if true, the "user only" criterion will be enforced

accept

public boolean accept(T obj)
Tests the given object to see if it matches all of the criteria and returns true if it does.

Specified by:
accept in interface DBObjectFilter<T extends SystemObject>
Parameters:
obj - the object to test
Returns:
true if the object matches all of the criteria

addFilter

public final void addFilter(DBObjectFilter<T> filter)
Adds an extra filter to this object as an auxillary criterion.

Parameters:
filter - a new filter to check when accept is called.

hasExtraCriteria

public final boolean hasExtraCriteria()
Returns true if this criteria has had at least one extra criterion added via the addFilter method.

Returns:
if the base criteria are not all that is being used to match

createCriteria

public static DBObjectCriteria<SystemObject> createCriteria()
Creates a new, blank criteria that isn't tied to a specific SystemObject subclass.


createCriteria

public static DBObjectCriteria<SystemObject> createCriteria(java.lang.String type,
                                                            Schema schema,
                                                            java.lang.String nameLike)
Creates a new, blank criteria that isn't tied to a specific SystemObject subclass.

Parameters:
type - restrict objects by this type
schema - restrict objects by this schema
nameLike - restrict object by names LIKE this string
Returns:
a criteria object with the given restrictions

createCriteria

public static DBObjectCriteria<SystemObject> createCriteria(java.lang.String type,
                                                            java.lang.String schemaName,
                                                            java.lang.String nameLike)
Creates a new, blank criteria that isn't tied to a specific SystemObject subclass.

Parameters:
type - restrict objects by this type
schemaName - restrict objects by this schema
nameLike - restrict object by names LIKE this string
Returns:
a criteria object with the given restrictions

createCriteria

public static DBObjectCriteria<SystemObject> createCriteria(java.lang.String[] types,
                                                            Schema schema,
                                                            java.lang.String nameLike)
Creates a new, blank criteria that isn't tied to a specific SystemObject subclass.

Parameters:
types - restrict objects by these types
schema - restrict objects by this schema
nameLike - restrict object by names LIKE this string
Returns:
a criteria object with the given restrictions

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

Copyright © 1997, 2009, Oracle. All rights reserved.