package at.gv.egiz.param_tests.serialization.html;
import java.io.PrintWriter;
import java.util.List;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.pdfbox.preflight.ValidationResult;
import org.apache.pdfbox.preflight.ValidationResult.ValidationError;
import at.gv.egiz.param_tests.serialization.TestInfoSerializer;
import at.gv.egiz.param_tests.testinfo.PDFATestInfo;
/**
* Concrete test information serializer for PDF-A conformance tests using HTML
* and Twitter-bootstrap.
*
* @author mtappler
*
*/
public class PDFAHTMLSerizalier extends HTMLSerializerTestInfoSerializer.baseTestInfo
*/
private PDFATestInfo testInfo;
/**
* Default contructor used for registering it as prototype.
*/
public PDFAHTMLSerizalier() {
this(null);
}
/**
* Package protected constructor used for cloning
*
* @param testInfo
*/
PDFAHTMLSerizalier(PDFATestInfo testInfo) {
this.testInfo = testInfo;
}
@Override
public PDFATestInfo createTestInfo() {
testInfo = new PDFATestInfo();
baseTestInfo = testInfo;
return testInfo;
}
@Override
public TestInfoSerializerValidation status before signing
");
writeValidationResult(pw, testInfo.getResultBeforeSign());
if (testInfo.getResultAfterSign() != null) {
pw.println("Validation status after signing
");
writeValidationResult(pw, testInfo.getResultAfterSign());
}
}
/**
* This method writes the validation result to the given print writer, i.e.
* an information about the success of the validation or an exception which
* was thrown during the validation or a list of validation errors.
*
* @param pw
* the PrintWriter
-object to which the HTML-code is
* written
* @param validationResult
* the pair which defines the result of a validation
*/
private void writeValidationResult(PrintWriter pw,
Pair
The document conforms to the PDF-A standard.
"); } else { ListWith to the PDF-A standard, " + "the document contains the following errors:
"); conformanceString .append("Error code | "); conformanceString.append("Error details | "); conformanceString.append("Warning | "); conformanceString.append("
---|