com.wewebu.ow.server.command
Class OwCommand

java.lang.Object
  extended by com.wewebu.ow.server.command.OwCommand

public abstract class OwCommand
extends Object

Execute a specific command for a collection of objects.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Field Summary
protected  OwMainAppContext m_appContext
          the application context
protected  OwMultipleObjectsProcessCollector m_collector
          object collector
protected  Collection m_objects
          the objects on which the command is executed.
 
Constructor Summary
OwCommand(Collection objects_p, OwMainAppContext appContext_p)
          Constructs a command where all given object are processable.
OwCommand(Collection objects_p, OwMainAppContext appContext_p, OwProcessableObjectStrategy processableObjectStrategy_p)
          Constructs a command where all given object are verified if they can be processed by this command, using processableStrategy_p.
OwCommand(OwObject object_p, OwMainAppContext appContext_p, OwProcessableObjectStrategy processableObjectStrategy_p)
          Constructs a command where the given object is verified if it can be processed by this command, using processableStrategy_p.
 
Method Summary
 void execute()
          Execute the command.
 String getAllErrorMessages()
          Get a String containing all error messages.
Must be called after the execute() method was called (otherwise a runtime exception is thrown).
 List getAllErrorNames()
          Get a list with all names of objects that failed to be processed.
 List getAllErrorObjects()
          Get a list with all objects that failed to be processed.
 List getDisabledObjectNames()
          Get the list of names of disabled objects.
 List getDisabledObjects()
          Get the list of objects that were unable to be processed because they were disabled.
 List getFailedObjectsData()
          Returns the list of OwMultipleObjectsProcessCollector.OwObjectCollectData objects that are not processed.
 Set getProcessedDMSIDs()
          Get a set of DMSIDs of successfully processed objects.
 List getProcessedObjectNames()
          Get a list with successfully processed object names.
Must be called after the execute() method was called (otherwise a runtime exception is thrown).
 List getProcessedObjects()
          Get a list with successfully processed objects.
Must be called after the execute() method was called (otherwise a runtime exception is thrown).
 boolean hasDisabledObjects()
          Check if this command has objects that were not processed and were disabled.
 boolean hasErrors()
          Check if the command execution ended with errors.
Must be called after the execute() method was called (otherwise a runtime exception is thrown).
 boolean hasProcessedObjects()
          Check if the command successfully processed some objects.
Must be called after the execute() method was called (otherwise a runtime exception is thrown).
protected abstract  void processObject(OwObject object_p)
          Process an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_appContext

protected OwMainAppContext m_appContext
the application context


m_collector

protected OwMultipleObjectsProcessCollector m_collector
object collector


m_objects

protected Collection m_objects
the objects on which the command is executed.

Constructor Detail

OwCommand

public OwCommand(OwObject object_p,
                 OwMainAppContext appContext_p,
                 OwProcessableObjectStrategy processableObjectStrategy_p)
Constructs a command where the given object is verified if it can be processed by this command, using processableStrategy_p.

Parameters:
object_p - - the object to be processed.
appContext_p - - the application context.
processableObjectStrategy_p - - checker for processability state of an object.

OwCommand

public OwCommand(Collection objects_p,
                 OwMainAppContext appContext_p)
Constructs a command where all given object are processable.

Parameters:
objects_p - - the collection of objects to be processed.
appContext_p - - the application context.

OwCommand

public OwCommand(Collection objects_p,
                 OwMainAppContext appContext_p,
                 OwProcessableObjectStrategy processableObjectStrategy_p)
Constructs a command where all given object are verified if they can be processed by this command, using processableStrategy_p.

Parameters:
objects_p - - the collection of objects to be processed.
appContext_p - - the application context.
processableObjectStrategy_p - - checker for processability state of an object.
Method Detail

execute

public final void execute()
Execute the command. All given objects are processed.
In case that an object cannot be processed, depending of implementation of OwProcessableObjectStrategy.canBeProcessed(OwObject), it is ignored (no exception is thrown) or added to the fail_to_process object list (method OwProcessableObjectStrategy.canBeProcessed(OwObject) thrown an exception) .
In case that an object is correctly processed, it is retained, and it will available for further interrogations.
In case that an object fails to be processed, the reason of failure, and the object is retained for further interrogations.


processObject

protected abstract void processObject(OwObject object_p)
                               throws Exception
Process an object. Each command must implement its specific way of processing.

Parameters:
object_p - - the object that need to be processed.
Throws:
Exception - - thrown when object fails to be processed.

hasErrors

public boolean hasErrors()
Check if the command execution ended with errors.
Must be called after the execute() method was called (otherwise a runtime exception is thrown).

Returns:
-true in case the command execution ended with errors.

getAllErrorMessages

public String getAllErrorMessages()
Get a String containing all error messages.
Must be called after the execute() method was called (otherwise a runtime exception is thrown).

Returns:
-a String containing all error messages.

hasProcessedObjects

public boolean hasProcessedObjects()
Check if the command successfully processed some objects.
Must be called after the execute() method was called (otherwise a runtime exception is thrown).

Returns:
-true in case the command execution successfully processed some objects.

getProcessedObjectNames

public List getProcessedObjectNames()
Get a list with successfully processed object names.
Must be called after the execute() method was called (otherwise a runtime exception is thrown).

Returns:
-a java.util.List with names of successfully processed objects.

getProcessedObjects

public List getProcessedObjects()
Get a list with successfully processed objects.
Must be called after the execute() method was called (otherwise a runtime exception is thrown).

Returns:
-a java.util.List with successfully processed OwObjects.

getProcessedDMSIDs

public Set getProcessedDMSIDs()
Get a set of DMSIDs of successfully processed objects. Must be called after the execute() method was called (otherwise a runtime exception is thrown).

Returns:
- a java.util.Set with DMSIDs.

getAllErrorNames

public List getAllErrorNames()
Get a list with all names of objects that failed to be processed. Must be called after the execute() method was called (otherwise a runtime exception is thrown).

Returns:
- a java.util.List of String (names of objects that cannot be processed.

getAllErrorObjects

public List getAllErrorObjects()
Get a list with all objects that failed to be processed. Must be called after the execute() method was called (otherwise a runtime exception is thrown).

Returns:
- a java.util.List of OwObject (objects that cannot be processed.

getDisabledObjects

public List getDisabledObjects()
Get the list of objects that were unable to be processed because they were disabled.

Returns:
list of disabled objects.

hasDisabledObjects

public boolean hasDisabledObjects()
Check if this command has objects that were not processed and were disabled.

Returns:
true if this command has disabled objects.

getDisabledObjectNames

public List getDisabledObjectNames()
Get the list of names of disabled objects.

Returns:
list of names.

getFailedObjectsData

public List getFailedObjectsData()
Returns the list of OwMultipleObjectsProcessCollector.OwObjectCollectData objects that are not processed.

Returns:
- a List of OwMultipleObjectsProcessCollector.OwObjectCollectData objects that are not processed.
Since:
3.0.0.0


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.