org.nuxeo.core.resources.model.impl
Class AbstractSiteOperation

java.lang.Object
  extended by org.nuxeo.core.resources.model.impl.AbstractSiteOperation
All Implemented Interfaces:
ISiteOperation
Direct Known Subclasses:
CompositeSiteOperation, CreateOperation, DeleteOperation, EditOperation, GetChildrenOperation, GetContentsOperation, ModifyOperation, SetContentsOperation

public abstract class AbstractSiteOperation
extends java.lang.Object
implements ISiteOperation

Author:
Bogdan Stefanescu

Field Summary
 
Fields inherited from interface org.nuxeo.core.resources.model.ISiteOperation
ANY, ASYNCHRONOUS, COPY, CREATE, DELETE, EDIT, HISTORY_ENABLED, MOVE, NONE, PUBLISH, RESTRICTED, SUBMIT, UNDOABLE
 
Constructor Summary
AbstractSiteOperation()
           
 
Method Summary
 void clearFlag(int flag)
          Clear the given flag (set the corresponding bit to 0)
 void execute()
          Execute the operation.
abstract  ISiteController getController()
          Get the site controller that should execute the operation
 int getFlags()
          Get the supported actions on the operation as a bit mask.
 ISiteOperation getInverseOperation()
          Get the inverse operation.
 org.eclipse.core.runtime.IProgressMonitor getProgressMonitor()
          Get the progress monitor used by this operation or null if none
 ISiteOperationStatus getStatus()
          Get the operation status If the operation was not executed the status is null
abstract  java.lang.String getType()
          Get the operation type
 boolean isAsynchronous()
          Tests whther the operation should be exectued asynchronously
 boolean isFlagSet(int flag)
          Tests if the given flag is set (the corresponding bit is 1)
 boolean isHistoryEnabled()
          Test whether ot nmot the operation should be logged
 boolean isRestricted()
          Test whether security checks should be done before executing the operation
 boolean isUndoable()
          Test whether the operation may be undoed.
 void setAsynchronous(boolean val)
          Set the asynchornous flag.
 void setFlag(int flag)
          Set the given flag (set the corresponding bit to 1)
 void setFlags(int flags)
          Set the supported actioons on the operation
 void setHistoryEnabled(boolean val)
          Set the history enabled flag
 void setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor monitor)
          Set the progress monitor to be used by the operation
 void setRestricted(boolean val)
          Set the security check flag.
 void setStatus(ISiteOperationStatus status)
          Set the operation status
 void setUndoable(boolean val)
          Set the undoable flag.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractSiteOperation

public AbstractSiteOperation()
Method Detail

getType

public abstract java.lang.String getType()
Description copied from interface: ISiteOperation
Get the operation type

Specified by:
getType in interface ISiteOperation
Returns:
the operation type

getController

public abstract ISiteController getController()
Get the site controller that should execute the operation

Returns:
the controller

execute

public void execute()
             throws org.eclipse.core.runtime.CoreException
Description copied from interface: ISiteOperation
Execute the operation. The operation is determining the target site controller based on the resources it manipulates and the type of operation, then it is delegating the operation execution to the controller

Specified by:
execute in interface ISiteOperation
Throws:
org.eclipse.core.runtime.CoreException - if an error occurs

getStatus

public ISiteOperationStatus getStatus()
Description copied from interface: ISiteOperation
Get the operation status If the operation was not executed the status is null

Specified by:
getStatus in interface ISiteOperation
Returns:
the operation status.

setStatus

public void setStatus(ISiteOperationStatus status)
Description copied from interface: ISiteOperation
Set the operation status

Specified by:
setStatus in interface ISiteOperation
Parameters:
status - the status to set

getProgressMonitor

public org.eclipse.core.runtime.IProgressMonitor getProgressMonitor()
Description copied from interface: ISiteOperation
Get the progress monitor used by this operation or null if none

Specified by:
getProgressMonitor in interface ISiteOperation
Returns:
the progress monitor used by this operation or null if none

setProgressMonitor

public void setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor monitor)
Description copied from interface: ISiteOperation
Set the progress monitor to be used by the operation

Specified by:
setProgressMonitor in interface ISiteOperation

getInverseOperation

public ISiteOperation getInverseOperation()
Description copied from interface: ISiteOperation
Get the inverse operation. The inverse operation is used by an undo/redo manager to undo an operation. Note that it is not assumed that an inverse operation can be undoed (i.e. it may not provide an inverse op. of itself) Redoing an operation means undoing the inverse operation. So if the inverse operation is not undoable then the operation is not redoable. So operations supporting undo are not necesarly supporting redo

Specified by:
getInverseOperation in interface ISiteOperation
Returns:
the inverse operation

getFlags

public int getFlags()
Description copied from interface: ISiteOperation
Get the supported actions on the operation as a bit mask. This is mainly used to specify what additional handling is supported by the operation. The default is ISiteOperation.NONE this means operation

Specified by:
getFlags in interface ISiteOperation
Returns:
the supported actions on the operation as a bit mask

setFlags

public void setFlags(int flags)
Description copied from interface: ISiteOperation
Set the supported actioons on the operation

Specified by:
setFlags in interface ISiteOperation
Parameters:
flags - the bit mask of supported actions

setFlag

public void setFlag(int flag)
Description copied from interface: ISiteOperation
Set the given flag (set the corresponding bit to 1)

Specified by:
setFlag in interface ISiteOperation
Parameters:
flag - the flag to set

clearFlag

public void clearFlag(int flag)
Description copied from interface: ISiteOperation
Clear the given flag (set the corresponding bit to 0)

Specified by:
clearFlag in interface ISiteOperation
Parameters:
flag - the flag to clear

isFlagSet

public boolean isFlagSet(int flag)
Description copied from interface: ISiteOperation
Tests if the given flag is set (the corresponding bit is 1)

Specified by:
isFlagSet in interface ISiteOperation
Parameters:
flag - the flag to test
Returns:
true if the flag is set, false otherwise

isAsynchronous

public boolean isAsynchronous()
Description copied from interface: ISiteOperation
Tests whther the operation should be exectued asynchronously

Specified by:
isAsynchronous in interface ISiteOperation
Returns:
true if operation should be executed asynchronously, false otherwise

setAsynchronous

public void setAsynchronous(boolean val)
Description copied from interface: ISiteOperation
Set the asynchornous flag. An asynchronous operation should run async. by the controller

Specified by:
setAsynchronous in interface ISiteOperation
Parameters:
val - true if operation should be executed asynchronously, false otherwise

isRestricted

public boolean isRestricted()
Description copied from interface: ISiteOperation
Test whether security checks should be done before executing the operation

Specified by:
isRestricted in interface ISiteOperation
Returns:
true if the operation is restricted and permissions must be checked

setRestricted

public void setRestricted(boolean val)
Description copied from interface: ISiteOperation
Set the security check flag.

Specified by:
setRestricted in interface ISiteOperation
Parameters:
val - true if the operation should be checked for right permissions before being executed or false otherwise

isUndoable

public boolean isUndoable()
Description copied from interface: ISiteOperation
Test whether the operation may be undoed. Undoable operations may not be redoable. If the operation needs a large amount of data to be executed it must not keep it in memory instead it should backup this data somehow and restore it when exectued

Specified by:
isUndoable in interface ISiteOperation
Returns:
true if the operation may be undoed, false otherwise

setUndoable

public void setUndoable(boolean val)
Description copied from interface: ISiteOperation
Set the undoable flag. If an operation is undoable it must provide an inverse operation using ISiteOperation.getInverseOperation()

Specified by:
setUndoable in interface ISiteOperation
Parameters:
val - true if operation can be undoed, false otherwise

isHistoryEnabled

public boolean isHistoryEnabled()
Description copied from interface: ISiteOperation
Test whether ot nmot the operation should be logged

Specified by:
isHistoryEnabled in interface ISiteOperation
Returns:
true if the operation shpould be logged, false otherwise

setHistoryEnabled

public void setHistoryEnabled(boolean val)
Description copied from interface: ISiteOperation
Set the history enabled flag

Specified by:
setHistoryEnabled in interface ISiteOperation
Parameters:
val - true to enable history logs, false otherwise