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
Modifier and Type | Field and Description |
---|---|
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 and Description |
---|
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 . |
Modifier and Type | Method and Description |
---|---|
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.
|
protected OwMainAppContext m_appContext
protected OwMultipleObjectsProcessCollector m_collector
protected Collection m_objects
public OwCommand(OwObject object_p, OwMainAppContext appContext_p, OwProcessableObjectStrategy processableObjectStrategy_p)
processableStrategy_p
.object_p
- - the object to be processed.appContext_p
- - the application context.processableObjectStrategy_p
- - checker for processability state of an object.public OwCommand(Collection objects_p, OwMainAppContext appContext_p)
objects_p
- - the collection of objects to be processed.appContext_p
- - the application context.public OwCommand(Collection objects_p, OwMainAppContext appContext_p, OwProcessableObjectStrategy processableObjectStrategy_p)
processableStrategy_p
.objects_p
- - the collection of objects to be processed.appContext_p
- - the application context.processableObjectStrategy_p
- - checker for processability state of an object.public final void execute()
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) . protected abstract void processObject(OwObject object_p) throws Exception
object_p
- - the object that need to be processed.Exception
- - thrown when object fails to be processed.public boolean hasErrors()
execute()
method was called
(otherwise a runtime exception is thrown).true
in case the command execution ended with errors.public String getAllErrorMessages()
execute()
method was called
(otherwise a runtime exception is thrown).String
containing all error messages.public boolean hasProcessedObjects()
execute()
method was called
(otherwise a runtime exception is thrown).true
in case the command execution successfully processed some objects.public List getProcessedObjectNames()
execute()
method was called
(otherwise a runtime exception is thrown).java.util.List
with names of successfully processed objects.public List getProcessedObjects()
execute()
method was called
(otherwise a runtime exception is thrown).java.util.List
with successfully processed OwObject
s.public Set getProcessedDMSIDs()
execute()
method was called
(otherwise a runtime exception is thrown).java.util.Set
with DMSIDs.public List getAllErrorNames()
execute()
method was called
(otherwise a runtime exception is thrown).java.util.List
of String (names of objects that cannot be processed.public List getAllErrorObjects()
execute()
method was called
(otherwise a runtime exception is thrown).java.util.List
of OwObject
(objects that cannot be processed.public List getDisabledObjects()
public boolean hasDisabledObjects()
true
if this command has disabled objects.public List getDisabledObjectNames()
public List getFailedObjectsData()
OwMultipleObjectsProcessCollector.OwObjectCollectData
objects that are not processed.List
of OwMultipleObjectsProcessCollector.OwObjectCollectData
objects that are not processed.Copyright © 2014 Alfresco Business Solutions. All Rights Reserved.