From: Tansley, Robert <robert.tansley@hp...> - 2005-01-28 20:42:33
> Im currently working on a DSpace WebService (misc. browsing and item=20
> creation) for a project.
> I have got the item creation service to work perfectly but I=20
> dont quite=20
> know how to update an item.
> The DC elements seems quite reasonable to update.. just clearDC's all=20
> elements, insert the new elements
> and do an item.update() (and ofcoz commit context afterwards) but how=20
> about the bundles and bitstreams?
> Ive taken a look at the item-importer, and this seems to=20
> simply replace=20
> the items and re-assigning the old
> handle to the newly created item (delete old item, insert new item,=20
> re-assign handle). Is this the
> way go about the problem?
That is one perfectly valid way -- the Handle is the important thing
that identifies an item.
Alternatively, you can remove old bitstreams from the "ORIGINAL" bundle
using Item.getBundle() to get the bundle, then Bundle.removeBitstream()
to remove each old bitstream, and then add the new ones. Then do
Item.update() to make sure everything is updated OK. This might be an
easier (and more elegant) approach.
Robert Tansley / Digital Media Systems Programme / HP Labs