com.iplanet.am.sdk
Interface AMEntity


public interface AMEntity


Method Summary
 void activate()
          Activates the entity (if a status attribute is defined for this entity).
 void deactivate()
          Deactivates the entity (if a status attribute is defined for this entity).
 void delete()
          Deletes the object.
 void delete(boolean recursive)
          Deletes object(s).
 java.util.Map getAttributes()
          Returns Map of all attributes.
 java.util.Map getAttributes(java.util.Set attributeNames)
          Returns Map of specified attributes.
 java.lang.String getDN()
          Returns the distinguished name of the entry.
 java.lang.String getOrganizationDN()
          Gets the object's organization distinguished name.
 java.lang.String getParentDN()
          Returns the parent distinguished name of the entry.
 boolean isActivated()
          Returns true if the entity is activated.
 boolean isExists()
          Returns true if the entry exists in the directory or not.
 void purge(boolean recursive, int graceperiod)
          Purges entry from data store.
 void removeAttributes(java.util.Set attributes)
          Removes attributes in this AMObject.
 void setAttributes(java.util.Map attributes)
          Sets attribute values in this AMObject.
 void store()
          Stores the change to directory server.
 

Method Detail

getDN

public java.lang.String getDN()
Returns the distinguished name of the entry.
Returns:
distinguished name.

getParentDN

public java.lang.String getParentDN()
Returns the parent distinguished name of the entry.
Returns:
distinguished name.

isExists

public boolean isExists()
                 throws SSOException
Returns true if the entry exists in the directory or not. First a syntax check is done on the distinguished name string corresponding to the entry. If the distinguished name syntax is valid, a directory call will be made to check for the existence of the entry.

NOTE: This method internally invokes a call to the directory to verify the existence of the entry. There could be a performance overhead. Hence, please use your discretion while using this method.

Returns:
false if the entry does not have a valid DN syntax or if the entry does not exists in the Directory.
Throws:
SSOException - if the single sign on token is no longer valid.

getAttributes

public java.util.Map getAttributes()
                            throws AMException,
                                   SSOException
Returns Map of all attributes. Map key is the attribute name and value is the attribute value.
Returns:
Map of all attributes.
Throws:
AMException - if an error is encountered when trying to read attributes from the data store.
SSOException - if the single sign on token is no longer valid.

getAttributes

public java.util.Map getAttributes(java.util.Set attributeNames)
                            throws AMException,
                                   SSOException
Returns Map of specified attributes. Map key is the attribute name and value is the attribute value.
Parameters:
attributeNames - The Set of attribute names.
Returns:
Map of specified attributes.
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the single sign on token is no longer valid.

setAttributes

public void setAttributes(java.util.Map attributes)
                   throws AMException,
                          SSOException
Sets attribute values in this AMObject. Note that this method sets or replaces the attribute value with the new value supplied. Also, the attributes changed by this method are not committed to the LDAP data store unless the method store() is called explicitly.
Parameters:
attributes - map of attribute name to a set of attribute values. Each of the attribute value must be a string value.
Throws:
AMException - if an error is encountered when trying to set/replace attributes from the data store.
SSOException - if the single sign on token is no longer valid.

removeAttributes

public void removeAttributes(java.util.Set attributes)
                      throws AMException,
                             SSOException
Removes attributes in this AMObject. The attributes are removed from the LDAP data store.
Parameters:
attributes - The Set of attribute names.
Throws:
AMException - if an error is encountered when trying to remove attributes from the data store.
SSOException - if the single sign on token is no longer valid.

activate

public void activate()
              throws AMException,
                     SSOException
Activates the entity (if a status attribute is defined for this entity). If a status attribute is not defined then this method returns without doing anything.
Throws:
AMException - if an error is encountered when trying to activate the managed object.
SSOException - if the single sign on token is no longer valid.

deactivate

public void deactivate()
                throws AMException,
                       SSOException
Deactivates the entity (if a status attribute is defined for this entity). If a status attribute is not defined then this method returns without doing anything.
Throws:
AMException - if an error is encountered when trying to deactivate the managed object.
SSOException - if the single sign on token is no longer valid.

isActivated

public boolean isActivated()
                    throws AMException,
                           SSOException
Returns true if the entity is activated. If the entity does not have a status attribute, then this method returns true, rather that throw an exception.
Returns:
true if the entity is activated.
Throws:
AMException - if an error is encountered when trying to get the status attribute from the data store.
SSOException - if the single sign on token is no longer valid.

delete

public void delete()
            throws AMException,
                   SSOException
Deletes the object.
Throws:
AMException - if an error is encountered when trying to delete entry from the data store.
SSOException - if the single sign on token is no longer valid.
See Also:
delete(boolean), purge(boolean, int)

delete

public void delete(boolean recursive)
            throws AMException,
                   SSOException
Deletes object(s). This method takes a boolean parameter, if its value is true, will remove the object and any objects under it, otherwise, will try to remove the object only. Two notes on recursive delete. First, be aware of the PERFORMANCE hit when large amount of child objects present. In the soft-delete mode, this method will mark the following objects for deletion: Organization, Group, User purge() should be used to physically delete this object.
Parameters:
recursive - if true delete the object and any objects under it, otherwise, delete the object only.
Throws:
AMException - if an error is encountered when trying to delete entry from the data store.
SSOException - if the single sign on token is no longer valid.
See Also:
purge(boolean, int)

getOrganizationDN

public java.lang.String getOrganizationDN()
                                   throws AMException,
                                          SSOException
Gets the object's organization distinguished name. NOTE: Obtaining an organization distinguished name involves considerable overhead. Hence after obtaining the organization distinguished name, each object saves this information. Consecutives method calls on this object fetch the value stored in the object. Creating a new AMEntity instance every time to obtain the organization distinguished name is not recommended.
Returns:
The object's organization DN.
Throws:
AMException - if an error is encountered when trying to access/retrieve data from the data store or the object does not have organization distinguished name.
SSOException - if the single sign on token is no longer valid.

store

public void store()
           throws AMException,
                  SSOException
Stores the change to directory server. This method should be called after doing setAttributes so that the changes that are made can be permanently committed to the LDAP data store.
Throws:
AMException - if an error is encountered when trying to save the attributes to the data store.
SSOException - if the single sign on token is no longer valid.

purge

public void purge(boolean recursive,
                  int graceperiod)
           throws AMException,
                  SSOException
Purges entry from data store. It will physically delete the entry from the data store. This method will override the soft-delete option, which the method delete() will not. There is a big PERFORMANCE hit if this method is used to delete a large organization in the recursive mode.
Parameters:
recursive - true to recursively delete the whole subtree.
graceperiod - If set to an integer greater than -1, it will verify if the object was last modified at least that many days ago before physically deleting it. Pre/Post Callback plugins as registered in the Administration Service, will be called upon object deletion. If any of the pre-callback classes throw an exception, then the operation is aborted.
Throws:
AMException - if there is an internal error in the data store.
SSOException - if the single sign on token is no longer valid.
See Also:
delete()