private void collectInfos(Set<String> result, XmlConstraintsConclusion constraintConclusion) { if (constraintConclusion != null) { if (CollectionUtils.isNotEmpty(constraintConclusion.getConstraint())) { for (XmlConstraint constraint : constraintConclusion.getConstraint()) { if (StringUtils.isNotEmpty(constraint.getId())) { List<XmlBasicBuildingBlocks> basicBuildingBlocks = detailedReport.getBasicBuildingBlocks(); if (CollectionUtils.isNotEmpty(basicBuildingBlocks)) { for (XmlBasicBuildingBlocks xmlBasicBuildingBlocks : basicBuildingBlocks) { if (StringUtils.equals(xmlBasicBuildingBlocks.getId(), constraint.getId())) { collectInfos(result, xmlBasicBuildingBlocks); } } } } XmlName info = constraint.getInfo(); if (info != null) { result.add(info.getValue()); } } } } }
/** * @param simpleReport * @param signature the diagnosticSignature element in the diagnostic data * @throws DSSException */ private void addSignature(SimpleReport simpleReport, SignatureWrapper signature) throws DSSException { totalSignatureCount++; String signatureId = signature.getId(); XmlSignature xmlSignature = new XmlSignature(); xmlSignature.setId(signatureId); addCounterSignature(signature, xmlSignature); addSignatureScope(signature, xmlSignature); addSigningTime(signature, xmlSignature); addSignatureFormat(signature, xmlSignature); addSignedBy(signature, xmlSignature); XmlConstraintsConclusion constraintsConclusion = null; switch (validationLevel) { case BASIC_SIGNATURES: case TIMESTAMPS: constraintsConclusion = getBasicSignatureValidationConclusion(signatureId); break; case LONG_TERM_DATA: constraintsConclusion = getLongTermDataValidationConclusion(signatureId); break; case ARCHIVAL_DATA: constraintsConclusion = getArchivalValidationConclusion(signatureId); break; default: logger.error("Unsupported validation level : " + validationLevel); break; } Indication indication = constraintsConclusion.getConclusion().getIndication(); SubIndication subIndication = constraintsConclusion.getConclusion().getSubIndication(); List<String> errorList = xmlSignature.getErrors(); XmlConclusion conclusion = constraintsConclusion.getConclusion(); List<XmlName> errors = conclusion.getErrors(); if (CollectionUtils.isNotEmpty(errors)) { for (XmlName error : errors) { errorList.add(error.getValue()); } } // TODO refactor xmlSignature.getWarnings().addAll(getWarnings(signatureId)); xmlSignature.getInfos().addAll(getInfos(signatureId)); if (Indication.PASSED.equals(indication)) { validSignatureCount++; xmlSignature.setIndication(Indication.TOTAL_PASSED); } else if (Indication.FAILED.equals(indication)) { xmlSignature.setIndication(Indication.TOTAL_FAILED); } else { xmlSignature.setIndication(indication); // INDERTERMINATE } xmlSignature.setSubIndication(subIndication); addSignatureProfile(signature, xmlSignature); simpleReport.getSignature().add(xmlSignature); }