On Fri, Mar 30, 2012 at 12:40, Wellaway, Ian <[email protected]> wrote:
> Is it possible to embargo individual bitstreams on a single item?

Yes, it is. Here's an example for embargo lifter. Setter is the same thing.

    public void liftEmbargo(Context context, Item item) throws
SQLException, AuthorizeException, IOException {
        ...
            Bundle[] bundles = item.getBundles("ORIGINAL");
            if(bundles.length != 1) {
                return;
            }
            Bundle originalBundle = bundles[0];
            Bitstream[] bitstreams = originalBundle.getBitstreams();
            for (int i = 0; i < bitstreams.length; i++) {
                Bitstream bitstream = bitstreams[i];
                ResourcePolicy policy = ResourcePolicy.create(context);
                policy.setAction(Constants.READ);
                policy.setEPerson(context.getCurrentUser());
                policy.setGroup(Group.findByName(context, "mygroup"));
                policy.setResource(bitstream);
                policy.update();
            }
        ...
    }

But remember that metadata is per-item, not per-bitstream.

Regards,
~~helix84

------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here 
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to