For those who have been following this thread I want to share my work,

Here you will find a working curation task for DSpace-6_x that can delete 
all files in a bundle (in this example THUMBNAILS), and also will delete 
empty Bundles (orphan):

https://github.com/kerojohan/curation_taks/blob/master/ctscripts/deletingTHUMBNAILS.py

Have fun.
Bests
Joan Caparrós



El dimarts, 20 setembre de 2016 10:08:57 UTC+2, Joan Caparros va escriure:
>
> Any help? can anyone try it?
>
> i will appreciate it
>
> Thank you
> Joan
>
> El divendres, 16 setembre de 2016 13:05:26 UTC+2, Joan Caparros va 
> escriure:
>>
>> Thank you for all your help, I've tried almost all, now with the 
>> BitstreamService I think that is the correct way but I'm getting an error 
>> of ConcurrentModificationException, I'm completely lost, I'm not modifying 
>> my ArrayList...
>>
>> initializing with Jython
>> perform on dso 
>> Item '10- Façana posterior' (10687/35746)
>> DELETE aplan_436-A_1266_00010.tif
>> Exception: null
>> java.util.ConcurrentModificationException
>> at java.util.ArrayList$Itr.checkForComodification(ArrayList.java:859)
>> at java.util.ArrayList$Itr.next(ArrayList.java:831)
>> at 
>> org.hibernate.collection.internal.AbstractPersistentCollection$IteratorProxy.next(AbstractPersistentCollection.java:810)
>> at org.python.core.JavaIterator.__iternext__(JavaIterator.java:18)
>> at org.python.pycode._pyx0.performDso$3(<script>:29)
>> at org.python.pycode._pyx0.call_function(<script>)
>> at org.python.core.PyTableCode.call(PyTableCode.java:167)
>> at org.python.core.PyBaseCode.call(PyBaseCode.java:307)
>> at org.python.core.PyBaseCode.call(PyBaseCode.java:198)
>> at org.python.core.PyFunction.__call__(PyFunction.java:482)
>> at org.python.core.PyMethod.instancemethod___call__(PyMethod.java:237)
>> at org.python.core.PyMethod.__call__(PyMethod.java:228)
>> at org.python.core.PyMethod.__call__(PyMethod.java:218)
>> at org.python.core.PyMethod.__call__(PyMethod.java:213)
>> at org.python.core.PyObject._jcallexc(PyObject.java:3626)
>> at org.python.proxies.__builtin__$MyTask$0.performDso(Unknown Source)
>> at org.dspace.curate.ResolvedTask.perform(ResolvedTask.java:88)
>> at org.dspace.curate.Curator$TaskRunner.run(Curator.java:537)
>> at org.dspace.curate.Curator.curate(Curator.java:252)
>> at org.dspace.curate.Curator.curate(Curator.java:199)
>> at org.dspace.curate.CurationCli.main(CurationCli.java:229)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at 
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> at 
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:606)
>> at 
>> org.dspace.app.launcher.ScriptLauncher.runOneCommand(ScriptLauncher.java:229)
>> at org.dspace.app.launcher.ScriptLauncher.main(ScriptLauncher.java:81)
>>
>>
>> class MyTask(ScriptedTask):
>>>         def init(self, curator, taskName):
>>>                 print "initializing with Jython"
>>>
>>>         def performDso(self, dso):
>>>                 print "perform on dso "
>>>                 if dso.getType()==2:
>>>                         print "Item '" + dso.getName() + "' 
>>> ("+dso.getHandle()+")"
>>>                         myBundles = 
>>> dso.itemService.getBundles(dso,"ORIGINAL")
>>>                         for i in myBundles:
>>>                                 myBitstreams = i.getBitstreams()
>>>                                 for k in myBitstreams:
>>>                                         print "DELETE "+k.getName()
>>>                                         bitstreamService = 
>>> ContentServiceFactory.getInstance().getBitstreamService()
>>>                                         
>>> bitstreamService.delete(Curator.curationContext(),k)
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"DSpace Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/dspace-community.
For more options, visit https://groups.google.com/d/optout.

Reply via email to