wt.admin
Class Selector

java.lang.Object
  extended bywt.admin.Selector
All Implemented Interfaces:
Evolvable, Externalizable, NetFactor, ObjectMappable, Serializable
Direct Known Subclasses:
AttributeValueSelector

public class Selector
extends Object
implements Serializable, ObjectMappable, Evolvable

The Selector class represents the antecedents of indexing and notification policy rules. Selector objects are also used as locators of indexing and notification lists. A selector object contains information about the domain, type, state and event to which the rule or list refers. Selector objects can also be used to formulate queries for both rules and lists.

Use the newSelector static factory method(s), not the Selector constructor, to construct instances of this class. Instances must be constructed using the static factory(s), in order to ensure proper initialization of the instance.



Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
static String ALL_EVENTS
          Constant representing all events.
static String ALL_STATES
          Constant representing all states.
private static String CLASSNAME
           
static String EVENT_KEY
          Label for the attribute; Name of the event.
private static int EVENT_KEY_UPPER_LIMIT
           
private  String eventKey
           
static long EXTERNALIZATION_VERSION_UID
           
protected static long OLD_FORMAT_VERSION_UID
           
static String OWNER_REF
          Label for the attribute; Reference to an administrative domain.
private  ObjectReference ownerRef
           
protected static long PRE_R6_VERSION_UID
           
private static String RESOURCE
           
static String SELECTOR_NAME
          Constant representing the name of the selector attribute when it is used in another class (for example, an index policy rule).
(package private) static long serialVersionUID
           
static String STATE_NAME
          Label for the attribute; State name (can be Selector.ALL_STATES).
private static int STATE_NAME_UPPER_LIMIT
           
private  String stateName
           
static String TOP_CLASS
          Persistence type identifier of the top class in the business class hierarchy.
static String TYPE_ID
          Label for the attribute; Persistence type identifier of the type the selector refers to.
private static int TYPE_ID_UPPER_LIMIT
           
private  String typeId
           
 
Constructor Summary
Selector()
           
 
Method Summary
 boolean equals(Object obj)
          Returns true if the object passed as argument is a equal, false otherwise.
 Enumeration getChildren(Vector sels)
          Returns all selectors contained in the vector passed as argument that are less general than the current one.
 ClassInfo getClassInfo()
          Returns the ClassInfo object for this class.
 String getConceptualClassname()
          Deprecated.  
 String getEventKey()
          Gets the value of the attribute: EVENT_KEY.
 String getLocalizedEventKey()
          Returns the localized name of the event key.
 ObjectReference getOwnerRef()
          Gets the value of the attribute: OWNER_REF.
 Enumeration getParents(Vector sels)
          Returns all selectors contained in the vector passed as argument that are more general than the current one.
 QuerySpec getQuerySpec(Class target_class)
          Returns the query spec embodied by the selector for the persistence type identifier passed as parameter.
 String getStateName()
          Gets the value of the attribute: STATE_NAME.
 String getTypeId()
          Gets the value of the attribute: TYPE_ID.
 int hashCode()
          Returns the hash code for the selector.
protected  void initialize()
          Supports initialization, following construction of an instance.
protected  void initialize(ObjectReference domain_ref)
          Supports initialization, following construction of an instance.
protected  void initialize(Selector selector)
          Supports initialization, following construction of an instance.
 boolean isGoodForList()
          Returns whether the selector should be used for policy lists.
 boolean isGoodForRule()
          Returns whether the selector should be used for policy rules.
private  boolean isInstanceOf(String class1, String class2)
           
 boolean isMoreGeneral(Selector sel)
          Returns whether a selector is "more general" than another.
static Selector newSelector()
          No argument constructor.
static Selector newSelector(ObjectReference domain_ref)
          Constructor that takes a domain reference argument.
static Selector newSelector(Selector selector)
          Copy constructor.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
 void readExternal(PersistentRetrieveIfc input)
          Used by Persistent Data Service to populate the persistent attributes of this class from a persistent store.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(Selector thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 void setEventKey(String a_EventKey)
          Sets the value of the attribute: EVENT_KEY.
 void setLocalizedEventKey(String event_name)
          Sets the event key of the selector using a localized name as argument.
 void setOwnerRef(ObjectReference a_OwnerRef)
          Sets the value of the attribute: OWNER_REF.
 void setStateName(String a_StateName)
          Sets the value of the attribute: STATE_NAME.
 void setTypeId(String a_TypeId)
          Sets the value of the attribute: TYPE_ID.
 String toString()
          Returns the conceptual (modeled) name for the class.
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 void writeExternal(PersistentStoreIfc output)
          Used by Persistent Data Service to obtain the values of the persistent attributes of this class, so they can be written to a persistent store.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

OWNER_REF

public static final String OWNER_REF
Label for the attribute; Reference to an administrative domain.

Supported API: false

See Also:
Constant Field Values

ownerRef

private ObjectReference ownerRef

TYPE_ID

public static final String TYPE_ID
Label for the attribute; Persistence type identifier of the type the selector refers to.

Supported API: false

See Also:
Constant Field Values

TYPE_ID_UPPER_LIMIT

private static int TYPE_ID_UPPER_LIMIT

typeId

private String typeId

STATE_NAME

public static final String STATE_NAME
Label for the attribute; State name (can be Selector.ALL_STATES).

Supported API: false

See Also:
Constant Field Values

STATE_NAME_UPPER_LIMIT

private static int STATE_NAME_UPPER_LIMIT

stateName

private String stateName

EVENT_KEY

public static final String EVENT_KEY
Label for the attribute; Name of the event.

Supported API: false

See Also:
Constant Field Values

EVENT_KEY_UPPER_LIMIT

private static int EVENT_KEY_UPPER_LIMIT

eventKey

private String eventKey

ALL_STATES

public static final String ALL_STATES
Constant representing all states.

Supported API: false

See Also:
Constant Field Values

ALL_EVENTS

public static final String ALL_EVENTS
Constant representing all events.

Supported API: false

See Also:
Constant Field Values

TOP_CLASS

public static final String TOP_CLASS
Persistence type identifier of the top class in the business class hierarchy.

Supported API: false


SELECTOR_NAME

public static final String SELECTOR_NAME
Constant representing the name of the selector attribute when it is used in another class (for example, an index policy rule).

Supported API: false

See Also:
Constant Field Values

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

PRE_R6_VERSION_UID

protected static final long PRE_R6_VERSION_UID
See Also:
Constant Field Values
Constructor Detail

Selector

public Selector()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(Selector thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

writeExternal

public void writeExternal(PersistentStoreIfc output)
                   throws SQLException,
                          DatastoreException
Used by Persistent Data Service to obtain the values of the persistent attributes of this class, so they can be written to a persistent store.

(Not intended for general use.)

Supported API: false

Specified by:
writeExternal in interface ObjectMappable
Parameters:
output -
Throws:
SQLException
DatastoreException

readExternal

public void readExternal(PersistentRetrieveIfc input)
                  throws SQLException,
                         DatastoreException
Used by Persistent Data Service to populate the persistent attributes of this class from a persistent store.

(Not intended for general use.)

Supported API: false

Specified by:
readExternal in interface ObjectMappable
Parameters:
input -
Throws:
SQLException
DatastoreException

getConceptualClassname

public String getConceptualClassname()
Deprecated.  

Returns the conceptual (modeled) name for the class.

Supported API: false

Specified by:
getConceptualClassname in interface NetFactor
Returns:
String

toString

public String toString()
Returns the conceptual (modeled) name for the class.

Supported API: false

Returns:
String

getClassInfo

public ClassInfo getClassInfo()
                       throws WTIntrospectionException
Returns the ClassInfo object for this class.

Supported API: false

Specified by:
getClassInfo in interface NetFactor
Returns:
ClassInfo
Throws:
WTIntrospectionException

getOwnerRef

public ObjectReference getOwnerRef()
Gets the value of the attribute: OWNER_REF. Reference to an administrative domain.

Supported API: false

Returns:
ObjectReference

setOwnerRef

public void setOwnerRef(ObjectReference a_OwnerRef)
Sets the value of the attribute: OWNER_REF. Reference to an administrative domain.

Supported API: false

Parameters:
a_OwnerRef -

getTypeId

public String getTypeId()
Gets the value of the attribute: TYPE_ID. Persistence type identifier of the type the selector refers to.

Supported API: false

Returns:
String

setTypeId

public void setTypeId(String a_TypeId)
Sets the value of the attribute: TYPE_ID. Persistence type identifier of the type the selector refers to.

Supported API: false

Parameters:
a_TypeId -

getStateName

public String getStateName()
Gets the value of the attribute: STATE_NAME. State name (can be Selector.ALL_STATES).

Supported API: false

Returns:
String

setStateName

public void setStateName(String a_StateName)
Sets the value of the attribute: STATE_NAME. State name (can be Selector.ALL_STATES).

Supported API: false

Parameters:
a_StateName -

getEventKey

public String getEventKey()
Gets the value of the attribute: EVENT_KEY. Name of the event.

Supported API: false

Returns:
String

setEventKey

public void setEventKey(String a_EventKey)
Sets the value of the attribute: EVENT_KEY. Name of the event.

Supported API: false

Parameters:
a_EventKey -

newSelector

public static Selector newSelector()
                            throws WTException
No argument constructor. Used mainly to formulate queries. After the selector is constructed, the domain reference is null, the persistence type identifier is set to Selector.TOP_CLASS, the state to Selector.ALL_STATES, and the event to Selector.ALL_EVENTS.

Supported API: false

Returns:
Selector
Throws:
WTException

initialize

protected void initialize()
                   throws WTException
Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

Supported API: false

Throws:
WTException

newSelector

public static Selector newSelector(ObjectReference domain_ref)
                            throws WTException
Constructor that takes a domain reference argument. After the selector is constructed, the domain reference is set to the specified value, and the remaining attributes are set to null.

Supported API: false

Parameters:
domain_ref -
Returns:
Selector
Throws:
WTException

initialize

protected void initialize(ObjectReference domain_ref)
                   throws WTException
Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

Supported API: false

Parameters:
domain_ref -
Throws:
WTException

newSelector

public static Selector newSelector(Selector selector)
                            throws WTException
Copy constructor.

Supported API: false

Parameters:
selector -
Returns:
Selector
Throws:
WTException

initialize

protected void initialize(Selector selector)
                   throws WTException
Supports initialization, following construction of an instance. Invoked by "new" factory having the same signature.

Supported API: false

Parameters:
selector -
Throws:
WTException

equals

public boolean equals(Object obj)
Returns true if the object passed as argument is a equal, false otherwise. Equality is determined by examining the domain, type, state and event.

Supported API: false

Parameters:
obj -
Returns:
boolean

hashCode

public int hashCode()
Returns the hash code for the selector.

Supported API: false

Returns:
int

getQuerySpec

public QuerySpec getQuerySpec(Class target_class)
                       throws WTException
Returns the query spec embodied by the selector for the persistence type identifier passed as parameter. For example, the following code excerpt can be used to query for rules that apply to documents in the default domain that are in the "RELEASED" state after the event "PROMOTE".
    ...
    Selector sel = Selector.newSelector ();
    sel.setDomainRef (defaultDomainRef);
    sel.setTypeId ("wt.doc.Document");
    sel.setStateName ("RELEASED");
    sel.setEventKey ("PROMOTE");
    QuerySpec qs = sel.getQuerySpec (IndexPolicyRule.class);
    ...
 
To query over all domains (or all states, events and types) simply set the respective attribute to "null".

Supported API: false

Parameters:
target_class -
Returns:
QuerySpec
Throws:
WTException

isMoreGeneral

public boolean isMoreGeneral(Selector sel)
Returns whether a selector is "more general" than another. If a rule applies to an object, all rules with more general selectors apply as well.

A selector is more general than if the following happens:

typeId1 is more general than typeId2 if they are the same or typeId2 is derived from typeId1; state1 is more general than state2 if they are the same or state1 is Selector.ALL_STATES; finally, event1 is more general than event2 if they are the same or event1 is Selector.ALL_EVENTS.

Note that this relationship is transitive and reflexive but not symmetric.

Supported API: false

Parameters:
sel -
Returns:
boolean

isGoodForList

public boolean isGoodForList()
Returns whether the selector should be used for policy lists. It can be used to discriminate lists if it has no null fields.

A Selector with null fields can only be used in queries.

Supported API: false

Returns:
boolean

isGoodForRule

public boolean isGoodForRule()
Returns whether the selector should be used for policy rules. It can be used to discriminate rules if it has no null fields.

A Selector with null fields can only be used in queries.

Supported API: false

Returns:
boolean

getChildren

public Enumeration getChildren(Vector sels)
Returns all selectors contained in the vector passed as argument that are less general than the current one.

Supported API: false

Parameters:
sels -
Returns:
Enumeration

getParents

public Enumeration getParents(Vector sels)
Returns all selectors contained in the vector passed as argument that are more general than the current one.

Supported API: false

Parameters:
sels -
Returns:
Enumeration

getLocalizedEventKey

public String getLocalizedEventKey()
Returns the localized name of the event key.

Supported API: false

Returns:
String

setLocalizedEventKey

public void setLocalizedEventKey(String event_name)
                          throws WTException
Sets the event key of the selector using a localized name as argument.

Supported API: false

Parameters:
event_name -
Throws:
WTException

isInstanceOf

private boolean isInstanceOf(String class1,
                             String class2)