com.sap.security.api
Interface IPrincipalMaint

All Superinterfaces:
IPrincipal, java.io.Serializable
All Known Subinterfaces:
IGroup, IPrincipalSet, IRole, IUserAccount, IUserMaint

public interface IPrincipalMaint
extends IPrincipal

This interface extends IPrincipal. It provides methods to change a principal's attributes, to commit these changes to the principal store or to roll them back (i.e. discard them) if appropriate. It is intended for administration of user profiles (including self-administration). The set-methods with boolean return values return true if the new value is different from the previous value. Calling of set-methods with a value of null to effectively remove an attribute. If invalid arguments in set-methods are detected, a UMRuntimeException is thrown. NOTE: For consistency reasons no leading or trailing spaces are allowed in namespaces, attribute names and String values.


Fields inherited from interface com.sap.security.api.IPrincipal
BYTE_TYPE, DEFAULT_NAMESPACE, DEFAULT_RELATION_NAMESPACE, DESCRIPTION, DISPLAYNAME, PRINCIPAL_CREATION_DATE, PRINCIPAL_MODIFY_DATE, PRINCIPAL_RELATION_MEMBER_ATTRIBUTE, PRINCIPAL_RELATION_PARENT_ATTRIBUTE, STRING_TYPE, TRANSIENT_NAMESPACE, UNIQUE_NAME, VERSIONSTRING
 
Method Summary
 void commit()
          Commit changed principal data to the principal store.
 boolean isModified()
          Check if the object has been modified
 void rollback()
          Roll back (i.e.
 void save()
          Call this function to save/update the principal data.
 boolean setAttribute(java.lang.String namespace, java.lang.String name, java.lang.String[] values)
          Generic method to associate arbitrary text data with a principal.
 boolean setBinaryAttribute(java.lang.String namespace, java.lang.String name, byte[] value)
          Generic method to associate arbitrary binary data with a principal.
 boolean setDisplayName(java.lang.String displayName)
          Sets the displayName of this principal.
 
Methods inherited from interface com.sap.security.api.IPrincipal
created, equals, getAttribute, getAttributeNames, getAttributeNamespaces, getAttributeType, getBinaryAttribute, getDisplayName, getParents, getUniqueID, hashCode, isExistenceChecked, isMutable, lastModified, refresh
 

Method Detail

setAttribute

public boolean setAttribute(java.lang.String namespace,
                            java.lang.String name,
                            java.lang.String[] values)
Generic method to associate arbitrary text data with a principal. The method will return true if values is different from the attribute's previous values, false otherwise. Namespace and name can have up to 255 characters. Each value String can have up to 255 characters. If the given values array is null, the attribute is deleted on the persistence. NOTE: Doublets in the values array are removed. I.e. if the values array contains ["t1","t1","t2"], it will be stored as ["t1","t2"].
Parameters:
namespace - namespace of the attribute to set (max. 255 characters).
name - name of the attribute (max. 255 characters)
values - values of the attribute (each max. 255 characters)
Throws:
UMRuntimeException - if either namespace or name is not supported

setBinaryAttribute

public boolean setBinaryAttribute(java.lang.String namespace,
                                  java.lang.String name,
                                  byte[] value)
Generic method to associate arbitrary binary data with a principal. The method will return true if values is different from the attribute's previous values, false otherwise. If the given value is null, the attribute is deleted on the persistence. Namespace and name can have up to 255 characters.
Parameters:
namespace - namespace of the attribute to set (max. 255 characters).
name - name of the attribute (max. 255 characters)
values - byte array of values of the attribute
Throws:
UMRuntimeException - if either namespace or name is not supported

isModified

public boolean isModified()
Check if the object has been modified
Returns:
true if any of the set method on this object have been called.

setDisplayName

public boolean setDisplayName(java.lang.String displayName)
                       throws UMException
Sets the displayName of this principal.
Throws:
UMException - if the displayName could not be set

commit

public void commit()
            throws UMException
Commit changed principal data to the principal store. Calling one of commit() or rollback will be required to unlock the principal if the principal factory employs pessimistic locking. Note: This method will throw a
Throws:
UMException - if the data can't be commited to the principal store.

rollback

public void rollback()
Roll back (i.e. discard) the changes applied to a principal object up to the point when IPrincipalMaint was requested or until the latest call of commit. Calling one of commit() or rollback will be required to unlock the principal if the principal factory employs pessimistic locking.

save

public void save()
          throws UMException
Call this function to save/update the principal data. However, the data will not be stored permanently until commit() is called. rollback() may be called to revert back to the old state. rollback() must be called to release the resources (like db connections) and locks (if implemented). The purpose of this method is to simulate a commit operation. Instead of committing the changes the data store checks if there are potential errors which would prevent the principal to be stored successfully. This method can be called optionally before doing a commit. Depending on the data store which is used to store principals there might be different UMExceptions which could be thrown.


Copyright © 2002 SAP AG All Rights Reserved.