wt.notify
Class AttributeValueSelector

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

public class AttributeValueSelector
extends Selector
implements Externalizable

AttributeValueSelector adds to Selector the ability to specify attribute names and their values to select an object. There is a limit on the number of pairs that can be specified. This limit depends on the length of the names and values, as they are represented internally by a WTStringMap object, that is limited to the maximum allowed in a database column.

Use the newAttributeValueSelector static factory method(s), not the AttributeValueSelector 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
protected static String ATTR_VALUE_MAP
          Label for the attribute.
private static int ATTR_VALUE_MAP_UPPER_LIMIT
           
private  WTStringMap attrValueMap
           
private static String CLASSNAME
           
static long EXTERNALIZATION_VERSION_UID
           
protected static long OLD_FORMAT_VERSION_UID
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
private static boolean VERBOSE_EXECUTION
           
 
Fields inherited from class wt.admin.Selector
ALL_EVENTS, ALL_STATES, EVENT_KEY, OWNER_REF, PRE_R6_VERSION_UID, SELECTOR_NAME, STATE_NAME, TOP_CLASS, TYPE_ID
 
Constructor Summary
AttributeValueSelector()
           
 
Method Summary
private  void attrValueMapValidate(WTStringMap a_AttrValueMap)
           
 boolean checkAttributeValues(Object object)
          Determines whether the object passed as argument matches the subscription, as far as attribute values are concerned.
 Selector copy()
          Returns a copy of the selector.
 boolean equals(Object obj)
          Returns true if the object passed as argument is a equal, false otherwise.
private  String eventToString(String event)
           
 Enumeration getAttributeNames()
          Returns an enumeration containing all attribute names.
 String getAttributeValue(String name)
          Returns the attribute value for the named attribute.
protected  WTStringMap getAttrValueMap()
          Gets the value of the attribute: ATTR_VALUE_MAP.
 String getConceptualClassname()
          Deprecated.  
 boolean hasAttributes()
          Returns 'true' if there are attribute-value pairs defined; 'false' otherwise.
 int hashCode()
          Returns the hash code for the selector.
protected  void initialize(Selector sel)
          Supports initialization, following construction of an instance.
 boolean isMoreGeneral(Selector sel)
          Returns whether a selector is "more general" than another.
static AttributeValueSelector newAttributeValueSelector()
          No-arg constructor.
static AttributeValueSelector newAttributeValueSelector(Selector sel)
          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(AttributeValueSelector thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
 void removeAttribute(String name)
          Removes attribute given its name.
 void setAttributeValue(String name, String value)
          Sets an attribute value for the named attribute.
protected  void setAttrValueMap(WTStringMap a_AttrValueMap)
          Sets the value of the attribute: ATTR_VALUE_MAP.
 String toString()
          Produces a String representation of the object.
private  String typeToString(String type_id)
           
 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 wt.admin.Selector
getChildren, getClassInfo, getEventKey, getLocalizedEventKey, getOwnerRef, getParents, getQuerySpec, getStateName, getTypeId, initialize, initialize, isGoodForList, isGoodForRule, newSelector, newSelector, newSelector, readVersion, setEventKey, setLocalizedEventKey, setOwnerRef, setStateName, setTypeId
 
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

ATTR_VALUE_MAP

protected static final String ATTR_VALUE_MAP
Label for the attribute.

Supported API: false

See Also:
Constant Field Values

ATTR_VALUE_MAP_UPPER_LIMIT

private static int ATTR_VALUE_MAP_UPPER_LIMIT

attrValueMap

private WTStringMap attrValueMap

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

VERBOSE_EXECUTION

private static boolean VERBOSE_EXECUTION
Constructor Detail

AttributeValueSelector

public AttributeValueSelector()
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
Overrides:
writeExternal in class Selector
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
Overrides:
readExternal in class Selector
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(AttributeValueSelector 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
Overrides:
writeExternal in class Selector
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
Overrides:
readExternal in class Selector
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
Overrides:
getConceptualClassname in class Selector
Returns:
String

getAttrValueMap

protected WTStringMap getAttrValueMap()
Gets the value of the attribute: ATTR_VALUE_MAP.

Supported API: false

Returns:
WTStringMap

setAttrValueMap

protected void setAttrValueMap(WTStringMap a_AttrValueMap)
                        throws WTPropertyVetoException
Sets the value of the attribute: ATTR_VALUE_MAP.

Supported API: false

Parameters:
a_AttrValueMap -
Throws:
WTPropertyVetoException

attrValueMapValidate

private void attrValueMapValidate(WTStringMap a_AttrValueMap)
                           throws WTPropertyVetoException
Parameters:
a_AttrValueMap -
Throws:
WTPropertyVetoException

newAttributeValueSelector

public static AttributeValueSelector newAttributeValueSelector()
                                                        throws WTException
No-arg constructor.

Supported API: false

Returns:
AttributeValueSelector
Throws:
WTException

newAttributeValueSelector

public static AttributeValueSelector newAttributeValueSelector(Selector sel)
                                                        throws WTException
Copy constructor.

Supported API: false

Parameters:
sel -
Returns:
AttributeValueSelector
Throws:
WTException

initialize

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

Supported API: false

Overrides:
initialize in class Selector
Parameters:
sel -
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, class, state and event and the attribute-value pairs.

Supported API: false

Overrides:
equals in class Selector
Parameters:
obj -
Returns:
boolean

hashCode

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

Supported API: false

Overrides:
hashCode in class Selector
Returns:
int

copy

public Selector copy()
              throws WTException
Returns a copy of the selector.

Supported API: false

Returns:
Selector
Throws:
WTException

getAttributeValue

public String getAttributeValue(String name)
Returns the attribute value for the named attribute.

Supported API: false

Parameters:
name -
Returns:
String

setAttributeValue

public void setAttributeValue(String name,
                              String value)
Sets an attribute value for the named attribute. If a value was previously set for the named attribute, the old value is replaced.

Supported API: false

Parameters:
name -
value -

removeAttribute

public void removeAttribute(String name)
Removes attribute given its name. Nothing happens if attribute doesn't belong to selector.

Supported API: false

Parameters:
name -

getAttributeNames

public Enumeration getAttributeNames()
Returns an enumeration containing all attribute names.

Supported API: false

Returns:
Enumeration

hasAttributes

public boolean hasAttributes()
Returns 'true' if there are attribute-value pairs defined; 'false' otherwise.

Supported API: false

Returns:
boolean

toString

public String toString()
Produces a String representation of the object.

Supported API: false

Overrides:
toString in class Selector
Returns:
String

checkAttributeValues

public boolean checkAttributeValues(Object object)
                             throws WTException
Determines whether the object passed as argument matches the subscription, as far as attribute values are concerned. Returns 'true' if the values of the attribute objects are the same as the values of the attributes in the subscription, for every attribute in the selector; returns 'false' otherwise.

Supported API: false

Parameters:
object -
Returns:
boolean
Throws:
WTException

isMoreGeneral

public boolean isMoreGeneral(Selector sel)
Description copied from class: Selector
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

Overrides:
isMoreGeneral in class Selector
Parameters:
sel -
Returns:
boolean

typeToString

private String typeToString(String type_id)

eventToString

private String eventToString(String event)