add support for integer64
This commit is contained in:
parent
89195efad3
commit
0cbb586dd1
|
@ -10410,7 +10410,7 @@ public class VersionConvertor_10_50 {
|
|||
return null;
|
||||
switch (src) {
|
||||
case DATATYPE:
|
||||
if (Utilities.existsInList(dtName, "boolean", "integer", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml", "url", "canonical"))
|
||||
if (Utilities.existsInList(dtName, "boolean", "integer", "integer64", "decimal", "base64Binary", "instant", "string", "uri", "date", "dateTime", "time", "code", "oid", "uuid", "id", "unsignedInt", "positiveInt", "markdown", "xhtml", "url", "canonical"))
|
||||
return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.PRIMITIVETYPE;
|
||||
else
|
||||
return org.hl7.fhir.r5.model.StructureDefinition.StructureDefinitionKind.COMPLEXTYPE;
|
||||
|
|
|
@ -249,6 +249,12 @@ public class VersionConvertor_30_50 {
|
|||
return tgt;
|
||||
}
|
||||
|
||||
public static org.hl7.fhir.dstu3.model.DecimalType convertInteger64(org.hl7.fhir.r5.model.Integer64Type src) throws FHIRException {
|
||||
org.hl7.fhir.dstu3.model.DecimalType tgt = new org.hl7.fhir.dstu3.model.DecimalType(src.getValue().toString());
|
||||
copyElement(src, tgt);
|
||||
return tgt;
|
||||
}
|
||||
|
||||
public static org.hl7.fhir.r5.model.MarkdownType convertMarkdown(org.hl7.fhir.dstu3.model.MarkdownType src) throws FHIRException {
|
||||
org.hl7.fhir.r5.model.MarkdownType tgt = new org.hl7.fhir.r5.model.MarkdownType(src.getValue());
|
||||
copyElement(src, tgt);
|
||||
|
@ -2838,6 +2844,8 @@ public class VersionConvertor_30_50 {
|
|||
return convertInstant((org.hl7.fhir.r5.model.InstantType) src);
|
||||
if (src instanceof org.hl7.fhir.r5.model.IntegerType)
|
||||
return convertInteger((org.hl7.fhir.r5.model.IntegerType) src);
|
||||
if (src instanceof org.hl7.fhir.r5.model.Integer64Type)
|
||||
return convertInteger64((org.hl7.fhir.r5.model.Integer64Type) src);
|
||||
if (src instanceof org.hl7.fhir.r5.model.MarkdownType)
|
||||
return convertMarkdown((org.hl7.fhir.r5.model.MarkdownType) src);
|
||||
if (src instanceof org.hl7.fhir.r5.model.OidType)
|
||||
|
|
|
@ -3736,7 +3736,7 @@ public class ProfileUtilities extends TranslatingUtilities {
|
|||
public boolean isPrimitive(String value) {
|
||||
StructureDefinition sd = context.fetchTypeDefinition(value);
|
||||
if (sd == null) // might be running before all SDs are available
|
||||
return Utilities.existsInList(value, "base64Binary", "boolean", "canonical", "code", "date", "dateTime", "decimal", "id", "instant", "integer", "markdown", "oid", "positiveInt", "string", "time", "unsignedInt", "uri", "url", "uuid");
|
||||
return Utilities.existsInList(value, "base64Binary", "boolean", "canonical", "code", "date", "dateTime", "decimal", "id", "instant", "integer", "integer64", "markdown", "oid", "positiveInt", "string", "time", "unsignedInt", "uri", "url", "uuid");
|
||||
else
|
||||
return sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE;
|
||||
}
|
||||
|
|
|
@ -466,7 +466,7 @@ public class SimpleWorkerContext extends BaseWorkerContext implements IWorkerCon
|
|||
|
||||
@Override
|
||||
public Set<String> typeTails() {
|
||||
return new HashSet<String>(Arrays.asList("Integer","UnsignedInt","PositiveInt","Decimal","DateTime","Date","Time","Instant","String","Uri","Url","Canonical","Oid","Uuid","Id","Boolean","Code","Markdown","Base64Binary","Coding","CodeableConcept","Attachment","Identifier","Quantity","SampledData","Range","Period","Ratio","HumanName","Address","ContactPoint","Timing","Reference","Annotation","Signature","Meta"));
|
||||
return new HashSet<String>(Arrays.asList("Integer","Integer64","UnsignedInt","PositiveInt","Decimal","DateTime","Date","Time","Instant","String","Uri","Url","Canonical","Oid","Uuid","Id","Boolean","Code","Markdown","Base64Binary","Coding","CodeableConcept","Attachment","Identifier","Quantity","SampledData","Range","Period","Ratio","HumanName","Address","ContactPoint","Timing","Reference","Annotation","Signature","Meta"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -52,7 +52,7 @@ public abstract class ParserBase {
|
|||
public enum ValidationPolicy { NONE, QUICK, EVERYTHING }
|
||||
|
||||
public boolean isPrimitive(String code) {
|
||||
return Utilities.existsInList(code, "boolean", "integer", "string", "decimal", "uri", "base64Binary", "instant", "date", "dateTime", "time", "code", "oid", "id", "markdown", "unsignedInt", "positiveInt", "xhtml", "url", "canonical");
|
||||
return Utilities.existsInList(code, "boolean", "integer", "integer64", "string", "decimal", "uri", "base64Binary", "instant", "date", "dateTime", "time", "code", "oid", "id", "markdown", "unsignedInt", "positiveInt", "xhtml", "url", "canonical");
|
||||
|
||||
// StructureDefinition sd = context.fetchTypeDefinition(code);
|
||||
// return sd != null && sd.getKind() == StructureDefinitionKind.PRIMITIVETYPE;
|
||||
|
|
|
@ -464,6 +464,8 @@ public class TurtleParser extends ParserBase {
|
|||
xst = "^^xsd:boolean";
|
||||
else if (type.equals("integer"))
|
||||
xst = "^^xsd:integer";
|
||||
else if (type.equals("integer64"))
|
||||
xst = "^^xsd:long";
|
||||
else if (type.equals("unsignedInt"))
|
||||
xst = "^^xsd:nonNegativeInteger";
|
||||
else if (type.equals("positiveInt"))
|
||||
|
|
|
@ -141,6 +141,11 @@ public class JsonParser extends JsonParserBase {
|
|||
return res;
|
||||
}
|
||||
|
||||
protected Integer64Type parseInteger64(java.lang.Long v) throws IOException, FHIRFormatError {
|
||||
Integer64Type res = new Integer64Type(v);
|
||||
return res;
|
||||
}
|
||||
|
||||
protected OidType parseOid(String v) throws IOException, FHIRFormatError {
|
||||
OidType res = new OidType(v);
|
||||
return res;
|
||||
|
@ -28567,6 +28572,12 @@ public class JsonParser extends JsonParserBase {
|
|||
parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer"), t);
|
||||
return t;
|
||||
}
|
||||
else if (json.has(prefix+"Integer64") || json.has("_"+prefix+"Integer64")) {
|
||||
Type t = json.has(prefix+"Integer64") ? parseInteger64(json.get(prefix+"Integer64").getAsLong()) : new Integer64Type();
|
||||
if (json.has("_"+prefix+"Integer64"))
|
||||
parseElementProperties(json.getAsJsonObject("_"+prefix+"Integer64"), t);
|
||||
return t;
|
||||
}
|
||||
else if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid")) {
|
||||
Type t = json.has(prefix+"Oid") ? parseOid(json.get(prefix+"Oid").getAsString()) : new OidType();
|
||||
if (json.has("_"+prefix+"Oid"))
|
||||
|
@ -29113,6 +29124,8 @@ public class JsonParser extends JsonParserBase {
|
|||
return true;
|
||||
if (json.has(prefix+"Integer") || json.has("_"+prefix+"Integer"))
|
||||
return true;
|
||||
if (json.has(prefix+"Integer64") || json.has("_"+prefix+"Integer64"))
|
||||
return true;
|
||||
if (json.has(prefix+"Oid") || json.has("_"+prefix+"Oid"))
|
||||
return true;
|
||||
if (json.has(prefix+"Canonical") || json.has("_"+prefix+"Canonical"))
|
||||
|
@ -29302,6 +29315,24 @@ public class JsonParser extends JsonParserBase {
|
|||
writeNull(name);
|
||||
}
|
||||
|
||||
protected void composeInteger64Core(String name, Integer64Type value, boolean inArray) throws IOException {
|
||||
if (value != null && value.hasValue()) {
|
||||
prop(name, value.getValue().toString());
|
||||
}
|
||||
else if (inArray)
|
||||
writeNull(name);
|
||||
}
|
||||
|
||||
protected void composeInteger64Extras(String name, Integer64Type value, boolean inArray) throws IOException {
|
||||
if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || makeComments(value))) {
|
||||
open(inArray ? null : "_"+name);
|
||||
composeElement(value);
|
||||
close();
|
||||
}
|
||||
else if (inArray)
|
||||
writeNull(name);
|
||||
}
|
||||
|
||||
protected void composeOidCore(String name, OidType value, boolean inArray) throws IOException {
|
||||
if (value != null && value.hasValue()) {
|
||||
prop(name, toString(value.getValue()));
|
||||
|
@ -60262,6 +60293,10 @@ public class JsonParser extends JsonParserBase {
|
|||
composeIntegerCore(prefix+"Integer", (IntegerType) type, false);
|
||||
composeIntegerExtras(prefix+"Integer", (IntegerType) type, false);
|
||||
}
|
||||
else if (type instanceof Integer64Type) {
|
||||
composeInteger64Core(prefix+"Integer64", (Integer64Type) type, false);
|
||||
composeInteger64Extras(prefix+"Integer64", (Integer64Type) type, false);
|
||||
}
|
||||
else if (type instanceof UriType) {
|
||||
composeUriCore(prefix+"Uri", (UriType) type, false);
|
||||
composeUriExtras(prefix+"Uri", (UriType) type, false);
|
||||
|
|
|
@ -158,6 +158,14 @@ public class RdfParser extends RdfParserBase {
|
|||
composeElement(t, parentType, name, value, index);
|
||||
}
|
||||
|
||||
protected void composeInteger64(Complex parent, String parentType, String name, Integer64Type value, int index) {
|
||||
if (value == null)
|
||||
return;
|
||||
Complex t = parent.predicate("fhir:"+parentType+"."+name);
|
||||
t.predicate("fhir:value", ttlLiteral(value.asStringValue()));
|
||||
composeElement(t, parentType, name, value, index);
|
||||
}
|
||||
|
||||
protected void composeOid(Complex parent, String parentType, String name, OidType value, int index) {
|
||||
if (value == null)
|
||||
return;
|
||||
|
@ -18416,6 +18424,8 @@ public class RdfParser extends RdfParserBase {
|
|||
composeString(parent, parentType, name, (StringType)value, index);
|
||||
else if (value instanceof IntegerType)
|
||||
composeInteger(parent, parentType, name, (IntegerType)value, index);
|
||||
else if (value instanceof Integer64Type)
|
||||
composeInteger64(parent, parentType, name, (Integer64Type)value, index);
|
||||
else if (value instanceof OidType)
|
||||
composeOid(parent, parentType, name, (OidType)value, index);
|
||||
else if (value instanceof CanonicalType)
|
||||
|
|
|
@ -190,6 +190,21 @@ public class XmlParser extends XmlParserBase {
|
|||
return res;
|
||||
}
|
||||
|
||||
protected Integer64Type parseInteger64(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
|
||||
Integer64Type res = new Integer64Type(xpp.getAttributeValue(null, "value"));
|
||||
parseElementAttributes(xpp, res);
|
||||
next(xpp);
|
||||
int eventType = nextNoWhitespace(xpp);
|
||||
while (eventType != XmlPullParser.END_TAG) {
|
||||
if (!parseElementContent(eventType, xpp, res))
|
||||
unknownContent(xpp);
|
||||
eventType = nextNoWhitespace(xpp);
|
||||
}
|
||||
next(xpp);
|
||||
parseElementClose(res);
|
||||
return res;
|
||||
}
|
||||
|
||||
protected OidType parseOid(XmlPullParser xpp) throws XmlPullParserException, IOException, FHIRFormatError {
|
||||
OidType res = new OidType(xpp.getAttributeValue(null, "value"));
|
||||
parseElementAttributes(xpp, res);
|
||||
|
@ -24697,6 +24712,8 @@ public class XmlParser extends XmlParserBase {
|
|||
return parseString(xpp);
|
||||
else if (xpp.getName().equals(prefix+"integer"))
|
||||
return parseInteger(xpp);
|
||||
else if (xpp.getName().equals(prefix+"integer64"))
|
||||
return parseInteger64(xpp);
|
||||
else if (xpp.getName().equals(prefix+"oid"))
|
||||
return parseOid(xpp);
|
||||
else if (xpp.getName().equals(prefix+"canonical"))
|
||||
|
@ -24815,6 +24832,8 @@ public class XmlParser extends XmlParserBase {
|
|||
return parseString(xpp);
|
||||
else if (xpp.getName().equals(prefix+"Integer"))
|
||||
return parseInteger(xpp);
|
||||
else if (xpp.getName().equals(prefix+"Integer64"))
|
||||
return parseInteger64(xpp);
|
||||
else if (xpp.getName().equals(prefix+"Oid"))
|
||||
return parseOid(xpp);
|
||||
else if (xpp.getName().equals(prefix+"Canonical"))
|
||||
|
@ -24857,6 +24876,8 @@ public class XmlParser extends XmlParserBase {
|
|||
return parseString(xpp);
|
||||
else if (type.equals("integer"))
|
||||
return parseInteger(xpp);
|
||||
else if (type.equals("integer64"))
|
||||
return parseInteger64(xpp);
|
||||
else if (type.equals("oid"))
|
||||
return parseOid(xpp);
|
||||
else if (type.equals("canonical"))
|
||||
|
@ -25343,6 +25364,8 @@ public class XmlParser extends XmlParserBase {
|
|||
return parseString(xpp);
|
||||
else if (type.equals("integer"))
|
||||
return parseInteger(xpp);
|
||||
else if (type.equals("integer64"))
|
||||
return parseInteger64(xpp);
|
||||
else if (type.equals("oid"))
|
||||
return parseOid(xpp);
|
||||
else if (type.equals("canonical"))
|
||||
|
@ -25745,6 +25768,8 @@ public class XmlParser extends XmlParserBase {
|
|||
return true;
|
||||
if (xpp.getName().equals(prefix+"Integer"))
|
||||
return true;
|
||||
if (xpp.getName().equals(prefix+"Integer64"))
|
||||
return true;
|
||||
if (xpp.getName().equals(prefix+"Oid"))
|
||||
return true;
|
||||
if (xpp.getName().equals(prefix+"Canonical"))
|
||||
|
@ -25884,6 +25909,19 @@ public class XmlParser extends XmlParserBase {
|
|||
}
|
||||
}
|
||||
|
||||
protected void composeInteger64(String name, Integer64Type value) throws IOException {
|
||||
if (value != null) { // integer
|
||||
composeElementAttributes(value);
|
||||
if (value.asStringValue() != null)
|
||||
xml.attribute("value", value.asStringValue());
|
||||
|
||||
xml.enter(FHIR_NS, name);
|
||||
composeElementElements(value);
|
||||
composeElementClose(value);
|
||||
xml.exit(FHIR_NS, name);
|
||||
}
|
||||
}
|
||||
|
||||
protected void composeOid(String name, OidType value) throws IOException {
|
||||
if (value != null && (!Utilities.noString(value.getId()) || ExtensionHelper.hasExtensions(value) || !Utilities.noString(value.getValue()))) {// oid
|
||||
composeElementAttributes(value);
|
||||
|
@ -51805,7 +51843,9 @@ public class XmlParser extends XmlParserBase {
|
|||
else if (type instanceof StringType)
|
||||
composeString(prefix+"String", (StringType) type);
|
||||
else if (type instanceof IntegerType)
|
||||
composeInteger(prefix+"Integer", (IntegerType) type);
|
||||
composeInteger(prefix+"Integer", (IntegerType) type);
|
||||
else if (type instanceof Integer64Type)
|
||||
composeInteger64(prefix+"Integer64", (Integer64Type) type);
|
||||
else if (type instanceof UriType)
|
||||
composeUri(prefix+"Uri", (UriType) type);
|
||||
else if (type instanceof InstantType)
|
||||
|
|
|
@ -5507,6 +5507,18 @@ When pattern[x] is used to constrain a complex object, it means that each proper
|
|||
return this != null && this.minValue instanceof IntegerType;
|
||||
}
|
||||
|
||||
public Integer64Type getMinValueInteger64Type() throws FHIRException {
|
||||
if (this.minValue == null)
|
||||
this.minValue = new Integer64Type();
|
||||
if (!(this.minValue instanceof Integer64Type))
|
||||
throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.minValue.getClass().getName()+" was encountered");
|
||||
return (Integer64Type) this.minValue;
|
||||
}
|
||||
|
||||
public boolean hasMinValueInteger64Type() {
|
||||
return this != null && this.minValue instanceof IntegerType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return {@link #minValue} (The minimum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.)
|
||||
*/
|
||||
|
@ -5560,7 +5572,7 @@ When pattern[x] is used to constrain a complex object, it means that each proper
|
|||
* @param value {@link #minValue} (The minimum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.)
|
||||
*/
|
||||
public ElementDefinition setMinValue(Type value) {
|
||||
if (value != null && !(value instanceof DateType || value instanceof DateTimeType || value instanceof InstantType || value instanceof TimeType || value instanceof DecimalType || value instanceof IntegerType || value instanceof PositiveIntType || value instanceof UnsignedIntType || value instanceof Quantity))
|
||||
if (value != null && !(value instanceof DateType || value instanceof DateTimeType || value instanceof InstantType || value instanceof TimeType || value instanceof DecimalType || value instanceof IntegerType || value instanceof Integer64Type || value instanceof PositiveIntType || value instanceof UnsignedIntType || value instanceof Quantity))
|
||||
throw new Error("Not the right type for ElementDefinition.minValue[x]: "+value.fhirType());
|
||||
this.minValue = value;
|
||||
return this;
|
||||
|
@ -5663,6 +5675,19 @@ When pattern[x] is used to constrain a complex object, it means that each proper
|
|||
return this != null && this.maxValue instanceof IntegerType;
|
||||
}
|
||||
|
||||
public Integer64Type getMaxValueInteger64Type() throws FHIRException {
|
||||
if (this.maxValue == null)
|
||||
this.maxValue = new Integer64Type();
|
||||
if (!(this.maxValue instanceof Integer64Type))
|
||||
throw new FHIRException("Type mismatch: the type Integer64Type was expected, but "+this.maxValue.getClass().getName()+" was encountered");
|
||||
return (Integer64Type) this.maxValue;
|
||||
}
|
||||
|
||||
public boolean hasMaxValueInteger64Type() {
|
||||
return this != null && this.maxValue instanceof Integer64Type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return {@link #maxValue} (The maximum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.)
|
||||
*/
|
||||
|
@ -5716,7 +5741,7 @@ When pattern[x] is used to constrain a complex object, it means that each proper
|
|||
* @param value {@link #maxValue} (The maximum allowed value for the element. The value is inclusive. This is allowed for the types date, dateTime, instant, time, decimal, integer, and Quantity.)
|
||||
*/
|
||||
public ElementDefinition setMaxValue(Type value) {
|
||||
if (value != null && !(value instanceof DateType || value instanceof DateTimeType || value instanceof InstantType || value instanceof TimeType || value instanceof DecimalType || value instanceof IntegerType || value instanceof PositiveIntType || value instanceof UnsignedIntType || value instanceof Quantity))
|
||||
if (value != null && !(value instanceof DateType || value instanceof DateTimeType || value instanceof InstantType || value instanceof TimeType || value instanceof DecimalType || value instanceof IntegerType || value instanceof Integer64Type || value instanceof PositiveIntType || value instanceof UnsignedIntType || value instanceof Quantity))
|
||||
throw new Error("Not the right type for ElementDefinition.maxValue[x]: "+value.fhirType());
|
||||
this.maxValue = value;
|
||||
return this;
|
||||
|
|
|
@ -1439,6 +1439,10 @@ public class Enumerations {
|
|||
* A whole number
|
||||
*/
|
||||
INTEGER,
|
||||
/**
|
||||
* A whole number
|
||||
*/
|
||||
INTEGER64,
|
||||
/**
|
||||
* A string that may contain Github Flavored Markdown syntax for optional processing by a mark down presentation engine
|
||||
*/
|
||||
|
@ -1596,6 +1600,8 @@ public class Enumerations {
|
|||
return INSTANT;
|
||||
if ("integer".equals(codeString))
|
||||
return INTEGER;
|
||||
if ("integer64".equals(codeString))
|
||||
return INTEGER64;
|
||||
if ("markdown".equals(codeString))
|
||||
return MARKDOWN;
|
||||
if ("oid".equals(codeString))
|
||||
|
@ -1675,6 +1681,7 @@ public class Enumerations {
|
|||
case ID: return "id";
|
||||
case INSTANT: return "instant";
|
||||
case INTEGER: return "integer";
|
||||
case INTEGER64: return "integer64";
|
||||
case MARKDOWN: return "markdown";
|
||||
case OID: return "oid";
|
||||
case POSITIVEINT: return "positiveInt";
|
||||
|
@ -1745,6 +1752,7 @@ public class Enumerations {
|
|||
case ID: return "http://hl7.org/fhir/data-types";
|
||||
case INSTANT: return "http://hl7.org/fhir/data-types";
|
||||
case INTEGER: return "http://hl7.org/fhir/data-types";
|
||||
case INTEGER64: return "http://hl7.org/fhir/data-types";
|
||||
case MARKDOWN: return "http://hl7.org/fhir/data-types";
|
||||
case OID: return "http://hl7.org/fhir/data-types";
|
||||
case POSITIVEINT: return "http://hl7.org/fhir/data-types";
|
||||
|
@ -1885,6 +1893,7 @@ public class Enumerations {
|
|||
case ID: return "id";
|
||||
case INSTANT: return "instant";
|
||||
case INTEGER: return "integer";
|
||||
case INTEGER64: return "integer64";
|
||||
case MARKDOWN: return "markdown";
|
||||
case OID: return "oid";
|
||||
case POSITIVEINT: return "positiveInt";
|
||||
|
@ -2015,6 +2024,8 @@ public class Enumerations {
|
|||
return DataType.INSTANT;
|
||||
if ("integer".equals(codeString))
|
||||
return DataType.INTEGER;
|
||||
if ("integer64".equals(codeString))
|
||||
return DataType.INTEGER64;
|
||||
if ("markdown".equals(codeString))
|
||||
return DataType.MARKDOWN;
|
||||
if ("oid".equals(codeString))
|
||||
|
@ -2155,6 +2166,8 @@ public class Enumerations {
|
|||
return new Enumeration<DataType>(this, DataType.INSTANT);
|
||||
if ("integer".equals(codeString))
|
||||
return new Enumeration<DataType>(this, DataType.INTEGER);
|
||||
if ("integer64".equals(codeString))
|
||||
return new Enumeration<DataType>(this, DataType.INTEGER64);
|
||||
if ("markdown".equals(codeString))
|
||||
return new Enumeration<DataType>(this, DataType.MARKDOWN);
|
||||
if ("oid".equals(codeString))
|
||||
|
@ -2288,6 +2301,8 @@ public class Enumerations {
|
|||
return "instant";
|
||||
if (code == DataType.INTEGER)
|
||||
return "integer";
|
||||
if (code == DataType.INTEGER64)
|
||||
return "integer64";
|
||||
if (code == DataType.MARKDOWN)
|
||||
return "markdown";
|
||||
if (code == DataType.OID)
|
||||
|
@ -3395,6 +3410,10 @@ public class Enumerations {
|
|||
* A whole number
|
||||
*/
|
||||
INTEGER,
|
||||
/**
|
||||
* A whole number
|
||||
*/
|
||||
INTEGER64,
|
||||
/**
|
||||
* A string that may contain Github Flavored Markdown syntax for optional processing by a mark down presentation engine
|
||||
*/
|
||||
|
@ -4139,6 +4158,8 @@ The primary difference between a medicationusage and a medicationadministration
|
|||
return INSTANT;
|
||||
if ("integer".equals(codeString))
|
||||
return INTEGER;
|
||||
if ("integer64".equals(codeString))
|
||||
return INTEGER64;
|
||||
if ("markdown".equals(codeString))
|
||||
return MARKDOWN;
|
||||
if ("oid".equals(codeString))
|
||||
|
@ -4510,6 +4531,7 @@ The primary difference between a medicationusage and a medicationadministration
|
|||
case ID: return "id";
|
||||
case INSTANT: return "instant";
|
||||
case INTEGER: return "integer";
|
||||
case INTEGER64: return "integer64";
|
||||
case MARKDOWN: return "markdown";
|
||||
case OID: return "oid";
|
||||
case POSITIVEINT: return "positiveInt";
|
||||
|
@ -5158,6 +5180,7 @@ The primary difference between a medicationusage and a medicationadministration
|
|||
case ID: return "id";
|
||||
case INSTANT: return "instant";
|
||||
case INTEGER: return "integer";
|
||||
case INTEGER64: return "integer64";
|
||||
case MARKDOWN: return "markdown";
|
||||
case OID: return "oid";
|
||||
case POSITIVEINT: return "positiveInt";
|
||||
|
@ -5434,6 +5457,8 @@ The primary difference between a medicationusage and a medicationadministration
|
|||
return FHIRAllTypes.INSTANT;
|
||||
if ("integer".equals(codeString))
|
||||
return FHIRAllTypes.INTEGER;
|
||||
if ("integer64".equals(codeString))
|
||||
return FHIRAllTypes.INTEGER64;
|
||||
if ("markdown".equals(codeString))
|
||||
return FHIRAllTypes.MARKDOWN;
|
||||
if ("oid".equals(codeString))
|
||||
|
@ -5866,6 +5891,8 @@ The primary difference between a medicationusage and a medicationadministration
|
|||
return new Enumeration<FHIRAllTypes>(this, FHIRAllTypes.INSTANT);
|
||||
if ("integer".equals(codeString))
|
||||
return new Enumeration<FHIRAllTypes>(this, FHIRAllTypes.INTEGER);
|
||||
if ("integer64".equals(codeString))
|
||||
return new Enumeration<FHIRAllTypes>(this, FHIRAllTypes.INTEGER64);
|
||||
if ("markdown".equals(codeString))
|
||||
return new Enumeration<FHIRAllTypes>(this, FHIRAllTypes.MARKDOWN);
|
||||
if ("oid".equals(codeString))
|
||||
|
@ -6291,6 +6318,8 @@ The primary difference between a medicationusage and a medicationadministration
|
|||
return "instant";
|
||||
if (code == FHIRAllTypes.INTEGER)
|
||||
return "integer";
|
||||
if (code == FHIRAllTypes.INTEGER64)
|
||||
return "integer64";
|
||||
if (code == FHIRAllTypes.MARKDOWN)
|
||||
return "markdown";
|
||||
if (code == FHIRAllTypes.OID)
|
||||
|
@ -6831,6 +6860,10 @@ The primary difference between a medicationusage and a medicationadministration
|
|||
* A whole number
|
||||
*/
|
||||
INTEGER,
|
||||
/**
|
||||
* A whole number
|
||||
*/
|
||||
INTEGER64,
|
||||
/**
|
||||
* A string that may contain Github Flavored Markdown syntax for optional processing by a mark down presentation engine
|
||||
*/
|
||||
|
@ -7567,6 +7600,8 @@ The primary difference between a medicationusage and a medicationadministration
|
|||
return INSTANT;
|
||||
if ("integer".equals(codeString))
|
||||
return INTEGER;
|
||||
if ("integer64".equals(codeString))
|
||||
return INTEGER64;
|
||||
if ("markdown".equals(codeString))
|
||||
return MARKDOWN;
|
||||
if ("oid".equals(codeString))
|
||||
|
@ -7934,6 +7969,7 @@ The primary difference between a medicationusage and a medicationadministration
|
|||
case ID: return "id";
|
||||
case INSTANT: return "instant";
|
||||
case INTEGER: return "integer";
|
||||
case INTEGER64: return "integer64";
|
||||
case MARKDOWN: return "markdown";
|
||||
case OID: return "oid";
|
||||
case POSITIVEINT: return "positiveInt";
|
||||
|
@ -8576,6 +8612,7 @@ The primary difference between a medicationusage and a medicationadministration
|
|||
case ID: return "id";
|
||||
case INSTANT: return "instant";
|
||||
case INTEGER: return "integer";
|
||||
case INTEGER64: return "integer64";
|
||||
case MARKDOWN: return "markdown";
|
||||
case OID: return "oid";
|
||||
case POSITIVEINT: return "positiveInt";
|
||||
|
@ -8850,6 +8887,8 @@ The primary difference between a medicationusage and a medicationadministration
|
|||
return FHIRDefinedType.INSTANT;
|
||||
if ("integer".equals(codeString))
|
||||
return FHIRDefinedType.INTEGER;
|
||||
if ("integer64".equals(codeString))
|
||||
return FHIRDefinedType.INTEGER64;
|
||||
if ("markdown".equals(codeString))
|
||||
return FHIRDefinedType.MARKDOWN;
|
||||
if ("oid".equals(codeString))
|
||||
|
@ -9278,6 +9317,8 @@ The primary difference between a medicationusage and a medicationadministration
|
|||
return new Enumeration<FHIRDefinedType>(this, FHIRDefinedType.INSTANT);
|
||||
if ("integer".equals(codeString))
|
||||
return new Enumeration<FHIRDefinedType>(this, FHIRDefinedType.INTEGER);
|
||||
if ("integer64".equals(codeString))
|
||||
return new Enumeration<FHIRDefinedType>(this, FHIRDefinedType.INTEGER64);
|
||||
if ("markdown".equals(codeString))
|
||||
return new Enumeration<FHIRDefinedType>(this, FHIRDefinedType.MARKDOWN);
|
||||
if ("oid".equals(codeString))
|
||||
|
@ -9699,6 +9740,8 @@ The primary difference between a medicationusage and a medicationadministration
|
|||
return "instant";
|
||||
if (code == FHIRDefinedType.INTEGER)
|
||||
return "integer";
|
||||
if (code == FHIRDefinedType.INTEGER64)
|
||||
return "integer64";
|
||||
if (code == FHIRDefinedType.MARKDOWN)
|
||||
return "markdown";
|
||||
if (code == FHIRDefinedType.OID)
|
||||
|
|
|
@ -220,6 +220,8 @@ public class Factory {
|
|||
return new BooleanType();
|
||||
else if (name.equals("integer"))
|
||||
return new IntegerType();
|
||||
else if (name.equals("integer64"))
|
||||
return new Integer64Type();
|
||||
else if (name.equals("decimal"))
|
||||
return new DecimalType();
|
||||
else if (name.equals("base64Binary"))
|
||||
|
|
|
@ -0,0 +1,133 @@
|
|||
/*
|
||||
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.
|
||||
|
||||
*/
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package org.hl7.fhir.r5.model;
|
||||
|
||||
/*-
|
||||
* #%L
|
||||
* org.hl7.fhir.r5
|
||||
* %%
|
||||
* Copyright (C) 2014 - 2019 Health Level 7
|
||||
* %%
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseIntegerDatatype;
|
||||
|
||||
import ca.uhn.fhir.model.api.annotation.DatatypeDef;
|
||||
|
||||
/**
|
||||
* Primitive type "integer" in FHIR: A signed 32-bit integer
|
||||
*/
|
||||
@DatatypeDef(name = "integer")
|
||||
public class Integer64Type extends PrimitiveType<Long> /* implements IBaseInteger64Datatype */ {
|
||||
|
||||
private static final long serialVersionUID = 3L;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Integer64Type() {
|
||||
// nothing
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Integer64Type(long theInteger) {
|
||||
setValue(theInteger);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param theIntegerAsString
|
||||
* A string representation of an integer
|
||||
* @throws IllegalArgumentException
|
||||
* If the string is not a valid integer representation
|
||||
*/
|
||||
public Integer64Type(String theIntegerAsString) {
|
||||
setValueAsString(theIntegerAsString);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param theValue The value
|
||||
* @throws IllegalArgumentException If the value is too large to fit in a signed integer
|
||||
*/
|
||||
public Integer64Type(Long theValue) {
|
||||
if (theValue < java.lang.Long.MIN_VALUE || theValue > java.lang.Long.MAX_VALUE) {
|
||||
throw new IllegalArgumentException
|
||||
(theValue + " cannot be cast to int without changing its value.");
|
||||
}
|
||||
if(theValue!=null) {
|
||||
setValue((long)theValue.longValue());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Long parse(String theValue) {
|
||||
try {
|
||||
return Long.parseLong(theValue);
|
||||
} catch (NumberFormatException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String encode(Long theValue) {
|
||||
return Long.toString(theValue);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer64Type copy() {
|
||||
Integer64Type ret = new Integer64Type(getValue());
|
||||
copyValues(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
public String fhirType() {
|
||||
return "integer64";
|
||||
}
|
||||
}
|
|
@ -98,6 +98,7 @@ public class TypesUtilities {
|
|||
res.add(new WildcardInformation("id", TypeClassification.PRIMITIVE));
|
||||
res.add(new WildcardInformation("instant", TypeClassification.PRIMITIVE));
|
||||
res.add(new WildcardInformation("integer", TypeClassification.PRIMITIVE));
|
||||
res.add(new WildcardInformation("integer64", TypeClassification.PRIMITIVE));
|
||||
res.add(new WildcardInformation("markdown", TypeClassification.PRIMITIVE));
|
||||
res.add(new WildcardInformation("oid", TypeClassification.PRIMITIVE));
|
||||
res.add(new WildcardInformation("positiveInt", TypeClassification.PRIMITIVE));
|
||||
|
@ -148,7 +149,7 @@ public class TypesUtilities {
|
|||
}
|
||||
|
||||
public static boolean isPrimitive(String code) {
|
||||
return Utilities.existsInList(code, "boolean", "integer", "string", "decimal", "uri", "url", "canonical", "base64Binary", "instant", "date", "dateTime", "time", "code", "oid", "id", "markdown", "unsignedInt", "positiveInt", "xhtml");
|
||||
return Utilities.existsInList(code, "boolean", "integer", "integer64", "string", "decimal", "uri", "url", "canonical", "base64Binary", "instant", "date", "dateTime", "time", "code", "oid", "id", "markdown", "unsignedInt", "positiveInt", "xhtml");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -142,6 +142,29 @@ public class Utilities {
|
|||
return true;
|
||||
}
|
||||
|
||||
public static boolean isLong(String string) {
|
||||
if (isBlank(string)) {
|
||||
return false;
|
||||
}
|
||||
String value = string.startsWith("-") ? string.substring(1) : string;
|
||||
for (char next : value.toCharArray()) {
|
||||
if (!Character.isDigit(next)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// check bounds -9,223,372,036,854,775,808 to +9,223,372,036,854,775,807
|
||||
if (value.length() > 20)
|
||||
return false;
|
||||
if (string.startsWith("-")) {
|
||||
if (value.length() == 20 && string.compareTo("9223372036854775808") > 0)
|
||||
return false;
|
||||
} else {
|
||||
if (value.length() == 20 && string.compareTo("9223372036854775807") > 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static boolean isHex(String string) {
|
||||
try {
|
||||
int i = Integer.parseInt(string, 16);
|
||||
|
|
|
@ -1735,6 +1735,17 @@ public class InstanceValidator extends BaseValidator implements IResourceValidat
|
|||
rule(errors, IssueType.INVALID, e.line(), e.col(), path, v > 0, "value is less than permitted minimum value of 1");
|
||||
}
|
||||
}
|
||||
if (type.equals("integer64")) {
|
||||
if (rule(errors, IssueType.INVALID, e.line(), e.col(), path, Utilities.isLong(e.primitiveValue()), "The value '" + e.primitiveValue() + "' is not a valid integer64")) {
|
||||
Long v = new Long(e.getValue()).longValue();
|
||||
rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMaxValueInteger64Type() || !context.getMaxValueInteger64Type().hasValue() || (context.getMaxValueInteger64Type().getValue() >= v), "value is greater than permitted maximum value of " + (context.hasMaxValueInteger64Type() ? context.getMaxValueInteger64Type() : ""));
|
||||
rule(errors, IssueType.INVALID, e.line(), e.col(), path, !context.hasMinValueInteger64Type() || !context.getMinValueInteger64Type().hasValue() || (context.getMinValueInteger64Type().getValue() <= v), "value is less than permitted minimum value of " + (context.hasMinValueInteger64Type() ? context.getMinValueInteger64Type() : ""));
|
||||
if (type.equals("unsignedInt"))
|
||||
rule(errors, IssueType.INVALID, e.line(), e.col(), path, v >= 0, "value is less than permitted minimum value of 0");
|
||||
if (type.equals("positiveInt"))
|
||||
rule(errors, IssueType.INVALID, e.line(), e.col(), path, v > 0, "value is less than permitted minimum value of 1");
|
||||
}
|
||||
}
|
||||
if (type.equals("decimal")) {
|
||||
if (e.primitiveValue() != null) {
|
||||
DecimalStatus ds = Utilities.checkDecimal(e.primitiveValue(), true, false);
|
||||
|
|
Loading…
Reference in New Issue