public abstract class AbstractCurationTask extends java.lang.Object implements CurationTask
| Modifier and Type | Field and Description |
|---|---|
protected Curator |
curator |
protected java.lang.String |
taskId |
| Constructor and Description |
|---|
AbstractCurationTask() |
| Modifier and Type | Method and Description |
|---|---|
protected DSpaceObject |
dereference(Context ctx,
java.lang.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,
java.lang.String taskId)
Initialize task - parameters inform the task of it's invoking curator.
|
int |
perform(Context ctx,
java.lang.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(java.lang.String message)
Sends message to the reporting stream
|
protected void |
setResult(java.lang.String result)
Assigns the result of the task performance
|
protected boolean |
taskBooleanProperty(java.lang.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(java.lang.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(java.lang.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 java.lang.String |
taskProperty(java.lang.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 java.lang.String taskId
public void init(Curator curator, java.lang.String taskId) throws java.io.IOException
CurationTaskinit in interface CurationTaskcurator - the Curator controlling this tasktaskId - identifier task should use in invoking servicesjava.io.IOExceptionpublic abstract int perform(DSpaceObject dso) throws java.io.IOException
CurationTaskperform in interface CurationTaskdso - the DSpace objectjava.io.IOExceptionprotected void distribute(DSpaceObject dso) throws java.io.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 DSpaceObjectjava.io.IOExceptionprotected void performObject(DSpaceObject dso) throws java.sql.SQLException, java.io.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 DSpaceObjectjava.sql.SQLExceptionjava.io.IOExceptionprotected void performItem(Item item) throws java.sql.SQLException, java.io.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 Itemjava.sql.SQLExceptionjava.io.IOExceptionpublic int perform(Context ctx, java.lang.String id) throws java.io.IOException
CurationTaskperform in interface CurationTaskctx - DSpace context objectid - persistent ID for DSpace objectjava.io.IOExceptionprotected DSpaceObject dereference(Context ctx, java.lang.String id) throws java.io.IOException
ctx - DSpace contextid - canonical id of objectjava.io.IOExceptionprotected void report(java.lang.String message)
message - the message to streamprotected void setResult(java.lang.String result)
result - the result stringprotected java.lang.String taskProperty(java.lang.String name)
null if no properties defined or no value for passed key.name - the property nameprotected int taskIntProperty(java.lang.String name,
int defaultValue)
name - the property namedefaultValue - value
the default valueprotected long taskLongProperty(java.lang.String name,
long defaultValue)
name - the property namedefaultValue - value
the default valueprotected boolean taskBooleanProperty(java.lang.String name,
boolean defaultValue)
name - the property namedefaultValue - value
the default valueCopyright © 2018 DuraSpace. All Rights Reserved.