[ 
https://jira.duraspace.org/browse/DS-1110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=23987#comment-23987
 ] 

Richard Rodgers commented on DS-1110:
-------------------------------------

Hi Tim:

This behavior is not a bug - the distribute()/performItem() pair was designed 
specifically for the overwhelmingly most common use-case (a task operating only 
on items). The proposed version loses much of that convenience:
now implementers would have to add a lot of boilerplate code:

performObject() {
   if (object intanceof Item) {
     // do what you really want to do
  }
}
 
The whole point of these methods was to reduce boilerplate code. Cases where a 
task *does* want to operate on all object-types exist, but they are rare.

I have no objection to adding new 'convenience' methods to AbstractCurationTask 
(maybe the proposed could be 'distributeAll()/performObject or distributeFull() 
or some such),
but I am very uneasy at the idea of breaking the API (existing tasks won't 
compile) - without so much as a @deprecated - and replacing it with a less 
generally useful version.

My 2 cents,

Richard




                
> AbstractCurationTask.distribute() convenience method doesn't distribute 
> across all DSpace Objects
> -------------------------------------------------------------------------------------------------
>
>                 Key: DS-1110
>                 URL: https://jira.duraspace.org/browse/DS-1110
>             Project: DSpace
>          Issue Type: Bug
>          Components: DSpace API
>    Affects Versions: 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1
>            Reporter: Tim Donohue
>            Assignee: Tim Donohue
>             Fix For: post-1.8.x
>
>         Attachments: AbstractCurationTask.patch
>
>
> The org.dspace.curate.AbstractCurationTask provides a 'distribute()' 
> convenience method which is recommended for any Curation Task that declares 
> the @Distributive annotation. 
> However, as implemented, that 'distribute()' method only distributes 
> (recursively performs) the Curation Task across all DSpace *ITEMS*.  This 
> means that a task which should be performed on other DSpace Objects (e.g. 
> Communities, Collections) cannot use the 'distribute()' method.
> Rather than implement a separate convenience method to allow for distributing 
> tasks across all Communities/Collections/Items, I feel the 'distribute()' 
> method should be reimplemented to properly distribute the task across all 
> DSpace Objects.
> I've attached a patch (AbstractCurationTask.patch) which changes the 
> 'distribute()' method and renames the corresponding 'performItem()' method to 
> be 'performObject()'.  This patch also fixes/refactors the single 
> out-of-the-box Task (ProfileFormats) which uses these convenience methods.  
> Finally this patch ensures that the 'distribute()' method can also distribute 
> a task across all objects in DSpace when it is called with the Site Object.
> I've tested these changes via the ProfileFormats task and it all seems to be 
> working as planned.
> I'd appreciate it if someone could perform a quick review of this work before 
> I commit it.  I just want to ensure that others agree that this seems to be a 
> logical refactoring of the AbstractCurationTask.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://jira.duraspace.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Dspace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-devel

Reply via email to