Poseidon for UMLTM
  UMLdoc
 PREV  CLASSIFIER    NEXT  CLASSIFIER     FRAMES    NO FRAMES      
SUMMARY:   INNER | ATTR | ASSOC | CONSTR | METHOD     DETAIL:   INNER | ATTR | ASSOC | CONSTR | METHOD     DIAGRAMS:   COLLAB | SEQ | STATE | ACTIV

com.gentleware.jboogie.openapi

Class Command

com.gentleware.jboogie.openapi.Command
All known Subclassifier:
MacroCommand


public abstract class Command


A Command can be executed and undone. It is supposed to encapsulate all create/delete accesses to RefObjects. A typical sequence would be to create the Command then call execute.

Calls to redo/undo should only be made by the UndoManager.

It is a good idea to gather all execute and undo information in the command's constructor or in lazyInit. Separating data collection and execution makes redo possible.

Authors:
Stephen Kelvin


 Attribute Summary
public static List  DONT_MODIFY_LIST
 
public static String  DONT_MODIFY_STRING
Constant to use if a parameter should not be modified. 
private boolean  _firstRedo
 
private String  _globalCommandId
 
private boolean  _hasBeenDone
A little sanity checking: redo() and undo() must be called strictly alternating. 
private boolean  _hasBeenUndone
 
private boolean  _hasExecuted
A little sanity checking: Execute must not be called more than once. 
private boolean  _isDipulizing
 
private boolean  _lazyInited
 
private boolean  _localCommand
Is this command a local one (issued by the user of this Poseidon-instance, or is it an external command issued by some other user. 
private String  _participantId
 
private Set  _smIdsToDipulize
 
public static boolean  makingLocalCommandFromRemoteCommand
THIS IS ONLY NEEDED FOR OTHER CLIENTS - not for the client which i am when creating my own command  
arrow_up
 

 Association Summary
protected Command  _activeCommand
 
private Command  _activeRootCommand
 
private DiIdProvider  _diIdProvider
 
private MacroCommand  _diPulizeCommand
 
private Command  _parentCommand
 
private Project  _project
The command is managed by this project's UndoManager. 
private ResourceId  _resourceId
 
private SmIdProvider  _smIdProvider
 
private Target.Memento  _targetMementoAfterRedo
 
private Target.Memento  _targetMementoBeforeRedo
 
public Command  command
 
arrow_up
 

 Constructor Summary
public   Command(Project project, ResourceId resourceId)
 
arrow_up
 

 Method Summary
public void   addDipulizeCommand(Command dipulizeCommand)
 
private void   addSmIdsToList(Object object, Set involvedIds)
Adds smIds of the object to the list involvedIds. 
private void   checkCommandCreation()
This method checks wether this command is created in a Command factory or not. 
private void   dipulize()
 
protected void   dipulizeInternal()
 
public final void   doRe()
Called by the UndoManager to (re)do this command. 
public final void   doUn()
Called by the UndoManager to undo this command. 
public boolean   doesConflictWithCurrentModel(ConflictChecker conflictChecker)
 
public final void   execute()
 
public static Command   getActiveCommand()
Returns the command which is currently running. 
public static Command   getActiveRootCommand()
Returns currently running root command. 
public final String   getDescription()
Returns the Commands description. 
public final DiIdProvider   getDiIdProvider()
 
public MacroCommand   getDiPulizeCommand()
 
public String   getGlobalCommandId()
 
public StringBuffer   getInnerGlobalCommandIds()
 
public void   getInvolvedSmIds(Set alreadyInvolvedIds)
Reflective method to collect all SmIds the command uses. 
public LayoutPool   getLayoutPool()
You can return a special layout pool here if your command wants to layout differently than the standard. 
public final Command   getParentCommand()
For internal use only related to MacroCommands. 
public String   getParticipantId()
 
protected final Project   getProject()
Access to this command's project (if needed by any subclass)  
public ResourceId   getResourceId()
returns specifuc for given class resourceId  
final Command   getRootCommand()
For internal use only related to MacroCommands. 
public final SmIdProvider   getSmIdProvider()
 
private Target.Memento   getTargetMemento()
 
public boolean   hasBeenDone()
 
public boolean   hasBeenUndone()
 
public boolean   hasDiIdProviderCreatedIds()
 
public boolean   hasSmIdProviderCreatedIds()
 
public boolean   isDipulizing()
 
public static boolean   isExecuting()
True if a command is currently running. 
public boolean   isFirstRedo()
 
public final boolean   isLazyInited()
True when lazy init is over. 
public boolean   isLocalCommand()
 
public final boolean   isRootCommand()
For internal use only related to MacroCommands. 
public void   lazyInit()
Put stuff here that should only be done once right before redo() is called for the first time. 
public void   lazyInitNoCommands()
Place all Initing here which does NOT create commands. 
public void   redo()
Should be implemented by subclasses to do whatever the command is supposed to do. 
public void   redoDiPulizeCommand()
 
protected void   redoDipulizeCommands()
 
public void   setDiIdProvider(DiIdProvider diIdProvider)
 
public void   setDiPulizeCommand(MacroCommand potentialMacro)
 
public void   setGlobalCommandId(String globalCommandId)
 
private void   setLayoutInvalid(Id id)
 
public final void   setParentCommand(Command parentCommand)
For internal use only related to MacroCommands. 
public void   setParticipantId(String participantId)
Tell the command which participant was the original creator/requestor of this command  
public void   setSmIdProvider(SmIdProvider smIdProvider)
 
public void   setToNonLocalCommand()
 
public void   showIdProviderContent()
 
public String   toString()
 
public void   undo()
This method should be implemented by subclasses to undo whatever the command did in execute. 
protected void   undoDipulizeCommands()
 
protected void   update(Id id, UpdatePolicy updatePolicy)
 
protected void   updateDiAndPiccolo(RefObject element)
Updates the di and piccolo representations of the specified model element  
protected void   updateDiAndPiccolo(Collection smIds)
 
protected void   updateRenderer(Collection updateRendererSmIds)
 
private void   updateRenderer(Id id)
 
arrow_up
 

Tagged Values
static false
 

 Attribute Detail

DONT_MODIFY_LIST

public static List DONT_MODIFY_LIST

arrow_up


DONT_MODIFY_STRING

public static String DONT_MODIFY_STRING

Constant to use if a parameter should not be modified.  
arrow_up


_firstRedo

private boolean _firstRedo

arrow_up


_globalCommandId

private String _globalCommandId

arrow_up


_hasBeenDone

private boolean _hasBeenDone

A little sanity checking: redo() and undo() must be called strictly alternating.  
arrow_up


_hasBeenUndone

private boolean _hasBeenUndone

arrow_up


_hasExecuted

private boolean _hasExecuted

A little sanity checking: Execute must not be called more than once.  
arrow_up


_isDipulizing

private boolean _isDipulizing

arrow_up


_lazyInited

private boolean _lazyInited

arrow_up


_localCommand

private boolean _localCommand

Is this command a local one (issued by the user of this Poseidon-instance, or is it an external command issued by some other user. (enterprise-edition)  
arrow_up


_participantId

private String _participantId

arrow_up


_smIdsToDipulize

private Set _smIdsToDipulize

arrow_up


makingLocalCommandFromRemoteCommand

public static boolean makingLocalCommandFromRemoteCommand

THIS IS ONLY NEEDED FOR OTHER CLIENTS - not for the client which i am when creating my own command  
arrow_up
 Association Detail

_activeCommand

protected Command _activeCommand

arrow_up


_activeRootCommand

private Command _activeRootCommand

arrow_up


_diIdProvider

private DiIdProvider _diIdProvider

arrow_up


_diPulizeCommand

private MacroCommand _diPulizeCommand

arrow_up


_parentCommand

private Command _parentCommand

arrow_up


_project

private Project _project

The command is managed by this project's UndoManager. Subclasses may query this, so they don't need to store the project themselves.  
arrow_up


_resourceId

private ResourceId _resourceId

arrow_up


_smIdProvider

private SmIdProvider _smIdProvider

arrow_up


_targetMementoAfterRedo

private Target.Memento _targetMementoAfterRedo

arrow_up


_targetMementoBeforeRedo

private Target.Memento _targetMementoBeforeRedo

arrow_up


command

public Command command

arrow_up
 Constructor Detail

Command

public Command Command(Project project, ResourceId resourceId)

Parameters:
project -
resourceId -
Returns:
arrow_up
 Method Detail

addDipulizeCommand

public void addDipulizeCommand(Command dipulizeCommand)

Parameters:
dipulizeCommand -
arrow_up


addSmIdsToList

private void addSmIdsToList(Object object, Set involvedIds)


Adds smIds of the object to the list involvedIds. The object itself is added if it is a smId. If the object is a diId the grounded SmElement is added and if the object is a collection all contained SmIds are added recursive.  
Parameters:
object -
involvedIds -
arrow_up


checkCommandCreation

private void checkCommandCreation()


This method checks wether this command is created in a Command factory or not. This is important for the EE context.  
arrow_up


dipulize

private void dipulize()

arrow_up


dipulizeInternal

protected void dipulizeInternal()

arrow_up


doRe

public final void doRe()


Called by the UndoManager to (re)do this command.  
Exceptions:
CommandConflictsWithModelException Before the command is really doRe()ed, we check wether the command works on correct premises. if not, then the command is not performed, but throws this exception, causing the undomanager to rollback.
arrow_up


doUn

public final void doUn()


Called by the UndoManager to undo this command.  
arrow_up


doesConflictWithCurrentModel

public boolean doesConflictWithCurrentModel(ConflictChecker conflictChecker)

Parameters:
conflictChecker -
Returns:
arrow_up


execute

public final void execute()

arrow_up


getActiveCommand

public static Command getActiveCommand()


Returns the command which is currently running.  
Returns:
arrow_up


getActiveRootCommand

public static Command getActiveRootCommand()


Returns currently running root command.  
Returns:
arrow_up


getDescription

public final String getDescription()


Returns the Commands description. If no description was set by the command, then the commands classname is returned. This method is final, do not override it. You may use setDescription() in your commands constructor to set the default value, and you may specify the commands real work in the redo()-method, when all the needed modelElements exist  
Returns:
Some string.
arrow_up


getDiIdProvider

public final DiIdProvider getDiIdProvider()

Returns:
arrow_up


getDiPulizeCommand

public MacroCommand getDiPulizeCommand()

Returns:
arrow_up


getGlobalCommandId

public String getGlobalCommandId()

Returns:
arrow_up


getInnerGlobalCommandIds

public StringBuffer getInnerGlobalCommandIds()

Returns:
arrow_up


getInvolvedSmIds

public void getInvolvedSmIds(Set alreadyInvolvedIds)


Reflective method to collect all SmIds the command uses. That are all attributes of this object which have the type SmId or the grounded elements of the DiId. The SmId are added too, if they are in collections.  
Parameters:
alreadyInvolvedIds -
arrow_up


getLayoutPool

public LayoutPool getLayoutPool()


You can return a special layout pool here if your command wants to layout differently than the standard. This is only for advanced uses, probably related to layouting plugins.  
Returns:
arrow_up


getParentCommand

public final Command getParentCommand()


For internal use only related to MacroCommands.  
Returns:
arrow_up


getParticipantId

public String getParticipantId()

Returns:
arrow_up


getProject

protected final Project getProject()


Access to this command's project (if needed by any subclass)  
Returns:
The project in which the command is running.
arrow_up


getResourceId

public ResourceId getResourceId()


returns specifuc for given class resourceId  
Returns:
arrow_up


getRootCommand

final Command getRootCommand()


For internal use only related to MacroCommands.  
Returns:
arrow_up


getSmIdProvider

public final SmIdProvider getSmIdProvider()

Returns:
arrow_up


getTargetMemento

private Target.Memento getTargetMemento()

Returns:
arrow_up


hasBeenDone

public boolean hasBeenDone()

Returns:
arrow_up


hasBeenUndone

public boolean hasBeenUndone()

Returns:
arrow_up


hasDiIdProviderCreatedIds

public boolean hasDiIdProviderCreatedIds()

Returns:
arrow_up


hasSmIdProviderCreatedIds

public boolean hasSmIdProviderCreatedIds()

Returns:
arrow_up


isDipulizing

public boolean isDipulizing()

Returns:
true if the commnad is inside the dipulizeInternal() method
arrow_up


isExecuting

public static boolean isExecuting()


True if a command is currently running.  
Returns:
arrow_up


isFirstRedo

public boolean isFirstRedo()

Returns:
arrow_up


isLazyInited

public final boolean isLazyInited()


True when lazy init is over. When this method returns true, it is illegal for this command to create IDs.  
Returns:
arrow_up


isLocalCommand

public boolean isLocalCommand()

Returns:
arrow_up


isRootCommand

public final boolean isRootCommand()


For internal use only related to MacroCommands.  
Returns:
arrow_up


lazyInit

public void lazyInit()


Put stuff here that should only be done once right before redo() is called for the first time. But only place your command-creation-stuff here. Anything else MUST be placed into lazyInitNoCommands!  
arrow_up


lazyInitNoCommands

public void lazyInitNoCommands()


Place all Initing here which does NOT create commands. If you do not place that stuff here, then it will not be run in the enterprise-context, because in ee-context, the lazyInit() is ignored on the remote clients and on the server! Only this method will be called there  
arrow_up


redo

public void redo()


Should be implemented by subclasses to do whatever the command is supposed to do. Package-private because only the UndoManager should call this. Must not be invoked from anywhere else than this instance's doRe() method!  
arrow_up


redoDiPulizeCommand

public void redoDiPulizeCommand()

arrow_up


redoDipulizeCommands

protected void redoDipulizeCommands()

arrow_up


setDiIdProvider

public void setDiIdProvider(DiIdProvider diIdProvider)

Parameters:
diIdProvider -
arrow_up


setDiPulizeCommand

public void setDiPulizeCommand(MacroCommand potentialMacro)

Parameters:
potentialMacro -
arrow_up


setGlobalCommandId

public void setGlobalCommandId(String globalCommandId)

Parameters:
globalCommandId -
arrow_up


setLayoutInvalid

private void setLayoutInvalid(Id id)

Parameters:
id -
arrow_up


setParentCommand

public final void setParentCommand(Command parentCommand)


For internal use only related to MacroCommands.  
Parameters:
parentCommand -
arrow_up


setParticipantId

public void setParticipantId(String participantId)


Tell the command which participant was the original creator/requestor of this command  
Parameters:
participantId -
arrow_up


setSmIdProvider

public void setSmIdProvider(SmIdProvider smIdProvider)

Parameters:
smIdProvider -
arrow_up


setToNonLocalCommand

public void setToNonLocalCommand()

arrow_up


showIdProviderContent

public void showIdProviderContent()

arrow_up


toString

public String toString()

Returns:
arrow_up


undo

public void undo()


This method should be implemented by subclasses to undo whatever the command did in execute. This implies that any subclass should gather the information for undoing before executing. Package-private because only the UndoManager should call this. Must not be invoked from anywhere else than this instance's doUn() method!  
arrow_up


undoDipulizeCommands

protected void undoDipulizeCommands()

arrow_up


update

protected void update(Id id, UpdatePolicy updatePolicy)

Parameters:
id -
updatePolicy -
arrow_up


updateDiAndPiccolo

protected void updateDiAndPiccolo(RefObject element)


Updates the di and piccolo representations of the specified model element  
Parameters:
element - model element to update
arrow_up


updateDiAndPiccolo

protected void updateDiAndPiccolo(Collection smIds)

Parameters:
smIds -
arrow_up


updateRenderer

protected void updateRenderer(Collection updateRendererSmIds)

Parameters:
updateRendererSmIds -
arrow_up


updateRenderer

private void updateRenderer(Id id)

Parameters:
id -
arrow_up
Created  2004 - 10 - 21

    Poseidon for UMLTM
  UMLdoc
 PREV  CLASSIFIER    NEXT  CLASSIFIER     FRAMES    NO FRAMES      
SUMMARY:   INNER | ATTR | ASSOC | CONSTR | METHOD     DETAIL:   INNER | ATTR | ASSOC | CONSTR | METHOD     DIAGRAMS:   COLLAB | SEQ | STATE | ACTIV

Generated with Poseidon for UMLTM.
Poseidon is a registered trademark of Gentleware AG in Germany, USA and other countries. Copyright 2003-2004 Gentleware AG, Schanzenstr. 70, 20357 Hamburg, Germany. All Rights Reserved.

UML is a trademark or registered trademark of Object Management Group, Inc. in the U.S. and other countries.