added german translations for new properties

removed unused property, added html message part as property in InstanceValidator
minor fixes
This commit is contained in:
patrick-werner 2020-03-13 18:45:12 +01:00
parent 5f3f84cf22
commit a44d1c3582
6 changed files with 20 additions and 23 deletions

View File

@ -80,7 +80,7 @@ public abstract class ParserBase {
public abstract void compose(Element e, OutputStream destination, OutputStyle style, String base) throws FHIRException, IOException;
//FIXME: i18n should be done here
public void logError(int line, int col, String path, IssueType type, String message, IssueSeverity level) throws FHIRFormatError {
if (policy == ValidationPolicy.EVERYTHING) {
ValidationMessage msg = new ValidationMessage(Source.InstanceValidator, type, line, col, path, message, level);

View File

@ -1,8 +1,5 @@
package org.hl7.fhir.utilities;
import java.text.MessageFormat;
import java.util.ResourceBundle;
public class I18nConstants {
public final static String BUNDLE_BUNDLE_ENTRY_CANONICAL = "Bundle_BUNDLE_Entry_Canonical";
@ -429,6 +426,7 @@ public class I18nConstants {
public final static String THIS_BASE_PROPERTY_MUST_BE_AN_ARRAY_NOT_A_ = "This_base_property_must_be_an_Array_not_a_";
public final static String THIS_PROPERTY_MUST_BE_AN_ARRAY_NOT_A_ = "This_property_must_be_an_Array_not_a_";
public final static String DOCUMENT = "documentmsg";
public final static String DOCUMENT_DATE_REQUIRED = "Document_Date_Missing";
public final static String DOCUMENT_DATE_REQUIRED = "Bundle_Document_Date_Missing";
public final static String DOCUMENT_DATE_REQUIRED_HTML = "Bundle_Document_Date_Missing_html";
}

View File

@ -49,10 +49,7 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
import java.text.MessageFormat;
import java.util.List;
import java.util.ResourceBundle;
import org.apache.commons.lang3.StringUtils;
import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.utilities.validation.ValidationMessage;
@ -70,11 +67,6 @@ public class BaseValidator {
this.context = context;
}
// public void setContext(IWorkerContext context) {
// this.context = context;
// i18Nmessages = ResourceBundle.getBundle("Messages", context.getLocale() );
// }
/**
* Test a rule and add a {@link IssueSeverity#FATAL} validation message if the validation fails
*
@ -82,7 +74,7 @@ public class BaseValidator {
* Set this parameter to <code>false</code> if the validation does not pass
* @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
*/
//todo: remove after i18n implementation done
@Deprecated
protected boolean fail(List<ValidationMessage> errors, IssueType type, int line, int col, String path, boolean thePass, String msg) {
if (!thePass) {
addValidationMessage(errors, type, line, col, path, msg, IssueSeverity.FATAL);
@ -105,6 +97,7 @@ public class BaseValidator {
* Set this parameter to <code>false</code> if the validation does not pass
* @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
*/
@Deprecated
protected boolean fail(List<ValidationMessage> errors, IssueType type, List<String> pathParts, boolean thePass, String msg) {
if (!thePass) {
String path = toPath(pathParts);
@ -120,6 +113,7 @@ public class BaseValidator {
* Set this parameter to <code>false</code> if the validation does not pass
* @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
*/
@Deprecated
protected boolean fail(List<ValidationMessage> errors, IssueType type, List<String> pathParts, boolean thePass, String theMessage, Object... theMessageArguments) {
if (!thePass) {
String path = toPath(pathParts);
@ -135,13 +129,14 @@ public class BaseValidator {
* Set this parameter to <code>false</code> if the validation does not pass
* @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
*/
@Deprecated
protected boolean fail(List<ValidationMessage> errors, IssueType type, String path, boolean thePass, String msg) {
if (!thePass) {
addValidationMessage(errors, type, -1, -1, path, msg, IssueSeverity.FATAL);
}
return thePass;
}
//TODO: i18n
protected boolean grammarWord(String w) {
return w.equals("and") || w.equals("or") || w.equals("a") || w.equals("the") || w.equals("for") || w.equals("this") || w.equals("that") || w.equals("of");
}
@ -168,7 +163,7 @@ public class BaseValidator {
* Set this parameter to <code>false</code> if the validation does not pass
* @return Returns <code>thePass</code> (in other words, returns <code>true</code> if the rule did not fail validation)
*/
//FIXME: formatMessage should be done here
protected boolean slicingHint(List<ValidationMessage> errors, IssueType type, int line, int col, String path, boolean thePass, String msg, String html) {
if (!thePass) {
addValidationMessage(errors, type, line, col, path, msg, IssueSeverity.INFORMATION).setSlicingHint(true).setSliceHtml(html);
@ -323,6 +318,8 @@ public class BaseValidator {
*/
protected boolean rule(List<ValidationMessage> errors, IssueType type, String path, boolean thePass, String msg, String html) {
if (!thePass) {
msg = context.formatMessage(msg, null);
html = context.formatMessage(html, null);
addValidationMessage(errors, type, path, msg, html, IssueSeverity.ERROR);
}
return thePass;

View File

@ -385,7 +385,6 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
public InstanceValidator(IWorkerContext theContext, IEvaluationContext hostServices) {
super(theContext);
this.context = theContext;
this.externalHostServices = hostServices;
this.profileUtilities = new ProfileUtilities(theContext, null, null);
fpe = new FHIRPathEngine(context);
@ -4295,7 +4294,7 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
boolean ok = bundle.hasChild(META)
&& bundle.getNamedChild(META).hasChild(LAST_UPDATED)
&& bundle.getNamedChild(META).getNamedChild(LAST_UPDATED).hasValue();
rule(errors, IssueType.REQUIRED, stack.literalPath, ok, I18nConstants.DOCUMENT_DATE_REQUIRED, "[(type = 'document') implies (meta.lastUpdated.hasValue())]");
rule(errors, IssueType.REQUIRED, stack.literalPath, ok, I18nConstants.DOCUMENT_DATE_REQUIRED, I18nConstants.DOCUMENT_DATE_REQUIRED_HTML);
}

View File

@ -17,7 +17,8 @@ Bundle_BUNDLE_FullUrl_NeedVersion = Entries matching fullURL {0} should declare
Bundle_BUNDLE_MultipleMatches = Multiple matches in bundle for reference {0}
Bundle_BUNDLE_Not_Local = URN reference is not locally contained within the bundle {0}
Bundle_MSG_Event_Count = Expected {0} but found {1} event elements
Bundle_Document_Date = A document must have a date [(type = 'document') implies (meta.lastUpdated.hasValue())]
Bundle_Document_Date_Missing = A document must have a date {0}
Bundle_Document_Date_Missing_html = [(type = 'document') implies (meta.lastUpdated.hasValue())]
CapabalityStatement_CS_SP_WrongType = Type mismatch - SearchParameter "{0}" type is {1}, but type here is {2}
CodeSystem_CS_VS_IncludeDetails = CodeSystem {0} has a ''all system'' value set of {1}, but the include has extra details
CodeSystem_CS_VS_Invalid = CodeSystem {0} has a ''all system'' value set of {1}, but doesn''t have a single include
@ -427,5 +428,5 @@ Unable_to_resolve_system__no_value_set = Unable to resolve system - no value set
This_base_property_must_be_an_Array_not_a_ = This base property must be an Array, not a {0}
This_property_must_be_an_Array_not_a_ = This property must be an Array, not a {0}
documentmsg = (document)
Document_Date_Missing = A document must have a date {0}

View File

@ -17,6 +17,8 @@ Bundle_BUNDLE_FullUrl_NeedVersion=Einträge, die mit fullURL {0} übereinstimmen
Bundle_BUNDLE_MultipleMatches=Mehrere Übereinstimmungen im Bundle für reference {0}
Bundle_BUNDLE_Not_Local=URN reference ist nicht lokal innerhalb des Bundles contained {0}
Bundle_MSG_Event_Count=Erwartet {0}, aber gefundene {1} event Elemente
Bundle_Document_Date_Missing=Ein Dokument muss ein Datum haben {0}
Bundle_Document_Date_Missing_html=[(type = 'document') impliziert (meta.lastUpdated.hasValue())]
CapabalityStatement_CS_SP_WrongType=Typabweichung - SearchParameter "{0}" sollte type {1} sein, ist aber {2}
CodeSystem_CS_VS_IncludeDetails=CodeSystem {0} hat einen ''all system'' ValueSet von {1}, aber das Include beeinhaltet zusätzliche Details
CodeSystem_CS_VS_Invalid=CodeSystem {0} hat einen ''all system'' ValueSet von {1}, aber keinen einzigen include
@ -113,7 +115,7 @@ Reference_REF_ResourceType=Passende Referenz für Referenz {0} hat resourceType
Reference_REF_WrongTarget=Der Typ "{0}" ist kein gültiges Ziel für dieses Element (muss einer von {1} sein)
Resource_RES_ID_Missing=Die Ressource erfordert eine ID, aber es ist keine vorhanden
Resource_RES_ID_Prohibited=Die Ressource hat eine ID, aber keine ist erlaubt
Terminology_PassThrough_TX_Message = {0} for "{1}#{2}"
Terminology_PassThrough_TX_Message = {0} für "{1}#{2}"
Terminology_TX_Binding_CantCheck=Binding durch URI-Referenz kann nicht überprüft werden
Terminology_TX_Binding_Missing=Binding für {0} fehlt (cc)
Terminology_TX_Binding_Missing2=Binding für {0} fehlt