Skip to content

Commit

Permalink
fixed objectcount of general statistics
Browse files Browse the repository at this point in the history
  • Loading branch information
fasseg committed Mar 19, 2013
1 parent ff5022b commit 845a4d6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Expand Up @@ -23,6 +23,8 @@ public interface DatabaseService {
long getSuccessCount();

long getRepairCount();

long getObjectCount();

void addStat(int successCount, int errorCount, int repairCount);

Expand Down
Expand Up @@ -182,6 +182,18 @@ public ObjectFixity getResult(long recordId) {
return result;
}

@Override
@Transactional(readOnly = true)
public long getObjectCount() {
Session sess = sessionFactory.openSession();
long count = (long) sess.createCriteria(ObjectFixity.class)
.setProjection(Projections.countDistinct("pid"))
.uniqueResult();
sess.close();
return count;
}


private void initializeObjectFixity(ObjectFixity oFixity) {
Hibernate.initialize(oFixity.getErrors());
for (DatastreamFixity p:oFixity.getErrors()){
Expand Down
Expand Up @@ -153,7 +153,7 @@ public List<ObjectFixity> getResults(int offset, int length) {

public GeneralStatistics getStatistics(){
GeneralStatistics stats = new GeneralStatistics();
stats.setNumObjects(databaseService.getResultCount());
stats.setNumObjects(databaseService.getObjectCount());
stats.setErrorCount(databaseService.getErrorCount());
stats.setSuccessCount(databaseService.getSuccessCount());
stats.setRepairCount(databaseService.getRepairCount());
Expand Down

0 comments on commit 845a4d6

Please sign in to comment.