com.waveset.object
Class PersistentObject

java.lang.Object
  extended by com.waveset.object.PersistentObject
All Implemented Interfaces:
com.waveset.object.AttributeBag, XmlObject, java.lang.Comparable, javax.naming.Referenceable
Direct Known Subclasses:
ObjectGroup, Principal, Service, TaskResult, WorkItem

public abstract class PersistentObject
extends java.lang.Object
implements XmlObject, java.lang.Comparable, javax.naming.Referenceable, com.waveset.object.AttributeBag

The base class of all objects that can be stored in the repository.

We define a number of common fields such as type, id and name. We also define behavior that all persistent objects share. Once such behavior is the interaction with an ObjectCache that provides automated resolution of references between objects.

Implements JNDI's Referenceable interface. This allows us to store a PersistentObject in any JNDI service provider.


Nested Class Summary
static class PersistentObject.Comparator
          Implement the Comparator interface to sort PersistentObject instances by type and name.
static class PersistentObject.InitialInstance
          An inner class describing an "initial instance" of a persistent object that is to be automatically added to a repository when it is created.
 
Field Summary
static java.lang.String code_id
           
static long INITIAL_OBJECT_VERSION
           
 
Constructor Summary
PersistentObject(com.sun.idm.object.IDMObjectClass objectClass)
          Base constructor for persistent objects.
 
Method Summary
 void addMemberObjectGroup(ObjectGroup og)
          Add a new object group, declaring this object as a member of that group.
 void addMemberObjectGroup(com.waveset.object.ObjectRef og)
          Add a new object group, declaring this object as a member of that group.
static void addXmlHeader(java.lang.StringBuffer b, java.lang.String element)
          Adds a standard XML header, DOCTYPE statement and element start tag.
 boolean attributesMatch(AttributeCondition[] attrConds)
          Return true if the attributes exposed by this object meet the supplied list of attribute conditions.
 boolean attributesMatch(com.waveset.object.LogicalExpression filter)
          Return true if the attributes exposed by this object satisfy the specified logical expression.
 boolean attributesMatch(WSAttributes extatts)
          Return true if the supplied list of attributes match attributes exposed by this object.
 void checkReference(com.waveset.object.ObjectRef ref)
          Checks a reference owned by an object to make sure that the referenced object is in the same cache as the referencing object.
 void checkReferences(java.util.List refs)
          Check a list of references.
 void clearId()
          Removes the ID from an object.
 PersistentObject cloneAs(java.lang.String newName)
          Clones an object, changing the name in the process.
 PersistentObject cloneObject()
          Clones an object.
 int compareTo(java.lang.Object o)
          Implement the Comparable interface so that lists of these will have a reasonable contains() implementation
static PersistentObject create(org.w3c.dom.Element element)
           
static PersistentObject create(java.lang.String xml)
          Build a persistent object from an XML string.
static PersistentObject create(java.lang.String xml, boolean validate)
          Build a persistent object from an XML string.
static PersistentObject create(com.waveset.object.Type type)
          Creates an empty object of the given type.
static PersistentObject.InitialInstance createLastModItem(PersistentObject obj)
          Build an InitialInstance for a special object used to hold the last modification time of all objects of a particular type.
static PersistentObject.InitialInstance createLastModItem(com.waveset.object.Type type)
           
static PersistentObject.InitialInstance[] createLastModItemList(PersistentObject obj)
          Build an InitialInstance array containing a single instance for the special "last mode time" marker.
 boolean directObjectGroupMember(ObjectGroup og)
          Test to see if this object is a direct member of the given object group.
 void dump()
          for consistency with XmlObjectFactory & AbstractXmlObject
 void dumpFile(java.lang.String file)
           
 boolean equals(java.lang.Object obj)
          Compares two objects for equality of identity.
 java.lang.String getAttribute(java.lang.String name)
          Return the value of an abstract attribute if the class supports it.
 WSAttribute getAttributeValues(com.sun.idm.object.IDMObjectClassAttribute attrDef)
           
 java.util.ArrayList getAuthReferences()
          Returns the list of all references in this object that are subject to CONNECT/DISCONNECT Right authorization checks.
 java.lang.String getAuthType()
          Return the authorization type of this object.
 javax.naming.directory.BasicAttributes getBasicAttributes()
           
static javax.naming.directory.BasicAttributes getBasicAttributes(PersistentObject po, java.lang.String[] attrIds)
           
 javax.naming.directory.BasicAttributes getBasicAttributes(java.lang.String[] attrIds)
           
 com.waveset.object.ObjectCache getCache()
          Gets the cache this object is referencing.
 long getCounterValue()
           
 java.util.Date getCreateDate()
           
 java.lang.String getCreator()
           
 java.lang.String getDisplayableName()
          Return the displayable name of this object.
 java.lang.String getDisplayName()
          Return the display name of this object.
 java.lang.String getElementName()
          Return the XML element name of this object.
 java.util.List getEncryptedValues()
           
 java.lang.String getId()
          Get the internally generated unique id for this object.
 java.lang.String getIdOrName()
          Get the id if one has been assigned, otherwise the name.
static PersistentObject.InitialInstance[] getInitialInstances()
          Returns the set of initial instances that should be created for this object type when a repository is created.
 long getLastMod()
          Return the modification count for this object at the time this object was last modified.
 java.util.Date getLastModDate()
          Return the date/time this object was created
 java.lang.String getLastModifier()
           
static java.lang.String getLastModItemId(com.waveset.object.Type type)
           
 com.waveset.object.LockInfo getLockInfo()
          Return information about any lock held on this object.
 java.util.List getMemberObjectGroupRefs()
          Return the list of references to object groups this object is a member of.
 java.util.List getMemberObjectGroupRefsUpTo(ObjectGroup og)
          Returns the list of references to object groups this object is a member of up the hierarchy to the specified object group (e.g.
 ObjectGroup[] getMemberObjectGroups()
          Get an array of resolved object groups to which this object is a member.
 java.lang.String getName()
          Return the name of this object.
 java.lang.String getNameOrId()
          Get the name if it has been assigned, otherwise the id.
 com.sun.idm.object.IDMObjectClass getPrimaryObjectClass()
           
 java.util.Properties getProperties()
           
 java.lang.Object getProperty(java.lang.String name)
           
 java.lang.String getPropertyAsString(java.lang.String name)
           
 com.waveset.object.PropertyList getPropertyList()
           
 WSAttributes getQueryableAttributes()
           
 javax.naming.Reference getReference()
           
 java.util.ArrayList getReferences()
          Returns the list of all references in this object.
 long getRepositoryMod()
          Returns the SQL timestamp time of the last update of the record in the repository.
 java.util.List getRuleDrivenMemberObjectGroupRefs()
          Return the list of references to object groups this object is a member of based on the evaluation of user members rules associated with the object groups controlled by the current subject.
 java.util.List getRuleDrivenMemberObjectGroupRefsUpTo(ObjectGroup og, ObjectGroup[] mogs)
          Returns the list of references to object groups this object is a member of up the hierarchy to the specified object group (e.g.
 ObjectGroup[] getRuleDrivenMemberObjectGroups()
          Get an array of resolved object groups to which this object is a member.
 java.lang.String getSubtype()
          Return the subtype of this object.
 WSAttributes getSummaryAttributes()
           
 java.lang.String getSummaryString()
          Get the summary string for this object.
abstract  com.waveset.object.Type getType()
          Return the type of this object.
 long getXMLSize()
           
static boolean hasEncryptedData()
           
 int hashCode()
          Implement the hashCode for efficient map insertion
 boolean identityEquals(PersistentObject pobj)
          Helper for the equals method, compares the identity of this object with another persistent object.
 boolean isAlias()
           
 boolean isHidden()
           
 boolean isProtected()
           
 boolean isProtectedFromDelete()
           
 boolean isReferencedIn(java.util.Collection coll)
          Returns true if an ObjectRef reference to this object is contained within the collection.
 void listOperationalAttributes(java.util.List attrs)
          Add to the specified list the "built-in" attributes that are queryable just because the IDM Repository needs them in order to operate.
 java.util.List listQueryableAttributes()
           
 java.util.List listQueryableReferenceAttributes()
           
 java.util.List listSummaryAttributes()
          Returns the complete list of defined attributes that this type of persistent object exposes as summary attributes (regardless of whether this particular object has a value for each).
 boolean objectGroupMember(ObjectGroup og)
          Test to see if this object is a member of the given object group.
 com.waveset.object.ObjectRef objectGroupMemberRef(ObjectGroup og)
          Test to see if this object is a member of the given object group.
 void prepareForSerialization()
          Prepare for serialization by doing anything that involves resolving references, leaving behind in the object anything that will be needed for toXml, getSummaryAttributes, getQueryableAttributes.
 void prepareToSerialize()
          Update the structure of the object prior to serialization.
 void reEncrypt()
           
 void removeMemberObjectGroup(ObjectGroup og)
          Remove an object group from this object.
 void removeProperty(java.lang.String name)
           
 int resolve(java.util.List refs)
          Resolve a list of references, filtering out elements that no longer resolve.
 boolean resolve(java.util.List refs, java.lang.Object[] array)
          Resolve a list of references, storing pointers to the resolved objects in an array as a side effect.
 PersistentObject resolve(com.waveset.object.ObjectRef ref)
          Resolve a single reference.
 java.lang.Object resolveArray(java.util.List refs, java.lang.Object[] array, java.lang.Class elClass)
          Resolve a list of references, creating a typed array of PersistentObject pointers.
 java.lang.Object resolveArrayByFetching(java.util.List refs, java.lang.Object[] array, java.lang.Class elClass)
          Now that users can also be administrators that can be approvers or be notified, together with the fact that users are a supressed type meaning they never get cached, we need a way to ensure that we alway resolve these list of refs by hitting the repo.
 void resolveObjectReferences(com.waveset.object.ObjectCache cache)
          Walk over an object looking for ObjectRefs without ids and resolve them.
 PersistentObject resolveReference(com.waveset.object.ObjectRef ref)
          DEPRECATED: like resolve above but throws an exception if it can't find it, try to weed these out.
static void resolveSummaryAttributes(com.waveset.object.ObjectCache cache, WSAttributes attrs)
          Walk the summary attributes, translating the embedded IDs to names.
static void resolveSummaryAttributes(com.waveset.object.Type type, com.waveset.object.ObjectCache cache, WSAttributes attrs)
          Map the type to an implementation class, then call its resolveSummaryAttributes method.
 com.waveset.object.ObjectRef ruleDrivenObjectGroupMemberRef(ObjectGroup og, java.util.List memberObjectGroupRefs)
          Test to see if this object is a member of the given object group.
 void setAuthType(com.waveset.object.AuthType t)
          Set the authorization type of this object.
 void setAuthType(java.lang.String s)
          Set the authorization type of this object.
 void setCache(com.waveset.object.ObjectCache c)
          Sets the object cache.
 void setDisplayName(com.waveset.msgcat.Message m)
          Set the display name to an unresolved message.
 void setDisplayName(java.lang.String s)
          Replaces the value of the displayName attribute.
 void setHidden(boolean b)
           
 void setIsAlias(boolean isAlias)
           
 void setMemberObjectGroupRef(com.waveset.object.ObjectRef og)
          Set a single member object group ref
 void setMemberObjectGroupRefs(java.util.List refs)
          Set the list of references to object groups to which this object is a member (say that 10 times fast).
 void setMemberObjectGroups(ObjectGroup[] ogarray)
          Set the object groups to which this object is a member.
 void setName(java.lang.String s)
          Replaces the value of the name attribute.
 void setProperties(java.util.Properties p)
           
 void setProperty(java.lang.String name, java.lang.Object value)
           
 void setPropertyList(com.waveset.object.PropertyList p)
           
 void setRuleDrivenMembersCache(com.waveset.object.RuleDrivenMembersCache cache)
           
 void setSubtype(java.lang.String subtype)
          Set the subtype of this object (e.g., Messages.ACCOUNT_CORRELATION_RULE within Type.RULE).
 void setTrace(boolean b)
           
 java.lang.String toString()
           
 java.lang.String toXml()
          Serialize the object to an XML string.
 void toXml(java.lang.StringBuffer b)
          Serialize the object as XML into a string buffer.
 void toXml(java.lang.StringBuffer b, int indent)
          Serialize the object as XML with an optional indentation.
 void toXmlFile(java.lang.String file)
          Serialize the object to a file.
 void visit(com.waveset.object.Visitor v)
          All persistent objects support a visitor interface.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

code_id

public static final java.lang.String code_id
See Also:
Constant Field Values

INITIAL_OBJECT_VERSION

public static final long INITIAL_OBJECT_VERSION
See Also:
Constant Field Values
Constructor Detail

PersistentObject

public PersistentObject(com.sun.idm.object.IDMObjectClass objectClass)
Base constructor for persistent objects.

Set default ObjectGroup to "Top" for all Persistent Objects the one exception is for the ObjectGroup "Top" whose member object group will be set to null (see ObjectGroup constructor).

Parameters:
objectClass - for the persistent object.
Method Detail

addMemberObjectGroup

public void addMemberObjectGroup(ObjectGroup og)
                          throws com.waveset.util.WavesetException
Add a new object group, declaring this object as a member of that group. The group is specified as an object.

Throws:
com.waveset.util.WavesetException

addMemberObjectGroup

public void addMemberObjectGroup(com.waveset.object.ObjectRef og)
                          throws com.waveset.util.WavesetException
Add a new object group, declaring this object as a member of that group. The group is specified as an object reference.

Throws:
com.waveset.util.WavesetException

addXmlHeader

public static void addXmlHeader(java.lang.StringBuffer b,
                                java.lang.String element)
Adds a standard XML header, DOCTYPE statement and element start tag. This is typically called by the toXml method above prior to calling the toXml method of a subclass. Subclasses may also call it if they want to overload the generation of the header or DOCTYPE for some reason, though there should be no reason to do so.


attributesMatch

public final boolean attributesMatch(AttributeCondition[] attrConds)
Return true if the attributes exposed by this object meet the supplied list of attribute conditions.

The default implementation here calls getQueryableAttributes to obtain the object's attribute list. This can be overloaded if desired if for some reason you want to support matching, without exposing queryable attributes.

See Also:
AttributeCondition

attributesMatch

public final boolean attributesMatch(com.waveset.object.LogicalExpression filter)
Return true if the attributes exposed by this object satisfy the specified logical expression.

The default implementation here calls getQueryableAttributes to obtain the object's attribute list. This can be overloaded if desired if for some reason you want to support matching, without exposing queryable attributes.

See Also:
LogicalExpression

attributesMatch

public final boolean attributesMatch(WSAttributes extatts)
Return true if the supplied list of attributes match attributes exposed by this object.

The default implementation here calls getQueryableAttributes to obtain the object's attribute list. This can be overloaded if desired if for some reason you want to support matching, without exposing queryable attributes.

See Also:
WSAttributes

checkReference

public void checkReference(com.waveset.object.ObjectRef ref)
Checks a reference owned by an object to make sure that the referenced object is in the same cache as the referencing object. This was added to diagnose a cache wiring problem; we may want to turn this into an exception.


checkReferences

public void checkReferences(java.util.List refs)
Check a list of references.


clearId

public void clearId()
Removes the ID from an object.

Useful when creating an object that is derived from another, clone the object, then clear the ID.


cloneAs

public PersistentObject cloneAs(java.lang.String newName)
                         throws com.waveset.util.WavesetException
Clones an object, changing the name in the process.

This is a convenience method for a common set of operations when attempting to create a new object that is a derivative of another.

We'll clone the object, clear the old object ID, and assign a differeent name.

Returns:
an duplicate of this object with no ID and a new name

Throws:
com.waveset.util.WavesetException - if there were problems duplicating the object

cloneObject

public PersistentObject cloneObject()
                             throws com.waveset.util.WavesetException
Clones an object.

We don't overload the java.lang.Object.clone method because it can't throw any exceptions, and there is the potential for deserialization errors here (though I suppose we could throw an unchecked exceptions).

The clone is done using the XML serialization that all PersistentObjects must support. It would probably be more efficient to implement java.lang.Serializable, but that's another serialization format that would have to be debugged. Since we have to support XML transforms anyway, just use that.

Returns:
an exact duplicate of this object

Throws:
com.waveset.util.WavesetException - if there were problems duplicating the object

compareTo

public int compareTo(java.lang.Object o)
Implement the Comparable interface so that lists of these will have a reasonable contains() implementation

Specified by:
compareTo in interface java.lang.Comparable

create

public static PersistentObject create(org.w3c.dom.Element element)
                               throws com.waveset.util.WavesetException
Returns:
a persistent object constructed from a DOM Element.
Throws:
com.waveset.util.WavesetException

create

public static PersistentObject create(java.lang.String xml)
                               throws com.waveset.util.WavesetException
Build a persistent object from an XML string.

DTD Validation is not performed.

Throws:
com.waveset.util.WavesetException

create

public static PersistentObject create(java.lang.String xml,
                                      boolean validate)
                               throws com.waveset.util.WavesetException
Build a persistent object from an XML string.

Validation against the DTD can be controlled with the validate argument. Normally this is off for performance, but in some contexts you may want it on.

Throws:
com.waveset.util.WavesetException

create

public static PersistentObject create(com.waveset.object.Type type)
                               throws com.waveset.util.WavesetException
Creates an empty object of the given type.

This was added for the generic object editor GUI, which needs to create a default object for a type. The only types that can be instantiated here are the ones which have no-argument constructors and for which the class is known from the Type object.

Throws:
com.waveset.util.WavesetException

createLastModItem

public static PersistentObject.InitialInstance createLastModItem(PersistentObject obj)
Build an InitialInstance for a special object used to hold the last modification time of all objects of a particular type. Since these are all constructed in the same way, any PersistentObject subclass may use this helper method to build an initial instance.


createLastModItem

public static PersistentObject.InitialInstance createLastModItem(com.waveset.object.Type type)

createLastModItemList

public static PersistentObject.InitialInstance[] createLastModItemList(PersistentObject obj)
Build an InitialInstance array containing a single instance for the special "last mode time" marker.

A helper method that may be used by persistent object classes that want to have their mod times tracked, but have no other initial instances.


directObjectGroupMember

public boolean directObjectGroupMember(ObjectGroup og)
                                throws com.waveset.util.WavesetException
Test to see if this object is a direct member of the given object group.

Throws:
com.waveset.util.WavesetException

dump

public void dump()
for consistency with XmlObjectFactory & AbstractXmlObject


dumpFile

public void dumpFile(java.lang.String file)

equals

public boolean equals(java.lang.Object obj)
Compares two objects for equality of identity.

This method overrides the java.lang.Object equals method. It determines equality based on whether the two identities of the current object and the object argument are equal, where equal is defined as:

  1. The object argument is either an instance of a PersistentObject or an ObjectRef
  2. The types must match
  3. If both ids are not null, they must be the same
  4. If either or both ids are null, then the names must be the same

Note that this will makes it impossible to use the equals() method to do content comparison of two object copies. I'm not sure I really like this, its an unusual way to have equals() behave, but it is convenient for searching collections for references.

Overrides:
equals in class java.lang.Object
Parameters:
obj - - a PersistentObject or an ObjectRef

getAttribute

public java.lang.String getAttribute(java.lang.String name)
                              throws com.waveset.util.WavesetException
Return the value of an abstract attribute if the class supports it.

Abstract attributes are not currently used, this interface was originally developed to support a concept that evolved into queryable attributes and summary attributes.

Throws:
com.waveset.util.WavesetException

getAttributeValues

public final WSAttribute getAttributeValues(com.sun.idm.object.IDMObjectClassAttribute attrDef)
Specified by:
getAttributeValues in interface com.waveset.object.AttributeBag

getAuthReferences

public java.util.ArrayList getAuthReferences()
Returns the list of all references in this object that are subject to CONNECT/DISCONNECT Right authorization checks. In most cases this will be the same list as returned by getReferences for a given persistent object. However, some objects like WSUser include object references not directly assigned by the user but generated by the system (e.g. ResourceInfo's) which are not subject to authorization checks when they change. This method should be overridden by subclasses that require the list of references to be different than the ones returned by getReferences.


getAuthType

public java.lang.String getAuthType()
Return the authorization type of this object. An authorization type may be used to further control access to the object beyond that defined for the base repository type.


getBasicAttributes

public javax.naming.directory.BasicAttributes getBasicAttributes()

getBasicAttributes

public static javax.naming.directory.BasicAttributes getBasicAttributes(PersistentObject po,
                                                                        java.lang.String[] attrIds)

getBasicAttributes

public javax.naming.directory.BasicAttributes getBasicAttributes(java.lang.String[] attrIds)

getCache

public com.waveset.object.ObjectCache getCache()
Gets the cache this object is referencing.


getCounterValue

public long getCounterValue()
Returns:
the current value of this object's counter.

getCreateDate

public java.util.Date getCreateDate()
Returns:
the value of Attribute.CREATE_DATE.

getCreator

public java.lang.String getCreator()
Returns:
the value of Attribute.CREATOR.

getDisplayableName

public java.lang.String getDisplayableName()
Return the displayable name of this object.


getDisplayName

public java.lang.String getDisplayName()
Return the display name of this object.


getElementName

public java.lang.String getElementName()
Return the XML element name of this object. This is normally the same as the type name, but may be different for classes that support subtyping.

Specified by:
getElementName in interface XmlObject
Returns:
the element name

getEncryptedValues

public java.util.List getEncryptedValues()
Returns:
the complete list of object values whose type is encrypted data (regardless of whether this object has a value for each).

Any subclass of PersistentObject that overrides this method must first invoke super.getEncryptedValues() to ensure that the list of encrypted values for PersistentObjects are included in the subclasses list.


getId

public java.lang.String getId()
Get the internally generated unique id for this object.


getIdOrName

public java.lang.String getIdOrName()
Get the id if one has been assigned, otherwise the name. A convenience method for code that needs some way to identity the object, but doesn't care if it is an id or name. Objects with names but without ids can appear when building new objects.


getInitialInstances

public static PersistentObject.InitialInstance[] getInitialInstances()
Returns the set of initial instances that should be created for this object type when a repository is created.

ServerRepository initialization will call this method on the Java class associated with each Type to get a list of the items it should "seed" into the repository.

Each initial instance contains a PersistentObject to be added, as well as boolean methods that describe any special handling.


getLastMod

public long getLastMod()
Return the modification count for this object at the time this object was last modified.


getLastModDate

public java.util.Date getLastModDate()
Return the date/time this object was created


getLastModifier

public java.lang.String getLastModifier()
Returns:
the value of the "lastModifier" attribute.

getLastModItemId

public static java.lang.String getLastModItemId(com.waveset.object.Type type)

getLockInfo

public com.waveset.object.LockInfo getLockInfo()
Return information about any lock held on this object.

NOTE: To obtain up-to-date lock information, use the Session.getLockInfo method.

See Also:
Session.getLockInfo(com.waveset.object.Type, java.lang.String)

getMemberObjectGroupRefs

public java.util.List getMemberObjectGroupRefs()
Return the list of references to object groups this object is a member of.


getMemberObjectGroupRefsUpTo

public java.util.List getMemberObjectGroupRefsUpTo(ObjectGroup og)
                                            throws com.waveset.util.WavesetException
Returns the list of references to object groups this object is a member of up the hierarchy to the specified object group (e.g. Marketing -> Waveset -> Top) If no object group path exists between this object and the one passed in, a null list is returned.

Throws:
com.waveset.util.WavesetException

getMemberObjectGroups

public ObjectGroup[] getMemberObjectGroups()
                                    throws com.waveset.util.WavesetException
Get an array of resolved object groups to which this object is a member.

This list is derived on demand from the list of group references.

Throws:
com.waveset.util.WavesetException

getName

public java.lang.String getName()
Return the name of this object.


getNameOrId

public java.lang.String getNameOrId()
Get the name if it has been assigned, otherwise the id. This is typically used for visible messages where we want to prefer the name over the id.


getPrimaryObjectClass

public com.sun.idm.object.IDMObjectClass getPrimaryObjectClass()
Returns:
primary object class for this persistent object, possibly null.

getProperties

public java.util.Properties getProperties()

getProperty

public java.lang.Object getProperty(java.lang.String name)

getPropertyAsString

public java.lang.String getPropertyAsString(java.lang.String name)

getPropertyList

public com.waveset.object.PropertyList getPropertyList()

getQueryableAttributes

public final WSAttributes getQueryableAttributes()
Returns:
attribute values to be used as search keys for this object. The WSAttributes contains a WSAttribute for each queryable attribute. Each WSAttribute may contain multiple values.

This is normally not used by applications, but called by storage managers like the Repository. This allows us to define type-specific search keys without requiring the Repository to know the details of each type. <> This default implementation adds values for a number of attributes commonly queryable for PersistentObjects.

See Also:

If a subclass wants to expose a different set of queryable attributes, that subclass should override {@link #listQueryableAttributes()}. In order to supply values for queryable attributes that may not be available in PersistentObject (e.g., from a field specified to that subclass), such a subclass may also override {@link #getAttributeValues(String)}.


getReference

public javax.naming.Reference getReference()
                                    throws javax.naming.NamingException
Specified by:
getReference in interface javax.naming.Referenceable
Throws:
javax.naming.NamingException

getReferences

public java.util.ArrayList getReferences()
Returns the list of all references in this object. This is intended to be overloaded by subclasses to add references specific to that class.


getRepositoryMod

public long getRepositoryMod()
Returns the SQL timestamp time of the last update of the record in the repository. This value represents the RDBMs timestamp, so it is coordinated across all IdM servers, but may have a resolution as low as 0.5 seconds for some RDBMS servers.


getRuleDrivenMemberObjectGroupRefs

public java.util.List getRuleDrivenMemberObjectGroupRefs()
                                                  throws com.waveset.util.WavesetException
Return the list of references to object groups this object is a member of based on the evaluation of user members rules associated with the object groups controlled by the current subject.

Throws:
com.waveset.util.WavesetException

getRuleDrivenMemberObjectGroupRefsUpTo

public java.util.List getRuleDrivenMemberObjectGroupRefsUpTo(ObjectGroup og,
                                                             ObjectGroup[] mogs)
                                                      throws com.waveset.util.WavesetException
Returns the list of references to object groups this object is a member of up the hierarchy to the specified object group (e.g. Marketing -> Waveset -> Top) If no object group path exists between this object and the one passed in, a null list is returned.

Throws:
com.waveset.util.WavesetException

getRuleDrivenMemberObjectGroups

public ObjectGroup[] getRuleDrivenMemberObjectGroups()
                                              throws com.waveset.util.WavesetException
Get an array of resolved object groups to which this object is a member.

This list is derived on demand from the list of group references.

Throws:
com.waveset.util.WavesetException

getSubtype

public final java.lang.String getSubtype()
Return the subtype of this object.

NOTE: By convention, the subtype value is a message key. This allows persistent objects to be filtered or queried by subtype within type using well-defined constants (i.e., message keys), but allows each subtype to be localized for display.


getSummaryAttributes

public WSAttributes getSummaryAttributes()
Returns:
attribute values to expose when this object appears in a list. The WSAttributes contains a WSAttribute for each attribute. Each WSAttribute may contain multiple values.

This default implementation adds values for attributes that are common to most (if not all) PersistentObjects.

See Also:

If a subclass wants to expose a different set of summary attributes, that subclass should override {@link #listSummaryAttributes}. In order to supply values for summary attributes that may not be available in PersistentObject (e.g., from a field specified to that subclass), such a subclass may also override {@link #getAttributeValues(String)}.

A subclass should not need to override this method (except to limit the number of values for a summary attribute).


getSummaryString

public java.lang.String getSummaryString()
Get the summary string for this object. In most cases, this is just a packed representation of the attributes returned by getSummaryAttributes. But some objects (WSUser) have special summary requirements, and may overload this method to calculate the summary in a special way.

Any subclass that overrides this implementation must limit the length of the summary string.

See Also:
Constants.MAX_SUMMARY_STRING_LENGTH

getType

public abstract com.waveset.object.Type getType()
Return the type of this object. This must be implemented by each subclass.

Returns:
type of this persistent object.

getXMLSize

public long getXMLSize()

hasEncryptedData

public static boolean hasEncryptedData()

hashCode

public int hashCode()
Implement the hashCode for efficient map insertion

Overrides:
hashCode in class java.lang.Object

identityEquals

public boolean identityEquals(PersistentObject pobj)
Helper for the equals method, compares the identity of this object with another persistent object.


isAlias

public boolean isAlias()

isHidden

public boolean isHidden()

isProtected

public boolean isProtected()

isProtectedFromDelete

public boolean isProtectedFromDelete()

isReferencedIn

public boolean isReferencedIn(java.util.Collection coll)
Returns true if an ObjectRef reference to this object is contained within the collection.

This is typically used by classes that maintain a collection of ObjectRefs, and wish to detect attempts to add the same reference more than once.

This could also be a static on ObjectRef, but it felt ok to handle this here too. At the moment you could accomplish a similar function using the Collection.contains method since our equals() method is overloaded to handle ObjectRef comparison. Defining equality for two completely different objects feels strange though, so this interface is also provided.

Parameters:
coll - - a collection (usually an ArrayList) that we will search

listOperationalAttributes

public void listOperationalAttributes(java.util.List attrs)
Add to the specified list the "built-in" attributes that are queryable just because the IDM Repository needs them in order to operate.


listQueryableAttributes

public java.util.List listQueryableAttributes()
Returns:
the complete list of defined attributes that this type of PersistentObject exposes as queryable attributes (regardless of whether this object has a value for each).

Any subclass of PersistentObject that overrides this method must first invoke super.getQueryableAttributes() to ensure that the list of queryable attribute for PersistentObjects are included in the subclasses list.

NOTE: UPDATING THIS METHOD also affects getQueryableAttributes().


listQueryableReferenceAttributes

public java.util.List listQueryableReferenceAttributes()
Returns:
the list of defined attributes that this type of persistent object exposes as queryable and for which each value is a reference to another persistent object.

This is intended to be overloaded each subclass to add queryable reference attributes that are specific to that subclass.


listSummaryAttributes

public java.util.List listSummaryAttributes()
Returns the complete list of defined attributes that this type of persistent object exposes as summary attributes (regardless of whether this particular object has a value for each).

Any subclass of PersistentObject that overrides this method should first invoke super.listSummaryAttributes() to ensure that the subclass includes summary attributes that are common to all PersistentObjects.

Any subclass that overrides this implementation must also consider the length of the summary string that will be generated from these attributes.

See Also:
Constants.MAX_SUMMARY_STRING_LENGTH, getSummaryString()

objectGroupMember

public boolean objectGroupMember(ObjectGroup og)
                          throws com.waveset.util.WavesetException
Test to see if this object is a member of the given object group.

Throws:
com.waveset.util.WavesetException

objectGroupMemberRef

public com.waveset.object.ObjectRef objectGroupMemberRef(ObjectGroup og)
                                                  throws com.waveset.util.WavesetException
Test to see if this object is a member of the given object group.

Returns:
ObjectRef to the object group that this object is a member of
Throws:
com.waveset.util.WavesetException

prepareForSerialization

public void prepareForSerialization()
                             throws com.waveset.util.WavesetException
Prepare for serialization by doing anything that involves resolving references, leaving behind in the object anything that will be needed for toXml, getSummaryAttributes, getQueryableAttributes.

This is called by the session before checking in the object. Later the repository will ask for the xml and summary string.

Throws:
com.waveset.util.WavesetException

prepareToSerialize

public void prepareToSerialize()
                        throws com.waveset.util.WavesetException
Update the structure of the object prior to serialization. This usually does nothing, but certain objects (notably WSUser) may perform complex traversal of related objects such as Roles to compute their summary attrbutes. It is important that resolution of object references be done oustside of the toXml, getQueryableAttributes or getSummaryAttributes calls, due to synchronization issues with the Repository. If your class needs to resolve references in any of these mehtods, it must be designed to do the resolution here and leave the results beind in the object for later use in these methods.

Throws:
com.waveset.util.WavesetException

reEncrypt

public void reEncrypt()
               throws com.waveset.util.WavesetException
Throws:
com.waveset.util.WavesetException

removeMemberObjectGroup

public void removeMemberObjectGroup(ObjectGroup og)
Remove an object group from this object. This effectively takes this object out of the group.


removeProperty

public void removeProperty(java.lang.String name)

resolve

public int resolve(java.util.List refs)
            throws com.waveset.util.WavesetException
Resolve a list of references, filtering out elements that no longer resolve.

Returns the size of the reference list.

Throws:
com.waveset.util.WavesetException

resolve

public boolean resolve(java.util.List refs,
                       java.lang.Object[] array)
                throws com.waveset.util.WavesetException
Resolve a list of references, storing pointers to the resolved objects in an array as a side effect. This is optimized for objects that maintain both an ArrayList of references, as well as an array of native object pointers in a cache that they want to keep refreshed.

We return true if the provided array matched the number of resolved references, this is the usual case. If the array size doesn't match, we'll still try to resolve all the elements in the list, but the caller will have to reallocate a suitable array. It would be nice if we could do this automatically, but we'd have to know the type of array to allocate, and I'm not sure how to do that with reflection.

Throws:
com.waveset.util.WavesetException

resolve

public PersistentObject resolve(com.waveset.object.ObjectRef ref)
                         throws com.waveset.util.WavesetException
Resolve a single reference. If the reference is not already resolved, we'll ask our cache to resolve it. We do not throw an exception if the object no longer exists.

If the object does not exist, the reference will be marked as being deleted, so that the ObjectRef.isDeleted method will return true.

Throws:
com.waveset.util.WavesetException
See Also:
ObjectRef.isDeleted()

resolveArray

public java.lang.Object resolveArray(java.util.List refs,
                                     java.lang.Object[] array,
                                     java.lang.Class elClass)
                              throws com.waveset.util.WavesetException
Resolve a list of references, creating a typed array of PersistentObject pointers. Used by various objects to provide a more convenient array interface for collections of references.

We allow an existing array to be passed in, and will try to reuse the array if it hasn't changed in size. !! Note that since this modifies the list, it is not thread safe if you are in the server thread. But its overly restrictive to synchronize here, the caller must be synchronized.

Throws:
com.waveset.util.WavesetException

resolveArrayByFetching

public java.lang.Object resolveArrayByFetching(java.util.List refs,
                                               java.lang.Object[] array,
                                               java.lang.Class elClass)
                                        throws com.waveset.util.WavesetException
Now that users can also be administrators that can be approvers or be notified, together with the fact that users are a supressed type meaning they never get cached, we need a way to ensure that we alway resolve these list of refs by hitting the repo.

Resolve a list of references, creating a typed array of PersistentObject pointers. Used by suppressed objects to provide a more convenient array interface for collections of references.

Note that in order to assure that we are always resolving the objects from the repo, we will null out the ref handles before calling resolveArray. !! Note that since this modifies the list, it is not thread safe if you happen to be operating within the server cache. The caller must be synchronized.

Throws:
com.waveset.util.WavesetException

resolveObjectReferences

public void resolveObjectReferences(com.waveset.object.ObjectCache cache)
                             throws com.waveset.util.WavesetException
Walk over an object looking for ObjectRefs without ids and resolve them.

We originally used the generic resolveReferences for this, but this operates off of the DOM tree and requires an expensive user/dom/user conversion. Since we're called from bulk load have to be more careful about garabge.

Formerly picked specific attributes out of the user object but that wasn't robust. Assume PersistentObject.getReferences is correct.

Throws:
com.waveset.util.WavesetException

resolveReference

public PersistentObject resolveReference(com.waveset.object.ObjectRef ref)
                                  throws com.waveset.util.WavesetException
DEPRECATED: like resolve above but throws an exception if it can't find it, try to weed these out.

Resolve a reference, throwing an exception if the object didn't exist. We're moving toward being tolerant of deleted objects, so you should call resolve instead. This will shortly become the default behavior.

Parameters:
ref - - an object reference
Throws:
com.waveset.util.WavesetException

resolveSummaryAttributes

public static void resolveSummaryAttributes(com.waveset.object.ObjectCache cache,
                                            WSAttributes attrs)
                                     throws com.waveset.util.WavesetException
Walk the summary attributes, translating the embedded IDs to names. For this object, they are just name and ID which do not need translating.

Throws:
com.waveset.util.WavesetException

resolveSummaryAttributes

public static void resolveSummaryAttributes(com.waveset.object.Type type,
                                            com.waveset.object.ObjectCache cache,
                                            WSAttributes attrs)
                                     throws com.waveset.util.WavesetException
Map the type to an implementation class, then call its resolveSummaryAttributes method.

Throws:
com.waveset.util.WavesetException

ruleDrivenObjectGroupMemberRef

public com.waveset.object.ObjectRef ruleDrivenObjectGroupMemberRef(ObjectGroup og,
                                                                   java.util.List memberObjectGroupRefs)
                                                            throws com.waveset.util.WavesetException
Test to see if this object is a member of the given object group.

Returns:
ObjectRef to the object group that this object is a member of
Throws:
com.waveset.util.WavesetException

setAuthType

public void setAuthType(com.waveset.object.AuthType t)
Set the authorization type of this object. An authorization type may be used to further control access to the object beyond that defined for the base repository type.


setAuthType

public void setAuthType(java.lang.String s)
Set the authorization type of this object. An authorization type may be used to further control access to the object beyond that defined for the base repository type.


setCache

public void setCache(com.waveset.object.ObjectCache c)
Sets the object cache.

There are two situations where this may be used. First, an ObjectCache may set this when an object is added to the cache. Second, an application may wish to assign a cache to this object for automatic reference resolution, without having the object actually be "in" the cache.

For example Type.USER objects will never be in a cache, but they need to point to a cache in order to automatically resolve roles and other things.

Parameters:
c - - an object cache

setDisplayName

public void setDisplayName(com.waveset.msgcat.Message m)
Set the display name to an unresolved message. This will convert it to a series of attributes encoded in a string.


setDisplayName

public void setDisplayName(java.lang.String s)
Replaces the value of the displayName attribute.


setHidden

public void setHidden(boolean b)

setIsAlias

public void setIsAlias(boolean isAlias)

setMemberObjectGroupRef

public void setMemberObjectGroupRef(com.waveset.object.ObjectRef og)
                             throws com.waveset.util.WavesetException
Set a single member object group ref

Throws:
com.waveset.util.WavesetException

setMemberObjectGroupRefs

public void setMemberObjectGroupRefs(java.util.List refs)
                              throws com.waveset.util.WavesetException
Set the list of references to object groups to which this object is a member (say that 10 times fast). // *

// * jsl - is this necessary?

Throws:
com.waveset.util.WavesetException

setMemberObjectGroups

public void setMemberObjectGroups(ObjectGroup[] ogarray)
                           throws com.waveset.util.WavesetException
Set the object groups to which this object is a member.

The list is specified as an array of group objects, it will be converted internally to a list of object reference objects.

Throws:
com.waveset.util.WavesetException

setName

public void setName(java.lang.String s)
Replaces the value of the name attribute.

Note that if you change the name of an object, and check the object into the repository using the Session.checkinObject method, this will have the effect of renaming the object in the repository.


setProperties

public void setProperties(java.util.Properties p)

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)

setPropertyList

public void setPropertyList(com.waveset.object.PropertyList p)

setRuleDrivenMembersCache

public void setRuleDrivenMembersCache(com.waveset.object.RuleDrivenMembersCache cache)

setSubtype

public void setSubtype(java.lang.String subtype)
Set the subtype of this object (e.g., Messages.ACCOUNT_CORRELATION_RULE within Type.RULE). This may be called by any subclass.

NOTE: By convention, the subtype value is a message key.


setTrace

public void setTrace(boolean b)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

toXml

public java.lang.String toXml()
Serialize the object to an XML string.

The default implementation is to create a string buffer, add an XML header and call the toXml(StringBuffer) method. This may be overloaded by the subclasses, though there is usually no need to.

Specified by:
toXml in interface XmlObject
Returns:
the string representation of this object

toXml

public void toXml(java.lang.StringBuffer b)
Serialize the object as XML into a string buffer. PersistentObject's implementation provides a standard template for its concrete subclasses.

NOTE: Each subclass should serialize any necessary fields specific to that subclass. // * @see #addSubclassAttributes // * @see #addSubclassElements


toXml

public void toXml(java.lang.StringBuffer b,
                  int indent)
Serialize the object as XML with an optional indentation. // * This is the one XmlObject wants to have defined, persistent objects // * should implement this, but its too late now. Since // * they're usually at top level anyway, it doesn't hurt much.

Specified by:
toXml in interface XmlObject
Parameters:
b - target buffer
indent - amount of indentation

toXmlFile

public void toXmlFile(java.lang.String file)
Serialize the object to a file. A hack primarily for debugging with JBuilder.


visit

public void visit(com.waveset.object.Visitor v)
           throws com.waveset.util.WavesetException
All persistent objects support a visitor interface. This is expected to be overridden in the subclasses if you want to support visiting. See the Visitor class for more information.

Parameters:
v - Visitor for this persistent object.
Throws:
com.waveset.util.WavesetException - if there's a problem from visitPersistentObject