org.hl7.fhir.r4.model.BooleanType Java Examples

The following examples show how to use org.hl7.fhir.r4.model.BooleanType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CodeSystemUtilities.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static boolean isDeprecated(CodeSystem cs, ConceptDefinitionComponent def)  {
  try {
    for (ConceptPropertyComponent p : def.getProperty()) {
      if (p.getCode().equals("status") && p.hasValue() && p.hasValueCodeType() && p.getValueCodeType().getCode().equals("deprecated"))
        return true;
      // this, though status should also be set
      if (p.getCode().equals("deprecationDate") && p.hasValue() && p.getValue() instanceof DateTimeType) 
        return ((DateTimeType) p.getValue()).before(new DateTimeType(Calendar.getInstance()));
      // legacy  
      if (p.getCode().equals("deprecated") && p.hasValue() && p.getValue() instanceof BooleanType) 
        return ((BooleanType) p.getValue()).getValue();
    }
    return false;
  } catch (FHIRException e) {
    return false;
  }
}
 
Example #2
Source File: VersionConvertorPrimitiveType40_50Test.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static Stream<Arguments> r4PrimitiveTypes() {
  return Stream.of(
    Arguments.arguments(BooleanType.class.getSimpleName(), new BooleanType()),
    Arguments.arguments(CodeType.class.getSimpleName(), new CodeType()),
    Arguments.arguments(DateType.class.getSimpleName(), new DateType()),
    Arguments.arguments(DateTimeType.class.getSimpleName(), new DateTimeType()),
    Arguments.arguments(DecimalType.class.getSimpleName(), new DecimalType()),
    Arguments.arguments(InstantType.class.getSimpleName(), new InstantType()),
    Arguments.arguments(PositiveIntType.class.getSimpleName(), new PositiveIntType()),
    Arguments.arguments(UnsignedIntType.class.getSimpleName(), new UnsignedIntType()),
    Arguments.arguments(IntegerType.class.getSimpleName(), new IntegerType()),
    Arguments.arguments(MarkdownType.class.getSimpleName(), new MarkdownType()),
    Arguments.arguments(OidType.class.getSimpleName(), new OidType()),
    Arguments.arguments(StringType.class.getSimpleName(), new StringType()),
    Arguments.arguments(TimeType.class.getSimpleName(), new TimeType()),
    Arguments.arguments(UuidType.class.getSimpleName(), new UuidType()),
    Arguments.arguments(Base64BinaryType.class.getSimpleName(), new Base64BinaryType()),
    Arguments.arguments(UriType.class.getSimpleName(), new UriType()));
}
 
Example #3
Source File: VersionConvertorPrimitiveType40_50Test.java    From org.hl7.fhir.core with Apache License 2.0 6 votes vote down vote up
public static Stream<Arguments> r5PrimitiveTypes() {
  return Stream.of(
    Arguments.arguments(org.hl7.fhir.r5.model.BooleanType.class.getSimpleName(), new org.hl7.fhir.r5.model.BooleanType()),
    Arguments.arguments(org.hl7.fhir.r5.model.CodeType.class.getSimpleName(), new org.hl7.fhir.r5.model.CodeType()),
    Arguments.arguments(org.hl7.fhir.r5.model.DateType.class.getSimpleName(), new org.hl7.fhir.r5.model.DateType()),
    Arguments.arguments(org.hl7.fhir.r5.model.DateTimeType.class.getSimpleName(), new org.hl7.fhir.r5.model.DateTimeType()),
    Arguments.arguments(org.hl7.fhir.r5.model.DecimalType.class.getSimpleName(), new org.hl7.fhir.r5.model.DecimalType()),
    Arguments.arguments(org.hl7.fhir.r5.model.InstantType.class.getSimpleName(), new org.hl7.fhir.r5.model.InstantType()),
    Arguments.arguments(org.hl7.fhir.r5.model.PositiveIntType.class.getSimpleName(), new org.hl7.fhir.r5.model.PositiveIntType()),
    Arguments.arguments(org.hl7.fhir.r5.model.UnsignedIntType.class.getSimpleName(), new org.hl7.fhir.r5.model.UnsignedIntType()),
    Arguments.arguments(org.hl7.fhir.r5.model.IntegerType.class.getSimpleName(), new org.hl7.fhir.r5.model.IntegerType()),
    Arguments.arguments(org.hl7.fhir.r5.model.MarkdownType.class.getSimpleName(), new org.hl7.fhir.r5.model.MarkdownType()),
    Arguments.arguments(org.hl7.fhir.r5.model.OidType.class.getSimpleName(), new org.hl7.fhir.r5.model.OidType()),
    Arguments.arguments(org.hl7.fhir.r5.model.StringType.class.getSimpleName(), new org.hl7.fhir.r5.model.StringType()),
    Arguments.arguments(org.hl7.fhir.r5.model.TimeType.class.getSimpleName(), new org.hl7.fhir.r5.model.TimeType()),
    Arguments.arguments(org.hl7.fhir.r5.model.UuidType.class.getSimpleName(), new org.hl7.fhir.r5.model.UuidType()),
    Arguments.arguments(org.hl7.fhir.r5.model.Base64BinaryType.class.getSimpleName(), new org.hl7.fhir.r5.model.Base64BinaryType()),
    Arguments.arguments(org.hl7.fhir.r5.model.UriType.class.getSimpleName(), new org.hl7.fhir.r5.model.UriType()));
}
 
Example #4
Source File: CodeSystemUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static boolean isNotSelectable(CodeSystem cs, ConceptDefinitionComponent def) {
  for (ConceptPropertyComponent p : def.getProperty()) {
    if (p.getCode().equals("notSelectable") && p.hasValue() && p.getValue() instanceof BooleanType) 
      return ((BooleanType) p.getValue()).getValue();
  }
  return false;
}
 
Example #5
Source File: CodeSystemUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static void setNotSelectable(CodeSystem cs, ConceptDefinitionComponent concept) throws FHIRFormatError {
  defineNotSelectableProperty(cs);
  ConceptPropertyComponent p = getProperty(concept, "notSelectable");
  if (p != null)
    p.setValue(new BooleanType(true));
  else
    concept.addProperty().setCode("notSelectable").setValue(new BooleanType(true));    
}
 
Example #6
Source File: StructureMapUtilities.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
private Type readConstant(String s, FHIRLexer lexer) throws FHIRLexerException {
	if (Utilities.isInteger(s))
		return new IntegerType(s);
	else if (Utilities.isDecimal(s, false))
		return new DecimalType(s);
	else if (Utilities.existsInList(s, "true", "false"))
		return new BooleanType(s.equals("true"));
	else 
		return new StringType(lexer.processConstant(s));        
}
 
Example #7
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static void addBooleanExtension(Element e, String url, boolean content) {
  Extension ex = getExtension(e, url);
  if (ex != null)
    ex.setValue(new BooleanType(content));
  else
    e.getExtension().add(Factory.newExtension(url, new BooleanType(content), true));   
}
 
Example #8
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static void addBooleanExtension(DomainResource e, String url, boolean content) {
  Extension ex = getExtension(e, url);
  if (ex != null)
    ex.setValue(new BooleanType(content));
  else
    e.getExtension().add(Factory.newExtension(url, new BooleanType(content), true));   
}
 
Example #9
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static Boolean readBooleanExtension(Element c, String uri) {
  Extension ex = ExtensionHelper.getExtension(c, uri);
  if (ex == null)
    return null;
  if (!(ex.getValue() instanceof BooleanType))
    return null;
  return ((BooleanType) ex.getValue()).getValue();
}
 
Example #10
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static boolean findBooleanExtension(Element c, String uri) {
  Extension ex = ExtensionHelper.getExtension(c, uri);
  if (ex == null)
    return false;
  if (!(ex.getValue() instanceof BooleanType))
    return false;
  return true;
}
 
Example #11
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static Boolean readBooleanExtension(DomainResource c, String uri) {
  Extension ex = ExtensionHelper.getExtension(c, uri);
  if (ex == null)
    return null;
  if (!(ex.getValue() instanceof BooleanType))
    return null;
  return ((BooleanType) ex.getValue()).getValue();
}
 
Example #12
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static boolean readBoolExtension(DomainResource c, String uri) {
  Extension ex = ExtensionHelper.getExtension(c, uri);
  if (ex == null)
    return false;
  if (!(ex.getValue() instanceof BooleanType))
    return false;
  return ((BooleanType) ex.getValue()).getValue();
}
 
Example #13
Source File: ToolingExtensions.java    From org.hl7.fhir.core with Apache License 2.0 5 votes vote down vote up
public static boolean findBooleanExtension(DomainResource c, String uri) {
  Extension ex = ExtensionHelper.getExtension(c, uri);
  if (ex == null)
    return false;
  if (!(ex.getValue() instanceof BooleanType))
    return false;
  return true;
}