{
continue;
}
else
{
throw new AuthorizeException("Not authorized to read Bundle named \"" + bundles[i].getName() + "\"");
}
}
Bitstream[] bitstreams = bundles[i].getBitstreams();
// Create a fileGrp, USE = permuted Bundle name
FileGrp fileGrp = new FileGrp();
String bName = bundles[i].getName();
if ((bName != null) && !bName.equals(""))
{
fileGrp.setUSE(bundleToFileGrp(bName));
}
// add technical metadata for a bundle
String techBundID = addAmdSec(context, bundles[i], params, mets, extraStreams);
if (techBundID != null)
{
fileGrp.setADMID(techBundID);
}
// watch for primary bitstream
int primaryBitstreamID = -1;
boolean isContentBundle = false;
if ((bName != null) && bName.equals("ORIGINAL"))
{
isContentBundle = true;
primaryBitstreamID = bundles[i].getPrimaryBitstreamID();
}
// For each bitstream, add to METS manifest
for (int bits = 0; bits < bitstreams.length; bits++)
{
// Check for authorization. Handle unauthorized
// bitstreams to match the logic in disseminate(),
// i.e. "unauth=zero" means include a 0-length bitstream,
// "unauth=skip" means to ignore it (and exclude from
// manifest).
boolean auth = AuthorizeManager.authorizeActionBoolean(context,
bitstreams[bits], Constants.READ);
if (!auth)
{
if (unauth != null && unauth.equalsIgnoreCase("skip"))
{
continue;
}
else if (!(unauth != null && unauth.equalsIgnoreCase("zero")))
{
throw new AuthorizeException("Not authorized to read Bitstream, SID=" + String.valueOf(bitstreams[bits].getSequenceID()));
}
}
String sid = String.valueOf(bitstreams[bits].getSequenceID());
String fileID = bitstreamIDstart + sid;