You will need to use the BitstreamService https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/content/service/BitstreamService.java#L26
This inherits from DSpaceObjectService https://github.com/DSpace/DSpace/blob/master/dspace-api/src/main/java/org/dspace/content/service/DSpaceObjectService.java#L393 Terry On Thu, Sep 15, 2016 at 10:08 AM, Joan Caparros <[email protected]> wrote: > Thank you Terry, I think that in DSpace could work but not in DSpace 6, > Bitstream doesn't have this method > > https://github.com/DSpace/DSpace/blob/master/dspace-api/ > src/main/java/org/dspace/content/Bitstream.java > > El dijous, 15 setembre de 2016 18:21:21 UTC+2, Terry Brady va escriure: >> >> Would this method do what you need? >> >> https://github.com/DSpace/DSpace/blob/dspace-5_x/dspace-api/ >> src/main/java/org/dspace/content/Bitstream.java#L513 >> >> On Thu, Sep 15, 2016 at 8:57 AM, Joan Caparros <[email protected]> >> wrote: >> >>> I'm trying to figure out how I can delete a bitstream, now I have this >>> curtation task but I'm not able to delete the file, I can not discover how >>> I have to call a delete or remove method from this file, do you know how I >>> can delete it? >>> >>> >>> 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 >>> ,"THUMBNAIL") >>> for i in myBundles: >>> myBitstreams = i.getBitstreams() >>> for k in myBitstreams: >>> print "I WANT TO DELETE THIS >>> FILE "+k.getName() >>> return 0 >>> >>> def performId(self, context, id): >>> print "perform on id %s" % (id) >>> return 0 >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> El dimarts, 1 març de 2016 0:19:41 UTC+1, Andrea Schweer va escriure: >>> >>>> Hi Jeffrey, >>>> >>>> On 01/03/16 12:02, Jeffrey Sheldon wrote: >>>> > 1. I'd like to remove a large number of thumbnail bitstreams that >>>> were generated for various bitstream types (JPEG, PDF, text, etc.). I'm >>>> doing this to simply fall back on a generic icon view for various bitstream >>>> types and be more selective about which types have generated thumbnails. >>>> >>>> The "right" way to do this is probably via a curation task, assuming >>>> you >>>> have Java skills available locally. The documentation is here: >>>> https://wiki.duraspace.org/display/DSDOC5x/Curation+System# >>>> CurationSystem-Writingyourowntasks >>>> -- there is also an option to use Jython (a python flavour) if that's >>>> more convenient: >>>> https://wiki.duraspace.org/display/DSDOC5x/Curation+tasks+in+Jython >>>> >>>> I have a script on github that removes PNG thumbnails for bitstreams >>>> that also have a JPG thumbnail: >>>> https://github.com/UoW-IRRs/DSpace-Scripts/blob/master/src/ >>>> main/java/nz/ac/waikato/its/irr/scripts/RemovePNGThumbnailsForPDFs.java >>>> We had custom thumbnails for a while and switched back to DSpace >>>> default >>>> when we upgraded to 5.x; the script was used as a one-off during the >>>> upgrade. It's a command-line script, to be invoked via dsrun after >>>> dropping the jar file into [dspace]/lib. I believe I went that route >>>> (instead of writing a curation task) because it was faster to write >>>> this >>>> way and we were confident that it really only would run once. It should >>>> be easy enough to rip out the processItem method and toss it into a >>>> curation task. >>>> >>>> cheers, >>>> Andrea >>>> >>>> -- >>>> Dr Andrea Schweer >>>> Lead Software Developer, ITS Information Systems >>>> The University of Waikato, Hamilton, New Zealand >>>> +64-7-837 9120 >>>> >>>> -- >>> 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. >>> >> >> >> >> -- >> Terry Brady >> Applications Programmer Analyst >> Georgetown University Library Information Technology >> http://georgetown-university-libraries.github.io/ >> <https://www.library.georgetown.edu/lit/code> >> 425-298-5498 (Seattle, WA) >> > -- > 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. > -- Terry Brady Applications Programmer Analyst Georgetown University Library Information Technology http://georgetown-university-libraries.github.io/ <https://www.library.georgetown.edu/lit/code> 425-298-5498 (Seattle, WA) -- 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.
