[DS-2728] Remove the BundleBitstream object & replace by JPA mapping

This commit is contained in:
KevinVdV
2015-08-27 12:51:28 +02:00
parent f1060aac7b
commit ae19c42a7b
78 changed files with 362 additions and 596 deletions

View File

@@ -367,12 +367,11 @@ public class ItemExportServiceImpl implements ItemExportService
for (Bundle bundle : bundles) {
// bundles can have multiple bitstreams now...
List<BundleBitstream> bitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
String bundleName = bundle.getName();
for (BundleBitstream bundleBitstream : bitstreams) {
Bitstream bitstream = bundleBitstream.getBitstream();
for (Bitstream bitstream : bitstreams) {
String myName = bitstream.getName();
String oldName = myName;
@@ -563,11 +562,11 @@ public class ItemExportServiceImpl implements ItemExportService
for (Bundle bundle : bundles)
{
// get all the bitstreams in each bundle
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
List<Bitstream> bitstreams = bundle.getBitstreams();
for (Bitstream bitstream : bitstreams)
{
// add up the size
size += bundleBitstream.getBitstream().getSize();
size += bitstream.getSize();
}
}
items.add(item.getID());
@@ -599,11 +598,11 @@ public class ItemExportServiceImpl implements ItemExportService
for (Bundle bundle : bundles)
{
// get all the bitstreams in the bundle
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
List<Bitstream> bitstreams = bundle.getBitstreams();
for (Bitstream bitstream : bitstreams)
{
// add up the size
size += bundleBitstream.getBitstream().getSize();
size += bitstream.getSize();
}
}
items.add(item.getID());
@@ -625,11 +624,11 @@ public class ItemExportServiceImpl implements ItemExportService
for (Bundle bundle : bundles)
{
// get all the bitstreams in the bundle
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
List<Bitstream> bitstreams = bundle.getBitstreams();
for (Bitstream bitstream : bitstreams)
{
// add up the size
size += bundleBitstream.getBitstream().getSize();
size += bitstream.getSize();
}
}
ArrayList<UUID> items = new ArrayList<>();

View File

@@ -14,7 +14,6 @@ import java.util.List;
import org.dspace.app.util.Util;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.BundleBitstream;
import org.dspace.content.Item;
import org.dspace.content.service.ItemService;
import org.dspace.core.Constants;
@@ -60,8 +59,7 @@ public class ItemMarkingAvailabilityBitstreamStrategy implements ItemMarkingExtr
return markInfo;
}
else {
BundleBitstream bundleBitstream = originalBundle.getBitstreams().get(0);
Bitstream bitstream = bundleBitstream.getBitstream();
Bitstream bitstream = originalBundle.getBitstreams().get(0);
ItemMarkingInfo signInfo = new ItemMarkingInfo();
signInfo.setImageName(availableImageName);

View File

@@ -159,10 +159,9 @@ public class AddBitstreamsAction extends UpdateBitstreamsAction {
//verify bundle + name are not duplicates
for (Bundle b : bundles)
{
List<BundleBitstream> bundleBitstreams = b.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
List<Bitstream> bitstreams = b.getBitstreams();
for (Bitstream bsm : bitstreams)
{
Bitstream bsm = bundleBitstream.getBitstream();
if (bsm.getName().equals(ce.filename))
{
throw new IllegalArgumentException("Duplicate bundle + filename cannot be added: "

View File

@@ -12,7 +12,6 @@ import java.util.List;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.BundleBitstream;
/**
* BitstreamFilter implementation to filter by bundle name
@@ -50,10 +49,9 @@ public class BitstreamFilterByBundleName extends BitstreamFilter {
try
{
List<BundleBitstream> bundles = bitstream.getBundles();
for (BundleBitstream bundleBitstream : bundles)
List<Bundle> bundles = bitstream.getBundles();
for (Bundle b : bundles)
{
Bundle b = bundleBitstream.getBundle();
if (b.getName().equals(bundleName))
{
return true;

View File

@@ -70,10 +70,9 @@ public class DeleteBitstreamsAction extends UpdateBitstreamsAction
}
else
{
List<BundleBitstream> bundles = bs.getBundles();
for (BundleBitstream bundleBitstream : bundles)
List<Bundle> bundles = bs.getBundles();
for (Bundle b : bundles)
{
Bundle b = bundleBitstream.getBundle();
if (isTest)
{
ItemUpdate.pr("Delete bitstream with id = " + id);
@@ -91,7 +90,7 @@ public class DeleteBitstreamsAction extends UpdateBitstreamsAction
DtoMetadata dtom = DtoMetadata.create("dc.description.provenance", "en", "");
String append = "Bitstream " + bs.getName() + " deleted on " + DCDate.getCurrent() + "; ";
Item item = bundles.iterator().next().getBundle().getItems().iterator().next();
Item item = bundles.iterator().next().getItems().iterator().next();
ItemUpdate.pr("Append provenance with: " + append);
if (!isTest)

View File

@@ -77,12 +77,11 @@ public class DeleteBitstreamsByFilterAction extends UpdateBitstreamsAction {
for (Bundle b : bundles)
{
List<BundleBitstream> bitstreams = b.getBitstreams();
List<Bitstream> bitstreams = b.getBitstreams();
String bundleName = b.getName();
for (BundleBitstream bundleBitstream : bitstreams)
for (Bitstream bs : bitstreams)
{
Bitstream bs = bundleBitstream.getBitstream();
if (filter.accept(bs))
{
if (isTest)

View File

@@ -12,7 +12,6 @@ import java.util.List;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.BundleBitstream;
/**
* Filter all bitstreams in the ORIGINAL bundle
@@ -39,10 +38,9 @@ public class OriginalBitstreamFilter extends BitstreamFilterByBundleName
{
try
{
List<BundleBitstream> bundles = bitstream.getBundles();
for (BundleBitstream bundleBitstream : bundles)
List<Bundle> bundles = bitstream.getBundles();
for (Bundle bundle : bundles)
{
Bundle bundle = bundleBitstream.getBundle();
if (bundle.getName().equals("ORIGINAL"))
{
return true;

View File

@@ -12,7 +12,6 @@ import java.util.List;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.BundleBitstream;
/**
* Filter all bitstreams in the ORIGINAL bundle
@@ -41,10 +40,9 @@ public class OriginalWithDerivativesBitstreamFilter extends BitstreamFilter
{
try
{
List<BundleBitstream> bundles = bitstream.getBundles();
for (BundleBitstream bundleBitstream : bundles)
List<Bundle> bundles = bitstream.getBundles();
for (Bundle b : bundles)
{
Bitstream b = bundleBitstream.getBitstream();
for (String bn : bundlesToEmpty)
{
if (b.getName().equals(bn))

View File

@@ -18,7 +18,6 @@ import javax.imageio.ImageIO;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.BundleBitstream;
import org.dspace.content.Item;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.ItemService;
@@ -157,8 +156,7 @@ public abstract class ImageMagickThumbnailFilter extends MediaFilter implements
{
String nsrc = source.getName();
for(Bundle b: itemService.getBundles(item, "THUMBNAIL")) {
for(BundleBitstream bundleBitstream: b.getBitstreams()) {
Bitstream bit = bundleBitstream.getBitstream();
for(Bitstream bit: b.getBitstreams()) {
String n = bit.getName();
if (n != null) {
if (nsrc != null) {

View File

@@ -168,10 +168,10 @@ public class MediaFilterServiceImpl implements MediaFilterService, InitializingB
boolean done = false;
for (Bundle myBundle : myBundles) {
// now look at all of the bitstreams
List<BundleBitstream> myBitstreams = myBundle.getBitstreams();
List<Bitstream> myBitstreams = myBundle.getBitstreams();
for (BundleBitstream myBitstream : myBitstreams) {
done |= filterBitstream(context, myItem, myBitstream.getBitstream());
for (Bitstream myBitstream : myBitstreams) {
done |= filterBitstream(context, myItem, myBitstream);
}
}
return done;
@@ -215,7 +215,7 @@ public class MediaFilterServiceImpl implements MediaFilterService, InitializingB
}
} catch (Exception e) {
String handle = myItem.getHandle();
List<BundleBitstream> bundles = myBitstream.getBundles();
List<Bundle> bundles = myBitstream.getBundles();
long size = myBitstream.getSize();
String checksum = myBitstream.getChecksum() + " (" + myBitstream.getChecksumAlgorithm() + ")";
int assetstore = myBitstream.getStoreNumber();
@@ -223,8 +223,8 @@ public class MediaFilterServiceImpl implements MediaFilterService, InitializingB
// Printout helpful information to find the errored bitstream.
System.out.println("ERROR filtering, skipping bitstream:\n");
System.out.println("\tItem Handle: " + handle);
for (BundleBitstream bundle : bundles) {
System.out.println("\tBundle Name: " + bundle.getBundle().getName());
for (Bundle bundle : bundles) {
System.out.println("\tBundle Name: " + bundle.getName());
}
System.out.println("\tFile Size: " + size);
System.out.println("\tChecksum: " + checksum);
@@ -318,12 +318,12 @@ public class MediaFilterServiceImpl implements MediaFilterService, InitializingB
{
// only finds the last match (FIXME?)
for (Bundle bundle : bundles) {
List<BundleBitstream> bitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bitstreams) {
if (bundleBitstream.getBitstream().getName().equals(newName)) {
for (Bitstream bitstream : bitstreams) {
if (bitstream.getName().equals(newName)) {
targetBundle = bundle;
existingBitstream = bundleBitstream.getBitstream();
existingBitstream = bitstream;
}
}
}

View File

@@ -52,8 +52,8 @@ public class AuthorizeUtil
public static void authorizeManageBitstreamPolicy(Context context,
Bitstream bitstream) throws AuthorizeException, SQLException
{
BundleBitstream bundleBitstream = bitstream.getBundles().get(0);
authorizeManageBundlePolicy(context, bundleBitstream.getBundle());
Bundle bundle = bitstream.getBundles().get(0);
authorizeManageBundlePolicy(context, bundle);
}
/**

View File

@@ -1055,9 +1055,8 @@ public class GoogleMetadata
int bitstreamCount = 0;
List<Bundle> contentBundles = itemService.getBundles(item, "ORIGINAL");
for (Bundle bundle : contentBundles) {
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams) {
Bitstream candidate = bundleBitstream.getBitstream();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (Bitstream candidate : bitstreams) {
if (candidate.equals(bundle.getPrimaryBitstream())) { // is primary -> use this one
if (isPublic(candidate)) {
return candidate;

View File

@@ -371,9 +371,8 @@ public class SyndicationFeed
try {
List<Bundle> bunds = itemService.getBundles(item, "ORIGINAL");
if (bunds.get(0) != null) {
List<BundleBitstream> bits = bunds.get(0).getBitstreams();
for (BundleBitstream bundleBitstream : bits) {
Bitstream bit = bundleBitstream.getBitstream();
List<Bitstream> bits = bunds.get(0).getBitstreams();
for (Bitstream bit : bits) {
String mime = bit.getFormat(context).getMIMEType();
if (podcastableMIMETypes.contains(mime)) {
SyndEnclosure enc = new SyndEnclosureImpl();

View File

@@ -282,7 +282,7 @@ public class AuthorizeServiceImpl implements AuthorizeService
}
if (o instanceof Bundle)
{
ignoreCustomPolicies = !isAnyItemInstalled(c, ((Bundle) o).getBitstreams());
ignoreCustomPolicies = !isAnyItemInstalled(c, Arrays.asList(((Bundle) o)));
}
if (o instanceof Item)
{
@@ -327,12 +327,12 @@ public class AuthorizeServiceImpl implements AuthorizeService
// check whether any bundle belongs to any item that passed submission
// and workflow process
protected boolean isAnyItemInstalled(Context ctx, List<BundleBitstream> bundles)
protected boolean isAnyItemInstalled(Context ctx, List<Bundle> bundles)
throws SQLException
{
for (BundleBitstream bundle : bundles)
for (Bundle bundle : bundles)
{
for (Item item : bundle.getBundle().getItems())
for (Item item : bundle.getItems())
{
if (workspaceItemService.findByItem(ctx, item) == null
&& workflowItemService.findByItem(ctx, item) == null)

View File

@@ -317,10 +317,9 @@ public class PolicySet
for (Bundle bundle : bundles) {
System.out.println("Bundle " + bundle.getID());
List<BundleBitstream> bitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bitstreams) {
Bitstream bitstream = bundleBitstream.getBitstream();
for (Bitstream bitstream : bitstreams) {
if (filter == null ||
bitstream.getName().indexOf(filter) != -1) {
// is this a replace? delete policies first

View File

@@ -61,9 +61,8 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
@JoinColumn(name = "bitstream_format_id")
private BitstreamFormat bitstreamFormat;
@OneToMany(mappedBy = "bitstream", fetch = FetchType.LAZY)
@OrderBy("bitstreamOrder asc")
private List<BundleBitstream> bundles = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY, mappedBy = "bitstreams")
private List<Bundle> bundles = new ArrayList<>();
@OneToOne(fetch = FetchType.LAZY, mappedBy="logo")
private Community community;
@@ -278,12 +277,12 @@ public class Bitstream extends DSpaceObject implements DSpaceObjectLegacySupport
* @return array of <code>Bundle</code> s this bitstream appears in
* @throws SQLException
*/
public List<BundleBitstream> getBundles() throws SQLException
public List<Bundle> getBundles() throws SQLException
{
return bundles;
}
void setBundles(List<BundleBitstream> bundles) {
void setBundles(List<Bundle> bundles) {
this.bundles = bundles;
}

View File

@@ -13,7 +13,6 @@ import org.apache.log4j.Logger;
import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.dao.BitstreamDAO;
import org.dspace.content.dao.BundleBitstreamDAO;
import org.dspace.content.service.BitstreamFormatService;
import org.dspace.content.service.BitstreamService;
import org.dspace.content.service.BundleService;
@@ -48,8 +47,6 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
@Autowired(required = true)
protected BitstreamDAO bitstreamDAO;
@Autowired(required = true)
protected BundleBitstreamDAO bundleBitstreamDAO;
@Autowired(required = true)
protected ItemService itemService;
@@ -246,16 +243,7 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
context.addEvent(new Event(Event.DELETE, Constants.BITSTREAM, bitstream.getID(),
String.valueOf(bitstream.getSequenceID()), getIdentifiers(context, bitstream)));
Iterator<BundleBitstream> bundleBits = bitstream.getBundles().iterator();
while(bundleBits.hasNext())
{
BundleBitstream bundleBitstream = bundleBits.next();
if(bundleBitstream.getBitstream().getID().equals(bitstream.getID()))
{
bundleBits.remove();
bundleBitstreamDAO.delete(context, bundleBitstream);
}
}
bitstream.getBundles().clear();
// Remove policies
@@ -288,11 +276,11 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
@Override
public DSpaceObject getParentObject(Context context, Bitstream bitstream) throws SQLException {
List<BundleBitstream> bundles = bitstream.getBundles();
List<Bundle> bundles = bitstream.getBundles();
if (CollectionUtils.isNotEmpty(bundles))
{
// the ADMIN action is not allowed on Bundle object so skip to the item
Item item = (Item) bundleService.getParentObject(context, bundles.iterator().next().getBundle());
Item item = (Item) bundleService.getParentObject(context, bundles.iterator().next());
if (item != null)
{
return item;
@@ -367,12 +355,12 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
List<Bundle> bundles = itemService.getBundles(item, bundleName);
for (int i = 0; i < bundles.size(); i++) {
Bundle bundle = bundles.get(i);
List<BundleBitstream> bitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (int j = 0; j < bitstreams.size(); j++) {
BundleBitstream bundleBitstream = bitstreams.get(j);
if(StringUtils.equals(bundleBitstream.getBitstream().getName(), bitstreamName))
Bitstream bitstream = bitstreams.get(j);
if(StringUtils.equals(bitstream.getName(), bitstreamName))
{
return bundleBitstream.getBitstream();
return bitstream;
}
}
}
@@ -384,10 +372,10 @@ public class BitstreamServiceImpl extends DSpaceObjectServiceImpl<Bitstream> imp
List<Bundle> bundles = itemService.getBundles(item, bundleName);
if(CollectionUtils.isNotEmpty(bundles))
{
List<BundleBitstream> bitstreams = bundles.get(0).getBitstreams();
List<Bitstream> bitstreams = bundles.get(0).getBitstreams();
if(CollectionUtils.isNotEmpty(bitstreams))
{
return bitstreams.get(0).getBitstream();
return bitstreams.get(0);
}
}
return null;

View File

@@ -40,9 +40,14 @@ public class Bundle extends DSpaceObject implements DSpaceObjectLegacySupport
@JoinColumn(name = "primary_bitstream_id")
private Bitstream primaryBitstream;
@OneToMany(mappedBy = "bundle", fetch = FetchType.LAZY)
@OrderBy("bitstreamOrder asc")
private List<BundleBitstream> bitstreams = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
name="bundle2bitstream",
joinColumns={@JoinColumn(name="bundle_id") },
inverseJoinColumns={@JoinColumn(name="bitstream_id") }
)
@OrderColumn(name="bitstream_order")
private List<Bitstream> bitstreams = new ArrayList<>();
@ManyToMany(fetch = FetchType.LAZY)
@JoinTable(
@@ -122,11 +127,11 @@ public class Bundle extends DSpaceObject implements DSpaceObjectLegacySupport
*
* @return the bitstreams
*/
public List<BundleBitstream> getBitstreams() {
public List<Bitstream> getBitstreams() {
return bitstreams;
}
void addBitstream(BundleBitstream bitstream){
void addBitstream(Bitstream bitstream){
bitstreams.add(bitstream);
}

View File

@@ -1,87 +0,0 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.content;
import org.hibernate.proxy.HibernateProxyHelper;
import javax.persistence.*;
import java.io.Serializable;
/**
* Database entity representation of the bundle2bitstream table
*
* @author kevinvandevelde at atmire.com
*/
@Entity
@Table(name="bundle2bitstream")
public class BundleBitstream implements Serializable {
@Id
@ManyToOne
@JoinColumn(name="bundle_id", nullable = false, referencedColumnName = "uuid")
private Bundle bundle;
@Id
@ManyToOne
@JoinColumn(name="bitstream_id", nullable = false, referencedColumnName = "uuid")
private Bitstream bitstream;
@Column(name="bitstream_order")
private int bitstreamOrder = -1;
protected BundleBitstream() {
}
@Override
public boolean equals(Object obj) {
if (obj == null)
{
return false;
}
Class<?> objClass = HibernateProxyHelper.getClassWithoutInitializingProxy(obj);
if (getClass() != objClass)
{
return false;
}
final BundleBitstream other = (BundleBitstream) obj;
if(!other.getBundle().equals(bundle))
{
return false;
}
if(!other.getBitstream().equals(bitstream))
{
return false;
}
return true;
}
public Bundle getBundle() {
return bundle;
}
public Bitstream getBitstream() {
return bitstream;
}
public int getBitstreamOrder() {
return bitstreamOrder;
}
void setBundle(Bundle bundle) {
this.bundle = bundle;
}
void setBitstream(Bitstream bitstream) {
this.bitstream = bitstream;
}
void setBitstreamOrder(int bitstreamOrder) {
this.bitstreamOrder = bitstreamOrder;
}
}

View File

@@ -15,7 +15,6 @@ import org.dspace.authorize.AuthorizeException;
import org.dspace.authorize.ResourcePolicy;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.authorize.service.ResourcePolicyService;
import org.dspace.content.dao.BundleBitstreamDAO;
import org.dspace.content.dao.BundleDAO;
import org.dspace.content.service.BitstreamService;
import org.dspace.content.service.BundleService;
@@ -44,9 +43,6 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
@Autowired(required = true)
protected BundleDAO bundleDAO;
@Autowired(required = true)
protected BundleBitstreamDAO bundleBitstreamDAO;
@Autowired(required = true)
protected BitstreamService bitstreamService;
@@ -118,8 +114,7 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
public Bitstream getBitstreamByName(Bundle bundle, String name) {
Bitstream target = null;
for (BundleBitstream bundleBitstream : bundle.getBitstreams()) {
Bitstream bitstream = bundleBitstream.getBitstream();
for (Bitstream bitstream : bundle.getBitstreams()) {
if (name.equals(bitstream.getName())) {
target = bitstream;
break;
@@ -138,28 +133,18 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
+ bundle.getID() + ",bitstream_id=" + bitstream.getID()));
// First check that the bitstream isn't already in the list
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
int topOrder = 0;
// First check that the bitstream isn't already in the list
for (BundleBitstream bundleBitstream : bundleBitstreams) {
if (bitstream.getID().equals(bundleBitstream.getBitstream().getID())) {
for (Bitstream bs : bitstreams) {
if (bitstream.getID().equals(bs.getID())) {
// Bitstream is already there; no change
return;
}
//The last file we encounter will have the highest order
topOrder = bundleBitstream.getBitstreamOrder();
}
// Add the bitstream object
BundleBitstream bundleBitstream = new BundleBitstream();
bundleBitstream.setBitstream(bitstream);
bundleBitstream.setBundle(bundle);
bundleBitstream = bundleBitstreamDAO.create(context, bundleBitstream);
bundleBitstream.setBitstreamOrder(topOrder++);
bundleBitstreamDAO.save(context, bundleBitstream);
bundle.addBitstream(bundleBitstream);
bitstream.getBundles().add(bundleBitstream);
bundle.addBitstream(bitstream);
bitstream.getBundles().add(bundle);
context.addEvent(new Event(Event.ADD, Constants.BUNDLE, bundle.getID(),
@@ -180,21 +165,8 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
log.info(LogManager.getHeader(context, "remove_bitstream",
"bundle_id=" + bundle.getID() + ",bitstream_id=" + bitstream.getID()));
// Remove from internal list of bitstreams
Iterator<BundleBitstream> li = bundle.getBitstreams().iterator();
while (li.hasNext())
{
BundleBitstream bundleBitstream = li.next();
if (bitstream.getID().equals(bundleBitstream.getBitstream().getID()))
{
// We've found the bitstream to remove
li.remove();
bitstream.getBundles().remove(bundleBitstream);
bundle.getBitstreams().remove(bundleBitstream);
bundleBitstreamDAO.delete(context, bundleBitstream);
}
}
bundle.getBitstreams().remove(bitstream);
bitstream.getBundles().remove(bundle);
context.addEvent(new Event(Event.REMOVE, Constants.BUNDLE, bundle.getID(),
Constants.BITSTREAM, bitstream.getID(), String.valueOf(bitstream.getSequenceID()),
@@ -247,12 +219,11 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
@Override
public void replaceAllBitstreamPolicies(Context context, Bundle bundle, List<ResourcePolicy> newpolicies) throws SQLException, AuthorizeException {
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
if (CollectionUtils.isNotEmpty(bundleBitstreams))
List<Bitstream> bitstreams = bundle.getBitstreams();
if (CollectionUtils.isNotEmpty(bitstreams))
{
for (BundleBitstream bundleBitstream : bundleBitstreams)
for (Bitstream bs : bitstreams)
{
Bitstream bs = bundleBitstream.getBitstream();
// change bitstream policies
authorizeService.removeAllPolicies(context, bs);
authorizeService.addPolicies(context, newpolicies, bs);
@@ -266,12 +237,12 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
@Override
public List<ResourcePolicy> getBitstreamPolicies(Context context, Bundle bundle) throws SQLException {
List<ResourcePolicy> list = new ArrayList<ResourcePolicy>();
List<BundleBitstream> bitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
if (CollectionUtils.isNotEmpty(bitstreams))
{
for (BundleBitstream bs : bitstreams)
for (Bitstream bs : bitstreams)
{
list.addAll(authorizeService.getPolicies(context, bs.getBitstream()));
list.addAll(authorizeService.getPolicies(context, bs));
}
}
return list;
@@ -286,6 +257,7 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
public void setOrder(Context context, Bundle bundle, UUID[] bitstreamIds) throws AuthorizeException, SQLException {
authorizeService.authorizeAction(context, bundle, Constants.WRITE);
bundle.getBitstreams().clear();
for (int i = 0; i < bitstreamIds.length; i++) {
UUID bitstreamId = bitstreamIds[i];
Bitstream bitstream = bitstreamService.find(context, bitstreamId);
@@ -294,13 +266,10 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
log.warn(LogManager.getHeader(context, "Invalid bitstream id while changing bitstream order", "Bundle: " + bundle.getID() + ", bitstream id: " + bitstreamId));
continue;
}
bitstream.getBundles().remove(bundle);
bundle.getBitstreams().add(bitstream);
bitstream.getBundles().add(bundle);
List<BundleBitstream> bitstreamBundles = bitstream.getBundles();
for (BundleBitstream bundleBitstream : bitstreamBundles) {
bundleBitstream.setBitstreamOrder(i);
bundleBitstreamDAO.save(context, bundleBitstream);
}
bitstreamService.update(context, bitstream);
}
@@ -415,12 +384,11 @@ public class BundleServiceImpl extends DSpaceObjectServiceImpl<Bundle> implement
bundle.getName(), getIdentifiers(context, bundle)));
// Remove bitstreams
Iterator<BundleBitstream> bundleBitstreams = bundle.getBitstreams().iterator();
while (bundleBitstreams.hasNext()) {
BundleBitstream bundleBitstream = bundleBitstreams.next();
bundleBitstreams.remove();
removeBitstream(context, bundle, bundleBitstream.getBitstream());
bundleBitstreamDAO.delete(context, bundleBitstream);
Iterator<Bitstream> bitstreams = bundle.getBitstreams().iterator();
while (bitstreams.hasNext()) {
Bitstream bitstream = bitstreams.next();
bitstreams.remove();
removeBitstream(context, bundle, bitstream);
}
Iterator<Item> items = bundle.getItems().iterator();

View File

@@ -330,10 +330,9 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
List<Bundle> bunds = item.getBundles();
for (Bundle bund : bunds) {
List<BundleBitstream> bitstreams = bund.getBitstreams();
List<Bitstream> bitstreams = bund.getBitstreams();
for (BundleBitstream bundleBitstream : bitstreams) {
Bitstream bitstream = bundleBitstream.getBitstream();
for (Bitstream bitstream : bitstreams) {
if (!bitstream.getFormat(context).isInternal()) {
// Bitstream is not of an internal format
bitstreamList.add(bitstream);
@@ -389,10 +388,10 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
for (Bundle bund : bunds) {
boolean removethisbundle = false;
List<BundleBitstream> bits = bund.getBitstreams();
List<Bitstream> bits = bund.getBitstreams();
for (BundleBitstream bit : bits) {
BitstreamFormat bft = bit.getBitstream().getFormat(context);
for (Bitstream bit : bits) {
BitstreamFormat bft = bit.getFormat(context);
if (bft.getID() == licensetype) {
removethisbundle = true;
@@ -426,10 +425,9 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
// find the highest current sequence number
for (Bundle bund : bunds) {
List<BundleBitstream> streams = bund.getBitstreams();
List<Bitstream> streams = bund.getBitstreams();
for (BundleBitstream bundleBitstream : streams) {
Bitstream bitstream = bundleBitstream.getBitstream();
for (Bitstream bitstream : streams) {
if (bitstream.getSequenceID() > sequence) {
sequence = bitstream.getSequenceID();
}
@@ -441,10 +439,9 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
for (Bundle bund : bunds) {
List<BundleBitstream> streams = bund.getBitstreams();
List<Bitstream> streams = bund.getBitstreams();
for (BundleBitstream bundleBitstream : streams) {
Bitstream stream = bundleBitstream.getBitstream();
for (Bitstream stream : streams) {
if (stream.getSequenceID() < 0) {
stream.setSequenceID(sequence);
sequence++;
@@ -687,10 +684,9 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
List<Bundle> bunds = item.getBundles();
for (Bundle mybundle : bunds) {
List<BundleBitstream> bs = mybundle.getBitstreams();
List<Bitstream> bs = mybundle.getBitstreams();
for (BundleBitstream b : bs) {
Bitstream bitstream = b.getBitstream();
for (Bitstream bitstream : bs) {
// remove bitstream policies
authorizeService.removeGroupPolicies(context, bitstream, group);
}
@@ -731,9 +727,8 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl<Item> implements It
List<ResourcePolicy> policiesBundleToAdd = filterPoliciesToAdd(context, defaultCollectionPolicies, mybundle);
authorizeService.addPolicies(context, policiesBundleToAdd, mybundle);
for(BundleBitstream bundleBitstream : mybundle.getBitstreams())
for(Bitstream bitstream : mybundle.getBitstreams())
{
Bitstream bitstream = bundleBitstream.getBitstream();
// if come from InstallItem: remove all submission/workflow policies
authorizeService.removeAllPoliciesByDSOAndType(context, bitstream, ResourcePolicy.TYPE_SUBMISSION);
authorizeService.removeAllPoliciesByDSOAndType(context, bitstream, ResourcePolicy.TYPE_WORKFLOW);

View File

@@ -216,7 +216,7 @@ public class OREDisseminationCrosswalk
// Add a link and an oreatom metadata entry for each bitstream in the item
List<Bundle> bundles = item.getBundles();
List<BundleBitstream> bitstreams;
List<Bitstream> bitstreams;
for (Bundle bundle : bundles)
{
// Omit the special "ORE" bitstream
@@ -226,9 +226,8 @@ public class OREDisseminationCrosswalk
}
bitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bitstreams)
for (Bitstream bs : bitstreams)
{
Bitstream bs = bundleBitstream.getBitstream();
arLink = new Element("link",ATOM_NS);
arLink.setAttribute("rel", ORE_NS.getURI()+"aggregates");
arLink.setAttribute("href",dsUrl + "/bitstream/handle/" + item.getHandle() + "/" + encodeForURL(bs.getName()) + "?sequence=" + bs.getSequenceID());

View File

@@ -244,10 +244,10 @@ public class PREMISCrosswalk
String baseUrl = ConfigurationManager.getProperty("dspace.url");
String handle = null;
// get handle of parent Item of this bitstream, if there is one:
List<BundleBitstream> bn = bitstream.getBundles();
List<Bundle> bn = bitstream.getBundles();
if (bn.size() > 0)
{
List<Item> bi = bn.get(0).getBundle().getItems();
List<Item> bi = bn.get(0).getItems();
if (bi.size() > 0)
{
handle = bi.get(0).getHandle();

View File

@@ -1,21 +0,0 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.content.dao;
import org.dspace.content.BundleBitstream;
import org.dspace.core.GenericDAO;
/**
* Database Access Object interface class for the BundleBitstream object.
* The implementation of this class is responsible for all database calls for the BundleBitstream object and is autowired by spring
* This class should only be accessed from a single service & should never be exposed outside of the API
*
* @author kevinvandevelde at atmire.com
*/
public interface BundleBitstreamDAO extends GenericDAO<BundleBitstream> {
}

View File

@@ -1,23 +0,0 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.content.dao.impl;
import org.dspace.content.BundleBitstream;
import org.dspace.content.dao.BundleBitstreamDAO;
import org.dspace.core.AbstractHibernateDAO;
/**
* Hibernate implementation of the Database Access Object interface class for the BundleBitstream object.
* This class is responsible for all database calls for the BundleBitstream object and is autowired by spring
* This class should never be accessed directly.
*
* @author kevinvandevelde at atmire.com
*/
public class BundleBitstreamDAOImpl extends AbstractHibernateDAO<BundleBitstream> implements BundleBitstreamDAO {
}

View File

@@ -438,9 +438,8 @@ public abstract class AbstractMETSDisseminator
throw new AuthorizeException("Not authorized to read Bundle named \"" + bundle.getName() + "\"");
}
}
List<BundleBitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bitstreams) {
Bitstream bitstream = bundleBitstream.getBitstream();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (Bitstream bitstream : bitstreams) {
boolean auth = authorizeService.authorizeActionBoolean(context,
bitstream, Constants.READ);
if (auth ||
@@ -885,7 +884,7 @@ public abstract class AbstractMETSDisseminator
}
}
List<BundleBitstream> bitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
// Create a fileGrp, USE = permuted Bundle name
FileGrp fileGrp = new FileGrp();
@@ -909,9 +908,8 @@ public abstract class AbstractMETSDisseminator
}
// For each bitstream, add to METS manifest
for (BundleBitstream bundleBitstream : bitstreams)
for (Bitstream bitstream : bitstreams)
{
Bitstream bitstream = bundleBitstream.getBitstream();
// Check for authorization. Handle unauthorized
// bitstreams to match the logic in disseminate(),
// i.e. "unauth=zero" means include a 0-length bitstream,
@@ -1274,11 +1272,10 @@ public abstract class AbstractMETSDisseminator
if ((bundle.getName() != null)
&& bundle.getName().equals("ORIGINAL")) {
// Now find the corresponding bitstream
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
for (Bitstream bitstream : bitstreams)
{
Bitstream bitstream = bundleBitstream.getBitstream();
if (bitstream.getName().equals(originalFilename)) {
return bitstream;
}
@@ -1487,10 +1484,10 @@ public abstract class AbstractMETSDisseminator
{
// get handle of parent Item of this bitstream, if there is one:
String handle = null;
List<BundleBitstream> bn = bitstream.getBundles();
List<Bundle> bn = bitstream.getBundles();
if (bn.size() > 0)
{
List<Item> bi = bn.get(0).getBundle().getItems();
List<Item> bi = bn.get(0).getItems();
if (bi.size() > 0)
{
handle = bi.get(0).getHandle();

View File

@@ -222,11 +222,10 @@ public class PackageUtils
}
for (Bundle bundle : bundles)
{
List<BundleBitstream> bitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bitstreams)
for (Bitstream bitstream : bitstreams)
{
Bitstream bitstream = bundleBitstream.getBitstream();
if (bsName.equals(bitstream.getName())) {
return bitstream;
}
@@ -259,10 +258,9 @@ public class PackageUtils
bundles = itemService.getBundles(item, bnName);
}
for (Bundle bundle : bundles) {
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams) {
Bitstream bitstream = bundleBitstream.getBitstream();
for (Bitstream bitstream : bitstreams) {
if (bitstream.getFormat(context).getID() == fid) {
return bitstream;
}
@@ -401,12 +399,11 @@ public class PackageUtils
for (Bundle bundle : bundles)
{
// Assume license will be in its own bundle
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
for (Bitstream bitstream : bitstreams)
{
// The License should have a file format of "License"
Bitstream bitstream = bundleBitstream.getBitstream();
if (bitstream.getFormat(context).getID() == licenseFormatId) {
//found a bitstream with format "License" -- return it
return bitstream;
@@ -416,8 +413,8 @@ public class PackageUtils
// If we couldn't find a bitstream with format = "License",
// we will just assume the first bitstream is the deposit license
// (usually a safe assumption as it is in the LICENSE bundle)
if (bundleBitstreams.size() > 0) {
return bundleBitstreams.get(0).getBitstream();
if (bitstreams.size() > 0) {
return bitstreams.get(0);
}
}

View File

@@ -57,15 +57,15 @@ public class BitstreamsIntoMetadata extends AbstractCurationTask
itemService.clearMetadata(Curator.curationContext(), item, "dc", "format", Item.ANY, Item.ANY);
for (Bundle bundle : item.getBundles()) {
if ("ORIGINAL".equals(bundle.getName())) {
for (BundleBitstream bundleBitstream : bundle.getBitstreams()) {
for (Bitstream bitstream : bundle.getBitstreams()) {
// Add the metadata and update the item
addMetadata(item, bundleBitstream.getBitstream(), "original");
addMetadata(item, bitstream, "original");
changed = true;
}
} else if ("THUMBNAIL".equals(bundle.getName())) {
for (BundleBitstream bundleBitstream : bundle.getBitstreams()) {
for (Bitstream bitstream : bundle.getBitstreams()) {
// Add the metadata and update the item
addMetadata(item, bundleBitstream.getBitstream(), "thumbnail");
addMetadata(item, bitstream, "thumbnail");
changed = true;
}
}

View File

@@ -106,9 +106,8 @@ public class ClamScan extends AbstractCurationTask
{
Bundle bundle = itemService.getBundles(item, "ORIGINAL").get(0);
results = new ArrayList<String>();
for (BundleBitstream bundleBitstream : bundle.getBitstreams())
for (Bitstream bitstream : bundle.getBitstreams())
{
Bitstream bitstream = bundleBitstream.getBitstream();
InputStream inputstream = bitstreamService.retrieve(Curator.curationContext(), bitstream);
logDebugMessage("Scanning " + bitstream.getName() + " . . . ");
int bstatus = scan(bitstream, inputstream, getItemHandle(item));

View File

@@ -52,9 +52,8 @@ public class ProfileFormats extends AbstractCurationTask
{
for (Bundle bundle : item.getBundles())
{
for (BundleBitstream bundleBitstream : bundle.getBitstreams())
for (Bitstream bs : bundle.getBitstreams())
{
Bitstream bs = bundleBitstream.getBitstream();
String fmt = bs.getFormat(Curator.curationContext()).getShortDescription();
Integer count = fmtTable.get(fmt);
if (count == null)

View File

@@ -108,8 +108,7 @@ public class CitationPage extends AbstractCurationTask {
//Create a map of the bitstreams in the displayBundle. This is used to
//check if the bundle being cited is already in the display bundle.
Map<String,Bitstream> displayMap = new HashMap<String,Bitstream>();
for (BundleBitstream bundleBitstream : dBundle.getBitstreams()) {
Bitstream bs = bundleBitstream.getBitstream();
for (Bitstream bs : dBundle.getBitstreams()) {
displayMap.put(bs.getName(), bs);
}
@@ -136,12 +135,11 @@ public class CitationPage extends AbstractCurationTask {
//Start looping through our bundles. Anything that is citable in these
//bundles will be cited.
for (Bundle bundle : bundles) {
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
// Loop through each file and generate a cover page for documents
// that are PDFs.
for (BundleBitstream bundleBitstream : bundleBitstreams) {
Bitstream bitstream = bundleBitstream.getBitstream();
for (Bitstream bitstream : bitstreams) {
BitstreamFormat format = bitstream.getFormat(Curator.curationContext());
//If bitstream is a PDF document then it is citable.
@@ -211,8 +209,8 @@ public class CitationPage extends AbstractCurationTask {
if (bundle.getID() != pBundle.getID()) {
bundleService.addBitstream(context, pBundle, bitstream);
bundleService.removeBitstream(context, bundle, bitstream);
List<BundleBitstream> originalBits = bundle.getBitstreams();
if (originalBits == null || originalBits.size() == 0) {
List<Bitstream> bitstreams = bundle.getBitstreams();
if (bitstreams == null || bitstreams.size() == 0) {
itemService.removeBundle(context, item, bundle);
}
}

View File

@@ -1349,11 +1349,10 @@ public class SolrServiceImpl implements SearchService, IndexingService {
&& myBundle.getName().equals("TEXT"))
{
// a-ha! grab the text out of the bitstreams
List<BundleBitstream> bundleBitstreams = myBundle.getBitstreams();
List<Bitstream> bitstreams = myBundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
for (Bitstream myBitstream : bitstreams)
{
Bitstream myBitstream = bundleBitstream.getBitstream();
try {
streams.add(new BitstreamContentStream(context, myBitstream));

View File

@@ -99,9 +99,8 @@ public class DefaultEmbargoSetter implements EmbargoSetter
{
//AuthorizeManager.removePoliciesActionFilter(context, bn, Constants.READ);
generatePolicies(context, liftDate.toDate(), null, bn, item.getOwningCollection());
for (BundleBitstream bundleBitstream : bn.getBitstreams())
for (Bitstream bs : bn.getBitstreams())
{
Bitstream bs = bundleBitstream.getBitstream();
//AuthorizeManager.removePoliciesActionFilter(context, bs, Constants.READ);
generatePolicies(context, liftDate.toDate(), null, bs, item.getOwningCollection());
}
@@ -176,9 +175,8 @@ public class DefaultEmbargoSetter implements EmbargoSetter
}
}
for (BundleBitstream bundleBitstream : bn.getBitstreams())
for (Bitstream bs : bn.getBitstreams())
{
Bitstream bs = bundleBitstream.getBitstream();
for (ResourcePolicy rp : getAuthorizeService().getPoliciesActionFilter(context, bs, Constants.READ))
{
System.out.println("CHECK WARNING: Item "+item.getHandle()+", Bitstream "+bs.getName()+" (in Bundle "+bn.getName()+") allows READ by "+

View File

@@ -112,10 +112,9 @@ public class RDFConsumer implements Consumer
+ "and we'll cover it by a REMOVE event on its bundle.");
return;
}
List<BundleBitstream> bundleBitstreams = bitstream.getBundles();
for (BundleBitstream bundleBitstream : bundleBitstreams)
List<Bundle> bundles = bitstream.getBundles();
for (Bundle b : bundles)
{
Bundle b = bundleBitstream.getBundle();
List<Item> items = b.getItems();
for (Item i : items)
{

View File

@@ -527,9 +527,8 @@ implements ConverterPlugin
// be configurable).
if (bundle.getName().equals("ORIGINAL"))
{
for (BundleBitstream bundleBitstream : bundle.getBitstreams())
for (Bitstream bs : bundle.getBitstreams())
{
Bitstream bs = bundleBitstream.getBitstream();
if (RDFUtil.isPublicBoolean(context, bs))
{
String url = bitstreamURI(context, bs);

View File

@@ -1232,11 +1232,11 @@ public class DSIndexer
if ((myBundle.getName() != null)
&& myBundle.getName().equals("TEXT")) {
// a-ha! grab the text out of the bitstreams
List<BundleBitstream> bundleBitstreams = myBundle.getBitstreams();
List<Bitstream> bitstreams = myBundle.getBitstreams();
for (j = 0; j < bundleBitstreams.size(); j++)
for (j = 0; j < bitstreams.size(); j++)
try {
Bitstream bitstream = bundleBitstreams.get(j).getBitstream();
Bitstream bitstream = bitstreams.get(j);
// Add each InputStream to the Indexed Document (Acts like an Append)
doc.add(new Field("default", new BufferedReader(new InputStreamReader(bitstreamService.retrieve(context, bitstream)))));

View File

@@ -268,10 +268,10 @@ public class ElasticSearchLoggerServiceImpl implements ElasticSearchLoggerServic
if (dspaceObject instanceof Bitstream) {
Bitstream bit = (Bitstream) dspaceObject;
List<BundleBitstream> bundles = bit.getBundles();
List<Bundle> bundles = bit.getBundles();
docBuilder.field("bundleName").startArray();
for (BundleBitstream bundleBitstream : bundles) {
docBuilder.value(bundleBitstream.getBundle().getName());
for (Bundle bundle : bundles) {
docBuilder.value(bundle.getName());
}
docBuilder.endArray();
}
@@ -386,10 +386,10 @@ public class ElasticSearchLoggerServiceImpl implements ElasticSearchLoggerServic
if (dspaceObject instanceof Bitstream) {
Bitstream bit = (Bitstream) dspaceObject;
List<BundleBitstream> bundles = bit.getBundles();
List<Bundle> bundles = bit.getBundles();
docBuilder.field("bundleName").startArray();
for (BundleBitstream bundleBitstream : bundles) {
docBuilder.value(bundleBitstream.getBundle().getName());
for (Bundle bundle : bundles) {
docBuilder.value(bundle.getName());
}
docBuilder.endArray();
}
@@ -493,8 +493,8 @@ public class ElasticSearchLoggerServiceImpl implements ElasticSearchLoggerServic
} else if (dso instanceof Bitstream) {
Bitstream bitstream = (Bitstream) dso;
for (BundleBitstream bundleBitstream : bitstream.getBundles()) {
for (Item item : bundleBitstream.getBundle().getItems()) {
for (Bundle bundle : bitstream.getBundles()) {
for (Item item : bundle.getItems()) {
parents.get("owningItem").add(item.getID().toString());
buildParents(item, parents);

View File

@@ -215,9 +215,9 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
if(dspaceObject instanceof Bitstream)
{
Bitstream bit = (Bitstream) dspaceObject;
List<BundleBitstream> bundleBitstreams = bit.getBundles();
for (BundleBitstream bundle : bundleBitstreams) {
doc1.addField("bundleName", bundle.getBundle().getName());
List<Bundle> bundles = bit.getBundles();
for (Bundle bundle : bundles) {
doc1.addField("bundleName", bundle.getName());
}
}
@@ -253,9 +253,9 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
return;
if (dspaceObject instanceof Bitstream) {
Bitstream bit = (Bitstream) dspaceObject;
List<BundleBitstream> bundles = bit.getBundles();
for (BundleBitstream bundleBitstream : bundles) {
doc1.addField("bundleName", bundleBitstream.getBundle().getName());
List<Bundle> bundles = bit.getBundles();
for (Bundle bundle : bundles) {
doc1.addField("bundleName", bundle.getName());
}
}
@@ -600,9 +600,9 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
else if (dso instanceof Bitstream)
{
Bitstream bitstream = (Bitstream) dso;
List<BundleBitstream> bundles = bitstream.getBundles();
for (BundleBitstream bundleBitstream : bundles) {
List<Item> items = bundleBitstream.getBundle().getItems();
List<Bundle> bundles = bitstream.getBundles();
for (Bundle bundle : bundles) {
List<Item> items = bundle.getItems();
for (Item item : items) {
doc1.addField("owningItem", item.getID());
storeParents(doc1, item);
@@ -1376,9 +1376,9 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea
Bitstream bitstream = bitstreamService.findByIdOrLegacyId(context, bitstreamId);
//Attempt to retrieve our bitstream !
if (bitstream != null){
List<BundleBitstream> bundles = bitstream.getBundles();
List<Bundle> bundles = bitstream.getBundles();
if(bundles != null && 0 < bundles.size()){
Bundle bundle = bundles.get(0).getBundle();
Bundle bundle = bundles.get(0);
bundleName = bundle.getName();
}else{
//No bundle found, we are either a collection or a community logo, check for it !

View File

@@ -407,7 +407,7 @@ public class StatisticsDataVisits extends StatisticsData
for (int j = 0; j < item.getBundles().size(); j++) {
Bundle bundle = item.getBundles().get(j);
for (int k = 0; k < bundle.getBitstreams().size(); k++) {
Bitstream bitstream = bundle.getBitstreams().get(k).getBitstream();
Bitstream bitstream = bundle.getBitstreams().get(k);
if(!bitstream.getFormat(context).isInternal()){
// Add a separate query for each bitstream
query.setDso(bitstream, bitstream.getType(), dsoLength);
@@ -607,10 +607,10 @@ public class StatisticsDataVisits extends StatisticsData
//Get our owning item
Item owningItem = null;
List<BundleBitstream> bunds = bit.getBundles();
if(0 < bunds.size() && 0 < bunds.get(0).getBundle().getItems().size())
List<Bundle> bunds = bit.getBundles();
if(0 < bunds.size() && 0 < bunds.get(0).getItems().size())
{
owningItem = bunds.get(0).getBundle().getItems().get(0);
owningItem = bunds.get(0).getItems().get(0);
}
// If possible reference this bitstream via a handle, however this may

View File

@@ -13,7 +13,7 @@ import org.apache.commons.cli.*;
import org.apache.commons.lang.time.DateFormatUtils;
import org.apache.log4j.Logger;
import org.dspace.content.Bitstream;
import org.dspace.content.BundleBitstream;
import org.dspace.content.Bundle;
import org.dspace.content.DSpaceObject;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.DSpaceObjectLegacySupportService;
@@ -273,10 +273,10 @@ public class StatisticsImporterElasticSearch {
if (dso instanceof Bitstream) {
Bitstream bit = (Bitstream) dso;
List<BundleBitstream> bundles = bit.getBundles();
List<Bundle> bundles = bit.getBundles();
postBuilder = postBuilder.field("bundleName").startArray();
for (BundleBitstream bundle : bundles) {
postBuilder = postBuilder.value(bundle.getBundle().getName());
for (Bundle bundle : bundles) {
postBuilder = postBuilder.value(bundle.getName());
}
postBuilder = postBuilder.endArray();
}

View File

@@ -187,7 +187,7 @@ public class InitialQuestionsStep extends AbstractProcessingStep
if (bundles.size() > 0)
{
List<BundleBitstream> bitstreams = bundles.get(0).getBitstreams();
List<Bitstream> bitstreams = bundles.get(0).getBitstreams();
willRemoveFiles = bitstreams.size() > 1;
}
@@ -318,18 +318,18 @@ public class InitialQuestionsStep extends AbstractProcessingStep
if (bundles.size() > 0)
{
Iterator<BundleBitstream> bundleBitstreams = bundles.get(0).getBitstreams().iterator();
Iterator<Bitstream> bitstreams = bundles.get(0).getBitstreams().iterator();
//Do NOT remove the first one
if(bundleBitstreams.hasNext())
if(bitstreams.hasNext())
{
bundleBitstreams.next();
bitstreams.next();
}
while (bundleBitstreams.hasNext())
while (bitstreams.hasNext())
{
//TODO: HIBERNATE, write unit test for this
BundleBitstream bundleBitstream = bundleBitstreams.next();
bundleService.removeBitstream(context, bundles.get(0), bundleBitstream.getBitstream());
Bitstream bitstream = bitstreams.next();
bundleService.removeBitstream(context, bundles.get(0), bitstream);
}
}
}

View File

@@ -405,16 +405,16 @@ public class UploadStep extends AbstractProcessingStep
// remove bitstream from bundle..
// delete bundle if it's now empty
List<BundleBitstream> bundles = bitstream.getBundles();
List<Bundle> bundles = bitstream.getBundles();
bundleService.removeBitstream(context, bundles.get(0).getBundle(), bitstream);
bundleService.removeBitstream(context, bundles.get(0), bitstream);
List<BundleBitstream> bitstreams = bundles.get(0).getBundle().getBitstreams();
List<Bitstream> bitstreams = bundles.get(0).getBitstreams();
// remove bundle if it's now empty
if (bitstreams.size() < 1)
{
itemService.removeBundle(context, item, bundles.get(0).getBundle());
itemService.removeBundle(context, item, bundles.get(0));
itemService.update(context, item);
}
@@ -591,16 +591,16 @@ public class UploadStep extends AbstractProcessingStep
{
// remove bitstream from bundle..
// delete bundle if it's now empty
List<BundleBitstream> bundleBitstreams = b.getBundles();
List<Bundle> bundles = b.getBundles();
bundleService.removeBitstream(context, bundleBitstreams.get(0).getBundle(), b);
bundleService.removeBitstream(context, bundles.get(0), b);
List<BundleBitstream> bitstreams = bundleBitstreams.get(0).getBundle().getBitstreams();
List<Bitstream> bitstreams = bundles.get(0).getBitstreams();
// remove bundle if it's now empty
if (bitstreams.size() < 1)
{
itemService.removeBundle(context, item, bundleBitstreams.get(0).getBundle());
itemService.removeBundle(context, item, bundles.get(0));
itemService.update(context, item);
}

View File

@@ -76,9 +76,8 @@ public abstract class AbstractVersionProvider {
authorizeService.findPoliciesByDSOAndType(c, nativeBundle, ResourcePolicy.TYPE_CUSTOM);
authorizeService.addPolicies(c, bundlePolicies, bundleNew);
for(BundleBitstream nativeBundleBitstream : nativeBundle.getBitstreams())
for(Bitstream nativeBitstream : nativeBundle.getBitstreams())
{
Bitstream nativeBitstream = nativeBundleBitstream.getBitstream();
Bitstream bitstreamNew = createBitstream(c, nativeBitstream);
bundleService.addBitstream(c, bundleNew, bitstreamNew);

View File

@@ -682,9 +682,9 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
List<Bundle> bundles = item.getBundles();
for (Bundle bundle : bundles) {
authorizeService.addPolicy(context, bundle, type, epa);
List<BundleBitstream> bits = bundle.getBitstreams();
for (BundleBitstream bit : bits) {
authorizeService.addPolicy(context, bit.getBitstream(), type, epa);
List<Bitstream> bits = bundle.getBitstreams();
for (Bitstream bit : bits) {
authorizeService.addPolicy(context, bit, type, epa);
}
}
}
@@ -695,9 +695,9 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
List<Bundle> bundles = item.getBundles();
for (Bundle bundle : bundles) {
authorizeService.addPolicy(context, bundle, type, group);
List<BundleBitstream> bits = bundle.getBitstreams();
for (BundleBitstream bit : bits) {
authorizeService.addPolicy(context, bit.getBitstream(), type, group);
List<Bitstream> bits = bundle.getBitstreams();
for (Bitstream bit : bits) {
authorizeService.addPolicy(context, bit, type, group);
}
}
}
@@ -711,9 +711,9 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
List<Bundle> bundles = item.getBundles();
for (Bundle bundle : bundles) {
authorizeService.removeEPersonPolicies(context, bundle, e);
List<BundleBitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bitstream : bitstreams) {
authorizeService.removeEPersonPolicies(context, bitstream.getBitstream(), e);
List<Bitstream> bitstreams = bundle.getBitstreams();
for (Bitstream bitstream : bitstreams) {
authorizeService.removeEPersonPolicies(context, bitstream, e);
}
}
// Ensure that the submitter always retains his resource policies
@@ -732,9 +732,9 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService {
List<Bundle> bundles = item.getBundles();
for (Bundle bundle : bundles) {
authorizeService.removeGroupPolicies(context, bundle, e);
List<BundleBitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bitstream : bitstreams) {
authorizeService.removeGroupPolicies(context, bitstream.getBitstream(), e);
List<Bitstream> bitstreams = bundle.getBitstreams();
for (Bitstream bitstream : bitstreams) {
authorizeService.removeGroupPolicies(context, bitstream, e);
}
}
}

View File

@@ -196,7 +196,7 @@ ALTER TABLE bundle2bitstream ALTER COLUMN bitstream_id SET NOT NULL;
ALTER TABLE bundle2bitstream DROP COLUMN bundle_legacy_id;
ALTER TABLE bundle2bitstream DROP COLUMN bitstream_legacy_id;
ALTER TABLE bundle2bitstream DROP COLUMN id;
ALTER TABLE bundle2bitstream add primary key (bitstream_id,bundle_id);
ALTER TABLE bundle2bitstream add primary key (bitstream_id,bundle_id,bitstream_order);
-- Migrate item

View File

@@ -30,8 +30,8 @@ CREATE SEQUENCE cwf_in_progress_user_seq;
CREATE TABLE cwf_workflowitem
(
workflowitem_id integer DEFAULT nextval('cwf_workflowitem_seq') PRIMARY KEY,
item_id INTEGER REFERENCES item(item_id) UNIQUE,
collection_id INTEGER REFERENCES collection(collection_id),
item_id UUID REFERENCES item(uuid) UNIQUE,
collection_id UUID REFERENCES collection(uuid),
-- Answers to questions on first page of submit UI
multiple_titles BOOL,
@@ -42,8 +42,8 @@ CREATE TABLE cwf_workflowitem
);
CREATE INDEX cwf_workflowitem_item_fk_idx ON cwf_workflowitem(item_id);
CREATE INDEX cwf_workflowitem_coll_fk_idx ON cwf_workflowitem(collection_id);
CREATE INDEX cwf_workflowitem_item_fk_idx ON cwf_workflowitem(uuid);
CREATE INDEX cwf_workflowitem_coll_fk_idx ON cwf_workflowitem(uuid);
CREATE TABLE cwf_collectionrole (
@@ -63,8 +63,8 @@ CREATE TABLE cwf_workflowitemrole (
workflowitemrole_id integer DEFAULT nextval('cwf_workflowitemrole_seq') PRIMARY KEY,
role_id Text,
workflowitem_id integer REFERENCES cwf_workflowitem(workflowitem_id),
eperson_id integer REFERENCES eperson(eperson_id),
group_id integer REFERENCES epersongroup(eperson_group_id)
eperson_id UUID REFERENCES eperson(uuid),
group_id UUID REFERENCES epersongroup(eperson_group_id)
);
ALTER TABLE ONLY cwf_workflowitemrole
ADD CONSTRAINT cwf_workflowitemrole_unique UNIQUE (role_id, workflowitem_id, eperson_id);
@@ -79,11 +79,11 @@ CREATE TABLE cwf_pooltask (
workflow_id TEXT,
step_id TEXT,
action_id TEXT,
eperson_id INTEGER REFERENCES EPerson(eperson_id),
group_id INTEGER REFERENCES epersongroup(eperson_group_id)
eperson_id UUID REFERENCES EPerson(uuid),
group_id UUID REFERENCES epersongroup(uuid)
);
CREATE INDEX cwf_pooltask_eperson_fk_idx ON cwf_pooltask(eperson_id);
CREATE INDEX cwf_pooltask_eperson_fk_idx ON cwf_pooltask(uuid);
CREATE INDEX cwf_pooltask_workflow_fk_idx ON cwf_pooltask(workflowitem_id);
CREATE INDEX cwf_pooltask_workflow_eperson_fk_idx ON cwf_pooltask(eperson_id,workflowitem_id);
@@ -95,7 +95,7 @@ CREATE TABLE cwf_claimtask (
workflow_id Text,
step_id Text,
action_id Text,
owner_id integer REFERENCES eperson(eperson_id)
owner_id UUID REFERENCES eperson(uuid)
);
ALTER TABLE ONLY cwf_claimtask
@@ -112,7 +112,7 @@ CREATE INDEX cwf_claimtask_workflow_step_action_eperson_fk_idx ON cwf_claimtask(
CREATE TABLE cwf_in_progress_user (
in_progress_user_id integer DEFAULT nextval('cwf_in_progress_user_seq') PRIMARY KEY,
workflowitem_id integer REFERENCES cwf_workflowitem(workflowitem_id),
user_id integer REFERENCES eperson(eperson_id),
user_id UUID REFERENCES eperson(uuid),
finished BOOL
);

View File

@@ -340,7 +340,7 @@ public class BundleTest extends AbstractDSpaceObjectTest
bundleService.addBitstream(context, b, bs);
assertThat("testGetBitstreams 2", b.getBitstreams(), notNullValue());
assertThat("testGetBitstreams 3", b.getBitstreams().size(), equalTo(1));
assertThat("testGetBitstreams 4", b.getBitstreams().get(0).getBitstream().getName(), equalTo(name));
assertThat("testGetBitstreams 4", b.getBitstreams().get(0).getName(), equalTo(name));
}
/**

View File

@@ -236,7 +236,7 @@ public class LicenseUtilsTest extends AbstractUnitTest
LicenseUtils.grantLicense(context, item, defaultLicense);
StringWriter writer = new StringWriter();
IOUtils.copy(bitstreamService.retrieve(context, itemService.getBundles(item, "LICENSE").get(0).getBitstreams().get(0).getBitstream()), writer);
IOUtils.copy(bitstreamService.retrieve(context, itemService.getBundles(item, "LICENSE").get(0).getBitstreams().get(0)), writer);
String license = writer.toString();
assertThat("testGrantLicense 0",license, equalTo(defaultLicense));

View File

@@ -641,12 +641,12 @@ public class DSpaceAIPIntegrationTest extends AbstractUnitTest
List<Bundle> bundles = itemService.getBundles(testItem, Constants.CONTENT_BUNDLE_NAME);
if(bundles.size()>0)
{
List<BundleBitstream> bitstreams = bundles.get(0).getBitstreams();
List<Bitstream> bitstreams = bundles.get(0).getBitstreams();
bitstreamCount = bitstreams.size();
if(bitstreamCount>0)
{
bitstreamName = bitstreams.get(0).getBitstream().getName();
bitstreamCheckSum = bitstreams.get(0).getBitstream().getChecksum();
bitstreamName = bitstreams.get(0).getName();
bitstreamCheckSum = bitstreams.get(0).getChecksum();
}
}

View File

@@ -44,7 +44,6 @@
<mapping class="org.dspace.content.Bitstream"/>
<mapping class="org.dspace.content.BitstreamFormat"/>
<mapping class="org.dspace.content.Bundle"/>
<mapping class="org.dspace.content.BundleBitstream"/>
<mapping class="org.dspace.content.Collection"/>
<mapping class="org.dspace.content.Community"/>
<mapping class="org.dspace.content.Item"/>

View File

@@ -198,14 +198,14 @@ public class BitstreamEntryGenerator extends DSpaceATOMEntry
try
{
// work our way up to the item
List<BundleBitstream> bundle2bitstreams = this.bitstream
List<Bundle> bundle2bitstreams = this.bitstream
.getBundles();
if (bundle2bitstreams.isEmpty())
{
log.error("Found orphaned bitstream: " + bitstream.getID());
throw new DSpaceSWORDException("Orphaned bitstream discovered");
}
Bundle bundle = bundle2bitstreams.get(0).getBundle();
Bundle bundle = bundle2bitstreams.get(0);
List<Item> items = bundle.getItems();
if (items.isEmpty())
{
@@ -225,10 +225,9 @@ public class BitstreamEntryGenerator extends DSpaceATOMEntry
// skip non-license bundles
continue;
}
List<BundleBitstream> bss = lbundle.getBitstreams();
for (BundleBitstream b2b : bss)
List<Bitstream> bss = lbundle.getBitstreams();
for (Bitstream bs : bss)
{
Bitstream bs = b2b.getBitstream();
String url = urlManager.getBitstreamUrl(bs);
rightsString.append(url).append(" ");
}

View File

@@ -204,12 +204,11 @@ public class ItemDepositor extends Depositor
// from them. This will ensure that the bitstream is physically
// removed from the disk.
Bitstream bs = result.getBitstream();
Iterator<BundleBitstream> b2bs = bs.getBundles().iterator();
while (b2bs.hasNext())
Iterator<Bundle> bundles = bs.getBundles().iterator();
while (bundles.hasNext())
{
BundleBitstream bundleBitstream = b2bs.next();
b2bs.remove();
Bundle bundle = bundleBitstream.getBundle();
Bundle bundle = bundles.next();
bundles.remove();
bundleService.removeBitstream(sc.getContext(), bundle, bs);
bundleService.update(sc.getContext(), bundle);
}

View File

@@ -103,11 +103,11 @@ public class ItemEntryGenerator extends DSpaceATOMEntry
{
if (swordBundle.equals(bundle.getName()))
{
List<BundleBitstream> bss = bundle
List<Bitstream> bss = bundle
.getBitstreams();
for (BundleBitstream bs : bss)
for (Bitstream bs : bss)
{
BitstreamFormat bf = bs.getBitstream()
BitstreamFormat bf = bs
.getFormat(
swordService.getContext());
String format = "application/octet-stream";
@@ -119,7 +119,7 @@ public class ItemEntryGenerator extends DSpaceATOMEntry
// calculate the bitstream link.
String bsLink = urlManager
.getBitstreamUrl(bs.getBitstream());
.getBitstreamUrl(bs);
con.setSource(bsLink);
entry.setContent(con);
@@ -213,16 +213,16 @@ public class ItemEntryGenerator extends DSpaceATOMEntry
{
if (Constants.CONTENT_BUNDLE_NAME.equals(bundle.getName()))
{
List<BundleBitstream> bss = bundle.getBitstreams();
for (BundleBitstream bs : bss)
List<Bitstream> bss = bundle.getBitstreams();
for (Bitstream bs : bss)
{
Link link = new Link();
String url = urlManager
.getBitstreamUrl(bs.getBitstream());
.getBitstreamUrl(bs);
link.setHref(url);
link.setRel("part");
BitstreamFormat bsf = bs.getBitstream()
BitstreamFormat bsf = bs
.getFormat(swordService.getContext());
if (bsf != null)
{
@@ -294,10 +294,10 @@ public class ItemEntryGenerator extends DSpaceATOMEntry
{
if (Constants.LICENSE_BUNDLE_NAME.equals(bundle.getName()))
{
List<BundleBitstream> bss = bundle.getBitstreams();
for (BundleBitstream bs : bss)
List<Bitstream> bss = bundle.getBitstreams();
for (Bitstream bs : bss)
{
String url = urlManager.getBitstreamUrl(bs.getBitstream());
String url = urlManager.getBitstreamUrl(bs);
rightsString.append(url).append(" ");
}
break;

View File

@@ -437,11 +437,11 @@ public class SWORDUrlManager
{
try
{
List<BundleBitstream> bundles = bitstream.getBundles();
List<Bundle> bundles = bitstream.getBundles();
Bundle parent = null;
if (!bundles.isEmpty())
{
parent = bundles.get(0).getBundle();
parent = bundles.get(0);
}
else
{
@@ -549,11 +549,11 @@ public class SWORDUrlManager
{
try
{
List<BundleBitstream> bundles = bitstream.getBundles();
List<Bundle> bundles = bitstream.getBundles();
Bundle parent = null;
if (!bundles.isEmpty())
{
parent = bundles.get(0).getBundle();
parent = bundles.get(0);
}
else
{

View File

@@ -44,13 +44,13 @@ public class FeedContentDisseminator extends AbstractSimpleDC
{
if (Constants.CONTENT_BUNDLE_NAME.equals(bundle.getName()))
{
List<BundleBitstream> bundleBitstreams = bundle
List<Bitstream> bitstreams = bundle
.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
for (Bitstream bitstream : bitstreams)
{
Entry entry = feed.addEntry();
this.populateEntry(context, entry,
bundleBitstream.getBitstream());
bitstream);
}
}
}

View File

@@ -9,7 +9,6 @@ package org.dspace.sword2;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.BundleBitstream;
import org.dspace.content.Item;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Context;
@@ -76,15 +75,15 @@ public abstract class GenericStatementDisseminator
{
if (swordBundle.equals(bundle.getName()))
{
List<BundleBitstream> bundleBitstreams = bundle
List<Bitstream> bitstreams = bundle
.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
for (Bitstream bitstream : bitstreams)
{
// note that original deposits don't have actionable urls
OriginalDeposit deposit = new OriginalDeposit(
this.urlManager.getBitstreamUrl(
bundleBitstream.getBitstream()));
deposit.setMediaType(bundleBitstream.getBitstream()
bitstream));
deposit.setMediaType(bitstream
.getFormat(context).getMIMEType());
originalDeposits.add(deposit);
}
@@ -147,15 +146,15 @@ public abstract class GenericStatementDisseminator
{
if (bundleName.equals(bundle.getName()))
{
List<BundleBitstream> bundleBitstreams = bundle
List<Bitstream> bitstreams = bundle
.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
for (Bitstream bitstream : bitstreams)
{
// note that individual bitstreams have actionable urls
ResourcePart part = new ResourcePart(this.urlManager
.getActionableBitstreamUrl(
bundleBitstream.getBitstream()));
part.setMediaType(bundleBitstream.getBitstream()
bitstream));
part.setMediaType(bitstream
.getFormat(context).getMIMEType());
resources.add(part);
}

View File

@@ -13,7 +13,6 @@ import org.dspace.authorize.factory.AuthorizeServiceFactory;
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.BundleBitstream;
import org.dspace.content.Item;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.BitstreamService;
@@ -260,10 +259,10 @@ public class MediaResourceManagerDSpace extends DSpaceSwordAPI
throws SQLException
{
Date lm = null;
List<BundleBitstream> bundleBitstreams = bitstream.getBundles();
for (BundleBitstream bundleBitstream : bundleBitstreams)
List<Bundle> bundles = bitstream.getBundles();
for (Bundle bundle : bundles)
{
List<Item> items = bundleBitstream.getBundle().getItems();
List<Item> items = bundle.getItems();
for (Item item : items)
{
Date possible = item.getLastModified();
@@ -325,10 +324,10 @@ public class MediaResourceManagerDSpace extends DSpaceSwordAPI
// check that we can submit to ALL the items this bitstream is in
List<Item> items = new ArrayList<>();
List<BundleBitstream> bundleBitstreams = bitstream.getBundles();
for (BundleBitstream bundleBitstream : bundleBitstreams)
List<Bundle> bundles = bitstream.getBundles();
for (Bundle bundle : bundles)
{
List<Item> bundleItems = bundleBitstream.getBundle()
List<Item> bundleItems = bundle
.getItems();
for (Item item : bundleItems)
{
@@ -529,9 +528,9 @@ public class MediaResourceManagerDSpace extends DSpaceSwordAPI
// check that we can submit to ALL the items this bitstream is in
List<Item> items = new ArrayList<>();
for (BundleBitstream bundleBitstream : bitstream.getBundles())
for (Bundle bundle : bitstream.getBundles())
{
List<Item> bundleItems = bundleBitstream.getBundle()
List<Item> bundleItems = bundle
.getItems();
for (Item item : bundleItems)
{

View File

@@ -157,10 +157,10 @@ public class ReceiptGenerator
{
continue;
}
List<BundleBitstream> bss = bundle.getBitstreams();
for (BundleBitstream bs : bss)
List<Bitstream> bss = bundle.getBitstreams();
for (Bitstream bs : bss)
{
String url = urlManager.getBitstreamUrl(bs.getBitstream());
String url = urlManager.getBitstreamUrl(bs);
rightsString.append(url).append(" ");
}
}
@@ -218,10 +218,10 @@ public class ReceiptGenerator
{
continue;
}
List<BundleBitstream> bss = bundle.getBitstreams();
for (BundleBitstream bs : bss)
List<Bitstream> bss = bundle.getBitstreams();
for (Bitstream bs : bss)
{
String url = urlManager.getBitstreamUrl(bs.getBitstream());
String url = urlManager.getBitstreamUrl(bs);
rightsString.append(url).append(" ");
}
}

View File

@@ -10,7 +10,6 @@ package org.dspace.sword2;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.BundleBitstream;
import org.dspace.content.Item;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.BitstreamService;
@@ -57,10 +56,9 @@ public class SimpleZipContentDisseminator implements SwordContentDisseminator
{
if (Constants.CONTENT_BUNDLE_NAME.equals(bundle.getName()))
{
List<BundleBitstream> bss = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bss)
List<Bitstream> bss = bundle.getBitstreams();
for (Bitstream bitstream : bss)
{
Bitstream bitstream = bundleBitstream.getBitstream();
ZipEntry ze = new ZipEntry(bitstream.getName());
zip.putNextEntry(ze);
InputStream is = bitstreamService

View File

@@ -441,11 +441,11 @@ public class SwordUrlManager
{
try
{
List<BundleBitstream> bundles = bitstream.getBundles();
List<Bundle> bundles = bitstream.getBundles();
Bundle parent = null;
if (!bundles.isEmpty())
{
parent = bundles.get(0).getBundle();
parent = bundles.get(0);
}
else
{

View File

@@ -10,7 +10,6 @@ package org.dspace.sword2;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.BundleBitstream;
import org.dspace.content.Item;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.BitstreamService;
@@ -73,14 +72,14 @@ public class VersionManager
}
// remove all the bitstreams from the bundle
Iterator<BundleBitstream> bundleBitstreams = source.getBitstreams()
Iterator<Bitstream> bitstreams = source.getBitstreams()
.iterator();
while (bundleBitstreams.hasNext())
while (bitstreams.hasNext())
{
BundleBitstream bundleBitstream = bundleBitstreams.next();
bundleBitstreams.remove();
Bitstream bitstream = bitstreams.next();
bitstreams.remove();
bundleService.removeBitstream(context, source,
bundleBitstream.getBitstream());
bitstream);
}
// delete the bundle itself
@@ -105,17 +104,17 @@ public class VersionManager
exempt = this.archiveBitstream(context, item, bitstream);
}
Iterator<BundleBitstream> bundleBitstreams = bitstream.getBundles()
Iterator<Bundle> bundles = bitstream.getBundles()
.iterator();
while (bundleBitstreams.hasNext())
while (bundles.hasNext())
{
BundleBitstream bundleBitstream = bundleBitstreams.next();
Bundle bundle = bundles.next();
if (exempt != null &&
bundleBitstream.getBundle().getID() != exempt.getID())
bundle.getID() != exempt.getID())
{
bundleBitstreams.remove();
bundles.remove();
bundleService
.removeBitstream(context, bundleBitstream.getBundle(),
.removeBitstream(context, bundle,
bitstream);
}
}
@@ -178,11 +177,11 @@ public class VersionManager
oldName = this.getNumberedName(item, oldName, 0);
Bundle old = bundleService.create(context, item, oldName);
List<BundleBitstream> bundleBitstreams = source.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
List<Bitstream> bitstreams = source.getBitstreams();
for (Bitstream bitstream : bitstreams)
{
bundleService
.addBitstream(context, old, bundleBitstream.getBitstream());
.addBitstream(context, old, bitstream);
}
}

View File

@@ -124,18 +124,18 @@ public class WorkflowManagerDefault implements WorkflowManager
// this is equivalent to asking whether the media resource in the item can be deleted
try
{
List<BundleBitstream> bundleBitstreams = bitstream.getBundles();
for (BundleBitstream bundleBitstream : bundleBitstreams)
List<Bundle> bundles = bitstream.getBundles();
for (Bundle bundle : bundles)
{
// is the bitstream in the ORIGINAL bundle? If not, it can't be worked on
if (!Constants.CONTENT_BUNDLE_NAME
.equals(bundleBitstream.getBundle().getName()))
.equals(bundle.getName()))
{
throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED,
"The file is not in a bundle which can be modified");
}
List<Item> items = bundleBitstream.getBundle().getItems();
List<Item> items = bundle.getItems();
for (Item item : items)
{
this.deleteMediaResource(context, item);
@@ -166,18 +166,18 @@ public class WorkflowManagerDefault implements WorkflowManager
// this is equivalent to asking whether the media resource in the item can be deleted
try
{
List<BundleBitstream> bundleBitstreams = bitstream.getBundles();
for (BundleBitstream bundleBitstream : bundleBitstreams)
List<Bundle> bundles = bitstream.getBundles();
for (Bundle bundle : bundles)
{
// is the bitstream in the ORIGINAL bundle? If not, it can't be worked on
if (!Constants.CONTENT_BUNDLE_NAME
.equals(bundleBitstream.getBundle().getName()))
.equals(bundle.getName()))
{
throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED,
"The file is not in a bundle which can be modified");
}
for (Item item : bundleBitstream.getBundle().getItems())
for (Item item : bundle.getItems())
{
this.replaceResourceContent(context, item);
}

View File

@@ -8,7 +8,6 @@
package org.dspace.sword2;
import org.dspace.content.*;
import org.dspace.core.ConfigurationManager;
import org.dspace.core.Constants;
import org.dspace.core.Context;
import org.swordapp.server.Deposit;
@@ -82,18 +81,18 @@ public class WorkflowManagerUnrestricted implements WorkflowManager
// this is equivalent to asking whether the media resource in the item can be deleted
try
{
List<BundleBitstream> bundleBitstreams = bitstream.getBundles();
for (BundleBitstream bundleBitstream : bundleBitstreams)
List<Bundle> bundles = bitstream.getBundles();
for (Bundle bundle : bundles)
{
// is the bitstream in the ORIGINAL bundle? If not, it can't be worked on
if (!Constants.CONTENT_BUNDLE_NAME
.equals(bundleBitstream.getBundle().getName()))
.equals(bundle.getName()))
{
throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED,
"The file is not in a bundle which can be modified");
}
List<Item> items = bundleBitstream.getBundle().getItems();
List<Item> items = bundle.getItems();
for (Item item : items)
{
this.deleteMediaResource(context, item);
@@ -112,18 +111,18 @@ public class WorkflowManagerUnrestricted implements WorkflowManager
// this is equivalent to asking whether the media resource in the item can be deleted
try
{
List<BundleBitstream> bundleBitstreams = bitstream.getBundles();
for (BundleBitstream bundleBitstream : bundleBitstreams)
List<Bundle> bundles = bitstream.getBundles();
for (Bundle bundle : bundles)
{
// is the bitstream in the ORIGINAL bundle? If not, it can't be worked on
if (!Constants.CONTENT_BUNDLE_NAME
.equals(bundleBitstream.getBundle().getName()))
.equals(bundle.getName()))
{
throw new SwordError(UriRegistry.ERROR_METHOD_NOT_ALLOWED,
"The file is not in a bundle which can be modified");
}
List<Item> items = bundleBitstream.getBundle().getItems();
List<Item> items = bundle.getItems();
for (Item item : items)
{
this.replaceResourceContent(context, item);

View File

@@ -522,7 +522,7 @@ public class FlowItemUtils
Collection owningCollection = item.getOwningCollection();
if (owningCollection != null)
{
Bundle bnd = bitstream.getBundles().get(0).getBundle();
Bundle bnd = bitstream.getBundles().get(0);
bundleService.inheritCollectionDefaultPolicies(context, bnd, owningCollection);
}
}
@@ -624,10 +624,10 @@ public class FlowItemUtils
//Step 2:
// Check if the primary bitstream status has changed
List<BundleBitstream> bundles = bitstream.getBundles();
List<Bundle> bundles = bitstream.getBundles();
if (bundles != null && bundles.size() > 0)
{
Bundle bundle = bundles.get(0).getBundle();
Bundle bundle = bundles.get(0);
if (bundle.getPrimaryBitstream() != null && bundle.getPrimaryBitstream().toString().equals(String.valueOf(bitstreamID)))
{
// currently the bitstream is primary
@@ -745,12 +745,11 @@ public class FlowItemUtils
List<Bundle> bundles = item.getBundles();
for (Bundle bundle : bundles) {
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
UUID[] newBitstreamOrder = new UUID[bundleBitstreams.size()];
UUID[] newBitstreamOrder = new UUID[bitstreams.size()];
if (submitButton.equals("submit_update_order")) {
for (BundleBitstream bundleBitstream : bundleBitstreams) {
Bitstream bitstream = bundleBitstream.getBitstream();
for (Bitstream bitstream : bitstreams) {
//The order is determined by javascript
//For each of our bitstream retrieve the order value
int order = Util.getIntParameter(request, "order_" + bitstream.getID());

View File

@@ -31,7 +31,6 @@ import org.dspace.authorize.service.AuthorizeService;
import org.dspace.authorize.service.ResourcePolicyService;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.BundleBitstream;
import org.dspace.content.Item;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.ItemService;
@@ -123,7 +122,6 @@ public class EditItemPolicies extends AbstractDSpaceTransformer
/* First, set up our various data structures */
Item item = itemService.find(context, itemID);
List<Bundle> bundles = item.getBundles();
Bitstream[] bitstreams;
ArrayList<ResourcePolicy> itemPolicies = (ArrayList<ResourcePolicy>) authorizeService.getPolicies(context, item);
@@ -162,9 +160,8 @@ public class EditItemPolicies extends AbstractDSpaceTransformer
this.rowBuilder(baseURL, table, bundlePolicies, bundle.getID(), Constants.BUNDLE, highlightID);
// And eventually to the bundle's bitstreams
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams) {
Bitstream bitstream = bundleBitstream.getBitstream();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (Bitstream bitstream : bitstreams) {
subheader = table.addRow(null,Row.ROLE_HEADER,"subheader");
subheader.addCell(null, null, 1, 7, "doubleIndent").addContent(T_subhead_bitstream.parameterize(bitstream.getName(),bitstream.getID()));
subheader.addCell().addXref(baseURL + "&submit_add_bitstream_" + bitstream.getID(), T_add_bitstreamPolicy_link);

View File

@@ -29,7 +29,6 @@ import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.Bitstream;
import org.dspace.content.BitstreamFormat;
import org.dspace.content.Bundle;
import org.dspace.content.BundleBitstream;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.BitstreamFormatService;
import org.dspace.content.service.BitstreamService;
@@ -103,10 +102,10 @@ public class EditBitstreamForm extends AbstractDSpaceTransformer
bitstreamFormatService.findNonInternal(context);
boolean primaryBitstream = false;
java.util.List<BundleBitstream> bundles = bitstream.getBundles();
java.util.List<Bundle> bundles = bitstream.getBundles();
if (bundles != null && bundles.size() > 0)
{
if (bitstream.equals(bundles.get(0).getBundle().getPrimaryBitstream()))
if (bitstream.equals(bundles.get(0).getPrimaryBitstream()))
{
primaryBitstream = true;
}

View File

@@ -127,14 +127,14 @@ public class EditItemBitstreamsForm extends AbstractDSpaceTransformer {
Cell bundleCell = files.addRow("bundle_head_" + bundle.getID(), Row.ROLE_DATA, "").addCell(1, 5);
bundleCell.addContent(T_bundle_label.parameterize(bundle.getName()));
java.util.List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
java.util.List<Bitstream> bitstreams = bundle.getBitstreams();
ArrayList<UUID> bitstreamIdOrder = new ArrayList<>();
for (BundleBitstream bundleBitstream : bundleBitstreams) {
bitstreamIdOrder.add(bundleBitstream.getBitstream().getID());
for (Bitstream bitstream : bitstreams) {
bitstreamIdOrder.add(bitstream.getID());
}
for (int bitstreamIndex = 0; bitstreamIndex < bundleBitstreams.size(); bitstreamIndex++) {
Bitstream bitstream = bundleBitstreams.get(bitstreamIndex).getBitstream();
for (int bitstreamIndex = 0; bitstreamIndex < bitstreams.size(); bitstreamIndex++) {
Bitstream bitstream = bitstreams.get(bitstreamIndex);
boolean primary = (bitstream.equals(bundle.getPrimaryBitstream()));
String name = bitstream.getName();
@@ -202,8 +202,8 @@ public class EditItemBitstreamsForm extends AbstractDSpaceTransformer {
}
upButton.setValue(T_order_up);
upButton.setHelp(T_order_up);
Button downButton = cell.addButton("submit_order_" + bundle.getID() + "_" + bitstream.getID() + "_down", (bitstreamIndex == (bundleBitstreams.size() - 1) ? "disabled" : "") + " icon-button arrowDown ");
if(bitstreamIndex == (bundleBitstreams.size() - 1)){
Button downButton = cell.addButton("submit_order_" + bundle.getID() + "_" + bitstream.getID() + "_down", (bitstreamIndex == (bitstreams.size() - 1) ? "disabled" : "") + " icon-button arrowDown ");
if(bitstreamIndex == (bitstreams.size() - 1)){
downButton.setDisabled();
}
downButton.setValue(T_order_down);

View File

@@ -23,7 +23,6 @@ import org.dspace.app.requestitem.service.RequestItemService;
import org.dspace.app.xmlui.utils.ContextUtil;
import org.dspace.content.Bitstream;
import org.dspace.content.Bundle;
import org.dspace.content.BundleBitstream;
import org.dspace.content.Item;
import org.dspace.content.factory.ContentServiceFactory;
import org.dspace.content.service.ItemService;
@@ -199,9 +198,8 @@ public class ItemRequestResponseAction extends AbstractAction
if (requestItem.isAllfiles()){
List<Bundle> bundles = itemService.getBundles(item, "ORIGINAL");
for (Bundle bundle : bundles) {
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams) {
Bitstream bitstream = bundleBitstream.getBitstream();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (Bitstream bitstream : bitstreams) {
if (!bitstream.getFormat(context).isInternal() /*&& RequestItemManager.isRestricted(context, bitstreams[k])*/) {
email.addAttachment(bitstreamStorageService.retrieve(context, bitstream), bitstream.getName(), bitstream.getFormat(context).getMIMEType());
}

View File

@@ -191,7 +191,7 @@ public class CSVOutputter extends AbstractReader implements Recyclable
entryValues[0] = bitstream.getID() + "";
entryValues[1] = bitstream.getName();
entryValues[2] = bitstream.getBundles().get(0).getBundle().getName();
entryValues[2] = bitstream.getBundles().get(0).getName();
entryValues[3] = item.getName();
entryValues[4] = "http://hdl.handle.net/" + item.getHandle();
entryValues[5] = wrapInDelimitedString(itemService.getMetadataByMetadataString(item, "dc.creator"));

View File

@@ -194,7 +194,7 @@ public class UploadStep extends AbstractSubmissionStep
String actionURL = contextPath + "/handle/"+collection.getHandle() + "/submit/" + knot.getId() + ".continue";
boolean disableFileEditing = (submissionInfo.isInWorkflow()) && !ConfigurationManager.getBooleanProperty("workflow", "reviewer.file-edit");
java.util.List<Bundle> bundles = itemService.getBundles(item, "ORIGINAL");
java.util.List<BundleBitstream> bitstreams = new ArrayList<>();
java.util.List<Bitstream> bitstreams = new ArrayList<>();
if (bundles.size() > 0)
{
bitstreams = bundles.get(0).getBitstreams();
@@ -268,9 +268,8 @@ public class UploadStep extends AbstractSubmissionStep
header.addCellContent(T_column5); // format
header.addCellContent(T_column6); // edit button
for (BundleBitstream bundleBitstream : bitstreams)
for (Bitstream bitstream : bitstreams)
{
Bitstream bitstream = bundleBitstream.getBitstream();
UUID id = bitstream.getID();
String name = bitstream.getName();
String url = makeBitstreamLink(item, bitstream);
@@ -452,15 +451,14 @@ public class UploadStep extends AbstractSubmissionStep
// Review all uploaded files
Item item = submission.getItem();
java.util.List<Bundle> bundles = itemService.getBundles(item, "ORIGINAL");
java.util.List<BundleBitstream> bitstreams = new ArrayList<>();
java.util.List<Bitstream> bitstreams = new ArrayList<>();
if (bundles.size() > 0)
{
bitstreams = bundles.get(0).getBitstreams();
}
for (BundleBitstream bundleBitstream : bitstreams)
for (Bitstream bitstream : bitstreams)
{
Bitstream bitstream = bundleBitstream.getBitstream();
BitstreamFormat bitstreamFormat = bitstream.getFormat(context);
String name = bitstream.getName();

View File

@@ -15,8 +15,10 @@ import org.dspace.app.xmlui.utils.UIException;
import org.dspace.app.xmlui.wing.Message;
import org.dspace.app.xmlui.wing.WingException;
import org.dspace.app.xmlui.wing.element.*;
import org.dspace.app.xmlui.wing.element.List;
import org.dspace.authorize.AuthorizeException;
import org.dspace.content.*;
import org.dspace.content.Collection;
import org.dspace.content.Item;
import org.dspace.core.ConfigurationManager;
import org.xml.sax.SAXException;
@@ -24,9 +26,7 @@ import org.xml.sax.SAXException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Map;
import java.util.UUID;
import java.util.*;
/**
* This class manages the upload step with embargo fields during the submission.
@@ -189,7 +189,7 @@ public class UploadWithEmbargoStep extends UploadStep
String actionURL = contextPath + "/handle/"+collection.getHandle() + "/submit/" + knot.getId() + ".continue";
boolean disableFileEditing = (submissionInfo.isInWorkflow()) && !ConfigurationManager.getBooleanProperty("workflow", "reviewer.file-edit");
java.util.List<Bundle> bundles = itemService.getBundles(item, "ORIGINAL");
java.util.List<BundleBitstream> bitstreams = new ArrayList<>();
java.util.List<Bitstream> bitstreams = new ArrayList<>();
if (bundles.size() > 0)
{
bitstreams = bundles.get(0).getBitstreams();
@@ -274,10 +274,8 @@ public class UploadWithEmbargoStep extends UploadStep
header.addCellContent(T_column5); // format
header.addCellContent(T_column6); // edit button
for (BundleBitstream bundleBitstream : bitstreams)
for (Bitstream bitstream : bitstreams)
{
Bitstream bitstream = bundleBitstream.getBitstream();
UUID id = bitstream.getID();
String name = bitstream.getName();
String url = makeBitstreamLink(item, bitstream);
@@ -411,15 +409,14 @@ public class UploadWithEmbargoStep extends UploadStep
// Review all uploaded files
Item item = submission.getItem();
java.util.List<Bundle> bundles = itemService.getBundles(item, "ORIGINAL");
java.util.List<BundleBitstream> bitstreams = new ArrayList<>();
java.util.List<Bitstream> bitstreams = new ArrayList<>();
if (bundles.size() > 0)
{
bitstreams = bundles.get(0).getBitstreams();
}
for (BundleBitstream bundleBitstream : bitstreams)
for (Bitstream bitstream : bitstreams)
{
Bitstream bitstream = bundleBitstream.getBitstream();
BitstreamFormat bitstreamFormat = bitstream.getFormat(context);
String name = bitstream.getName();

View File

@@ -463,13 +463,13 @@ public class BitstreamReader extends AbstractReader implements Recyclable
List<Bundle> bundles = item.getBundles();
for (Bundle bundle : bundles)
{
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
for (Bitstream bitstream : bitstreams)
{
if (bundleBitstream.getBitstream().getSequenceID() == sequence)
if (bitstream.getSequenceID() == sequence)
{
return bundleBitstream.getBitstream();
return bitstream;
}
}
}
@@ -511,13 +511,13 @@ public class BitstreamReader extends AbstractReader implements Recyclable
List<Bundle> bundles = item.getBundles();
for (Bundle bundle : bundles)
{
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
for (Bitstream bitstream : bitstreams)
{
if (name.equals(bundleBitstream.getBitstream().getName()))
if (name.equals(bitstream.getName()))
{
return bundleBitstream.getBitstream();
return bitstream;
}
}
}

View File

@@ -158,13 +158,13 @@ public class UsageLoggerAction extends AbstractAction {
List<Bundle> bundles = item.getBundles();
for (Bundle bundle : bundles)
{
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
for (Bitstream bitstream : bitstreams)
{
if (bundleBitstream.getBitstream().getSequenceID() == sequence)
if (bitstream.getSequenceID() == sequence)
{
return bundleBitstream.getBitstream();
return bitstream;
}
}
}
@@ -206,13 +206,13 @@ public class UsageLoggerAction extends AbstractAction {
List<Bundle> bundles = item.getBundles();
for (Bundle bundle : bundles)
{
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
for (Bitstream bitstream : bitstreams)
{
if (name.equals(bundleBitstream.getBitstream().getName()))
if (name.equals(bitstream.getName()))
{
return bundleBitstream.getBitstream();
return bitstream;
}
}
}

View File

@@ -530,15 +530,15 @@ public class ItemAdapter extends AbstractAdapter
List<Bundle> bundles = findEnabledBundles();
for (Bundle bundle : bundles)
{
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
// Create a sub-section of <amdSec> for each bitstream in bundle
for(BundleBitstream bundleBitstream : bundleBitstreams)
for(Bitstream bitstream : bitstreams)
{
// Only render the section if crosswalk works with bitstreams
if(crosswalk.canDisseminate(bundleBitstream.getBitstream()))
if(crosswalk.canDisseminate(bitstream))
{
renderAmdSubSection(amdSecName, mdType, crosswalk, bundleBitstream.getBitstream());
renderAmdSubSection(amdSecName, mdType, crosswalk, bitstream);
}
} // end for each bitstream
} // end for each bundle
@@ -722,9 +722,8 @@ public class ItemAdapter extends AbstractAdapter
attributes.put("USE", use);
startElement(METS,"fileGrp",attributes);
for (BundleBitstream bundleBitstream : bundle.getBitstreams())
for (Bitstream bitstream : bundle.getBitstreams())
{
Bitstream bitstream = bundleBitstream.getBitstream();
// //////////////////////////////
// Determine the file's IDs
String fileID = getFileID(bitstream);
@@ -973,13 +972,13 @@ public class ItemAdapter extends AbstractAdapter
&& bundle.getName().equals("ORIGINAL"))
{
// Now find the corresponding bitstream
List<BundleBitstream> bundleBitstreams = bundle.getBitstreams();
List<Bitstream> bitstreams = bundle.getBitstreams();
for (BundleBitstream bundleBitstream : bundleBitstreams)
for (Bitstream bitstream : bitstreams)
{
if (bundleBitstream.getBitstream().getName().equals(originalFilename))
if (bitstream.getName().equals(originalFilename))
{
return bundleBitstream.getBitstream();
return bitstream;
}
}
}

View File

@@ -304,9 +304,9 @@ public class DSpaceValidity implements SourceValidity
validityKey.append(bundle.getName());
validityKey.append(bundle.getPrimaryBitstream() != null ? bundle.getPrimaryBitstream().getID() : "");
for(BundleBitstream bundleBitstream : bundle.getBitstreams())
for(Bitstream bitstream : bundle.getBitstreams())
{
this.add(context, bundleBitstream.getBitstream());
this.add(context, bitstream);
}
}
else if (dso instanceof Bitstream)

View File

@@ -188,9 +188,9 @@ public class HandleUtil
if (aDso instanceof Bitstream)
{
Bitstream bitstream = (Bitstream) aDso;
List<BundleBitstream> bundles = bitstream.getBundles();
List<Bundle> bundles = bitstream.getBundles();
aDso = bundles.get(0).getBundle();
aDso = bundles.get(0);
}
if (aDso instanceof Bundle)

View File

@@ -58,7 +58,6 @@
<mapping class="org.dspace.content.Bitstream"/>
<mapping class="org.dspace.content.BitstreamFormat"/>
<mapping class="org.dspace.content.Bundle"/>
<mapping class="org.dspace.content.BundleBitstream"/>
<mapping class="org.dspace.content.Collection"/>
<mapping class="org.dspace.content.Community"/>
<mapping class="org.dspace.content.Item"/>

View File

@@ -20,7 +20,6 @@
<bean class="org.dspace.content.dao.impl.CollectionDAOImpl"/>
<bean class="org.dspace.content.dao.impl.BitstreamDAOImpl"/>
<bean class="org.dspace.content.dao.impl.BitstreamFormatDAOImpl"/>
<bean class="org.dspace.content.dao.impl.BundleBitstreamDAOImpl"/>
<bean class="org.dspace.content.dao.impl.BundleDAOImpl"/>
<bean class="org.dspace.content.dao.impl.CommunityDAOImpl"/>
<bean class="org.dspace.content.dao.impl.ItemDAOImpl"/>