From f874e92d272ec95fe2163d3c8fcc4c9ab496e3a7 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Mon, 2 Oct 2023 15:44:55 +0200 Subject: [PATCH] Removed unwanted changes. --- .../dspace/content/BitstreamServiceImpl.java | 30 ------------------- .../dspace/content/clarin/ClarinLicense.java | 2 -- .../content/clarin/ClarinLicenseLabel.java | 2 -- .../MetadataBitstreamRestRepository.java | 3 -- 4 files changed, 37 deletions(-) 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 f331393707e2..2e20c7defb67 100644 --- a/dspace-api/src/main/java/org/dspace/content/BitstreamServiceImpl.java +++ b/dspace-api/src/main/java/org/dspace/content/BitstreamServiceImpl.java @@ -302,17 +302,7 @@ public int getSupportsTypeConstant() { @Override public InputStream retrieve(Context context, Bitstream bitstream) throws IOException, SQLException, AuthorizeException { - // Maybe should return AuthorizeException?? -// try { authorizeService.authorizeAction(context, bitstream, Constants.READ); -// } catch (MissingLicenseAgreementException e) { -// If the context contains `PREVIEW` action it should not throw an exception, -// but retrieve the content instead. -// if (!contextHasPreviewEvent(context)) { -// throw e; -// } - // Else remove event from context and retrieve the bitstream content. -// } return bitstreamStorageService.retrieve(context, bitstream); } @@ -496,24 +486,4 @@ public List getNotReferencedBitstreams(Context context) throws SQLExc public Long getLastModified(Bitstream bitstream) throws IOException { return bitstreamStorageService.getLastModified(bitstream); } - - private boolean contextHasPreviewEvent(Context context) { - int id = 0; - for (Event event : context.getEvents()) { - if (!Objects.equals(event.getEventType(), Event.MODIFY)) { - return false; - } - if (Objects.equals(event.getDetail(), "PREVIEW")) { - // Remove Preview Event - removeEventFromContext(context, id); - return true; - } - id++; - } - return false; - } - - private void removeEventFromContext(Context context, int eventID) { - context.getEvents().remove(eventID); - } } diff --git a/dspace-api/src/main/java/org/dspace/content/clarin/ClarinLicense.java b/dspace-api/src/main/java/org/dspace/content/clarin/ClarinLicense.java index 1ac807895231..2c23eba24d04 100644 --- a/dspace-api/src/main/java/org/dspace/content/clarin/ClarinLicense.java +++ b/dspace-api/src/main/java/org/dspace/content/clarin/ClarinLicense.java @@ -54,8 +54,6 @@ public class ClarinLicense implements ReloadableEntity { */ public static final String SEND_TOKEN = "SEND_TOKEN"; - public final static String HAMLEDT_LICENSE_NAME = "HamleDT 3.0 License Terms"; - @Id @Column(name = "license_id") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "license_definition_license_id_seq") diff --git a/dspace-api/src/main/java/org/dspace/content/clarin/ClarinLicenseLabel.java b/dspace-api/src/main/java/org/dspace/content/clarin/ClarinLicenseLabel.java index dcf1416f84cc..a945da7fbb15 100644 --- a/dspace-api/src/main/java/org/dspace/content/clarin/ClarinLicenseLabel.java +++ b/dspace-api/src/main/java/org/dspace/content/clarin/ClarinLicenseLabel.java @@ -32,8 +32,6 @@ @Table(name = "license_label") public class ClarinLicenseLabel implements ReloadableEntity { - public final static String PUB_LABEL_NAME = "PUB"; - @Id @Column(name = "label_id") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "license_label_label_id_seq") diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/MetadataBitstreamRestRepository.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/MetadataBitstreamRestRepository.java index 676578caa744..34ad31f9c912 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/MetadataBitstreamRestRepository.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/repository/MetadataBitstreamRestRepository.java @@ -68,9 +68,6 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; -import static org.dspace.content.clarin.ClarinLicense.HAMLEDT_LICENSE_NAME; -import static org.dspace.content.clarin.ClarinLicenseLabel.PUB_LABEL_NAME; - @Component(MetadataBitstreamWrapperRest.CATEGORY + "." + MetadataBitstreamWrapperRest.NAME) public class MetadataBitstreamRestRepository extends DSpaceRestRepository{ private static Logger log = org.apache.logging.log4j.LogManager.getLogger(MetadataBitstreamRestRepository.class);