etf-webapp
etf-webapp copied to clipboard
Message aggregation
Some basic thoughts about inspire-eu-validation/ets-repository#48
Example structures of the translation templates in the 2.0.0-beta:
<message ref="TR.xmlSchemaError">
<translationArguments>
<argument token="filename">ES_AD_50.xml</argument>
<argument token="error">
4:389: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://inspire.ec.europa.eu/schemas/ad/4.0":situatedWithin}'. One of '{"http://www.opengis.net/gml/3.2":metaDataProperty, "http://www.opengis.net/gml/3.2":description, "http://www.opengis.net/gml/3.2":descriptionReference, "http://www.opengis.net/gml/3.2":identifier, "http://www.opengis.net/gml/3.2":name, "http://www.opengis.net/gml/3.2":boundedBy, "http://www.opengis.net/gml/3.2":location, "http://inspire.ec.europa.eu/schemas/ad/4.0":inspireId, "http://inspire.ec.europa.eu/schemas/ad/4.0":alternativeIdentifier, "http://inspire.ec.europa.eu/schemas/ad/4.0":beginLifespanVersion}' is expected.
</argument>
</translationArguments>
</message>
<message ref="TR.xmlSchemaError">
<translationArguments>
<argument token="filename">ES_AD_50.xml</argument>
<argument token="error">
7:24: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://inspire.ec.europa.eu/schemas/gn/4.0":spelling}'. One of '{"http://inspire.ec.europa.eu/schemas/gn/4.0":language}' is expected.
</argument>
</translationArguments>
</message>
and
<LangTranslationTemplateCollection name="TR.xmlSchemaError">
<translationTemplates>
<TranslationTemplate language="en" name="TR.xmlSchemaError">XML document '{filename}': {error}</TranslationTemplate>
</translationTemplates>
</LangTranslationTemplateCollection>
we could change it to:
<message ref="TR.xmlSchemaError">
<translationArguments>
<!-- Note the optional target="header" attribute and the aggregated "error" arguments -->
<argument token="filename" target="header">ES_AD_50.xml</argument>
<argument token="error">
4:389: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://inspire.ec.europa.eu/schemas/ad/4.0":situatedWithin}'. One of '{"http://www.opengis.net/gml/3.2":metaDataProperty, "http://www.opengis.net/gml/3.2":description, "http://www.opengis.net/gml/3.2":descriptionReference, "http://www.opengis.net/gml/3.2":identifier, "http://www.opengis.net/gml/3.2":name, "http://www.opengis.net/gml/3.2":boundedBy, "http://www.opengis.net/gml/3.2":location, "http://inspire.ec.europa.eu/schemas/ad/4.0":inspireId, "http://inspire.ec.europa.eu/schemas/ad/4.0":alternativeIdentifier, "http://inspire.ec.europa.eu/schemas/ad/4.0":beginLifespanVersion}' is expected.
</argument>
<argument token="error">
7:24: cvc-complex-type.2.4.a: Invalid content was found starting with element '{"http://inspire.ec.europa.eu/schemas/gn/4.0":spelling}'. One of '{"http://inspire.ec.europa.eu/schemas/gn/4.0":language}' is expected.
</argument>
</translationArguments>
</message>
and
<LangTranslationTemplateCollection name="TR.xmlSchemaError">
<translationTemplates>
<!-- Note the optional header attribute. -->
<TranslationTemplate language="en" name="TR.xmlSchemaError" header="XML document '{filename}': ">{error}</TranslationTemplate>
</translationTemplates>
</LangTranslationTemplateCollection>
in order to support the message aggregation.
In the core the TestResultCollector interface must be changed from
void addMessage(final String translationTemplateId, final String... tokensAndValues);
void addMessage(final String[] headerTokensAndValues, final String translationTemplateId, final String... tokensAndValues);
One more note: The change in the TranslationTemplates and the ETS would make them no longer backwards compatible with 2.0.0-beta.