added -locale cli option
This commit is contained in:
parent
fdb07ba097
commit
bacaf09af6
|
@ -1311,6 +1311,6 @@ public abstract class BaseWorkerContext implements IWorkerContext {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setValidationMessageLanguage(Locale locale) {
|
public void setValidationMessageLanguage(Locale locale) {
|
||||||
i18Nmessages = ResourceBundle.getBundle("Messages", locale );
|
i18Nmessages = ResourceBundle.getBundle("Messages", locale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
import org.hl7.fhir.exceptions.DefinitionException;
|
import org.hl7.fhir.exceptions.DefinitionException;
|
||||||
import org.hl7.fhir.exceptions.FHIRException;
|
import org.hl7.fhir.exceptions.FHIRException;
|
||||||
import org.hl7.fhir.exceptions.FHIRFormatError;
|
import org.hl7.fhir.exceptions.FHIRFormatError;
|
||||||
|
@ -68,7 +69,9 @@ public interface IResourceValidator {
|
||||||
|
|
||||||
Element fetch(Object appContext, String url) throws FHIRFormatError, DefinitionException, FHIRException, IOException;
|
Element fetch(Object appContext, String url) throws FHIRFormatError, DefinitionException, FHIRException, IOException;
|
||||||
ReferenceValidationPolicy validationPolicy(Object appContext, String path, String url);
|
ReferenceValidationPolicy validationPolicy(Object appContext, String path, String url);
|
||||||
boolean resolveURL(Object appContext, String path, String url) throws IOException, FHIRException;
|
boolean resolveURL(Object appContext, String path, String url) throws IOException, FHIRException;
|
||||||
|
|
||||||
|
void setLocale(Locale locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum BestPracticeWarningLevel {
|
public enum BestPracticeWarningLevel {
|
||||||
|
|
|
@ -139,6 +139,8 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
public class ValidationEngine implements IValidatorResourceFetcher {
|
public class ValidationEngine implements IValidatorResourceFetcher {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class ScanOutputItem {
|
public class ScanOutputItem {
|
||||||
private String ref;
|
private String ref;
|
||||||
private ImplementationGuide ig;
|
private ImplementationGuide ig;
|
||||||
|
@ -240,6 +242,7 @@ public class ValidationEngine implements IValidatorResourceFetcher {
|
||||||
private Set<String> loadedIgs = new HashSet<>();
|
private Set<String> loadedIgs = new HashSet<>();
|
||||||
private IValidatorResourceFetcher fetcher;
|
private IValidatorResourceFetcher fetcher;
|
||||||
private boolean assumeValidRestReferences;
|
private boolean assumeValidRestReferences;
|
||||||
|
private Locale locale;
|
||||||
|
|
||||||
private class AsteriskFilter implements FilenameFilter {
|
private class AsteriskFilter implements FilenameFilter {
|
||||||
String dir;
|
String dir;
|
||||||
|
@ -1269,6 +1272,7 @@ public class ValidationEngine implements IValidatorResourceFetcher {
|
||||||
validator.setNoInvariantChecks(isNoInvariantChecks());
|
validator.setNoInvariantChecks(isNoInvariantChecks());
|
||||||
validator.setValidationLanguage(language);
|
validator.setValidationLanguage(language);
|
||||||
validator.setAssumeValidRestReferences(assumeValidRestReferences);
|
validator.setAssumeValidRestReferences(assumeValidRestReferences);
|
||||||
|
validator.getContext().setLocale(locale);
|
||||||
validator.setFetcher(this);
|
validator.setFetcher(this);
|
||||||
return validator;
|
return validator;
|
||||||
}
|
}
|
||||||
|
@ -1592,6 +1596,11 @@ public class ValidationEngine implements IValidatorResourceFetcher {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLocale(Locale locale) {
|
||||||
|
this.locale = locale;
|
||||||
|
}
|
||||||
|
|
||||||
public void handleOutput(Resource r, String output, String version) throws Exception {
|
public void handleOutput(Resource r, String output, String version) throws Exception {
|
||||||
if (output.startsWith("http://") || output.startsWith("http://")) {
|
if (output.startsWith("http://") || output.startsWith("http://")) {
|
||||||
ByteArrayOutputStream bs = new ByteArrayOutputStream();
|
ByteArrayOutputStream bs = new ByteArrayOutputStream();
|
||||||
|
|
|
@ -55,6 +55,7 @@ import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -195,6 +196,8 @@ public class Validator {
|
||||||
System.out.println(" Produce additional information about the loading/validation process");
|
System.out.println(" Produce additional information about the loading/validation process");
|
||||||
System.out.println("-recurse");
|
System.out.println("-recurse");
|
||||||
System.out.println(" Look in subfolders when -ig refers to a folder");
|
System.out.println(" Look in subfolders when -ig refers to a folder");
|
||||||
|
System.out.println("-locale");
|
||||||
|
System.out.println(" Specifies the locale/language of the validation result messages (eg.: de-DE");
|
||||||
System.out.println("-sct");
|
System.out.println("-sct");
|
||||||
System.out.println(" Specify the edition of SNOMED CT to use. Valid Choices:");
|
System.out.println(" Specify the edition of SNOMED CT to use. Valid Choices:");
|
||||||
System.out.println(" intl | us | uk | au | nl | ca | se | dk | es");
|
System.out.println(" intl | us | uk | au | nl | ca | se | dk | es");
|
||||||
|
@ -399,6 +402,7 @@ public class Validator {
|
||||||
boolean anyExtensionsAllowed = true;
|
boolean anyExtensionsAllowed = true;
|
||||||
boolean hintAboutNonMustSupport = false;
|
boolean hintAboutNonMustSupport = false;
|
||||||
boolean recursive = false;
|
boolean recursive = false;
|
||||||
|
Locale locale = null;
|
||||||
List<String> profiles = new ArrayList<String>();
|
List<String> profiles = new ArrayList<String>();
|
||||||
EngineMode mode = EngineMode.VALIDATION;
|
EngineMode mode = EngineMode.VALIDATION;
|
||||||
String output = null;
|
String output = null;
|
||||||
|
@ -477,6 +481,12 @@ public class Validator {
|
||||||
throw new Error("Snomed edition '"+s+"' not known");
|
throw new Error("Snomed edition '"+s+"' not known");
|
||||||
} else if (args[i].equals("-recurse")) {
|
} else if (args[i].equals("-recurse")) {
|
||||||
recursive = true;
|
recursive = true;
|
||||||
|
} else if (args[i].equals("-locale")) {
|
||||||
|
if (i+1 == args.length) {
|
||||||
|
throw new Error("Specified -locale without indicating locale");
|
||||||
|
} else {
|
||||||
|
locale = new Locale(args[++i]);
|
||||||
|
}
|
||||||
} else if (args[i].equals("-strictExtensions")) {
|
} else if (args[i].equals("-strictExtensions")) {
|
||||||
anyExtensionsAllowed = false;
|
anyExtensionsAllowed = false;
|
||||||
} else if (args[i].equals("-hintAboutNonMustSupport")) {
|
} else if (args[i].equals("-hintAboutNonMustSupport")) {
|
||||||
|
@ -585,6 +595,7 @@ public class Validator {
|
||||||
validator.setHintAboutNonMustSupport(hintAboutNonMustSupport);
|
validator.setHintAboutNonMustSupport(hintAboutNonMustSupport);
|
||||||
validator.setAnyExtensionsAllowed(anyExtensionsAllowed);
|
validator.setAnyExtensionsAllowed(anyExtensionsAllowed);
|
||||||
validator.setLanguage(lang);
|
validator.setLanguage(lang);
|
||||||
|
validator.setLocale(locale);
|
||||||
validator.setSnomedExtension(snomedCT);
|
validator.setSnomedExtension(snomedCT);
|
||||||
validator.setAssumeValidRestReferences(assumeValidRestReferences);
|
validator.setAssumeValidRestReferences(assumeValidRestReferences);
|
||||||
|
|
||||||
|
|
|
@ -426,6 +426,11 @@ public class ValidationTestSuite implements IEvaluationContext, IValidatorResour
|
||||||
return !url.contains("example.org");
|
return !url.contains("example.org");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLocale(Locale locale) {
|
||||||
|
//do nothing
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean conformsToProfile(Object appContext, Base item, String url) throws FHIRException {
|
public boolean conformsToProfile(Object appContext, Base item, String url) throws FHIRException {
|
||||||
IResourceValidator val = TestingUtilities.context(version).newValidator();
|
IResourceValidator val = TestingUtilities.context(version).newValidator();
|
||||||
|
|
Loading…
Reference in New Issue