public class PersistentObject extends Object implements ISearch, Serializable, IUMSConstants
Modifier and Type | Field and Description |
---|---|
static String |
COMPUTED_MEMBER_ATTR_NAME |
ADD_NULL_OBJ, ATTR_NOT_ALLOWED, ATTRIBUTETYPE_NOT_FOUND, BAD_ATTRNAMES, BAD_CHILD_OBJ, BAD_CLASS, BAD_COS_ATTR_QUALIFIER, BAD_GUID, BAD_ID, BAD_NAMING_ATTR, BAD_OBJ_TO_ADD, BAD_PRINCIPAL_HDL, BAD_STRUCTURE_TEMPLATE_PRIORITY, BAD_TEMPLATE, BAD_TOKEN_HDL, COMPOSE_GUID_FAILED, CONFIG_MGR_ERROR, COS_DEF_OR_TARGET_OBJECT_NULL, COS_DEFINITION_NOT_FOUND, COS_DEFINITION_NOT_PERSISTENT, COS_TARGET_OBJECT_DIFFERENT_TREE, COS_TARGET_OBJECT_NOT_PERSISTENT, COS_TEMPLATE_NOT_FOUND, DATA_CONSTRAINT, DEFINITION_NOT_PERSISTENT, DEL_NULL_OBJ, DSCFG_CONNECTFAIL, DSCFG_CTRLERROR, DSCFG_DIRSERVER_NODE_EXPECTED, DSCFG_INVALID_BASE_DN, DSCFG_JSSSFFAIL, DSCFG_NO_FILE_PATH, DSCFG_NOCFGMGR, DSCFG_SERVER_NOT_FOUND, DSCFG_SERVERGROUP_NODE_EXPECTED, DSCFG_UNSUPPORTEDLSTNRTYPE, DSCFG_UNSUPPORTEDSERVERCTRL, ENTRY_ALREADY_EXISTS, ENTRY_NOT_FOUND, ERROR_CM, ERROR_CM_INITIATE, ILLEGAL_ADGROUP_SCOPE, ILLEGAL_GROUP_SCOPE, INSTANCE_FAILED, INSUFFICIENT_ACCESS_ADD, INSUFFICIENT_ACCESS_DELETE, INVALID_COS_ATTRIBUTE_QUALIFIER, INVALID_COSDEFINITION, INVALID_TOKEN, MISSING_TEMPL_NAME, MULTIPLE_ENTRY, NEW_INSTANCE_FAILED, NEXT_ENTRY_FAILED, NO_NAMING_ATTR, NO_POLICY_DOMAIN, NO_RECURSION_ALLOW, NO_REQUIRED, NO_VALUE, NULL_GUIDS, NULL_PRINCIPAL, NULL_SESSION, NULL_TOKEN, OBJECT_NOT_PERSISTENT, OBJECTCLASS_NOT_FOUND, PERSISTENT_OBJECT_PARAM_NULL, POLICIES_DO_NOT_MATCH_BY_NAME_RESOURCE_ACTION, POLICY_DOMAIN_NOT_FOUND, POLICY_EXISTS_FOR_NAME, POLICY_EXISTS_FOR_RESOURCE_ACTION, POLICY_NOT_FOUND, POLICY_ROOT_NOT_FOUND, READ_ATTRIBUTES_ERROR, READING_LDIF_FAILED, REPLACE_DEFINITION_NOT_PERSISTENT, ROLE_CONTAINED, SEARCH_FAILED, services_validator_initialize_failed, services_validator_invalid_attr_name, services_validator_invalid_attr_schema, services_validator_schema_does_not_exist, SMS_ADD_SUB_CONFIG_FAILED, SMS_ADMIN_LIMIT_EXCEEDED, SMS_ATTR_LIST_NEEDED, SMS_ATTR_NAME_NOT_FOUND, SMS_ATTR_OR_VAL_EXISTS, SMS_ATTR_SYNTAX_NOT_FOUND, SMS_AUTHENTICATION_ERROR, SMS_CAN_NOT_CONSTRUCT_SERVICE_MANAGER, SMS_CANNOT_CREATE_INSTANCE, SMS_CANNOT_CREATE_PLACE_HOLDER_NODE, SMS_EVENT_NOTIFICATION_FAILED, SMS_failed_to_get_schema_manager, SMS_INSUFFICIENT_ACCESS_RIGHTS, SMS_INVALID_ATTR_ENTRY, SMS_INVALID_ATTR_NAME, SMS_INVALID_CLASS_NAME, SMS_INVALID_CONFIG_NAME, SMS_INVALID_DN, SMS_INVALID_METHOD, SMS_INVALID_OP_VALUE, SMS_INVALID_PARAMETERS, SMS_INVALID_SEARCH_BASE, SMS_INVALID_SEARCH_ORDER_PARAMETER, SMS_INVALID_SEARCH_PATTERN, SMS_LDAP_NOT_SUPPORTED, SMS_LDAP_OPERATION_FAILED, SMS_LDAP_REFERRAL_EXCEPTION, SMS_LDAP_SERVER_BUSY, SMS_NO_ATTRIBUTE_IN_ENTRY, SMS_NO_SUCH_ATTRIBUTE, SMS_NO_SUCH_OBJECT, SMS_NODE_ALREADY_EXISTS, SMS_OC_NAME_NOT_FOUND, SMS_organization_already_exists_no_args, SMS_READONLY_OBJ, SMS_SERVER_DOWN, SMS_SERVER_INSTANCE_NOT_FOUND, SMS_service_already_exists, SMS_service_already_exists_no_args, SMS_service_does_not_exist, SMS_SERVICE_NAME_NOT_FOUND, SMS_SERVICE_NODE_NOT_FOUND, SMS_services_node_does_not_exist, SMS_SMSSchema_exception_message, SMS_SMSSchema_invalid_input_stream, SMS_SMSSchema_invalid_xml_document, SMS_SMSSchema_no_schema_element, SMS_SMSSchema_no_service_element, SMS_SMSSchema_parser_error, SMS_SMSSchema_service_notfound, SMS_SUB_CONFIG_DOES_NOT_EXIST, SMS_TIME_LIMIT_EXCEEDED, SMS_UNEXPECTED_LDAP_EXCEPTION, SMS_UNKNOWN_EXCEPTION_OCCURRED, SMS_VALIDATOR_CANNOT_INSTANTIATE_CLASS, SMS_VALUE_DOES_NOT_EXIST, SMS_xml_invalid_doc_type, SMS_XML_PARSER_EXCEPTION, SMSSCHEMA_SERVICE_NOTFOUND, SSO_ILLEGALACCESS, SSO_NOPROVIDERCLASS, SSO_NOPROVIDERINSTANCE, SSO_NOPROVIDERPROPERTY, STRUCTURE_TEMPLATE_ATTRSET_NULL, TEMPLATE_NO_ATTR, UMS_BUNDLE_NAME, UMS_DEBUG, UMS_PKG, UNABLE_TO_ADD_ENTRY, UNABLE_TO_DELETE_ENTRY, UNABLE_TO_READ_ENTRY, UNMATCHED_CLASS, USER_NOT_IN_GROUP_SCOPE
Modifier | Constructor and Description |
---|---|
protected |
PersistentObject()
Default Constructor
|
|
PersistentObject(CreationTemplate template,
AttrSet attrSet)
Constructor for in memory object to be added to the system.
|
Modifier and Type | Method and Description |
---|---|
void |
addACI(ACI aci)
Adds an ACI to this object.
|
static void |
addAttributeValue(SSOToken token,
Guid guid,
String name,
String value)
Adds value for an attribute and saves the change in the database.
|
void |
addChild(PersistentObject object)
Adds a child object to the persistent object container.
|
void |
changePassword(String entryDN,
String attrName,
String oldPassword,
String newPassword)
Changes user password.
|
void |
deleteACI(ACI aci)
Deletes an ACI of this object
|
Collection |
getACI()
Returns all the ACIs of this object.
|
Collection |
getACI(String name)
Returns all the ACIs of this object with the given name.
|
Attr |
getAttribute(String attrName)
Gets an attribute of the object.
|
Attr |
getAttribute(String attrName,
Locale locale)
Gets an attribute value with a given locale
|
String[] |
getAttributeNames()
Gets names for all available attributes for this entity
|
AttrSet |
getAttributes(String[] attrs)
Gets attribute values
|
AttrSet |
getAttributes(String[] attrs,
boolean cacheOnly)
Gets attribute values
|
AttrSet |
getAttributes(String[] attrNames,
Locale locale)
Returns attribute values with a specified locale.
|
protected AttrSet |
getAttrSet()
Gets the attribute set as a reference, not a deep copy
|
SearchResults |
getChildren(SearchTemplate template,
SearchControl searchControl)
Gets all immediate children under current node based on search criteria
specified in template, and returns attributes specified there.
|
SearchResults |
getChildren(String filter,
SearchControl searchControl)
Gets the immediate children, subject to search filter constraints.
|
SearchResults |
getChildren(String filter,
String[] resultAttributeNames,
SearchControl searchControl)
Gets the immediate children, returning only specified attributes
|
String |
getDN()
Gets the DN of the entity
|
Guid |
getGuid()
Get GUID of the given entity
|
String |
getNamingAttribute()
Gets the attribute name that specifies the ID (or RDN in terms of DN in
ldap) component in an object.
|
Guid |
getParentGuid()
Gets the parent guid
|
PersistentObject |
getParentObject()
Gets the parent object
|
Collection |
getRoles()
Gets the list of GUIDS roles assosciated with this object
|
static String |
idToDN(String namingAttribute,
String name,
String[] parentID)
Maps to a DN from naming attribute value of a persistent object.
|
boolean |
isMemberOf(IMembership im)
Checks if this object is a member of an IMembership.
|
protected boolean |
isPersistent()
Check if the object is persistent in the system
|
void |
modify(Attr attr,
org.forgerock.opendj.ldap.ModificationType modificationType)
Modifies the values of a single attribute for the entity.
|
void |
modify(Collection<org.forgerock.opendj.ldap.Modification> modSet)
Modifies attribute values for the entity.
|
void |
modify(String attrName,
String value,
org.forgerock.opendj.ldap.ModificationType modificationType)
Modify a single attribute for the entity.
|
void |
remove()
Remove itself from the persistent store.
|
void |
removeAttribute(Attr attr)
Removes attribute value for the entity.
|
static void |
removeAttributeValue(SSOToken token,
Guid guid,
String name,
String value)
Removes value for an attribute and saves the change in the database.
|
void |
removeChild(Guid childGuid)
Removes an object given its unique ID.
|
void |
removeChild(PersistentObject object)
Removes a child object from a persistent object container.
|
void |
rename(String newRDN,
boolean deleteOldName)
Renames the RDN to a new value.
|
void |
replaceACI(ACI oldACI,
ACI newACI)
Replaces an ACI of this object
|
void |
save()
Save the modification(s) to the object.
|
SearchResults |
search(SearchTemplate template,
SearchControl searchControl)
Gets the attributes specified in the template for all objects at the
current level and below which match the search filter in the template.
|
SearchResults |
search(String filter,
SearchControl searchControl)
Gets only the IDs and object classes of all objects at the current level
and below which match the search filter.
|
SearchResults |
search(String filter,
String[] resultAttributeNames,
SearchControl searchControl)
Gets the specified attributes of all objects at the current level and
below which match the search filter.
|
void |
setAttribute(Attr attr)
Set an attribute value for the entity.
|
void |
setAttribute(Attr attr,
Locale locale)
Sets an attribute value with a given locale for the entity.
|
protected void |
setAttrSet(AttrSet attrSet)
Sets the attribute set
|
protected void |
setGuid(Guid guid)
Sets the GUID of the entity; used within the package
|
String |
toString()
Gets a string representation of the object
|
public static final String COMPUTED_MEMBER_ATTR_NAME
protected PersistentObject()
public PersistentObject(CreationTemplate template, AttrSet attrSet) throws UMSException
1) call add on parent object (recommended)
2) call save(...) method after all attributes for in memory object are set up properly.
template
- Object creation template. The template holds all the default
values such as objectclass and requirted attributes to be
suppliedattrSet
- Attribute set to construct the object in memoryUMSException
- for failure to construct the object. The given attrSet needs
to provide the required attribute(s) defined in templatepublic Attr getAttribute(String attrName)
attrName
- Name of the attribute to be queriedpublic Attr getAttribute(String attrName, Locale locale) throws UMSException
attrName
- Name of the attributelocale
- Locale of attribute to be retrievedUMSException
getAttribute(String)
public AttrSet getAttributes(String[] attrs) throws UMSException
attrs
- Array of strings representing attribute namesUMSException
getAttribute(String)
public AttrSet getAttributes(String[] attrs, boolean cacheOnly) throws UMSException
attrs
- Array of strings representing attribute namescacheOnly
- if true, read attributes from cache only without contacting
data stroeUMSException
getAttribute(String)
public AttrSet getAttributes(String[] attrNames, Locale locale) throws UMSException
attrNames
- Attribute nameslocale
- Locale of the attributes to be queriedUMSException
getAttribute(String)
public void setAttribute(Attr attr)
IMPORTANT: To make the changes persistent, you need to call the save method to save the changes.
attr
- Attribute and valuepublic void setAttribute(Attr attr, Locale locale)
IMPORTANT: To make the changes persistent, you need to call the save method to save the changes.
attr
- Attribute and valuelocale
- Intended locale of the attribute to be setpublic void changePassword(String entryDN, String attrName, String oldPassword, String newPassword) throws UMSException
entryDN
- DN of the profile whose template is to be setattrName
- password attribute nameoldPassword
- old passwordnewPassword
- new passwordAMException
- if an error occurs when changing user passwordSSOException
- If user's single sign on token is invalid.UMSException
public void removeAttribute(Attr attr)
IMPORTANT: To make the changes persistent, you need to call the save method to save the changes.
attr
- Attribute to be removedpublic String[] getAttributeNames()
public void modify(Collection<org.forgerock.opendj.ldap.Modification> modSet)
IMPORTANT: To make the changes persistent, you need to call the save method to save the changes.
modSet
- Set of modification of attributesModSet
public void modify(Attr attr, org.forgerock.opendj.ldap.ModificationType modificationType)
IMPORTANT: To make the changes persistent, you need to call the save method to save the changes.
attr
- Attribute value to be modifiedmodificationType
- Operation type in the modification. Input values include
ModificationType.ADD, ModificationType.DELETE, ModificationType.REPLACE, ModificationType.INCREMENT
ModSet
public void modify(String attrName, String value, org.forgerock.opendj.ldap.ModificationType modificationType)
IMPORTANT: To make the changes persistent, you need to call the save method to save the changes.
attrName
- Attribute name of the attribute to be modifiedvalue
- String value of the attributemodificationType
- Operation type in the modification. Input values include
ModificationType.ADD, ModificationType.DELETE, ModificationType.REPLACE, ModificationType.INCREMENT
public Guid getGuid()
public void rename(String newRDN, boolean deleteOldName) throws AccessRightsException, EntryNotFoundException, UMSException
newRDN
- the new RDN valuedeleteOldName
- if true old RDN value is deleted, otherwise the old value is
retained.AccessRightsException
- if an access rights exception occurs.EntryNotFoundException
- if the entry is not foundUMSException
- on failure to save to persistent storagepublic void save() throws AccessRightsException, EntryNotFoundException, UMSException
This save method takes no parameter. You use this save method when the object is already instantiated. For example,
User user = (User) UMSObject.getObject(principal, id); user.modify("telephonenumber", "650.937.4444", ModificationType.REPLACE); user.save();
AccessRightsException
- if an access rights exception occurs.EntryNotFoundException
- if the entry is not foundUMSException
- on failure to save to persistent storagepublic String getNamingAttribute()
public PersistentObject getParentObject() throws UMSException
UMSException
- on failure instantiating the parent objectpublic void addChild(PersistentObject object) throws AccessRightsException, EntryAlreadyExistsException, UMSException
object
- Child object to be added to this persistent container.AccessRightsException
- if an access rights exception occurs.EntryAlreadyExistsException
- if the entry already exists.UMSException
- if fail to add the given child object to the
container. Possible causes include
EntryAlreadyExists
, AccessRights
violation.public void removeChild(PersistentObject object) throws AccessRightsException, EntryNotFoundException, UMSException
object
- Child object to be removed.AccessRightsException
- if an access rights exception occurs.EntryNotFoundException
- if the entry is not found.UMSException
- if fail to remove the child object. Possible causes
includes EntryNotFount, AccessRights violation etc.public void removeChild(Guid childGuid) throws AccessRightsException, EntryNotFoundException, UMSException
childGuid
- Unique entry identification for the child to be removed.AccessRights
- if an access rights exception occurs.EntryNotFoundException
- if the entry is not found.UMSException
- if failure to remove the entry from the persistent
store. Possible causes include AccessRights violation,
EntryNotFound etc.AccessRightsException
public void remove() throws AccessRightsException, EntryNotFoundException, UMSException
AccessRights
- Exception if an access rights exception occurs.EntryNotFoundException
- if the entry is not foundUMSException
- from UMSSession.removeObject( principal, guid)AccessRightsException
public String toString()
public Guid getParentGuid()
getParentGuid
in interface ISearch
public SearchResults getChildren(String filter, SearchControl searchControl) throws InvalidSearchFilterException, UMSException
getChildren
in interface ISearch
filter
- Search filtersearchControl
- Search controlInvalidSearchFilterException
- if the search filter is invalidUMSException
- on searching for immediate children in the containerpublic SearchResults getChildren(String filter, String[] resultAttributeNames, SearchControl searchControl) throws InvalidSearchFilterException, UMSException
getChildren
in interface ISearch
filter
- Search filterresultAttributeNames
- Names of attributes to retrievesearchControl
- Search control objectInvalidSearchFilterException
- on invalid search filterUMSException
- on failure with searhingpublic SearchResults getChildren(SearchTemplate template, SearchControl searchControl) throws UMSException
Returning attributes are determined by the search template
getChildren
in interface ISearch
template
- Search templatesearchControl
- Search control, use default setting if searchControl == nullUMSException
- on failure with searchingpublic SearchResults search(String filter, SearchControl searchControl) throws InvalidSearchFilterException, UMSException
search
in interface ISearch
filter
- Search filtersearchControl
- Search control objectInvalidSearchFilterException
- on invalid search filterUMSException
- on failure with searchingpublic SearchResults search(String filter, String[] resultAttributeNames, SearchControl searchControl) throws InvalidSearchFilterException, UMSException
search
in interface ISearch
filter
- Search filterresultAttributeNames
- Names of attributes to retrievesearchControl
- Search control objectInvalidSearchFilterException
- on invalid search filterUMSException
- on failure with searchingpublic SearchResults search(SearchTemplate template, SearchControl searchControl) throws UMSException
search
in interface ISearch
template
- Search templatesearchControl
- Search control, use default setting if searchControl == nullUMSException
- on failure to searchpublic String getDN()
protected void setGuid(Guid guid)
guid
- String representation of guidprotected void setAttrSet(AttrSet attrSet)
attrSet
- The attribute set to be assigned as a reference (not a deep
copy)protected AttrSet getAttrSet()
public static String idToDN(String namingAttribute, String name, String[] parentID)
namingAttribute
- Naming attribute of the object.name
- Naming attribute value of the object.parentID
- Array of its parent names, all assumed to take
o
as the naming attributes.public boolean isMemberOf(IMembership im) throws UMSException
im
- Role or Group against which the membership is to be checkedtrue
if this object is a member of the
IMembership, false
otherwiseUMSException
- propagates any exception from the datalayerpublic Collection getRoles() throws UMSException
UMSException
- propagates any exception from the datalayerpublic Collection getACI() throws ACIParseException, UMSException
ACIParseException
- if any errorUMSException
public Collection getACI(String name) throws ACIParseException, UMSException
name
- Name of the ACI to get.ACIParseException
- in case of any errorUMSException
public void addACI(ACI aci) throws AccessRightsException, UMSException
aci
- ACI added to be added to this object.AccessRightsException
- if an access rights exception occurs.UMSException
- if any errorpublic void deleteACI(ACI aci) throws AccessRightsException, UMSException
aci
- ACI to be deleted.AccessRightsException
- if an access rights exception occurs.UMSException
- if any error.public void replaceACI(ACI oldACI, ACI newACI) throws AccessRightsException, UMSException
oldACI
- ACI to be replaced.newACI
- the new ACI.AccessRightsException
- if an access rights exception occurs.UMSException
- if any error.public static void addAttributeValue(SSOToken token, Guid guid, String name, String value) throws UMSException
token
- Authenticated prinicpal's single sign on token.guid
- Identifiation of the entry to which to add the attribute
value.name
- Name of the attribute to which value is being added.value
- Value to be added to the attribute.UMSException
- if any exception from the data layer.public static void removeAttributeValue(SSOToken token, Guid guid, String name, String value) throws UMSException
token
- Authenticated prinicpal's single sign on token.guid
- Identification of the entry from which to remove the
attribute value.name
- Name of the attribute from which value is being removed.value
- Value to be removed from the attribute.UMSException
- if any exception from the data layer.protected boolean isPersistent()
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.