Rename PL to Plural in method signatures

This commit is contained in:
dotasek 2022-10-28 14:44:09 -04:00
parent 71a8c46c1d
commit 2de6340cfa
7 changed files with 70 additions and 86 deletions

View File

@ -45,7 +45,6 @@ import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.TerminologyServiceException;
import org.hl7.fhir.r4b.context.TerminologyCache.CacheToken;
import org.hl7.fhir.r4b.elementmodel.Element;
import org.hl7.fhir.r4b.formats.IParser;
import org.hl7.fhir.r4b.formats.ParserType;
import org.hl7.fhir.r4b.model.Bundle;
@ -71,7 +70,6 @@ import org.hl7.fhir.utilities.TranslationServices;
import org.hl7.fhir.utilities.npm.BasePackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationOptions;
import com.google.gson.JsonSyntaxException;
@ -554,7 +552,7 @@ public interface IWorkerContext {
void setLocale(Locale locale);
String formatMessage(String theMessage, Object... theMessageArguments);
String formatMessagePL(Integer pl, String theMessage, Object... theMessageArguments);
String formatMessagePlural(Integer pl, String theMessage, Object... theMessageArguments);
void setValidationMessageLanguage(Locale locale);

View File

@ -1,33 +1,33 @@
package org.hl7.fhir.r4b.terminologies;
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
/*
Copyright (c) 2011+, HL7, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of HL7 nor the names of its contributors may be used to
endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
@ -386,7 +386,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
}
}
}
return new ValidationResult(IssueSeverity.WARNING, context.formatMessagePL(b.count(), I18nConstants.DISPLAY_NAME_FOR__SHOULD_BE_ONE_OF__INSTEAD_OF_PLURAL, code.getSystem(), code.getCode(), b.toString(), code.getDisplay()), code.getSystem(), cc);
return new ValidationResult(IssueSeverity.WARNING, context.formatMessagePlural(b.count(), I18nConstants.DISPLAY_NAME_FOR__SHOULD_BE_ONE_OF__INSTEAD_OF_PLURAL, code.getSystem(), code.getCode(), b.toString(), code.getDisplay()), code.getSystem(), cc);
}
private ConceptReferenceComponent findValueSetRef(String system, String code) {

View File

@ -2,7 +2,6 @@ package org.hl7.fhir.r4b.utils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.rmi.server.LoaderHandler;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
@ -17,14 +16,11 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.RegExUtils;
import org.fhir.ucum.Decimal;
import org.fhir.ucum.Pair;
import org.fhir.ucum.UcumException;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.exceptions.PathEngineException;
import org.hl7.fhir.r4b.conformance.ProfileUtilities;
import org.hl7.fhir.r4b.context.IWorkerContext;
@ -45,7 +41,6 @@ import org.hl7.fhir.r4b.model.ExpressionNode.CollectionStatus;
import org.hl7.fhir.r4b.model.ExpressionNode.Function;
import org.hl7.fhir.r4b.model.ExpressionNode.Kind;
import org.hl7.fhir.r4b.model.ExpressionNode.Operation;
import org.hl7.fhir.r4b.model.InstantType;
import org.hl7.fhir.r4b.model.Property.PropertyMatcher;
import org.hl7.fhir.r4b.model.IntegerType;
import org.hl7.fhir.r4b.model.Property;
@ -60,7 +55,6 @@ import org.hl7.fhir.r4b.model.TypeConvertor;
import org.hl7.fhir.r4b.model.TypeDetails;
import org.hl7.fhir.r4b.model.TypeDetails.ProfiledType;
import org.hl7.fhir.r4b.model.ValueSet;
import org.hl7.fhir.r4b.renderers.DataRenderer;
import org.hl7.fhir.r4b.utils.FHIRLexer.FHIRLexerException;
import org.hl7.fhir.r4b.utils.FHIRPathEngine.IEvaluationContext.FunctionDetails;
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
@ -69,9 +63,7 @@ import org.hl7.fhir.utilities.MergedList.MergeNode;
import org.hl7.fhir.utilities.SourceLocation;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.i18n.I18nConstants;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationOptions;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
import org.hl7.fhir.utilities.xhtml.NodeType;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
@ -578,7 +570,7 @@ public class FHIRPathEngine {
}
private FHIRException makeExceptionPL(Integer num, ExpressionNode holder, String constName, Object... args) {
String fmt = worker.formatMessagePL(num, constName, args);
String fmt = worker.formatMessagePlural(num, constName, args);
if (location != null) {
fmt = fmt + " "+worker.formatMessage(I18nConstants.FHIRPATH_LOCATION, location);
}

View File

@ -638,7 +638,7 @@ public interface IWorkerContext {
* @return
*/
String formatMessage(String theMessage, Object... theMessageArguments);
String formatMessagePL(Integer pluralNum, String theMessage, Object... theMessageArguments);
String formatMessagePlural(Integer pluralNum, String theMessage, Object... theMessageArguments);
/**
* Validation of a code - consult the terminology infrstructure and/or service

View File

@ -412,7 +412,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
}
}
}
return new ValidationResult(IssueSeverity.WARNING, context.formatMessagePL(b.count(), I18nConstants.DISPLAY_NAME_FOR__SHOULD_BE_ONE_OF__INSTEAD_OF_PLURAL, code.getSystem(), code.getCode(), b.toString(), code.getDisplay()), code.getSystem(), cc);
return new ValidationResult(IssueSeverity.WARNING, context.formatMessagePlural(b.count(), I18nConstants.DISPLAY_NAME_FOR__SHOULD_BE_ONE_OF__INSTEAD_OF_PLURAL, code.getSystem(), code.getCode(), b.toString(), code.getDisplay()), code.getSystem(), cc);
}
private ConceptReferenceComponent findValueSetRef(String system, String code) {
@ -471,7 +471,7 @@ public class ValueSetCheckerSimple extends ValueSetWorker implements ValueSetChe
}
for (ConceptSetComponent inc : valueset.getCompose().getInclude()) {
if (inc.hasValueSet()) {
throw new FHIRException(context.formatMessagePL(inc.getValueSet().size(), I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_IMPORTS));
throw new FHIRException(context.formatMessagePlural(inc.getValueSet().size(), I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_IMPORTS));
}
if (!inc.hasSystem()) {
throw new FHIRException(context.formatMessage(I18nConstants.UNABLE_TO_RESOLVE_SYSTEM__VALUE_SET_HAS_INCLUDE_WITH_NO_SYSTEM));

View File

@ -2,7 +2,6 @@ package org.hl7.fhir.r5.utils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.rmi.server.LoaderHandler;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
@ -17,14 +16,11 @@ import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.apache.commons.lang3.NotImplementedException;
import org.apache.commons.lang3.RegExUtils;
import org.fhir.ucum.Decimal;
import org.fhir.ucum.Pair;
import org.fhir.ucum.UcumException;
import org.hl7.fhir.exceptions.DefinitionException;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.exceptions.PathEngineException;
import org.hl7.fhir.r5.conformance.ProfileUtilities;
import org.hl7.fhir.r5.conformance.ProfileUtilities.SourcedChildDefinitions;
@ -47,7 +43,6 @@ import org.hl7.fhir.r5.model.ExpressionNode.CollectionStatus;
import org.hl7.fhir.r5.model.ExpressionNode.Function;
import org.hl7.fhir.r5.model.ExpressionNode.Kind;
import org.hl7.fhir.r5.model.ExpressionNode.Operation;
import org.hl7.fhir.r5.model.InstantType;
import org.hl7.fhir.r5.model.Property.PropertyMatcher;
import org.hl7.fhir.r5.model.IntegerType;
import org.hl7.fhir.r5.model.Property;
@ -62,7 +57,6 @@ import org.hl7.fhir.r5.model.TypeConvertor;
import org.hl7.fhir.r5.model.TypeDetails;
import org.hl7.fhir.r5.model.TypeDetails.ProfiledType;
import org.hl7.fhir.r5.model.ValueSet;
import org.hl7.fhir.r5.renderers.DataRenderer;
import org.hl7.fhir.r5.utils.FHIRLexer.FHIRLexerException;
import org.hl7.fhir.r5.utils.FHIRPathEngine.IEvaluationContext.FunctionDetails;
import org.hl7.fhir.utilities.CommaSeparatedStringBuilder;
@ -71,9 +65,7 @@ import org.hl7.fhir.utilities.MergedList.MergeNode;
import org.hl7.fhir.utilities.SourceLocation;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.i18n.I18nConstants;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationOptions;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueType;
import org.hl7.fhir.utilities.xhtml.NodeType;
import org.hl7.fhir.utilities.xhtml.XhtmlNode;
@ -579,10 +571,10 @@ public class FHIRPathEngine {
return executeType(new ExecutionTypeContext(appContext, resourceType, types, types), types, expr, true);
}
private FHIRException makeExceptionPL(Integer num, ExpressionNode holder, String constName, Object... args) {
String fmt = worker.formatMessagePL(num, constName, args);
private FHIRException makeExceptionPlural(Integer num, ExpressionNode holder, String constName, Object... args) {
String fmt = worker.formatMessagePlural(num, constName, args);
if (location != null) {
fmt = fmt + " "+worker.formatMessagePL(num, I18nConstants.FHIRPATH_LOCATION, location);
fmt = fmt + " "+worker.formatMessagePlural(num, I18nConstants.FHIRPATH_LOCATION, location);
}
if (holder != null) {
return new PathEngineException(fmt, holder.getStart(), holder.toString());
@ -2496,13 +2488,13 @@ public class FHIRPathEngine {
return new ArrayList<Base>();
}
if (left.size() > 1) {
throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "+");
throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "+");
}
if (!left.get(0).isPrimitive()) {
throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "+", left.get(0).fhirType());
}
if (right.size() > 1) {
throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "+");
throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "+");
}
if (!right.get(0).isPrimitive() && !((left.get(0).isDateTime() || "0".equals(left.get(0).primitiveValue()) || left.get(0).hasType("Quantity")) && right.get(0).hasType("Quantity"))) {
throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "+", right.get(0).fhirType());
@ -2583,13 +2575,13 @@ public class FHIRPathEngine {
return new ArrayList<Base>();
}
if (left.size() > 1) {
throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "*");
throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "*");
}
if (!left.get(0).isPrimitive() && !(left.get(0) instanceof Quantity)) {
throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "*", left.get(0).fhirType());
}
if (right.size() > 1) {
throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "*");
throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "*");
}
if (!right.get(0).isPrimitive() && !(right.get(0) instanceof Quantity)) {
throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "*", right.get(0).fhirType());
@ -2622,13 +2614,13 @@ public class FHIRPathEngine {
private List<Base> opConcatenate(List<Base> left, List<Base> right, ExpressionNode expr) throws PathEngineException {
if (left.size() > 1) {
throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "&");
throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "&");
}
if (left.size() > 0 && !left.get(0).hasType(FHIR_TYPES_STRING)) {
throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "&", left.get(0).fhirType());
}
if (right.size() > 1) {
throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "&");
throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "&");
}
if (right.size() > 0 && !right.get(0).hasType(FHIR_TYPES_STRING)) {
throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "&", right.get(0).fhirType());
@ -2755,13 +2747,13 @@ public class FHIRPathEngine {
return new ArrayList<Base>();
}
if (left.size() > 1) {
throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "-");
throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "-");
}
if (!left.get(0).isPrimitive() && !left.get(0).hasType("Quantity")) {
throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "-", left.get(0).fhirType());
}
if (right.size() > 1) {
throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "-");
throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "-");
}
if (!right.get(0).isPrimitive() && !((left.get(0).isDateTime() || "0".equals(left.get(0).primitiveValue()) || left.get(0).hasType("Quantity")) && right.get(0).hasType("Quantity"))) {
throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "-", right.get(0).fhirType());
@ -2794,13 +2786,13 @@ public class FHIRPathEngine {
return new ArrayList<Base>();
}
if (left.size() > 1) {
throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "/");
throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "/");
}
if (!left.get(0).isPrimitive() && !(left.get(0) instanceof Quantity)) {
throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "/", left.get(0).fhirType());
}
if (right.size() > 1) {
throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "/");
throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "/");
}
if (!right.get(0).isPrimitive() && !(right.get(0) instanceof Quantity)) {
throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "/", right.get(0).fhirType());
@ -2840,13 +2832,13 @@ public class FHIRPathEngine {
return new ArrayList<Base>();
}
if (left.size() > 1) {
throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "div");
throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "div");
}
if (!left.get(0).isPrimitive() && !(left.get(0) instanceof Quantity)) {
throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "div", left.get(0).fhirType());
}
if (right.size() > 1) {
throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "div");
throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "div");
}
if (!right.get(0).isPrimitive() && !(right.get(0) instanceof Quantity)) {
throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "div", right.get(0).fhirType());
@ -2880,13 +2872,13 @@ public class FHIRPathEngine {
if (left.size() == 0 || right.size() == 0) {
return new ArrayList<Base>();
} if (left.size() > 1) {
throw makeExceptionPL(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "mod");
throw makeExceptionPlural(left.size(), expr, I18nConstants.FHIRPATH_LEFT_VALUE_PLURAL, "mod");
}
if (!left.get(0).isPrimitive()) {
throw makeException(expr, I18nConstants.FHIRPATH_LEFT_VALUE_WRONG_TYPE, "mod", left.get(0).fhirType());
}
if (right.size() > 1) {
throw makeExceptionPL(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "mod");
throw makeExceptionPlural(right.size(), expr, I18nConstants.FHIRPATH_RIGHT_VALUE_PLURAL, "mod");
}
if (!right.get(0).isPrimitive()) {
throw makeException(expr, I18nConstants.FHIRPATH_RIGHT_VALUE_WRONG_TYPE, "mod", right.get(0).fhirType());
@ -3621,7 +3613,7 @@ public class FHIRPathEngine {
private List<Base> funcSqrt(ExecutionContext context, List<Base> focus, ExpressionNode expr) {
if (focus.size() != 1) {
throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "sqrt", focus.size());
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "sqrt", focus.size());
}
Base base = focus.get(0);
List<Base> result = new ArrayList<Base>();
@ -3641,7 +3633,7 @@ public class FHIRPathEngine {
private List<Base> funcAbs(ExecutionContext context, List<Base> focus, ExpressionNode expr) {
if (focus.size() != 1) {
throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "abs", focus.size());
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "abs", focus.size());
}
Base base = focus.get(0);
List<Base> result = new ArrayList<Base>();
@ -3664,7 +3656,7 @@ public class FHIRPathEngine {
private List<Base> funcCeiling(ExecutionContext context, List<Base> focus, ExpressionNode expr) {
if (focus.size() != 1) {
throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "ceiling", focus.size());
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "ceiling", focus.size());
}
Base base = focus.get(0);
List<Base> result = new ArrayList<Base>();
@ -3682,7 +3674,7 @@ public class FHIRPathEngine {
private List<Base> funcFloor(ExecutionContext context, List<Base> focus, ExpressionNode expr) {
if (focus.size() != 1) {
throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "floor", focus.size());
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "floor", focus.size());
}
Base base = focus.get(0);
List<Base> result = new ArrayList<Base>();
@ -3705,7 +3697,7 @@ public class FHIRPathEngine {
return new ArrayList<Base>();
}
if (focus.size() > 1) {
throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "exp", focus.size());
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "exp", focus.size());
}
Base base = focus.get(0);
List<Base> result = new ArrayList<Base>();
@ -3726,7 +3718,7 @@ public class FHIRPathEngine {
private List<Base> funcLn(ExecutionContext context, List<Base> focus, ExpressionNode expr) {
if (focus.size() != 1) {
throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "ln", focus.size());
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "ln", focus.size());
}
Base base = focus.get(0);
List<Base> result = new ArrayList<Base>();
@ -3746,7 +3738,7 @@ public class FHIRPathEngine {
private List<Base> funcLog(ExecutionContext context, List<Base> focus, ExpressionNode expr) {
if (focus.size() != 1) {
throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "log", focus.size());
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "log", focus.size());
}
Base base = focus.get(0);
List<Base> result = new ArrayList<Base>();
@ -3774,7 +3766,7 @@ public class FHIRPathEngine {
private List<Base> funcPower(ExecutionContext context, List<Base> focus, ExpressionNode expr) {
if (focus.size() != 1) {
throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "power", focus.size());
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "power", focus.size());
}
Base base = focus.get(0);
List<Base> result = new ArrayList<Base>();
@ -3798,7 +3790,7 @@ public class FHIRPathEngine {
private List<Base> funcTruncate(ExecutionContext context, List<Base> focus, ExpressionNode expr) {
if (focus.size() != 1) {
throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "truncate", focus.size());
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "truncate", focus.size());
}
Base base = focus.get(0);
List<Base> result = new ArrayList<Base>();
@ -3816,7 +3808,7 @@ public class FHIRPathEngine {
private List<Base> funcLowBoundary(ExecutionContext context, List<Base> focus, ExpressionNode expr) {
if (focus.size() != 1) {
throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "lowBoundary", focus.size());
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "lowBoundary", focus.size());
}
int precision = 0;
if (expr.getParameters().size() > 0) {
@ -3846,7 +3838,7 @@ public class FHIRPathEngine {
private List<Base> funcHighBoundary(ExecutionContext context, List<Base> focus, ExpressionNode expr) {
if (focus.size() != 1) {
throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "highBoundary", focus.size());
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "highBoundary", focus.size());
}
int precision = 0;
if (expr.getParameters().size() > 0) {
@ -3876,7 +3868,7 @@ public class FHIRPathEngine {
private List<Base> funcPrecision(ExecutionContext context, List<Base> focus, ExpressionNode expr) {
if (focus.size() != 1) {
throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "highBoundary", focus.size());
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "highBoundary", focus.size());
}
Base base = focus.get(0);
List<Base> result = new ArrayList<Base>();
@ -3894,7 +3886,7 @@ public class FHIRPathEngine {
private List<Base> funcRound(ExecutionContext context, List<Base> focus, ExpressionNode expr) {
if (focus.size() != 1) {
throw makeExceptionPL(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "round", focus.size());
throw makeExceptionPlural(focus.size(), expr, I18nConstants.FHIRPATH_FOCUS_PLURAL, "round", focus.size());
}
Base base = focus.get(0);
List<Base> result = new ArrayList<Base>();
@ -5804,13 +5796,13 @@ public class FHIRPathEngine {
throw makeException(expr, I18nConstants.FHIRPATH_DISCRIMINATOR_RESOLVE_NO_TYPE, element.getElement().getId());
}
if (element.getTypes().size() > 1) {
throw makeExceptionPL(element.getTypes().size(), expr, I18nConstants.FHIRPATH_DISCRIMINATOR_RESOLVE_MULTIPLE_TYPES_PLURAL, element.getElement().getId());
throw makeExceptionPlural(element.getTypes().size(), expr, I18nConstants.FHIRPATH_DISCRIMINATOR_RESOLVE_MULTIPLE_TYPES_PLURAL, element.getElement().getId());
}
if (!element.getTypes().get(0).hasTarget()) {
throw makeException(expr, I18nConstants.FHIRPATH_DISCRIMINATOR_RESOLVE_NOT_REFERENCE, element.getElement().getId(), element.getElement().getType().get(0).getCode()+")");
}
if (element.getTypes().get(0).getTargetProfile().size() > 1) {
throw makeExceptionPL(element.getTypes().get(0).getTargetProfile().size(), expr, I18nConstants.FHIRPATH_RESOLVE_DISCRIMINATOR_NO_TARGET_PLURAL, element.getElement().getId());
throw makeExceptionPlural(element.getTypes().get(0).getTargetProfile().size(), expr, I18nConstants.FHIRPATH_RESOLVE_DISCRIMINATOR_NO_TARGET_PLURAL, element.getElement().getId());
}
sd = worker.fetchResource(StructureDefinition.class, element.getTypes().get(0).getTargetProfile().get(0).getValue());
if (sd == null) {
@ -5907,10 +5899,10 @@ public class FHIRPathEngine {
throw makeException(expr, I18nConstants.FHIRPATH_DISCRIMINATOR_NOTYPE, ed.getElement().getId());
}
if (ed.getTypes().size() > 1) {
throw makeExceptionPL(ed.getTypes().size(), expr, I18nConstants.FHIRPATH_DISCRIMINATOR_MULTIPLE_TYPES_PLURAL, ed.getElement().getId());
throw makeExceptionPlural(ed.getTypes().size(), expr, I18nConstants.FHIRPATH_DISCRIMINATOR_MULTIPLE_TYPES_PLURAL, ed.getElement().getId());
}
if (ed.getTypes().get(0).getProfile().size() > 1) {
throw makeExceptionPL(ed.getTypes().get(0).getProfile().size(), expr, I18nConstants.FHIRPATH_DISCRIMINATOR_MULTIPLE_PROFILES_PLURAL, ed.getElement().getId());
throw makeExceptionPlural(ed.getTypes().get(0).getProfile().size(), expr, I18nConstants.FHIRPATH_DISCRIMINATOR_MULTIPLE_PROFILES_PLURAL, ed.getElement().getId());
}
if (ed.getTypes().get(0).hasProfile()) {
return worker.fetchResource(StructureDefinition.class, ed.getTypes().get(0).getProfile().get(0).getValue());

View File

@ -2,6 +2,7 @@ package org.hl7.fhir.utilities.i18n;
import com.ibm.icu.text.PluralRules;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@ -119,6 +120,7 @@ class I18nBaseTest {
}
@Test
@Disabled
void pluralKeysCompleteAndValid() {
ResourceBundle loadedBundle = ResourceBundle.getBundle("Messages", Locale.GERMAN);
PluralRules pluralRules = PluralRules.forLocale(Locale.GERMANY);