com.sun.identity.um
Class Common

java.lang.Object
  |
  +--com.sun.identity.um.Common
Direct Known Subclasses:
AssignableDynamicGroup, DynamicGroup, Organization, Role, StaticGroup, User

public class Common
extends java.lang.Object

This is the common set of methods needed by all the objects. This class is extended by all the objects


Constructor Summary
Common()
           
 
Method Summary
 void assignServices(java.util.Map serviceNameAndAttrs)
          Assign services to the user.
 void delete()
          Deletes the object.
 void delete(boolean recursive)
          Deletes object(s).
 java.util.Set getAssignedServices()
          Gets the names of the services that are assigned to the user/group/org.
 java.util.Map getAttributes()
          Gets Map of all attributes.
 java.util.Map getAttributes(java.util.Set attributeNames)
          Gets Map of specified attributes.
 java.lang.String getDN()
          Gets the DN of the entry.
 java.lang.String getOrganizationDN()
          Gets the object's organization.
 java.lang.String getParentDN()
          Gets the parent DN of the entry.
 java.util.Map getServiceAttributes(java.lang.String serviceName)
          Gets Map of all attributes of specified service.
 java.lang.String getServiceStatus(java.lang.String serviceName)
          Get the status of the service for this entity (User/Org/Group/OrgUnit).
 boolean isExists()
          Checks if the entry exists in the directory or not.
 void modifyService(java.lang.String serviceName, java.util.Map attrMap)
          Modify the service attributes of a service assigned to a user.
 void removeAttributes(java.util.Set attributes)
          Removes attributes in this AMCommon.
 void setAttributes(java.util.Map attributes)
          Sets attribute values in this AMCommon.
 void setServiceStatus(java.lang.String serviceName, java.lang.String status)
          Set the status of the service for this entity (User/Org/Group/OrgUnit).
 void store()
          Stores the change to directory server.
 void unassignServices(java.util.Set serviceNames)
          Unassigns services from the user/group/org.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Common

public Common()
Method Detail

getDN

public java.lang.String getDN()
                       throws UMException,
                              SSOException
Gets the DN of the entry.
Returns:
String DN

getParentDN

public java.lang.String getParentDN()
                             throws UMException,
                                    SSOException
Gets the parent DN of the entry.
Returns:
String DN

store

public void store()
           throws UMException,
                  SSOException
Stores the change to directory server.
Throws:
UMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

isExists

public boolean isExists()
                 throws UMException,
                        SSOException
Checks if the entry exists in the directory or not. First a syntax check is done on the DN string corresponding to the entry. If the DN 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. False otherwise.
Throws:
SSOException - if the sign-on is no longer valid.

getAttributes

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

getAttributes

public java.util.Map getAttributes(java.util.Set attributeNames)
                            throws UMException,
                                   SSOException
Gets 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:
UMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

getServiceAttributes

public java.util.Map getServiceAttributes(java.lang.String serviceName)
                                   throws UMException,
                                          SSOException
Gets Map of all attributes of specified service. Map key is the attribute name and value is the attribute value.
Parameters:
serviceName - Service name
Returns:
Map of all attributes of specified service, an empty Map will be returned if no service attribute is defined in the specified service.
Throws:
UMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

setAttributes

public void setAttributes(java.util.Map attributes)
                   throws UMException,
                          SSOException
Sets attribute values in this AMCommon. Note that this method sets or replaces the attribute value with the new value supplied.
Parameters:
attributes - Map where key is the attribute name and value is a Set of attribute values. Each of the attribute value must be a string value.
Throws:
UMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

removeAttributes

public void removeAttributes(java.util.Set attributes)
                      throws UMException,
                             SSOException
Removes attributes in this AMCommon.
Parameters:
attributes - The Set of attribute names
Throws:
UMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

delete

public void delete()
            throws UMException,
                   SSOException
Deletes the object.
Throws:
UMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

delete

public void delete(boolean recursive)
            throws UMException,
                   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. Second, it won't follow referral.
Parameters:
recursive - if true delete the object and any objects under it, otherwise, delete the object only.
Throws:
UMException - if an error is encountered when trying to access/retrieve data from the data store
SSOException - if the sign-on is no longer valid.

getOrganizationDN

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

assignServices

public void assignServices(java.util.Map serviceNameAndAttrs)
                    throws UMException,
                           SSOException
Assign services to the user. Also sets the atributes as provided in the map.Attribute value is validated before being set. Any required attributes that should be there, but are not provided in the attrMap, will be included and set to default values as stated in the Service Schema. After the above operations and before setting the service, the ServiceCallback classes, if any are instantiated and the method validateAttributes() is called.
Parameters:
serviceNameAndAttrs - Map of Service name with Map of Attribute-Value pairs
Throws:
UMException - if an error is encounters when trying to access/retrieve data from the datastore
SSOException - if the token is no longer valid

modifyService

public void modifyService(java.lang.String serviceName,
                          java.util.Map attrMap)
                   throws UMException,
                          SSOException
Modify the service attributes of a service assigned to a user. It replaces existing service attribute values with the ones provided. If new attribute values are provided, those are set too. Values of the attribute are validated per the service schema. Before the values are replaced in the entry, the ServiceCallback classes, if any, are instantiated and the validateAttribute() method is called.
Parameters:
serviceName -  
attributeMap - Map of attribute names and set of attribute values.
Throws:
UMException - when an error occurs during validation or storing
SSOException - if the SSOToken is no longer valid.

setServiceStatus

public void setServiceStatus(java.lang.String serviceName,
                             java.lang.String status)
                      throws UMException,
                             SSOException
Set the status of the service for this entity (User/Org/Group/OrgUnit). The valid values for the status attribute are defined in the sms DTD. Before the status attribute is set, it is verified to see if the service is first assigned to the user or not, that the value for the status is valid per the DTD.
Parameters:
serviceName -  
status -  
Throws:
UMException - when an error occurs while validating/storing data
SSOException - when the SSOToken is no longer valid

getServiceStatus

public java.lang.String getServiceStatus(java.lang.String serviceName)
                                  throws UMException,
                                         SSOException
Get the status of the service for this entity (User/Org/Group/OrgUnit). Returns null, if service is not assigned to the entity.
Parameters:
serviceName -  
Throws:
UMException - when an error occurs while validating/storing data
SSOException - when SSOToken is no longer valid

unassignServices

public void unassignServices(java.util.Set serviceNames)
                      throws UMException,
                             SSOException
Unassigns services from the user/group/org.
Parameters:
serviceNames - Set of service names
Throws:
UMException - if there is an internal error in the AM Store
SSOException - if the sign on is no longer valid

getAssignedServices

public java.util.Set getAssignedServices()
                                  throws UMException,
                                         SSOException
Gets the names of the services that are assigned to the user/group/org.
Returns:
The Set of service names that are assigned to the user.
Throws:
UMException - if there is an internal error in the data Store
SSOException - if the sign on is no longer valid