Example usage for javax.xml.datatype DatatypeConfigurationException DatatypeConfigurationException

List of usage examples for javax.xml.datatype DatatypeConfigurationException DatatypeConfigurationException

Introduction

In this page you can find the example usage for javax.xml.datatype DatatypeConfigurationException DatatypeConfigurationException.

Prototype


public DatatypeConfigurationException(Throwable cause) 

Source Link

Document

Create a new DatatypeConfigurationException with the specified cause.

Usage

From source file:eu.europa.ec.fisheries.uvms.rules.service.bean.RulesMessageServiceBean.java

private List<ValidationResultDocument> getValidationResultDocument(ValidationResultDto faReportValidationResult)
        throws DatatypeConfigurationException {
    ValidationResultDocument validationResultDocument = new ValidationResultDocument();

    GregorianCalendar date = DateTime.now(DateTimeZone.UTC).toGregorianCalendar();
    XMLGregorianCalendar calender = DatatypeFactory.newInstance().newXMLGregorianCalendar(date);
    DateTimeType dateTime = new DateTimeType();
    dateTime.setDateTime(calender);/*from   www  .jav a  2 s . c om*/
    validationResultDocument.setCreationDateTime(dateTime);

    IDType idType = new IDType();
    String fluxNationCode = ruleModuleCache.getSingleConfig("flux_local_nation_code");
    idType.setValue(StringUtils.isNotEmpty(fluxNationCode) ? fluxNationCode : "XEU");
    idType.setSchemeID("FLUX_GP_PARTY");
    validationResultDocument.setValidatorID(idType);

    List<ValidationQualityAnalysis> validationQuality = new ArrayList<>();
    for (ValidationMessageType validationMessage : faReportValidationResult.getValidationMessages()) {
        ValidationQualityAnalysis analysis = new ValidationQualityAnalysis();

        IDType identification = new IDType();
        identification.setValue(validationMessage.getBrId());
        analysis.setID(identification);

        CodeType level = new CodeType();
        level.setValue(validationMessage.getLevel());
        analysis.setLevelCode(level);

        eu.europa.ec.fisheries.uvms.rules.service.constants.ErrorType errorType = codeTypeMapper
                .mapErrorType(validationMessage.getErrorType());

        if (errorType != null) {
            CodeType type = new CodeType();
            type.setValue(errorType.name());
            analysis.setTypeCode(type);
        } else {
            throw new DatatypeConfigurationException("UNABLE TO MAP ERROR CODES");
        }

        TextType text = new TextType();
        text.setValue(validationMessage.getMessage());
        analysis.getResults().add(text);

        List<String> xpaths = validationMessage.getXpaths();
        if (CollectionUtils.isNotEmpty(xpaths)) {
            for (String xpath : xpaths) {
                TextType referenceItem = new TextType();
                referenceItem.setValue(xpath);
                analysis.getReferencedItems().add(referenceItem);
            }
        }

        validationQuality.add(analysis);
    }
    validationResultDocument.setRelatedValidationQualityAnalysises(validationQuality);
    return singletonList(validationResultDocument);
}