Skip to content

Commit

Permalink
Removed unwanted changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
milanmajchrak committed Oct 2, 2023
1 parent 7719609 commit f874e92
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -496,24 +486,4 @@ public List<Bitstream> 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);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@ public class ClarinLicense implements ReloadableEntity<Integer> {
*/
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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
@Table(name = "license_label")
public class ClarinLicenseLabel implements ReloadableEntity<Integer> {

public final static String PUB_LABEL_NAME = "PUB";

@Id
@Column(name = "label_id")
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "license_label_label_id_seq")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<MetadataBitstreamWrapperRest, Integer>{
private static Logger log = org.apache.logging.log4j.LogManager.getLogger(MetadataBitstreamRestRepository.class);
Expand Down

0 comments on commit f874e92

Please sign in to comment.