Compoze Software, Inc.

com.compoze.collab
Class Restriction


java.lang.Object

  |

  +--com.compoze.collab.Restriction

All Implemented Interfaces:
java.io.Serializable

public abstract class Restriction
extends java.lang.Object
implements java.io.Serializable

Restricts the items returned from a query. Restrictions are built up into a hierarchy of conditions that are turned into an appropriate query or API call by the provider.

See Also:
IContainer.getItemCount(Restriction), Serialized Form

Field Summary
static int EQUAL
          Represents a ValueRestriction 'equal to' comparison.
static int GREATER
          Represents a ValueRestriction 'greater than' comparison.
static int GREATER_EQUAL
          Represents a ValueRestriction 'greater than or equal to' comparison.
static int LESS
          Represents a ValueRestriction 'less than' comparison.
static int LESS_EQUAL
          Represents a ValueRestriction 'less than or equal to' comparison.
static int NOT_EQUAL
          Represents a ValueRestriction 'not equal' comparison.
static int TYPE_AND
          Indicates the restriction is a Logical AND restriction.
static int TYPE_BINARY
          Indicates the restriction is a binary restriction.
static int TYPE_COMPARE
          Indicates the restriction is a Compare restriction.
static int TYPE_CONTENT
          Indicates the restriction is a Content restriction.
static int TYPE_EXISTS
          Indicates the restriction is an Exists restriction.
static int TYPE_NOT
          Indicates the restriction is a NOT restriction.
static int TYPE_OR
          Indicates the restriction is a Logical OR restriction.
static int TYPE_SIZE
          Indicates the restriction is a Size restriction.
static int TYPE_VALUE
          Indicates the restriction is a Value restriction.
static int WHERE_FULLSTRING
          Indicates the ContentRestriction should match the full string.
static int WHERE_PREFIX
          Indicates the ContentRestriction should match the prefix ('string starts with').
static int WHERE_SUBSTRING
          Indicates the ContentRestriction should match any part of the string.
 
Constructor Summary
Restriction()
           
 
Method Summary
static Restriction createAndRestriction(Restriction[] subRestrictions)
          Create an AndRestriction ANDing two or more Restrictions.
static Restriction createAndRestriction(Restriction restriction1, Restriction restriction2)
          Create an AndRestriction ANDing exactly two Restrictions.
static Restriction createBinaryRestriction(Key key, int iRelation, byte[] yBinary)
          Creates a binary restriction.
static Restriction createCompareRestriction(Key key1, int iRelation, Key key2)
          Constructs a Restriction comparing two properties of the same type.
static Restriction createContentRestriction(Key key, java.lang.String sValue, int iWhereType, boolean bIgnoreCase)
          Create a ContentRestriction on a property.
static Restriction createExistsRestriction(Key key)
          Create a Restriction testing whether a property exists.
static Restriction createNotRestriction(Restriction subRestriction)
          Create a NotRestriction inverting the sense of a Restriction
static Restriction createOrRestriction(Restriction[] subRestrictions)
          Create an OrRestriction ORing two or more Restrictions.
static Restriction createOrRestriction(Restriction restriction1, Restriction restriction2)
          Create an OrRestriction ORing exactly two Restrictions.
static Restriction createSizeRestriction(Key key, int iRelation, int iValue)
          Create a SizeRestriction on a property.
static Restriction createValueRestriction(Key key, int iRelation, int iValue)
          Create a ValueRestriction on a property with an int.
static Restriction createValueRestriction(Key key, int iRelation, java.lang.Object value)
          Create a ValueRestriction on a property.
abstract  int getType()
          Gets the type of the restriction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_AND


public static final int TYPE_AND
Indicates the restriction is a Logical AND restriction.

TYPE_OR


public static final int TYPE_OR
Indicates the restriction is a Logical OR restriction.

TYPE_NOT


public static final int TYPE_NOT
Indicates the restriction is a NOT restriction.

TYPE_CONTENT


public static final int TYPE_CONTENT
Indicates the restriction is a Content restriction.

TYPE_VALUE


public static final int TYPE_VALUE
Indicates the restriction is a Value restriction.

TYPE_COMPARE


public static final int TYPE_COMPARE
Indicates the restriction is a Compare restriction.

TYPE_EXISTS


public static final int TYPE_EXISTS
Indicates the restriction is an Exists restriction.

TYPE_SIZE


public static final int TYPE_SIZE
Indicates the restriction is a Size restriction.

TYPE_BINARY


public static final int TYPE_BINARY
Indicates the restriction is a binary restriction.

WHERE_FULLSTRING


public static final int WHERE_FULLSTRING
Indicates the ContentRestriction should match the full string.

WHERE_PREFIX


public static final int WHERE_PREFIX
Indicates the ContentRestriction should match the prefix ('string starts with').

WHERE_SUBSTRING


public static final int WHERE_SUBSTRING
Indicates the ContentRestriction should match any part of the string.

LESS


public static final int LESS
Represents a ValueRestriction 'less than' comparison.

LESS_EQUAL


public static final int LESS_EQUAL
Represents a ValueRestriction 'less than or equal to' comparison.

EQUAL


public static final int EQUAL
Represents a ValueRestriction 'equal to' comparison.

NOT_EQUAL


public static final int NOT_EQUAL
Represents a ValueRestriction 'not equal' comparison.

GREATER_EQUAL


public static final int GREATER_EQUAL
Represents a ValueRestriction 'greater than or equal to' comparison.

GREATER


public static final int GREATER
Represents a ValueRestriction 'greater than' comparison.
Constructor Detail

Restriction


public Restriction()
Method Detail

getType


public abstract int getType()
Gets the type of the restriction.
Returns:
the type (one of the TYPE_ constants in this class)

createValueRestriction


public static Restriction createValueRestriction(Key key,
                                                 int iRelation,
                                                 java.lang.Object value)
                                          throws CollaborationException
Create a ValueRestriction on a property.
Parameters:
key - key that identifies the property
iRelation - LESS, LESS_EQUAL, EQUAL, NOT_EQUAL, GREATER_EQUAL, GREATER,
value - constant to compare against; must be compatible with key's type
Returns:
a Restriction on the value (not null)
Throws:
CollaborationException - if value is not compatible with the type of key

createValueRestriction


public static Restriction createValueRestriction(Key key,
                                                 int iRelation,
                                                 int iValue)
                                          throws CollaborationException
Create a ValueRestriction on a property with an int.
Parameters:
key - key that identifies the property
iRelation - LESS, LESS_EQUAL, EQUAL, NOT_EQUAL, GREATER_EQUAL, GREATER,
iValue - int to compare against; must be compatible with key's type
Returns:
a Restriction on the int value (not null)
Throws:
CollaborationException - if int is not compatible with the type of key

createAndRestriction


public static Restriction createAndRestriction(Restriction[] subRestrictions)
Create an AndRestriction ANDing two or more Restrictions.
Parameters:
subRestrictions - the Restrictions to AND together
Returns:
the ANDing Restriction (not null)

createAndRestriction


public static Restriction createAndRestriction(Restriction restriction1,
                                               Restriction restriction2)
Create an AndRestriction ANDing exactly two Restrictions.
Parameters:
restriction1 - the first Restriction
restriction2 - the second Restriction
Returns:
the ANDing Restriction (not null)

createOrRestriction


public static Restriction createOrRestriction(Restriction[] subRestrictions)
Create an OrRestriction ORing two or more Restrictions.
Parameters:
subRestrictions - the Restrictions to OR together
Returns:
the ORing Restriction (not null)

createOrRestriction


public static Restriction createOrRestriction(Restriction restriction1,
                                              Restriction restriction2)
Create an OrRestriction ORing exactly two Restrictions.
Parameters:
restriction1 - the first Restriction
restriction2 - the second Restriction
Returns:
the ORing Restriction (not null)

createContentRestriction


public static Restriction createContentRestriction(Key key,
                                                   java.lang.String sValue,
                                                   int iWhereType,
                                                   boolean bIgnoreCase)
Create a ContentRestriction on a property.
Parameters:
key - the key to filter on
sValue - the value to filter
iWhereType - the WHERE_ constant to defined how a match is made; this parameter may be ignored if an invalid property is specified.
bIgnoreCase - whether the restriction should ignore case
Returns:
the content restriction (not null)
Throws:
InvalidArgumentException - if key does not have VALUE_STRING

createCompareRestriction


public static Restriction createCompareRestriction(Key key1,
                                                   int iRelation,
                                                   Key key2)
Constructs a Restriction comparing two properties of the same type.
Parameters:
key1 - key that identifies the first property
iRelation - LESS, LESS_EQUAL, EQUAL, NOT_EQUAL, GREATER_EQUAL, GREATER
key2 - key that identifies the second property
Returns:
the compare restriction (not null)
Throws:
InvalidArgumentException - if key1 and key2 are not the same type

createExistsRestriction


public static Restriction createExistsRestriction(Key key)
Create a Restriction testing whether a property exists.
Parameters:
key - key that identifies the property
Returns:
the exists restriction (not null)

createSizeRestriction


public static Restriction createSizeRestriction(Key key,
                                                int iRelation,
                                                int iValue)
Create a SizeRestriction on a property.
Parameters:
key - key that identifies the property
iRelation - LESS, LESS_EQUAL, EQUAL, NOT_EQUAL, GREATER_EQUAL, GREATER,
iValue - int size to compare against
Returns:
a Restriction on the value size (not null)

createNotRestriction


public static Restriction createNotRestriction(Restriction subRestriction)
Create a NotRestriction inverting the sense of a Restriction
Parameters:
subRestriction - the Restriction to NOT
Returns:
the not restriction (not null)

createBinaryRestriction


public static Restriction createBinaryRestriction(Key key,
                                                  int iRelation,
                                                  byte[] yBinary)
Creates a binary restriction.
Parameters:
key - the key to use for the restriction.
iRelation - the type of relation for this binary restriction. (EQUAL, NOT_EQUAL).
yBinary - the binary value
Returns:
the binary restriction (not null)

Compoze Software, Inc.

Copyright ©1999-2003 Compoze Software, Inc. All rights reserved.