Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions core/src/main/java/org/verapdf/core/utils/ValidationProgress.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
*/
package org.verapdf.core.utils;

import java.util.HashMap;
import java.util.Map;

public class ValidationProgress {

private static final int UPPER_LIMIT_POWER_OF_TEN = 6;
Expand Down Expand Up @@ -95,6 +98,15 @@ private String getCurrentValidationJobProgress() {
+ numberOfObjectsToBeProcessed + " in stack.";
}

public Map<String, Object> getCurrentValidationJobStats() {
Map<String, Object> progressStats = new HashMap<>();
progressStats.put("checks", numberOfChecks);
progressStats.put("failedChecks", numberOfFailedChecks);
progressStats.put("processedObjects", numberOfProcessedObjects);
progressStats.put("objectsToBeProcessed", numberOfObjectsToBeProcessed);
return progressStats;
}

private boolean checkCurrentNumberOfChecks() {
return numberOfChecks % currentStep == 0;
}
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/java/org/verapdf/pdfa/PDFAValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.verapdf.processor.reports.enums.JobEndStatus;

import java.util.List;
import java.util.Map;

/**
* A PDFAValidator performs a series of checks on PDF/A documents to verify that
Expand Down Expand Up @@ -65,6 +66,8 @@ public interface PDFAValidator extends Component {

public List<ValidationResult> validateAll(PDFAParser toValidate) throws ValidationException;

public Map<String, Object> getValidationProgressStats();

public String getValidationProgressString();

public void cancelValidation(JobEndStatus endStatus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,11 @@ public String getValidationProgressString() {
return validationProgress.getCurrentValidationJobProgressWithCommas();
}

@Override
public Map<String, java.lang.Object> getValidationProgressStats() {
return validationProgress.getCurrentValidationJobStats();
}

@Override
public void cancelValidation(JobEndStatus endStatus) {
this.jobEndStatus = endStatus;
Expand Down
Loading