diff --git a/dspace-api/src/main/java/org/dspace/app/itemexport/ItemExportServiceImpl.java b/dspace-api/src/main/java/org/dspace/app/itemexport/ItemExportServiceImpl.java index ee8ddda772..c652c91340 100644 --- a/dspace-api/src/main/java/org/dspace/app/itemexport/ItemExportServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/app/itemexport/ItemExportServiceImpl.java @@ -367,12 +367,11 @@ public class ItemExportServiceImpl implements ItemExportService for (Bundle bundle : bundles) { // bundles can have multiple bitstreams now... - List bitstreams = bundle.getBitstreams(); + List 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 bundleBitstreams = bundle.getBitstreams(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + List 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 bundleBitstreams = bundle.getBitstreams(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + List 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 bundleBitstreams = bundle.getBitstreams(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + List bitstreams = bundle.getBitstreams(); + for (Bitstream bitstream : bitstreams) { // add up the size - size += bundleBitstream.getBitstream().getSize(); + size += bitstream.getSize(); } } ArrayList items = new ArrayList<>(); diff --git a/dspace-api/src/main/java/org/dspace/app/itemmarking/ItemMarkingAvailabilityBitstreamStrategy.java b/dspace-api/src/main/java/org/dspace/app/itemmarking/ItemMarkingAvailabilityBitstreamStrategy.java index 92a8c107a4..45c63660bd 100644 --- a/dspace-api/src/main/java/org/dspace/app/itemmarking/ItemMarkingAvailabilityBitstreamStrategy.java +++ b/dspace-api/src/main/java/org/dspace/app/itemmarking/ItemMarkingAvailabilityBitstreamStrategy.java @@ -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); diff --git a/dspace-api/src/main/java/org/dspace/app/itemupdate/AddBitstreamsAction.java b/dspace-api/src/main/java/org/dspace/app/itemupdate/AddBitstreamsAction.java index ce97a4602d..eebf8189a7 100644 --- a/dspace-api/src/main/java/org/dspace/app/itemupdate/AddBitstreamsAction.java +++ b/dspace-api/src/main/java/org/dspace/app/itemupdate/AddBitstreamsAction.java @@ -159,10 +159,9 @@ public class AddBitstreamsAction extends UpdateBitstreamsAction { //verify bundle + name are not duplicates for (Bundle b : bundles) { - List bundleBitstreams = b.getBitstreams(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + List 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: " diff --git a/dspace-api/src/main/java/org/dspace/app/itemupdate/BitstreamFilterByBundleName.java b/dspace-api/src/main/java/org/dspace/app/itemupdate/BitstreamFilterByBundleName.java index 9c8f907682..a983561635 100644 --- a/dspace-api/src/main/java/org/dspace/app/itemupdate/BitstreamFilterByBundleName.java +++ b/dspace-api/src/main/java/org/dspace/app/itemupdate/BitstreamFilterByBundleName.java @@ -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 bundles = bitstream.getBundles(); - for (BundleBitstream bundleBitstream : bundles) + List bundles = bitstream.getBundles(); + for (Bundle b : bundles) { - Bundle b = bundleBitstream.getBundle(); if (b.getName().equals(bundleName)) { return true; diff --git a/dspace-api/src/main/java/org/dspace/app/itemupdate/DeleteBitstreamsAction.java b/dspace-api/src/main/java/org/dspace/app/itemupdate/DeleteBitstreamsAction.java index fbf3dbbdef..6f9121fda2 100644 --- a/dspace-api/src/main/java/org/dspace/app/itemupdate/DeleteBitstreamsAction.java +++ b/dspace-api/src/main/java/org/dspace/app/itemupdate/DeleteBitstreamsAction.java @@ -70,10 +70,9 @@ public class DeleteBitstreamsAction extends UpdateBitstreamsAction } else { - List bundles = bs.getBundles(); - for (BundleBitstream bundleBitstream : bundles) + List 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) diff --git a/dspace-api/src/main/java/org/dspace/app/itemupdate/DeleteBitstreamsByFilterAction.java b/dspace-api/src/main/java/org/dspace/app/itemupdate/DeleteBitstreamsByFilterAction.java index e8c287a439..c5b959c510 100644 --- a/dspace-api/src/main/java/org/dspace/app/itemupdate/DeleteBitstreamsByFilterAction.java +++ b/dspace-api/src/main/java/org/dspace/app/itemupdate/DeleteBitstreamsByFilterAction.java @@ -77,12 +77,11 @@ public class DeleteBitstreamsByFilterAction extends UpdateBitstreamsAction { for (Bundle b : bundles) { - List bitstreams = b.getBitstreams(); + List 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) diff --git a/dspace-api/src/main/java/org/dspace/app/itemupdate/OriginalBitstreamFilter.java b/dspace-api/src/main/java/org/dspace/app/itemupdate/OriginalBitstreamFilter.java index 0d51d05824..8ca370b917 100644 --- a/dspace-api/src/main/java/org/dspace/app/itemupdate/OriginalBitstreamFilter.java +++ b/dspace-api/src/main/java/org/dspace/app/itemupdate/OriginalBitstreamFilter.java @@ -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 bundles = bitstream.getBundles(); - for (BundleBitstream bundleBitstream : bundles) + List bundles = bitstream.getBundles(); + for (Bundle bundle : bundles) { - Bundle bundle = bundleBitstream.getBundle(); if (bundle.getName().equals("ORIGINAL")) { return true; diff --git a/dspace-api/src/main/java/org/dspace/app/itemupdate/OriginalWithDerivativesBitstreamFilter.java b/dspace-api/src/main/java/org/dspace/app/itemupdate/OriginalWithDerivativesBitstreamFilter.java index 48069a2e1f..084ae301bd 100644 --- a/dspace-api/src/main/java/org/dspace/app/itemupdate/OriginalWithDerivativesBitstreamFilter.java +++ b/dspace-api/src/main/java/org/dspace/app/itemupdate/OriginalWithDerivativesBitstreamFilter.java @@ -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 bundles = bitstream.getBundles(); - for (BundleBitstream bundleBitstream : bundles) + List bundles = bitstream.getBundles(); + for (Bundle b : bundles) { - Bitstream b = bundleBitstream.getBitstream(); for (String bn : bundlesToEmpty) { if (b.getName().equals(bn)) diff --git a/dspace-api/src/main/java/org/dspace/app/mediafilter/ImageMagickThumbnailFilter.java b/dspace-api/src/main/java/org/dspace/app/mediafilter/ImageMagickThumbnailFilter.java index 7edff11514..81f4086d7f 100644 --- a/dspace-api/src/main/java/org/dspace/app/mediafilter/ImageMagickThumbnailFilter.java +++ b/dspace-api/src/main/java/org/dspace/app/mediafilter/ImageMagickThumbnailFilter.java @@ -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) { diff --git a/dspace-api/src/main/java/org/dspace/app/mediafilter/MediaFilterServiceImpl.java b/dspace-api/src/main/java/org/dspace/app/mediafilter/MediaFilterServiceImpl.java index 9e198ae5a4..bab81123b6 100644 --- a/dspace-api/src/main/java/org/dspace/app/mediafilter/MediaFilterServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/app/mediafilter/MediaFilterServiceImpl.java @@ -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 myBitstreams = myBundle.getBitstreams(); + List 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 bundles = myBitstream.getBundles(); + List 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 bitstreams = bundle.getBitstreams(); + List 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; } } } diff --git a/dspace-api/src/main/java/org/dspace/app/util/AuthorizeUtil.java b/dspace-api/src/main/java/org/dspace/app/util/AuthorizeUtil.java index 64fc2de781..735602e24b 100644 --- a/dspace-api/src/main/java/org/dspace/app/util/AuthorizeUtil.java +++ b/dspace-api/src/main/java/org/dspace/app/util/AuthorizeUtil.java @@ -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); } /** diff --git a/dspace-api/src/main/java/org/dspace/app/util/GoogleMetadata.java b/dspace-api/src/main/java/org/dspace/app/util/GoogleMetadata.java index 58b49a06a8..89a488b1ee 100644 --- a/dspace-api/src/main/java/org/dspace/app/util/GoogleMetadata.java +++ b/dspace-api/src/main/java/org/dspace/app/util/GoogleMetadata.java @@ -1055,9 +1055,8 @@ public class GoogleMetadata int bitstreamCount = 0; List contentBundles = itemService.getBundles(item, "ORIGINAL"); for (Bundle bundle : contentBundles) { - List bundleBitstreams = bundle.getBitstreams(); - for (BundleBitstream bundleBitstream : bundleBitstreams) { - Bitstream candidate = bundleBitstream.getBitstream(); + List bitstreams = bundle.getBitstreams(); + for (Bitstream candidate : bitstreams) { if (candidate.equals(bundle.getPrimaryBitstream())) { // is primary -> use this one if (isPublic(candidate)) { return candidate; diff --git a/dspace-api/src/main/java/org/dspace/app/util/SyndicationFeed.java b/dspace-api/src/main/java/org/dspace/app/util/SyndicationFeed.java index 2b24a022ea..933e596a7e 100644 --- a/dspace-api/src/main/java/org/dspace/app/util/SyndicationFeed.java +++ b/dspace-api/src/main/java/org/dspace/app/util/SyndicationFeed.java @@ -371,9 +371,8 @@ public class SyndicationFeed try { List bunds = itemService.getBundles(item, "ORIGINAL"); if (bunds.get(0) != null) { - List bits = bunds.get(0).getBitstreams(); - for (BundleBitstream bundleBitstream : bits) { - Bitstream bit = bundleBitstream.getBitstream(); + List bits = bunds.get(0).getBitstreams(); + for (Bitstream bit : bits) { String mime = bit.getFormat(context).getMIMEType(); if (podcastableMIMETypes.contains(mime)) { SyndEnclosure enc = new SyndEnclosureImpl(); diff --git a/dspace-api/src/main/java/org/dspace/authorize/AuthorizeServiceImpl.java b/dspace-api/src/main/java/org/dspace/authorize/AuthorizeServiceImpl.java index e5ce3a6e00..985196e858 100644 --- a/dspace-api/src/main/java/org/dspace/authorize/AuthorizeServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/authorize/AuthorizeServiceImpl.java @@ -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 bundles) + protected boolean isAnyItemInstalled(Context ctx, List 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) diff --git a/dspace-api/src/main/java/org/dspace/authorize/PolicySet.java b/dspace-api/src/main/java/org/dspace/authorize/PolicySet.java index 334faa95f9..88a93c2f3f 100644 --- a/dspace-api/src/main/java/org/dspace/authorize/PolicySet.java +++ b/dspace-api/src/main/java/org/dspace/authorize/PolicySet.java @@ -317,10 +317,9 @@ public class PolicySet for (Bundle bundle : bundles) { System.out.println("Bundle " + bundle.getID()); - List bitstreams = bundle.getBitstreams(); + List 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 diff --git a/dspace-api/src/main/java/org/dspace/content/Bitstream.java b/dspace-api/src/main/java/org/dspace/content/Bitstream.java index 5bbf884423..f815c6bdb4 100644 --- a/dspace-api/src/main/java/org/dspace/content/Bitstream.java +++ b/dspace-api/src/main/java/org/dspace/content/Bitstream.java @@ -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 bundles = new ArrayList<>(); + @ManyToMany(fetch = FetchType.LAZY, mappedBy = "bitstreams") + private List 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 Bundle s this bitstream appears in * @throws SQLException */ - public List getBundles() throws SQLException + public List getBundles() throws SQLException { return bundles; } - void setBundles(List bundles) { + void setBundles(List bundles) { this.bundles = bundles; } diff --git a/dspace-api/src/main/java/org/dspace/content/BitstreamServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/BitstreamServiceImpl.java index 64c38e15fe..b355ad1af7 100644 --- a/dspace-api/src/main/java/org/dspace/content/BitstreamServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/content/BitstreamServiceImpl.java @@ -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 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 imp context.addEvent(new Event(Event.DELETE, Constants.BITSTREAM, bitstream.getID(), String.valueOf(bitstream.getSequenceID()), getIdentifiers(context, bitstream))); - Iterator 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 imp @Override public DSpaceObject getParentObject(Context context, Bitstream bitstream) throws SQLException { - List bundles = bitstream.getBundles(); + List 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 imp List bundles = itemService.getBundles(item, bundleName); for (int i = 0; i < bundles.size(); i++) { Bundle bundle = bundles.get(i); - List bitstreams = bundle.getBitstreams(); + List 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 imp List bundles = itemService.getBundles(item, bundleName); if(CollectionUtils.isNotEmpty(bundles)) { - List bitstreams = bundles.get(0).getBitstreams(); + List bitstreams = bundles.get(0).getBitstreams(); if(CollectionUtils.isNotEmpty(bitstreams)) { - return bitstreams.get(0).getBitstream(); + return bitstreams.get(0); } } return null; diff --git a/dspace-api/src/main/java/org/dspace/content/Bundle.java b/dspace-api/src/main/java/org/dspace/content/Bundle.java index e3d2d89c63..a7bc8e6a38 100644 --- a/dspace-api/src/main/java/org/dspace/content/Bundle.java +++ b/dspace-api/src/main/java/org/dspace/content/Bundle.java @@ -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 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 bitstreams = new ArrayList<>(); @ManyToMany(fetch = FetchType.LAZY) @JoinTable( @@ -122,11 +127,11 @@ public class Bundle extends DSpaceObject implements DSpaceObjectLegacySupport * * @return the bitstreams */ - public List getBitstreams() { + public List getBitstreams() { return bitstreams; } - void addBitstream(BundleBitstream bitstream){ + void addBitstream(Bitstream bitstream){ bitstreams.add(bitstream); } diff --git a/dspace-api/src/main/java/org/dspace/content/BundleBitstream.java b/dspace-api/src/main/java/org/dspace/content/BundleBitstream.java deleted file mode 100644 index e9c27ea47c..0000000000 --- a/dspace-api/src/main/java/org/dspace/content/BundleBitstream.java +++ /dev/null @@ -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; - } -} diff --git a/dspace-api/src/main/java/org/dspace/content/BundleServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/BundleServiceImpl.java index da6cfc8b96..0f91b64379 100644 --- a/dspace-api/src/main/java/org/dspace/content/BundleServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/content/BundleServiceImpl.java @@ -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 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 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 implement + bundle.getID() + ",bitstream_id=" + bitstream.getID())); // First check that the bitstream isn't already in the list - List bundleBitstreams = bundle.getBitstreams(); + List 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 implement log.info(LogManager.getHeader(context, "remove_bitstream", "bundle_id=" + bundle.getID() + ",bitstream_id=" + bitstream.getID())); - // Remove from internal list of bitstreams - Iterator 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 implement @Override public void replaceAllBitstreamPolicies(Context context, Bundle bundle, List newpolicies) throws SQLException, AuthorizeException { - List bundleBitstreams = bundle.getBitstreams(); - if (CollectionUtils.isNotEmpty(bundleBitstreams)) + List 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 implement @Override public List getBitstreamPolicies(Context context, Bundle bundle) throws SQLException { List list = new ArrayList(); - List bitstreams = bundle.getBitstreams(); + List 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 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 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 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 implement bundle.getName(), getIdentifiers(context, bundle))); // Remove bitstreams - Iterator bundleBitstreams = bundle.getBitstreams().iterator(); - while (bundleBitstreams.hasNext()) { - BundleBitstream bundleBitstream = bundleBitstreams.next(); - bundleBitstreams.remove(); - removeBitstream(context, bundle, bundleBitstream.getBitstream()); - bundleBitstreamDAO.delete(context, bundleBitstream); + Iterator bitstreams = bundle.getBitstreams().iterator(); + while (bitstreams.hasNext()) { + Bitstream bitstream = bitstreams.next(); + bitstreams.remove(); + removeBitstream(context, bundle, bitstream); } Iterator items = bundle.getItems().iterator(); diff --git a/dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java b/dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java index 434ddb8c8e..13de583782 100644 --- a/dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/content/ItemServiceImpl.java @@ -330,10 +330,9 @@ public class ItemServiceImpl extends DSpaceObjectServiceImpl implements It List bunds = item.getBundles(); for (Bundle bund : bunds) { - List bitstreams = bund.getBitstreams(); + List 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 implements It for (Bundle bund : bunds) { boolean removethisbundle = false; - List bits = bund.getBitstreams(); + List 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 implements It // find the highest current sequence number for (Bundle bund : bunds) { - List streams = bund.getBitstreams(); + List 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 implements It for (Bundle bund : bunds) { - List streams = bund.getBitstreams(); + List 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 implements It List bunds = item.getBundles(); for (Bundle mybundle : bunds) { - List bs = mybundle.getBitstreams(); + List 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 implements It List 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); diff --git a/dspace-api/src/main/java/org/dspace/content/crosswalk/OREDisseminationCrosswalk.java b/dspace-api/src/main/java/org/dspace/content/crosswalk/OREDisseminationCrosswalk.java index 60c189ad4b..0acddcf7ea 100644 --- a/dspace-api/src/main/java/org/dspace/content/crosswalk/OREDisseminationCrosswalk.java +++ b/dspace-api/src/main/java/org/dspace/content/crosswalk/OREDisseminationCrosswalk.java @@ -216,7 +216,7 @@ public class OREDisseminationCrosswalk // Add a link and an oreatom metadata entry for each bitstream in the item List bundles = item.getBundles(); - List bitstreams; + List 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()); diff --git a/dspace-api/src/main/java/org/dspace/content/crosswalk/PREMISCrosswalk.java b/dspace-api/src/main/java/org/dspace/content/crosswalk/PREMISCrosswalk.java index 0b727390ec..a61b2b245b 100644 --- a/dspace-api/src/main/java/org/dspace/content/crosswalk/PREMISCrosswalk.java +++ b/dspace-api/src/main/java/org/dspace/content/crosswalk/PREMISCrosswalk.java @@ -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 bn = bitstream.getBundles(); + List bn = bitstream.getBundles(); if (bn.size() > 0) { - List bi = bn.get(0).getBundle().getItems(); + List bi = bn.get(0).getItems(); if (bi.size() > 0) { handle = bi.get(0).getHandle(); diff --git a/dspace-api/src/main/java/org/dspace/content/dao/BundleBitstreamDAO.java b/dspace-api/src/main/java/org/dspace/content/dao/BundleBitstreamDAO.java deleted file mode 100644 index 0a8d3e6c4d..0000000000 --- a/dspace-api/src/main/java/org/dspace/content/dao/BundleBitstreamDAO.java +++ /dev/null @@ -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 { -} diff --git a/dspace-api/src/main/java/org/dspace/content/dao/impl/BundleBitstreamDAOImpl.java b/dspace-api/src/main/java/org/dspace/content/dao/impl/BundleBitstreamDAOImpl.java deleted file mode 100644 index bf3adc11ab..0000000000 --- a/dspace-api/src/main/java/org/dspace/content/dao/impl/BundleBitstreamDAOImpl.java +++ /dev/null @@ -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 implements BundleBitstreamDAO { - -} diff --git a/dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSDisseminator.java b/dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSDisseminator.java index 4127404d14..5f06972d4f 100644 --- a/dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSDisseminator.java +++ b/dspace-api/src/main/java/org/dspace/content/packager/AbstractMETSDisseminator.java @@ -438,9 +438,8 @@ public abstract class AbstractMETSDisseminator throw new AuthorizeException("Not authorized to read Bundle named \"" + bundle.getName() + "\""); } } - List bitstreams = bundle.getBitstreams(); - for (BundleBitstream bundleBitstream : bitstreams) { - Bitstream bitstream = bundleBitstream.getBitstream(); + List 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 bitstreams = bundle.getBitstreams(); + List 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 bundleBitstreams = bundle.getBitstreams(); + List 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 bn = bitstream.getBundles(); + List bn = bitstream.getBundles(); if (bn.size() > 0) { - List bi = bn.get(0).getBundle().getItems(); + List bi = bn.get(0).getItems(); if (bi.size() > 0) { handle = bi.get(0).getHandle(); diff --git a/dspace-api/src/main/java/org/dspace/content/packager/PackageUtils.java b/dspace-api/src/main/java/org/dspace/content/packager/PackageUtils.java index c3e5ad01ed..9fb4caf853 100644 --- a/dspace-api/src/main/java/org/dspace/content/packager/PackageUtils.java +++ b/dspace-api/src/main/java/org/dspace/content/packager/PackageUtils.java @@ -222,11 +222,10 @@ public class PackageUtils } for (Bundle bundle : bundles) { - List bitstreams = bundle.getBitstreams(); + List 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 bundleBitstreams = bundle.getBitstreams(); + List 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 bundleBitstreams = bundle.getBitstreams(); + List 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); } } diff --git a/dspace-api/src/main/java/org/dspace/ctask/general/BitstreamsIntoMetadata.java b/dspace-api/src/main/java/org/dspace/ctask/general/BitstreamsIntoMetadata.java index e76f45a185..bf15c77225 100644 --- a/dspace-api/src/main/java/org/dspace/ctask/general/BitstreamsIntoMetadata.java +++ b/dspace-api/src/main/java/org/dspace/ctask/general/BitstreamsIntoMetadata.java @@ -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; } } diff --git a/dspace-api/src/main/java/org/dspace/ctask/general/ClamScan.java b/dspace-api/src/main/java/org/dspace/ctask/general/ClamScan.java index 1fff407f93..87fdc4b438 100644 --- a/dspace-api/src/main/java/org/dspace/ctask/general/ClamScan.java +++ b/dspace-api/src/main/java/org/dspace/ctask/general/ClamScan.java @@ -106,9 +106,8 @@ public class ClamScan extends AbstractCurationTask { Bundle bundle = itemService.getBundles(item, "ORIGINAL").get(0); results = new ArrayList(); - 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)); diff --git a/dspace-api/src/main/java/org/dspace/ctask/general/ProfileFormats.java b/dspace-api/src/main/java/org/dspace/ctask/general/ProfileFormats.java index a0b67a96fe..c72821d40b 100644 --- a/dspace-api/src/main/java/org/dspace/ctask/general/ProfileFormats.java +++ b/dspace-api/src/main/java/org/dspace/ctask/general/ProfileFormats.java @@ -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) diff --git a/dspace-api/src/main/java/org/dspace/curate/CitationPage.java b/dspace-api/src/main/java/org/dspace/curate/CitationPage.java index 98509eb64d..570bd96afe 100644 --- a/dspace-api/src/main/java/org/dspace/curate/CitationPage.java +++ b/dspace-api/src/main/java/org/dspace/curate/CitationPage.java @@ -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 displayMap = new HashMap(); - 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 bundleBitstreams = bundle.getBitstreams(); + List 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 originalBits = bundle.getBitstreams(); - if (originalBits == null || originalBits.size() == 0) { + List bitstreams = bundle.getBitstreams(); + if (bitstreams == null || bitstreams.size() == 0) { itemService.removeBundle(context, item, bundle); } } diff --git a/dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java index 86722cb0de..98fbc65403 100644 --- a/dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/discovery/SolrServiceImpl.java @@ -1349,11 +1349,10 @@ public class SolrServiceImpl implements SearchService, IndexingService { && myBundle.getName().equals("TEXT")) { // a-ha! grab the text out of the bitstreams - List bundleBitstreams = myBundle.getBitstreams(); + List bitstreams = myBundle.getBitstreams(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + for (Bitstream myBitstream : bitstreams) { - Bitstream myBitstream = bundleBitstream.getBitstream(); try { streams.add(new BitstreamContentStream(context, myBitstream)); diff --git a/dspace-api/src/main/java/org/dspace/embargo/DefaultEmbargoSetter.java b/dspace-api/src/main/java/org/dspace/embargo/DefaultEmbargoSetter.java index 30e2b68431..aea3a4ffce 100644 --- a/dspace-api/src/main/java/org/dspace/embargo/DefaultEmbargoSetter.java +++ b/dspace-api/src/main/java/org/dspace/embargo/DefaultEmbargoSetter.java @@ -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 "+ diff --git a/dspace-api/src/main/java/org/dspace/rdf/RDFConsumer.java b/dspace-api/src/main/java/org/dspace/rdf/RDFConsumer.java index 0dcc818e4d..183a321c37 100644 --- a/dspace-api/src/main/java/org/dspace/rdf/RDFConsumer.java +++ b/dspace-api/src/main/java/org/dspace/rdf/RDFConsumer.java @@ -112,10 +112,9 @@ public class RDFConsumer implements Consumer + "and we'll cover it by a REMOVE event on its bundle."); return; } - List bundleBitstreams = bitstream.getBundles(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + List bundles = bitstream.getBundles(); + for (Bundle b : bundles) { - Bundle b = bundleBitstream.getBundle(); List items = b.getItems(); for (Item i : items) { diff --git a/dspace-api/src/main/java/org/dspace/rdf/conversion/SimpleDSORelationsConverterPlugin.java b/dspace-api/src/main/java/org/dspace/rdf/conversion/SimpleDSORelationsConverterPlugin.java index d1f2c14bf2..9b188abb76 100644 --- a/dspace-api/src/main/java/org/dspace/rdf/conversion/SimpleDSORelationsConverterPlugin.java +++ b/dspace-api/src/main/java/org/dspace/rdf/conversion/SimpleDSORelationsConverterPlugin.java @@ -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); diff --git a/dspace-api/src/main/java/org/dspace/search/DSIndexer.java b/dspace-api/src/main/java/org/dspace/search/DSIndexer.java index c3ea525a09..6485e1c4c1 100644 --- a/dspace-api/src/main/java/org/dspace/search/DSIndexer.java +++ b/dspace-api/src/main/java/org/dspace/search/DSIndexer.java @@ -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 bundleBitstreams = myBundle.getBitstreams(); + List 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))))); diff --git a/dspace-api/src/main/java/org/dspace/statistics/ElasticSearchLoggerServiceImpl.java b/dspace-api/src/main/java/org/dspace/statistics/ElasticSearchLoggerServiceImpl.java index f56e610eb7..469b7a248c 100644 --- a/dspace-api/src/main/java/org/dspace/statistics/ElasticSearchLoggerServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/statistics/ElasticSearchLoggerServiceImpl.java @@ -268,10 +268,10 @@ public class ElasticSearchLoggerServiceImpl implements ElasticSearchLoggerServic if (dspaceObject instanceof Bitstream) { Bitstream bit = (Bitstream) dspaceObject; - List bundles = bit.getBundles(); + List 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 bundles = bit.getBundles(); + List 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); diff --git a/dspace-api/src/main/java/org/dspace/statistics/SolrLoggerServiceImpl.java b/dspace-api/src/main/java/org/dspace/statistics/SolrLoggerServiceImpl.java index a389ba3290..8ab27dda36 100644 --- a/dspace-api/src/main/java/org/dspace/statistics/SolrLoggerServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/statistics/SolrLoggerServiceImpl.java @@ -215,9 +215,9 @@ public class SolrLoggerServiceImpl implements SolrLoggerService, InitializingBea if(dspaceObject instanceof Bitstream) { Bitstream bit = (Bitstream) dspaceObject; - List bundleBitstreams = bit.getBundles(); - for (BundleBitstream bundle : bundleBitstreams) { - doc1.addField("bundleName", bundle.getBundle().getName()); + List 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 bundles = bit.getBundles(); - for (BundleBitstream bundleBitstream : bundles) { - doc1.addField("bundleName", bundleBitstream.getBundle().getName()); + List 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 bundles = bitstream.getBundles(); - for (BundleBitstream bundleBitstream : bundles) { - List items = bundleBitstream.getBundle().getItems(); + List bundles = bitstream.getBundles(); + for (Bundle bundle : bundles) { + List 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 bundles = bitstream.getBundles(); + List 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 ! diff --git a/dspace-api/src/main/java/org/dspace/statistics/content/StatisticsDataVisits.java b/dspace-api/src/main/java/org/dspace/statistics/content/StatisticsDataVisits.java index 857ec68853..20db4abb45 100644 --- a/dspace-api/src/main/java/org/dspace/statistics/content/StatisticsDataVisits.java +++ b/dspace-api/src/main/java/org/dspace/statistics/content/StatisticsDataVisits.java @@ -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 bunds = bit.getBundles(); - if(0 < bunds.size() && 0 < bunds.get(0).getBundle().getItems().size()) + List 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 diff --git a/dspace-api/src/main/java/org/dspace/statistics/util/StatisticsImporterElasticSearch.java b/dspace-api/src/main/java/org/dspace/statistics/util/StatisticsImporterElasticSearch.java index b0d0b5e810..69176fe2d6 100644 --- a/dspace-api/src/main/java/org/dspace/statistics/util/StatisticsImporterElasticSearch.java +++ b/dspace-api/src/main/java/org/dspace/statistics/util/StatisticsImporterElasticSearch.java @@ -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 bundles = bit.getBundles(); + List 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(); } diff --git a/dspace-api/src/main/java/org/dspace/submit/step/InitialQuestionsStep.java b/dspace-api/src/main/java/org/dspace/submit/step/InitialQuestionsStep.java index c47d824ac2..f65374b736 100644 --- a/dspace-api/src/main/java/org/dspace/submit/step/InitialQuestionsStep.java +++ b/dspace-api/src/main/java/org/dspace/submit/step/InitialQuestionsStep.java @@ -187,7 +187,7 @@ public class InitialQuestionsStep extends AbstractProcessingStep if (bundles.size() > 0) { - List bitstreams = bundles.get(0).getBitstreams(); + List bitstreams = bundles.get(0).getBitstreams(); willRemoveFiles = bitstreams.size() > 1; } @@ -318,18 +318,18 @@ public class InitialQuestionsStep extends AbstractProcessingStep if (bundles.size() > 0) { - Iterator bundleBitstreams = bundles.get(0).getBitstreams().iterator(); + Iterator 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); } } } diff --git a/dspace-api/src/main/java/org/dspace/submit/step/UploadStep.java b/dspace-api/src/main/java/org/dspace/submit/step/UploadStep.java index 7a4686ad87..2dd9838351 100644 --- a/dspace-api/src/main/java/org/dspace/submit/step/UploadStep.java +++ b/dspace-api/src/main/java/org/dspace/submit/step/UploadStep.java @@ -405,16 +405,16 @@ public class UploadStep extends AbstractProcessingStep // remove bitstream from bundle.. // delete bundle if it's now empty - List bundles = bitstream.getBundles(); + List bundles = bitstream.getBundles(); - bundleService.removeBitstream(context, bundles.get(0).getBundle(), bitstream); + bundleService.removeBitstream(context, bundles.get(0), bitstream); - List bitstreams = bundles.get(0).getBundle().getBitstreams(); + List 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 bundleBitstreams = b.getBundles(); + List bundles = b.getBundles(); - bundleService.removeBitstream(context, bundleBitstreams.get(0).getBundle(), b); + bundleService.removeBitstream(context, bundles.get(0), b); - List bitstreams = bundleBitstreams.get(0).getBundle().getBitstreams(); + List 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); } diff --git a/dspace-api/src/main/java/org/dspace/versioning/AbstractVersionProvider.java b/dspace-api/src/main/java/org/dspace/versioning/AbstractVersionProvider.java index 4f5b4b465c..2405c99047 100644 --- a/dspace-api/src/main/java/org/dspace/versioning/AbstractVersionProvider.java +++ b/dspace-api/src/main/java/org/dspace/versioning/AbstractVersionProvider.java @@ -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); diff --git a/dspace-api/src/main/java/org/dspace/xmlworkflow/XmlWorkflowServiceImpl.java b/dspace-api/src/main/java/org/dspace/xmlworkflow/XmlWorkflowServiceImpl.java index bc459a48e7..d4adbc4250 100644 --- a/dspace-api/src/main/java/org/dspace/xmlworkflow/XmlWorkflowServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/xmlworkflow/XmlWorkflowServiceImpl.java @@ -682,9 +682,9 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService { List bundles = item.getBundles(); for (Bundle bundle : bundles) { authorizeService.addPolicy(context, bundle, type, epa); - List bits = bundle.getBitstreams(); - for (BundleBitstream bit : bits) { - authorizeService.addPolicy(context, bit.getBitstream(), type, epa); + List bits = bundle.getBitstreams(); + for (Bitstream bit : bits) { + authorizeService.addPolicy(context, bit, type, epa); } } } @@ -695,9 +695,9 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService { List bundles = item.getBundles(); for (Bundle bundle : bundles) { authorizeService.addPolicy(context, bundle, type, group); - List bits = bundle.getBitstreams(); - for (BundleBitstream bit : bits) { - authorizeService.addPolicy(context, bit.getBitstream(), type, group); + List bits = bundle.getBitstreams(); + for (Bitstream bit : bits) { + authorizeService.addPolicy(context, bit, type, group); } } } @@ -711,9 +711,9 @@ public class XmlWorkflowServiceImpl implements XmlWorkflowService { List bundles = item.getBundles(); for (Bundle bundle : bundles) { authorizeService.removeEPersonPolicies(context, bundle, e); - List bitstreams = bundle.getBitstreams(); - for (BundleBitstream bitstream : bitstreams) { - authorizeService.removeEPersonPolicies(context, bitstream.getBitstream(), e); + List 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 bundles = item.getBundles(); for (Bundle bundle : bundles) { authorizeService.removeGroupPolicies(context, bundle, e); - List bitstreams = bundle.getBitstreams(); - for (BundleBitstream bitstream : bitstreams) { - authorizeService.removeGroupPolicies(context, bitstream.getBitstream(), e); + List bitstreams = bundle.getBitstreams(); + for (Bitstream bitstream : bitstreams) { + authorizeService.removeGroupPolicies(context, bitstream, e); } } } diff --git a/dspace-api/src/main/resources/org/dspace/storage/rdbms/sqlmigration/postgres/V6.0_2015.03.07__DS-2701_Hibernate_migration.sql b/dspace-api/src/main/resources/org/dspace/storage/rdbms/sqlmigration/postgres/V6.0_2015.03.07__DS-2701_Hibernate_migration.sql index 9db3710fca..cea771d61e 100644 --- a/dspace-api/src/main/resources/org/dspace/storage/rdbms/sqlmigration/postgres/V6.0_2015.03.07__DS-2701_Hibernate_migration.sql +++ b/dspace-api/src/main/resources/org/dspace/storage/rdbms/sqlmigration/postgres/V6.0_2015.03.07__DS-2701_Hibernate_migration.sql @@ -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 diff --git a/dspace-api/src/main/resources/org/dspace/storage/rdbms/xmlworkflow/postgres/xml_workflow_migration.sql b/dspace-api/src/main/resources/org/dspace/storage/rdbms/xmlworkflow/postgres/xml_workflow_migration.sql index 4e1646c61e..cd53ffcd94 100644 --- a/dspace-api/src/main/resources/org/dspace/storage/rdbms/xmlworkflow/postgres/xml_workflow_migration.sql +++ b/dspace-api/src/main/resources/org/dspace/storage/rdbms/xmlworkflow/postgres/xml_workflow_migration.sql @@ -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 ); diff --git a/dspace-api/src/test/java/org/dspace/content/BundleTest.java b/dspace-api/src/test/java/org/dspace/content/BundleTest.java index 2e0b92fd2f..12e2e54af2 100644 --- a/dspace-api/src/test/java/org/dspace/content/BundleTest.java +++ b/dspace-api/src/test/java/org/dspace/content/BundleTest.java @@ -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)); } /** diff --git a/dspace-api/src/test/java/org/dspace/content/LicenseUtilsTest.java b/dspace-api/src/test/java/org/dspace/content/LicenseUtilsTest.java index 102e87e131..d135d326d3 100644 --- a/dspace-api/src/test/java/org/dspace/content/LicenseUtilsTest.java +++ b/dspace-api/src/test/java/org/dspace/content/LicenseUtilsTest.java @@ -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)); diff --git a/dspace-api/src/test/java/org/dspace/content/packager/DSpaceAIPIntegrationTest.java b/dspace-api/src/test/java/org/dspace/content/packager/DSpaceAIPIntegrationTest.java index 2c693a6642..d3030e149e 100644 --- a/dspace-api/src/test/java/org/dspace/content/packager/DSpaceAIPIntegrationTest.java +++ b/dspace-api/src/test/java/org/dspace/content/packager/DSpaceAIPIntegrationTest.java @@ -641,12 +641,12 @@ public class DSpaceAIPIntegrationTest extends AbstractUnitTest List bundles = itemService.getBundles(testItem, Constants.CONTENT_BUNDLE_NAME); if(bundles.size()>0) { - List bitstreams = bundles.get(0).getBitstreams(); + List 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(); } } diff --git a/dspace-api/src/test/resources/hibernate.cfg.xml b/dspace-api/src/test/resources/hibernate.cfg.xml index 735940f0ba..b43dc3310e 100644 --- a/dspace-api/src/test/resources/hibernate.cfg.xml +++ b/dspace-api/src/test/resources/hibernate.cfg.xml @@ -44,7 +44,6 @@ - diff --git a/dspace-sword/src/main/java/org/dspace/sword/BitstreamEntryGenerator.java b/dspace-sword/src/main/java/org/dspace/sword/BitstreamEntryGenerator.java index 840d46dce4..2b21455a4f 100644 --- a/dspace-sword/src/main/java/org/dspace/sword/BitstreamEntryGenerator.java +++ b/dspace-sword/src/main/java/org/dspace/sword/BitstreamEntryGenerator.java @@ -198,14 +198,14 @@ public class BitstreamEntryGenerator extends DSpaceATOMEntry try { // work our way up to the item - List bundle2bitstreams = this.bitstream + List 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 items = bundle.getItems(); if (items.isEmpty()) { @@ -225,10 +225,9 @@ public class BitstreamEntryGenerator extends DSpaceATOMEntry // skip non-license bundles continue; } - List bss = lbundle.getBitstreams(); - for (BundleBitstream b2b : bss) + List bss = lbundle.getBitstreams(); + for (Bitstream bs : bss) { - Bitstream bs = b2b.getBitstream(); String url = urlManager.getBitstreamUrl(bs); rightsString.append(url).append(" "); } diff --git a/dspace-sword/src/main/java/org/dspace/sword/ItemDepositor.java b/dspace-sword/src/main/java/org/dspace/sword/ItemDepositor.java index 3345b05de8..38d4465c37 100644 --- a/dspace-sword/src/main/java/org/dspace/sword/ItemDepositor.java +++ b/dspace-sword/src/main/java/org/dspace/sword/ItemDepositor.java @@ -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 b2bs = bs.getBundles().iterator(); - while (b2bs.hasNext()) + Iterator 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); } diff --git a/dspace-sword/src/main/java/org/dspace/sword/ItemEntryGenerator.java b/dspace-sword/src/main/java/org/dspace/sword/ItemEntryGenerator.java index 27ac991022..c5fb4e6787 100644 --- a/dspace-sword/src/main/java/org/dspace/sword/ItemEntryGenerator.java +++ b/dspace-sword/src/main/java/org/dspace/sword/ItemEntryGenerator.java @@ -103,11 +103,11 @@ public class ItemEntryGenerator extends DSpaceATOMEntry { if (swordBundle.equals(bundle.getName())) { - List bss = bundle + List 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 bss = bundle.getBitstreams(); - for (BundleBitstream bs : bss) + List 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 bss = bundle.getBitstreams(); - for (BundleBitstream bs : bss) + List bss = bundle.getBitstreams(); + for (Bitstream bs : bss) { - String url = urlManager.getBitstreamUrl(bs.getBitstream()); + String url = urlManager.getBitstreamUrl(bs); rightsString.append(url).append(" "); } break; diff --git a/dspace-sword/src/main/java/org/dspace/sword/SWORDUrlManager.java b/dspace-sword/src/main/java/org/dspace/sword/SWORDUrlManager.java index c1f393f776..2eed3f55b5 100644 --- a/dspace-sword/src/main/java/org/dspace/sword/SWORDUrlManager.java +++ b/dspace-sword/src/main/java/org/dspace/sword/SWORDUrlManager.java @@ -437,11 +437,11 @@ public class SWORDUrlManager { try { - List bundles = bitstream.getBundles(); + List 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 bundles = bitstream.getBundles(); + List bundles = bitstream.getBundles(); Bundle parent = null; if (!bundles.isEmpty()) { - parent = bundles.get(0).getBundle(); + parent = bundles.get(0); } else { diff --git a/dspace-swordv2/src/main/java/org/dspace/sword2/FeedContentDisseminator.java b/dspace-swordv2/src/main/java/org/dspace/sword2/FeedContentDisseminator.java index efe7333724..b8c9dc8f44 100644 --- a/dspace-swordv2/src/main/java/org/dspace/sword2/FeedContentDisseminator.java +++ b/dspace-swordv2/src/main/java/org/dspace/sword2/FeedContentDisseminator.java @@ -44,13 +44,13 @@ public class FeedContentDisseminator extends AbstractSimpleDC { if (Constants.CONTENT_BUNDLE_NAME.equals(bundle.getName())) { - List bundleBitstreams = bundle + List bitstreams = bundle .getBitstreams(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + for (Bitstream bitstream : bitstreams) { Entry entry = feed.addEntry(); this.populateEntry(context, entry, - bundleBitstream.getBitstream()); + bitstream); } } } diff --git a/dspace-swordv2/src/main/java/org/dspace/sword2/GenericStatementDisseminator.java b/dspace-swordv2/src/main/java/org/dspace/sword2/GenericStatementDisseminator.java index 3f126262df..71abca0cbb 100644 --- a/dspace-swordv2/src/main/java/org/dspace/sword2/GenericStatementDisseminator.java +++ b/dspace-swordv2/src/main/java/org/dspace/sword2/GenericStatementDisseminator.java @@ -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 bundleBitstreams = bundle + List 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 bundleBitstreams = bundle + List 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); } diff --git a/dspace-swordv2/src/main/java/org/dspace/sword2/MediaResourceManagerDSpace.java b/dspace-swordv2/src/main/java/org/dspace/sword2/MediaResourceManagerDSpace.java index e558c6df66..50b8185f98 100644 --- a/dspace-swordv2/src/main/java/org/dspace/sword2/MediaResourceManagerDSpace.java +++ b/dspace-swordv2/src/main/java/org/dspace/sword2/MediaResourceManagerDSpace.java @@ -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 bundleBitstreams = bitstream.getBundles(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + List bundles = bitstream.getBundles(); + for (Bundle bundle : bundles) { - List items = bundleBitstream.getBundle().getItems(); + List 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 items = new ArrayList<>(); - List bundleBitstreams = bitstream.getBundles(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + List bundles = bitstream.getBundles(); + for (Bundle bundle : bundles) { - List bundleItems = bundleBitstream.getBundle() + List 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 items = new ArrayList<>(); - for (BundleBitstream bundleBitstream : bitstream.getBundles()) + for (Bundle bundle : bitstream.getBundles()) { - List bundleItems = bundleBitstream.getBundle() + List bundleItems = bundle .getItems(); for (Item item : bundleItems) { diff --git a/dspace-swordv2/src/main/java/org/dspace/sword2/ReceiptGenerator.java b/dspace-swordv2/src/main/java/org/dspace/sword2/ReceiptGenerator.java index 8d160ed25a..6baea052e3 100644 --- a/dspace-swordv2/src/main/java/org/dspace/sword2/ReceiptGenerator.java +++ b/dspace-swordv2/src/main/java/org/dspace/sword2/ReceiptGenerator.java @@ -157,10 +157,10 @@ public class ReceiptGenerator { continue; } - List bss = bundle.getBitstreams(); - for (BundleBitstream bs : bss) + List 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 bss = bundle.getBitstreams(); - for (BundleBitstream bs : bss) + List bss = bundle.getBitstreams(); + for (Bitstream bs : bss) { - String url = urlManager.getBitstreamUrl(bs.getBitstream()); + String url = urlManager.getBitstreamUrl(bs); rightsString.append(url).append(" "); } } diff --git a/dspace-swordv2/src/main/java/org/dspace/sword2/SimpleZipContentDisseminator.java b/dspace-swordv2/src/main/java/org/dspace/sword2/SimpleZipContentDisseminator.java index 84bf6e9467..5f360bb684 100644 --- a/dspace-swordv2/src/main/java/org/dspace/sword2/SimpleZipContentDisseminator.java +++ b/dspace-swordv2/src/main/java/org/dspace/sword2/SimpleZipContentDisseminator.java @@ -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 bss = bundle.getBitstreams(); - for (BundleBitstream bundleBitstream : bss) + List bss = bundle.getBitstreams(); + for (Bitstream bitstream : bss) { - Bitstream bitstream = bundleBitstream.getBitstream(); ZipEntry ze = new ZipEntry(bitstream.getName()); zip.putNextEntry(ze); InputStream is = bitstreamService diff --git a/dspace-swordv2/src/main/java/org/dspace/sword2/SwordUrlManager.java b/dspace-swordv2/src/main/java/org/dspace/sword2/SwordUrlManager.java index 14e62fc614..4cdb3afd57 100644 --- a/dspace-swordv2/src/main/java/org/dspace/sword2/SwordUrlManager.java +++ b/dspace-swordv2/src/main/java/org/dspace/sword2/SwordUrlManager.java @@ -441,11 +441,11 @@ public class SwordUrlManager { try { - List bundles = bitstream.getBundles(); + List bundles = bitstream.getBundles(); Bundle parent = null; if (!bundles.isEmpty()) { - parent = bundles.get(0).getBundle(); + parent = bundles.get(0); } else { diff --git a/dspace-swordv2/src/main/java/org/dspace/sword2/VersionManager.java b/dspace-swordv2/src/main/java/org/dspace/sword2/VersionManager.java index 6f300d6f7e..fc3e90729b 100644 --- a/dspace-swordv2/src/main/java/org/dspace/sword2/VersionManager.java +++ b/dspace-swordv2/src/main/java/org/dspace/sword2/VersionManager.java @@ -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 bundleBitstreams = source.getBitstreams() + Iterator 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 bundleBitstreams = bitstream.getBundles() + Iterator 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 bundleBitstreams = source.getBitstreams(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + List bitstreams = source.getBitstreams(); + for (Bitstream bitstream : bitstreams) { bundleService - .addBitstream(context, old, bundleBitstream.getBitstream()); + .addBitstream(context, old, bitstream); } } diff --git a/dspace-swordv2/src/main/java/org/dspace/sword2/WorkflowManagerDefault.java b/dspace-swordv2/src/main/java/org/dspace/sword2/WorkflowManagerDefault.java index 8d140b21aa..b1a73509f0 100644 --- a/dspace-swordv2/src/main/java/org/dspace/sword2/WorkflowManagerDefault.java +++ b/dspace-swordv2/src/main/java/org/dspace/sword2/WorkflowManagerDefault.java @@ -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 bundleBitstreams = bitstream.getBundles(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + List 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 items = bundleBitstream.getBundle().getItems(); + List 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 bundleBitstreams = bitstream.getBundles(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + List 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); } diff --git a/dspace-swordv2/src/main/java/org/dspace/sword2/WorkflowManagerUnrestricted.java b/dspace-swordv2/src/main/java/org/dspace/sword2/WorkflowManagerUnrestricted.java index f9c3de03b4..9e238023f5 100644 --- a/dspace-swordv2/src/main/java/org/dspace/sword2/WorkflowManagerUnrestricted.java +++ b/dspace-swordv2/src/main/java/org/dspace/sword2/WorkflowManagerUnrestricted.java @@ -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 bundleBitstreams = bitstream.getBundles(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + List 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 items = bundleBitstream.getBundle().getItems(); + List 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 bundleBitstreams = bitstream.getBundles(); - for (BundleBitstream bundleBitstream : bundleBitstreams) + List 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 items = bundleBitstream.getBundle().getItems(); + List items = bundle.getItems(); for (Item item : items) { this.replaceResourceContent(context, item); diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/FlowItemUtils.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/FlowItemUtils.java index 1a5971bef0..487f5cab80 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/FlowItemUtils.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/FlowItemUtils.java @@ -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 bundles = bitstream.getBundles(); + List 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 bundles = item.getBundles(); for (Bundle bundle : bundles) { - List bundleBitstreams = bundle.getBitstreams(); + List 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()); diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/authorization/EditItemPolicies.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/authorization/EditItemPolicies.java index 22599c93eb..79bfbdd7a7 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/authorization/EditItemPolicies.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/authorization/EditItemPolicies.java @@ -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,8 +122,7 @@ public class EditItemPolicies extends AbstractDSpaceTransformer /* First, set up our various data structures */ Item item = itemService.find(context, itemID); List bundles = item.getBundles(); - Bitstream[] bitstreams; - + ArrayList itemPolicies = (ArrayList) authorizeService.getPolicies(context, item); // DIVISION: main @@ -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 bundleBitstreams = bundle.getBitstreams(); - for (BundleBitstream bundleBitstream : bundleBitstreams) { - Bitstream bitstream = bundleBitstream.getBitstream(); + List 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); diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/item/EditBitstreamForm.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/item/EditBitstreamForm.java index b616277778..0b5dc08d90 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/item/EditBitstreamForm.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/item/EditBitstreamForm.java @@ -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 bundles = bitstream.getBundles(); + java.util.List 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; } diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/item/EditItemBitstreamsForm.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/item/EditItemBitstreamsForm.java index bf8247fab2..27d0372220 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/item/EditItemBitstreamsForm.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/administrative/item/EditItemBitstreamsForm.java @@ -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 bundleBitstreams = bundle.getBitstreams(); + java.util.List bitstreams = bundle.getBitstreams(); ArrayList 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); diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/ItemRequestResponseAction.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/ItemRequestResponseAction.java index b552bfaf20..f948572763 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/ItemRequestResponseAction.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/artifactbrowser/ItemRequestResponseAction.java @@ -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 bundles = itemService.getBundles(item, "ORIGINAL"); for (Bundle bundle : bundles) { - List bundleBitstreams = bundle.getBitstreams(); - for (BundleBitstream bundleBitstream : bundleBitstreams) { - Bitstream bitstream = bundleBitstream.getBitstream(); + List 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()); } diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/CSVOutputter.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/CSVOutputter.java index c71f1edef9..4821c2f8bf 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/CSVOutputter.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/statisticsElasticSearch/CSVOutputter.java @@ -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")); diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/submission/submit/UploadStep.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/submission/submit/UploadStep.java index 1a91dfb8ad..5f340180a3 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/submission/submit/UploadStep.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/submission/submit/UploadStep.java @@ -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 bundles = itemService.getBundles(item, "ORIGINAL"); - java.util.List bitstreams = new ArrayList<>(); + java.util.List 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 bundles = itemService.getBundles(item, "ORIGINAL"); - java.util.List bitstreams = new ArrayList<>(); + java.util.List 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(); diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/submission/submit/UploadWithEmbargoStep.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/submission/submit/UploadWithEmbargoStep.java index 11d3cf1edf..7b34f169f2 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/submission/submit/UploadWithEmbargoStep.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/aspect/submission/submit/UploadWithEmbargoStep.java @@ -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 bundles = itemService.getBundles(item, "ORIGINAL"); - java.util.List bitstreams = new ArrayList<>(); + java.util.List 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 bundles = itemService.getBundles(item, "ORIGINAL"); - java.util.List bitstreams = new ArrayList<>(); + java.util.List 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(); diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/cocoon/BitstreamReader.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/cocoon/BitstreamReader.java index 6d643cf83d..897c4d2460 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/cocoon/BitstreamReader.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/cocoon/BitstreamReader.java @@ -463,13 +463,13 @@ public class BitstreamReader extends AbstractReader implements Recyclable List bundles = item.getBundles(); for (Bundle bundle : bundles) { - List bundleBitstreams = bundle.getBitstreams(); + List 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 bundles = item.getBundles(); for (Bundle bundle : bundles) { - List bundleBitstreams = bundle.getBitstreams(); + List 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; } } } diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/cocoon/UsageLoggerAction.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/cocoon/UsageLoggerAction.java index 53eb14120d..2f061b6bbd 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/cocoon/UsageLoggerAction.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/cocoon/UsageLoggerAction.java @@ -158,13 +158,13 @@ public class UsageLoggerAction extends AbstractAction { List bundles = item.getBundles(); for (Bundle bundle : bundles) { - List bundleBitstreams = bundle.getBitstreams(); + List 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 bundles = item.getBundles(); for (Bundle bundle : bundles) { - List bundleBitstreams = bundle.getBitstreams(); + List 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; } } } diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/objectmanager/ItemAdapter.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/objectmanager/ItemAdapter.java index 6f7a8d9cac..b8eb381ab9 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/objectmanager/ItemAdapter.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/objectmanager/ItemAdapter.java @@ -530,15 +530,15 @@ public class ItemAdapter extends AbstractAdapter List bundles = findEnabledBundles(); for (Bundle bundle : bundles) { - List bundleBitstreams = bundle.getBitstreams(); + List bitstreams = bundle.getBitstreams(); // Create a sub-section of 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 bundleBitstreams = bundle.getBitstreams(); + List 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; } } } diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/utils/DSpaceValidity.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/utils/DSpaceValidity.java index a81b28326d..38c779c634 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/utils/DSpaceValidity.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/utils/DSpaceValidity.java @@ -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) diff --git a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/utils/HandleUtil.java b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/utils/HandleUtil.java index 41fb23cc74..87c0c0750c 100644 --- a/dspace-xmlui/src/main/java/org/dspace/app/xmlui/utils/HandleUtil.java +++ b/dspace-xmlui/src/main/java/org/dspace/app/xmlui/utils/HandleUtil.java @@ -188,9 +188,9 @@ public class HandleUtil if (aDso instanceof Bitstream) { Bitstream bitstream = (Bitstream) aDso; - List bundles = bitstream.getBundles(); + List bundles = bitstream.getBundles(); - aDso = bundles.get(0).getBundle(); + aDso = bundles.get(0); } if (aDso instanceof Bundle) diff --git a/dspace/config/hibernate.cfg.xml b/dspace/config/hibernate.cfg.xml index 2620f0662a..b7762a57f1 100644 --- a/dspace/config/hibernate.cfg.xml +++ b/dspace/config/hibernate.cfg.xml @@ -58,7 +58,6 @@ - diff --git a/dspace/config/spring/api/core-dao-services.xml b/dspace/config/spring/api/core-dao-services.xml index 5689417f07..27c7bf27b3 100644 --- a/dspace/config/spring/api/core-dao-services.xml +++ b/dspace/config/spring/api/core-dao-services.xml @@ -20,7 +20,6 @@ -