public abstract class AbstractCurationTask extends Object implements CurationTask
| Modifier and Type | Field and Description |
|---|---|
protected CommunityService |
communityService |
protected ConfigurationService |
configurationService |
protected Curator |
curator |
protected HandleService |
handleService |
protected ItemService |
itemService |
protected String |
taskId |
| Constructor and Description |
|---|
AbstractCurationTask() |
| Modifier and Type | Method and Description |
|---|---|
protected DSpaceObject |
dereference(Context ctx,
String id)
Returns a DSpaceObject for passed identifier, if it exists
|
protected void |
distribute(DSpaceObject dso)
Distributes a task through a DSpace container - a convenience method
for tasks declaring the
@Distributive property. |
void |
init(Curator curator,
String taskId)
Initialize task - parameters inform the task of it's invoking curator.
|
int |
perform(Context ctx,
String id)
Perform the curation task for passed id
|
abstract int |
perform(DSpaceObject dso)
Perform the curation task upon passed DSO
|
protected void |
performItem(Item item)
Performs task upon a single DSpace Item.
|
protected void |
performObject(DSpaceObject dso)
Performs task upon a single DSpaceObject.
|
protected void |
report(String message)
Sends message to the reporting stream
|
protected void |
setResult(String result)
Assigns the result of the task performance
|
protected String[] |
taskArrayProperty(String name)
Returns task configuration Array property value for passed name, else
null if no properties defined or no value for passed key. |
protected boolean |
taskBooleanProperty(String name,
boolean defaultValue)
Returns task configuration boolean property value for passed name, else
passed default value if no properties defined or no value for passed key.
|
protected int |
taskIntProperty(String name,
int defaultValue)
Returns task configuration integer property value for passed name, else
passed default value if no properties defined or no value for passed key.
|
protected long |
taskLongProperty(String name,
long defaultValue)
Returns task configuration long property value for passed name, else
passed default value if no properties defined or no value for passed key.
|
protected String |
taskProperty(String name)
Returns task configuration property value for passed name, else
null if no properties defined or no value for passed key. |
protected Curator curator
protected String taskId
protected CommunityService communityService
protected ItemService itemService
protected HandleService handleService
protected ConfigurationService configurationService
public void init(Curator curator, String taskId) throws IOException
CurationTaskinit in interface CurationTaskcurator - the Curator controlling this tasktaskId - identifier task should use in invoking servicesIOExceptionpublic abstract int perform(DSpaceObject dso) throws IOException
CurationTaskperform in interface CurationTaskdso - the DSpace objectIOExceptionprotected void distribute(DSpaceObject dso) throws IOException
@Distributive property.
This method invokes the 'performObject()' method on the current DSO, and then recursively invokes the 'performObject()' method on all DSOs contained within the current DSO. For example: if a Community is passed in, then 'performObject()' will be called on that Community object, as well as on all SubCommunities/Collections/Items contained in that Community.
Individual tasks MUST override either the performObject method or
the performItem method to ensure the task is run on either all
DSOs or just all Items, respectively.
dso - current DSpaceObjectIOExceptionprotected void performObject(DSpaceObject dso) throws SQLException, IOException
distribute method to run a single task across multiple DSpaceObjects.
By default, this method just wraps a call to performItem
for each Item Object.
You should override this method if you want to use
distribute to run your task across multiple DSpace Objects.
Either this method or performItem should be overridden if
distribute method is used.
dso - the DSpaceObjectSQLExceptionIOExceptionprotected void performItem(Item item) throws SQLException, IOException
distribute method to run a single task across multiple Items.
You should override this method if you want to use
distribute to run your task across multiple DSpace Items.
Either this method or performObject should be overridden if
distribute method is used.
item - the DSpace ItemSQLExceptionIOExceptionpublic int perform(Context ctx, String id) throws IOException
CurationTaskperform in interface CurationTaskctx - DSpace context objectid - persistent ID for DSpace objectIOExceptionprotected DSpaceObject dereference(Context ctx, String id) throws IOException
ctx - DSpace contextid - canonical id of objectIOExceptionprotected void report(String message)
message - the message to streamprotected void setResult(String result)
result - the result stringprotected String taskProperty(String name)
null if no properties defined or no value for passed key.name - the property nameprotected int taskIntProperty(String name, int defaultValue)
name - the property namedefaultValue - value
the default valueprotected long taskLongProperty(String name, long defaultValue)
name - the property namedefaultValue - value
the default valueprotected boolean taskBooleanProperty(String name, boolean defaultValue)
name - the property namedefaultValue - value
the default valueCopyright © 2016 DuraSpace. All Rights Reserved.