mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-15 14:03:17 +00:00
D4CRIS-338 use constant to work with "ORIGINAL" bundle
This commit is contained in:
@@ -36,6 +36,7 @@ import org.dspace.content.service.BitstreamFormatService;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.content.service.WorkspaceItemService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.eperson.EPerson;
|
||||
import org.dspace.eperson.EPersonServiceImpl;
|
||||
@@ -199,13 +200,13 @@ public class WorkspaceItemRestRepository extends DSpaceRestRepository<WorkspaceI
|
||||
WorkspaceItem wsi = wis.find(context, id);
|
||||
Item item = wsi.getItem();
|
||||
// do we already have a bundle?
|
||||
List<Bundle> bundles = itemService.getBundles(item, "ORIGINAL");
|
||||
List<Bundle> bundles = itemService.getBundles(item, Constants.CONTENT_BUNDLE_NAME);
|
||||
|
||||
try {
|
||||
InputStream inputStream = new BufferedInputStream(file.getInputStream());
|
||||
if (bundles.size() < 1) {
|
||||
// set bundle's name to ORIGINAL
|
||||
source = itemService.createSingleBitstream(context, inputStream, item, "ORIGINAL");
|
||||
source = itemService.createSingleBitstream(context, inputStream, item, Constants.CONTENT_BUNDLE_NAME);
|
||||
} else {
|
||||
// we have a bundle already, just add bitstream
|
||||
source = bitstreamService.create(context, bundles.get(0), inputStream);
|
||||
|
@@ -9,6 +9,7 @@ import org.dspace.content.Bundle;
|
||||
import org.dspace.content.Item;
|
||||
import org.dspace.content.WorkspaceItem;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.services.model.Request;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -27,7 +28,7 @@ public class AccessConditionRemovePatchOperation extends RemovePatchOperation<Ac
|
||||
String[] split = path.split("/");
|
||||
Item item = source.getItem();
|
||||
|
||||
List<Bundle> bundle = itemService.getBundles(item, "ORIGINAL");
|
||||
List<Bundle> bundle = itemService.getBundles(item, Constants.CONTENT_BUNDLE_NAME);
|
||||
;
|
||||
for (Bundle bb : bundle) {
|
||||
int idx = 0;
|
||||
|
@@ -40,7 +40,7 @@ public class AccessConditionReplacePatchOperation extends ReplacePatchOperation<
|
||||
String[] split = path.split("/");
|
||||
Item item = source.getItem();
|
||||
|
||||
List<Bundle> bundle = itemService.getBundles(item, "ORIGINAL");
|
||||
List<Bundle> bundle = itemService.getBundles(item, Constants.CONTENT_BUNDLE_NAME);
|
||||
;
|
||||
for (Bundle bb : bundle) {
|
||||
int idx = 0;
|
||||
|
@@ -10,6 +10,7 @@ import org.dspace.content.Item;
|
||||
import org.dspace.content.WorkspaceItem;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.Utils;
|
||||
import org.dspace.services.model.Request;
|
||||
@@ -28,7 +29,7 @@ public class BitstreamMetadataValueAddPatchOperation extends AddPatchOperation<M
|
||||
void add(Context context, Request currentRequest, WorkspaceItem source, String path, Object value) throws Exception {
|
||||
String[] split = path.split("/");
|
||||
Item item = source.getItem();
|
||||
List<Bundle> bundle = itemService.getBundles(item, "ORIGINAL");;
|
||||
List<Bundle> bundle = itemService.getBundles(item, Constants.CONTENT_BUNDLE_NAME);;
|
||||
for(Bundle bb : bundle) {
|
||||
int idx = 0;
|
||||
for(Bitstream b : bb.getBitstreams()) {
|
||||
|
@@ -11,6 +11,7 @@ import org.dspace.content.MetadataValue;
|
||||
import org.dspace.content.WorkspaceItem;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.Utils;
|
||||
import org.dspace.services.model.Request;
|
||||
@@ -29,7 +30,7 @@ public class BitstreamMetadataValueRemovePatchOperation extends RemovePatchOpera
|
||||
void remove(Context context, Request currentRequest, WorkspaceItem source, String path, Object value) throws Exception {
|
||||
String[] split = path.split("/");
|
||||
Item item = source.getItem();
|
||||
List<Bundle> bundle = itemService.getBundles(item, "ORIGINAL");;
|
||||
List<Bundle> bundle = itemService.getBundles(item, Constants.CONTENT_BUNDLE_NAME);;
|
||||
for(Bundle bb : bundle) {
|
||||
int idx = 0;
|
||||
for(Bitstream b : bb.getBitstreams()) {
|
||||
|
@@ -10,6 +10,7 @@ import org.dspace.content.Item;
|
||||
import org.dspace.content.WorkspaceItem;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.core.Utils;
|
||||
import org.dspace.services.model.Request;
|
||||
@@ -28,7 +29,7 @@ public class BitstreamMetadataValueReplacePatchOperation extends ReplacePatchOpe
|
||||
void replace(Context context, Request currentRequest, WorkspaceItem source, String path, Object value) throws Exception {
|
||||
String[] split = path.split("/");
|
||||
Item item = source.getItem();
|
||||
List<Bundle> bundle = itemService.getBundles(item, "ORIGINAL");;
|
||||
List<Bundle> bundle = itemService.getBundles(item, Constants.CONTENT_BUNDLE_NAME);;
|
||||
for(Bundle bb : bundle) {
|
||||
int idx = 0;
|
||||
for(Bitstream b : bb.getBitstreams()) {
|
||||
|
@@ -9,6 +9,7 @@ import org.dspace.content.WorkspaceItem;
|
||||
import org.dspace.content.service.BitstreamService;
|
||||
import org.dspace.content.service.BundleService;
|
||||
import org.dspace.content.service.ItemService;
|
||||
import org.dspace.core.Constants;
|
||||
import org.dspace.core.Context;
|
||||
import org.dspace.services.model.Request;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -26,7 +27,7 @@ public class BitstreamRemovePatchOperation extends RemovePatchOperation<String>{
|
||||
throws Exception {
|
||||
|
||||
Item item = source.getItem();
|
||||
List<Bundle> bbb = itemService.getBundles(item, "ORIGINAL");
|
||||
List<Bundle> bbb = itemService.getBundles(item, Constants.CONTENT_BUNDLE_NAME);
|
||||
Bitstream bitstream = null;
|
||||
external : for(Bundle bb : bbb) {
|
||||
int idx = 0;
|
||||
|
Reference in New Issue
Block a user