com.metamatrix.common.actions
Class ActionDefinition

java.lang.Object
  extended by com.metamatrix.common.actions.ActionDefinition
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
CreateObject, TargetedActionDefinition

public abstract class ActionDefinition
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

This abstract class is the foundation for the set of classes which define the atomic actions for the ModificationAction class.

See Also:
ModificationAction, Serialized Form

Constructor Summary
  ActionDefinition()
          Create a new instance of an action with no target, no attribute definition, and no arguments.
protected ActionDefinition(ActionDefinition rhs)
           
  ActionDefinition(java.lang.Object[] arguments)
          Create a new instance of an action.
  ActionDefinition(java.lang.Object target, AttributeDefinition attribute)
          Create a new instance of an action definition by specifying the target.
  ActionDefinition(java.lang.Object target, AttributeDefinition attribute, java.lang.Object[] arguments)
          Create a new instance of an action definition by specifying the target.
protected ActionDefinition(java.lang.Object target, java.lang.Integer code)
           
protected ActionDefinition(java.lang.Object target, java.lang.Integer code, java.lang.Object[] arguments)
           
protected ActionDefinition(java.lang.Object target, java.lang.Integer code, java.lang.Object[] arguments, long creationTime)
           
 
Method Summary
abstract  java.lang.Object clone()
          Return a deep cloned instance of this object.
abstract  java.lang.String getActionDescription()
          Get the description (i.e., verb) for this type of action.
 java.lang.Object[] getArguments()
           
 java.lang.Integer getAttributeCode()
          Get the an attribute definition code for this action.
 java.lang.String getAttributeDescription()
          Return whether this definition has an attribute definition.
 java.util.Date getCreationTime()
          Get the time that this action was created.
 long getCreationTimeMillis()
          Get the time as milliseconds that this action was created.
 java.lang.Object getTarget()
          Get the target object for this action.
abstract  ActionDefinition getUndoActionDefinition()
          Obtain the definition of the action that undoes this action definition.
 boolean hasArguments()
          Return whether this definition has a target.
 boolean hasAttributeCode()
          Return whether this definition has an attribute definition.
 boolean hasTarget()
          Return whether this definition has a target.
 java.lang.String toString()
          Returns a string representing the current state of the object.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ActionDefinition

public ActionDefinition()
Create a new instance of an action with no target, no attribute definition, and no arguments.


ActionDefinition

public ActionDefinition(java.lang.Object[] arguments)
Create a new instance of an action.

Parameters:
arguments - the objects that define the arguments for this action.

ActionDefinition

public ActionDefinition(java.lang.Object target,
                        AttributeDefinition attribute,
                        java.lang.Object[] arguments)
Create a new instance of an action definition by specifying the target.

Parameters:
target - the object (or identifier for the object) that is the target of this action.
arguments - the objects that define the arguments for this action.

ActionDefinition

public ActionDefinition(java.lang.Object target,
                        AttributeDefinition attribute)
Create a new instance of an action definition by specifying the target.

Parameters:
target - the object (or identifier for the object) that is the target of this action.
arguments - the objects that define the arguments for this action.

ActionDefinition

protected ActionDefinition(java.lang.Object target,
                           java.lang.Integer code)

ActionDefinition

protected ActionDefinition(java.lang.Object target,
                           java.lang.Integer code,
                           java.lang.Object[] arguments,
                           long creationTime)

ActionDefinition

protected ActionDefinition(java.lang.Object target,
                           java.lang.Integer code,
                           java.lang.Object[] arguments)

ActionDefinition

protected ActionDefinition(ActionDefinition rhs)
Method Detail

getCreationTime

public java.util.Date getCreationTime()
Get the time that this action was created.

Returns:
the creation time.

getCreationTimeMillis

public long getCreationTimeMillis()
Get the time as milliseconds that this action was created.

Returns:
the creation time as milliseconds.

getActionDescription

public abstract java.lang.String getActionDescription()
Get the description (i.e., verb) for this type of action.

Returns:
the string description for this type of action.

clone

public abstract java.lang.Object clone()
Return a deep cloned instance of this object. Subclasses must override this method.

Overrides:
clone in class java.lang.Object
Returns:
the object that is the clone of this instance.

toString

public java.lang.String toString()
Returns a string representing the current state of the object.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this instance.

getUndoActionDefinition

public abstract ActionDefinition getUndoActionDefinition()
Obtain the definition of the action that undoes this action definition. If a modification action with the returned action definition is applied to the same target (when the state is such as that left by the original modification action), the resulting target will be left in a state that is identical to the target before either action were applied.

Returns:
the action definition that undoes this action definition.

hasTarget

public final boolean hasTarget()
Return whether this definition has a target.

Returns:
true if the target of this object is not null.

hasArguments

public final boolean hasArguments()
Return whether this definition has a target.

Returns:
true if the target of this object is not null.

hasAttributeCode

public final boolean hasAttributeCode()
Return whether this definition has an attribute definition.

Returns:
true if the target of this object is not null.

getAttributeDescription

public final java.lang.String getAttributeDescription()
Return whether this definition has an attribute definition.

Returns:
true if the target of this object is not null.

getTarget

public final java.lang.Object getTarget()
Get the target object for this action.

Returns:
the target object, or null if there is no target defined

getAttributeCode

public final java.lang.Integer getAttributeCode()
Get the an attribute definition code for this action.

Returns:
the attribute definition code as an Integer, or null if there is no attribute defined.

getArguments

public java.lang.Object[] getArguments()


Copyright © 2009. All Rights Reserved.