Class AbstractCurationTask
- All Implemented Interfaces:
CurationTask
- Direct Known Subclasses:
AbstractTranslator,BasicLinkChecker,BitstreamsIntoMetadata,CitationPage,ClamScan,CreateMissingIdentifiers,MetadataWebService,NoOpCurationTask,ProfileFormats,PropertyParameterTestingTask,RegisterDOI,RequiredMetadata,WorkflowReportTest
- Author:
- richardrodgers
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CommunityServiceprotected ConfigurationServiceprotected Curatorprotected HandleServiceprotected ItemServiceprotected String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DSpaceObjectdereference(Context ctx, String id) Returns a DSpaceObject for passed identifier, if it existsprotected voiddistribute(DSpaceObject dso) Distributes a task through a DSpace container - a convenience method for tasks declaring the@Distributiveproperty.voidInitialize task - parameters inform the task of it's invoking curator.abstract intperform(DSpaceObject dso) Perform the curation task upon passed DSOintPerform the curation task for passed idprotected voidperformItem(Item item) Performs task upon a single DSpace Item.protected voidPerforms task upon a single DSpaceObject.protected voidSends message to the reporting streamprotected voidAssigns the result of the task performanceprotected String[]taskArrayProperty(String name) Returns task configuration Array property value for passed name, elsenullif no properties defined or no value for passed key.protected booleantaskBooleanProperty(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 inttaskIntProperty(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 longtaskLongProperty(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 StringtaskProperty(String name) Returns task configuration property value for passed name, elsenullif no properties defined or no value for passed key.
-
Field Details
-
curator
-
taskId
-
communityService
-
itemService
-
handleService
-
configurationService
-
-
Constructor Details
-
AbstractCurationTask
public AbstractCurationTask()
-
-
Method Details
-
init
Description copied from interface:CurationTaskInitialize task - parameters inform the task of it's invoking curator. Since the curator can provide services to the task, this represents curation DI.- Specified by:
initin interfaceCurationTask- Parameters:
curator- the Curator controlling this tasktaskId- identifier task should use in invoking services- Throws:
IOException- if error
-
perform
Description copied from interface:CurationTaskPerform the curation task upon passed DSO- Specified by:
performin interfaceCurationTask- Parameters:
dso- the DSpace object- Returns:
- status code
- Throws:
IOException- if error
-
distribute
Distributes a task through a DSpace container - a convenience method for tasks declaring the@Distributiveproperty.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
performObjectmethod or theperformItemmethod to ensure the task is run on either all DSOs or just all Items, respectively.- Parameters:
dso- current DSpaceObject- Throws:
IOException- if IO error
-
performObject
Performs task upon a single DSpaceObject. Used in conjunction with thedistributemethod to run a single task across multiple DSpaceObjects.By default, this method just wraps a call to
performItemfor each Item Object.You should override this method if you want to use
distributeto run your task across multiple DSpace Objects.Either this method or
performItemshould be overridden ifdistributemethod is used.- Parameters:
dso- the DSpaceObject- Throws:
SQLException- if database errorIOException- if IO error
-
performItem
Performs task upon a single DSpace Item. Used in conjunction with thedistributemethod to run a single task across multiple Items.You should override this method if you want to use
distributeto run your task across multiple DSpace Items.Either this method or
performObjectshould be overridden ifdistributemethod is used.- Parameters:
item- the DSpace Item- Throws:
SQLException- if database errorIOException- if IO error
-
perform
Description copied from interface:CurationTaskPerform the curation task for passed id- Specified by:
performin interfaceCurationTask- Parameters:
ctx- DSpace context objectid- persistent ID for DSpace object- Returns:
- status code
- Throws:
IOException- if error
-
dereference
Returns a DSpaceObject for passed identifier, if it exists- Parameters:
ctx- DSpace contextid- canonical id of object- Returns:
- dso DSpace object, or null if no object with id exists
- Throws:
IOException- if IO error
-
report
Sends message to the reporting stream- Parameters:
message- the message to stream
-
setResult
Assigns the result of the task performance- Parameters:
result- the result string
-
taskProperty
Returns task configuration property value for passed name, elsenullif no properties defined or no value for passed key. If a taskID/Name is specified, prepend it on the configuration name.- Parameters:
name- the property name- Returns:
- value the property value, or null
-
taskIntProperty
Returns task configuration integer property value for passed name, else passed default value if no properties defined or no value for passed key. If a taskID/Name is specified, prepend it on the configuration name.- Parameters:
name- the property namedefaultValue- value the default value- Returns:
- value the property value, or default value
-
taskLongProperty
Returns task configuration long property value for passed name, else passed default value if no properties defined or no value for passed key. If a taskID/Name is specified, prepend it on the configuration name.- Parameters:
name- the property namedefaultValue- value the default value- Returns:
- value the property value, or default
-
taskBooleanProperty
Returns task configuration boolean property value for passed name, else passed default value if no properties defined or no value for passed key. If a taskID/Name is specified, prepend it on the configuration name.- Parameters:
name- the property namedefaultValue- value the default value- Returns:
- value the property value, or default
-
taskArrayProperty
Returns task configuration Array property value for passed name, elsenullif no properties defined or no value for passed key. If a taskID/Name is specified, prepend it on the configuration name.- Parameters:
name- the property name- Returns:
- value the property value, or null
-