Nitido Inc.

com.nitido.nimx.services.datacontrol.cachedmap
Class AttrModification

java.lang.Object
  extended by com.nitido.nimx.services.datacontrol.cachedmap.AttrModification

public class AttrModification
extends java.lang.Object

This data object encapsulate the transient data when processing a batch modification.

This is a "transaction operation container" object. It condense multiple ADD/REMOVE operations on the same attribute to the same ADD/REMOVE operation. It also perform validation logic to ensures the following:

  1. MODIFY operation never mixed with ADD/REMOVE operation of the same attribute (NOTE: each AttrModification represents the operation on a specific attribute. So, for each AttrModification object, it cannot contain both the MODIFY and ADD/REMOVE at the same time.)
  2. REMOVE "all values" operation (i.e. passing no value at all when appending a REMOVE operation) cannot mix with REMOVE "specific values" operation.


Field Summary
protected  java.lang.String _attrName
           
protected  com.nitido.nimx.services.datacontrol.cachedmap.CacheSetting _cacheSetting
           
protected  java.lang.String _userSpaceKey
           
 
Constructor Summary
AttrModification(java.lang.String userSpaceKey, java.lang.String attrName, com.nitido.nimx.services.datacontrol.cachedmap.CacheSetting cacheSetting)
          The default constructor.
 
Method Summary
 int appendAddCommand(java.io.Serializable[] values)
          Append a set of values to be added to the target attribute.
 int appendModCommand(java.io.Serializable[] values)
          Append a set of values to be MODIFY on the target attribute.
 int appendRemoveCommand(java.io.Serializable[] values)
          Append a set of values to be removed from the target attribute.
 java.util.ArrayList getAddList()
          Get the list of values to be added.
 java.io.Serializable[] getAddValues()
          Get the array of add values.
 java.io.Serializable[] getModValues()
          Get the array of modification values.
 java.util.ArrayList getRemoveList()
          Get the list of values to be removed.
 java.io.Serializable[] getRemoveValues()
          Get the array of remove values.
 boolean needRefetch()
          Check if this attrModification object's command requires "refetching".
 java.lang.String toString()
          Generates the debug string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_userSpaceKey

protected final java.lang.String _userSpaceKey

_attrName

protected final java.lang.String _attrName

_cacheSetting

protected final com.nitido.nimx.services.datacontrol.cachedmap.CacheSetting _cacheSetting
Constructor Detail

AttrModification

public AttrModification(java.lang.String userSpaceKey,
                        java.lang.String attrName,
                        com.nitido.nimx.services.datacontrol.cachedmap.CacheSetting cacheSetting)
The default constructor.

Parameters:
userSpaceKey - The user space key of the values to be modified/added/removed.
attrName - The LDAP attribute name that the user space key is mapped to.
cacheSetting - The cache setting associated to the specified user space key.
Method Detail

appendModCommand

public int appendModCommand(java.io.Serializable[] values)
                     throws DataControlException
Append a set of values to be MODIFY on the target attribute. The MODIFY operation actually replaces all the existing values of the attribute with the new values. As a result, this method will throw exception if it has been invoked any of the methods appendModCommand() appendRemoveCommand() and appendAddCommand() has been invoked before.

Parameters:
values - The new values of the attribute. If this parameter is null, an empty array, or the first member is null, this method will treat the request as a "remove" command and will call the appendRemoveCommand(null).
Throws:
DataControlException

appendAddCommand

public int appendAddCommand(java.io.Serializable[] values)
                     throws DataControlException
Append a set of values to be added to the target attribute. You may invoke this method more than once, the new values will just be appended to the existing pending "ADD" values. However, this method will not check for duplication of the values to be added. Moreover, if the appendModCommand has been invoked before, this method will throw an exception. It is because you cannot have the "replace existing values" and "adding new values" at the same time. (Otherwise, we will need to monitor also the sequence of the commands that were being launched. Moreover, some LDAP server simply doesn't allow it.) Similarly, this method will also fails if the appendRemoveCommand( null ) was invoked before. A null parameter for appendRemoveCommand() means remove all existing values. So, we cannot add new values to it if all the values need to be removed.

Parameters:
values - The new values to be added to the attribute.
Throws:
DataControlException

appendRemoveCommand

public int appendRemoveCommand(java.io.Serializable[] values)
                        throws DataControlException
Append a set of values to be removed from the target attribute. If you passed a null parameter to this method, it will remove all existing values. As a result, if you have invoked this method with a null parameter, you cannot invoke any of the methods appendModCommand(), appendRemoveCommand() or appendAddCommand() again.

On the other hand, if you have specified valid values to be removed, The method will be successful even if you have invoked appendAddCommand() and appendRemoveCommand( with valid values ) before. You may invoke this method more than once, the new values will just be appended to the existing pending "REMOVE" values. However, this method will not check for duplication of the values to be added. Moreover, if the appendModCommand has been invoked before, this method will throw an exception. It is because you cannot have the "replace existing values" and "removing values" at the same time. (Otherwise, we will need to monitor also the sequence of the commands that were being launched. Moreover, some LDAP server simply doesn't allow it.)

Parameters:
values - The new values to be added to the attribute.
Throws:
DataControlException

getModValues

public java.io.Serializable[] getModValues()
Get the array of modification values.


getAddValues

public java.io.Serializable[] getAddValues()
Get the array of add values.


getRemoveValues

public java.io.Serializable[] getRemoveValues()
Get the array of remove values.


getAddList

public java.util.ArrayList getAddList()
Get the list of values to be added.


getRemoveList

public java.util.ArrayList getRemoveList()
Get the list of values to be removed.


needRefetch

public boolean needRefetch()
Check if this attrModification object's command requires "refetching". The refetching is required if we are adding new values to the attribute or removing specific values from the backend.


toString

public java.lang.String toString()
Generates the debug string.

Overrides:
toString in class java.lang.Object

Nitido NiM 2.5 Java API

These JavaDoc pages are generated for release/nim_2_5-2.5.44

Copyright © 1999-2009 Nitido Inc.    Proprietary and Confidential.    All Rights Reserved.