DSpace refactored service api

This commit is contained in:
KevinVdV
2014-11-08 09:19:09 +01:00
parent fcb3717aad
commit 54222f3c1d
1145 changed files with 52233 additions and 57064 deletions

View File

@@ -7,10 +7,13 @@
*/
package org.dspace.checker;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.Date;
import org.apache.log4j.Logger;
import org.dspace.content.Bitstream;
import org.dspace.core.Context;
import org.dspace.core.I18nUtil;
/**
@@ -43,11 +46,6 @@ public class ResultsLogger implements ChecksumResultsCollector
*/
Date startDate = null;
/**
* ChecksumResultDAO dependency variable.
*/
private ChecksumResultDAO resultDAO;
/**
* Blanked off, no-op constructor. Do not use.
*/
@@ -63,8 +61,6 @@ public class ResultsLogger implements ChecksumResultsCollector
*/
public ResultsLogger(Date startDt)
{
this.resultDAO = new ChecksumResultDAO();
LOG.info(msg("run-start-time") + ": " + DATE_FORMAT.format(startDt));
}
@@ -75,7 +71,7 @@ public class ResultsLogger implements ChecksumResultsCollector
* to get the message.
* @return the message found.
*/
private String msg(String key)
protected String msg(String key)
{
return I18nUtil.getMessage("org.dspace.checker.ResultsLogger." + key);
}
@@ -85,35 +81,36 @@ public class ResultsLogger implements ChecksumResultsCollector
*
* @param info
* the BitstreamInfo representing the result.
* @see org.dspace.checker.ChecksumResultsCollector#collect(org.dspace.checker.BitstreamInfo)
* @see org.dspace.checker.ChecksumResultsCollector#collect(org.dspace.checker.MostRecentChecksum)
*/
public void collect(BitstreamInfo info)
{
@Override
public void collect(Context context, MostRecentChecksum info) throws SQLException {
Bitstream bitstream = info.getBitstream();
LOG.info("******************************************************");
LOG.info(msg("bitstream-id") + ": " + info.getBitstreamId());
LOG.info(msg("bitstream-info-found") + ": " + info.getInfoFound());
LOG.info(msg("bitstream-marked-deleted") + ": " + info.getDeleted());
LOG.info(msg("bitstream-found") + ": " + info.getBitstreamFound());
LOG.info(msg("to-be-processed") + ": " + info.getToBeProcessed());
LOG.info(msg("internal-id") + ": " + info.getInternalId());
LOG.info(msg("name") + ": " + info.getName());
LOG.info(msg("store-number") + ": " + info.getStoreNumber());
LOG.info(msg("size") + ": " + info.getSize());
LOG.info(msg("bitstream-format") + ": " + info.getBitstreamFormatId());
LOG.info(msg("bitstream-id") + ": " + bitstream.getID());
LOG.info(msg("bitstream-info-found") + ": " + info.isInfoFound());
LOG.info(msg("bitstream-marked-deleted") + ": " + bitstream.isDeleted());
LOG.info(msg("bitstream-found") + ": " + info.isBitstreamFound());
LOG.info(msg("to-be-processed") + ": " + info.isToBeProcessed());
LOG.info(msg("internal-id") + ": " + bitstream.getInternalId());
LOG.info(msg("name") + ": " + bitstream.getName());
LOG.info(msg("store-number") + ": " + bitstream.getStoreNumber());
LOG.info(msg("size") + ": " + bitstream.getSize());
LOG.info(msg("bitstream-format") + ": " + (bitstream.getFormat(context) != null ? bitstream.getFormat(context).getID() : "-1"));
LOG.info(msg("user-format-description") + ": "
+ info.getUserFormatDescription());
LOG.info(msg("source") + ": " + info.getSource());
+ bitstream.getUserFormatDescription());
LOG.info(msg("source") + ": " + bitstream.getSource());
LOG
.info(msg("checksum-algorithm") + ": "
+ info.getChecksumAlgorithm());
LOG.info(msg("previous-checksum") + ": " + info.getStoredChecksum());
LOG.info(msg("previous-checksum") + ": " + info.getExpectedChecksum());
LOG.info(msg("previous-checksum-date")
+ ": "
+ ((info.getProcessEndDate() != null) ? DATE_FORMAT.format(info
.getProcessEndDate()) : "unknown"));
LOG.info(msg("new-checksum") + ": " + info.getCalculatedChecksum());
LOG.info(msg("new-checksum") + ": " + info.getCurrentChecksum());
LOG.info(msg("checksum-comparison-result") + ": "
+ resultDAO.getChecksumCheckStr(info.getChecksumCheckResult()));
+ (info.getChecksumResult().getResultCode()));
LOG.info("\n\n");
}
}