Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ufal/be-s3-checker-sync #486

Merged
merged 16 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ public List<Collection> findAuthorizedByGroup(Context context, EPerson ePerson,

@Override
public List<Collection> findCollectionsWithSubscribers(Context context) throws SQLException {
return list(createQuery(context, "SELECT DISTINCT col FROM Subscription s join s.collection col"));
return list(createQuery(context, "SELECT DISTINCT col FROM Subscription s join s.dSpaceObject col"));
vidiecan marked this conversation as resolved.
Show resolved Hide resolved
}

@Override
Expand Down
46 changes: 24 additions & 22 deletions dspace-api/src/main/java/org/dspace/health/ChecksumCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.dspace.checker.ChecksumResultsCollector;
import org.dspace.checker.MostRecentChecksum;
import org.dspace.checker.SimpleDispatcher;
import org.dspace.content.Bitstream;
import org.dspace.core.Context;

/**
Expand All @@ -40,37 +41,38 @@ public String run(ReportInfo ri) {
checker.setReportVerbose(true);
try {
checker.process();
if (collector.arr.size() > 0) {
ret = String.format("Checksum performed on [%d] items:\n",
collector.arr.size());
int ok_items = 0;
for (MostRecentChecksum bi : collector.arr) {
if (!ChecksumResultCode.CHECKSUM_MATCH.equals(bi
.getChecksumResult().getResultCode())) {
Bitstream reloadedBitstream = context.reloadEntity(bi.getBitstream());
ret += String
.format("md5 checksum FAILED (%s): %s id: %s bitstream-id: %s\n was: %s\n is: %s\n",
bi.getChecksumResult(), reloadedBitstream.getName(),
reloadedBitstream.getInternalId(), reloadedBitstream.getID(),
bi.getExpectedChecksum(),
bi.getCurrentChecksum());
} else {
ok_items++;
}
}

ret += String.format("checksum OK for [%d] items\n", ok_items);
}
context.complete();
context = null;
return ret;
} catch (SQLException e) {
error(e);
} finally {
if (context != null) {
context.abort();
}
}

if (collector.arr.size() > 0) {
ret = String.format("Checksum performed on [%d] items:\n",
collector.arr.size());
int ok_items = 0;
for (MostRecentChecksum bi : collector.arr) {
if (!ChecksumResultCode.CHECKSUM_MATCH.equals(bi
.getChecksumResult().getResultCode())) {
ret += String
.format("md5 checksum FAILED (%s): %s id: %s bitstream-id: %s\n was: %s\n is: %s\n",
bi.getChecksumResult(), bi.getBitstream().getName(),
bi.getBitstream().getInternalId(), bi.getBitstream().getID(),
bi.getExpectedChecksum(),
bi.getCurrentChecksum());
} else {
ok_items++;
}
}

ret += String.format("checksum OK for [%d] items\n", ok_items);
}
return ret;
return ret;
}
}

Expand Down
Loading