Package ca.uhn.fhir.model.api

Examples of ca.uhn.fhir.model.api.IElement


      parseChildren(theState, nextName, nextVal, alternateVal);

    }

    if (elementId != null) {
      IElement object = (IElement) theState.getObject();
      if (object instanceof IIdentifiableElement) {
        ((IIdentifiableElement) object).setId(new IdDt(elementId));
      } else if (object instanceof IResource) {
        ((IResource) object).setId(new IdDt(elementId));
      }
View Full Code Here


        theEventWriter.writeEnd();
      }
    }

    private void writeUndeclaredExt(RuntimeResourceDefinition theResDef, IResource theResource, JsonGenerator theEventWriter, ExtensionDt ext) throws IOException {
      IElement value = ext.getValue();

      theEventWriter.writeStartObject();
      theEventWriter.write("url", ext.getUrl().getValue());

      boolean noValue = value == null || value.isEmpty();
      if (noValue && ext.getAllUndeclaredExtensions().isEmpty()) {
        ourLog.debug("Extension with URL[{}] has no value", ext.getUrl().getValue());
      } else if (noValue) {
        theEventWriter.writeStartArray("extension");
        for (ExtensionDt next : ext.getUndeclaredExtensions()) {
          writeUndeclaredExt(theResDef, theResource, theEventWriter, next);
        }
        theEventWriter.writeEnd();
      } else {
        RuntimeChildUndeclaredExtensionDefinition extDef = myContext.getRuntimeChildUndeclaredExtensionDefinition();
        String childName = extDef.getChildNameByDatatype(value.getClass());
        if (childName == null) {
          throw new ConfigurationException("Unable to encode extension, unregognized child element type: " + value.getClass().getCanonicalName());
        }
        BaseRuntimeElementDefinition<?> childDef = extDef.getChildElementDefinitionByDatatype(value.getClass());
        encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, value, childDef, childName);
      }

      // theEventWriter.name(myUndeclaredExtension.get);
View Full Code Here

    for (ExtensionDt next : extensions) {
      theWriter.writeStartElement(tagName);
      theWriter.writeAttribute("url", next.getUrl().getValue());

      if (next.getValue() != null) {
        IElement nextValue = next.getValue();
        RuntimeChildUndeclaredExtensionDefinition extDef = myContext.getRuntimeChildUndeclaredExtensionDefinition();
        String childName = extDef.getChildNameByDatatype(nextValue.getClass());
        if (childName == null) {
          throw new ConfigurationException("Unable to encode extension, unregognized child element type: " + nextValue.getClass().getCanonicalName());
        }
        BaseRuntimeElementDefinition<?> childDef = extDef.getChildElementDefinitionByDatatype(nextValue.getClass());
        encodeChildElementToStreamWriter(theResDef, theResource, theWriter, nextValue, childName, childDef, null, theIncludedResource);
      }

      // child extensions
      encodeExtensionsIfPresent(theResDef, theResource, theWriter, next, theIncludedResource);
View Full Code Here

  public static boolean isEmpty(IElement... theElements) {
    if (theElements == null) {
      return true;
    }
    for (int i = 0; i < theElements.length; i++) {
      IElement next = theElements[i];
      if (next != null && !next.isEmpty()) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

  public static boolean isEmpty(List<? extends IElement> theElements) {
    if (theElements == null) {
      return true;
    }
    for (int i = 0; i < theElements.size(); i++) {
      IElement next = theElements.get(i);
      if (next != null && !next.isEmpty()) {
        return false;
      }
    }
    return true;
  }
View Full Code Here

    for (ExtensionDt next : extensions) {
      theWriter.writeStartElement(tagName);
      theWriter.writeAttribute("url", next.getUrl().getValue());

      if (next.getValue() != null) {
        IElement nextValue = next.getValue();
        RuntimeChildUndeclaredExtensionDefinition extDef = myContext.getRuntimeChildUndeclaredExtensionDefinition();
        String childName = extDef.getChildNameByDatatype(nextValue.getClass());
        if (childName == null) {
          throw new ConfigurationException("Unable to encode extension, unregognized child element type: " + nextValue.getClass().getCanonicalName());
        }
        BaseRuntimeElementDefinition<?> childDef = extDef.getChildElementDefinitionByDatatype(nextValue.getClass());
        encodeChildElementToStreamWriter(theResDef, theResource, theWriter, nextValue, childName, childDef, null, theIncludedResource);
      }

      // child extensions
      encodeExtensionsIfPresent(theResDef, theResource, theWriter, next, theIncludedResource);
View Full Code Here

      parseChildren(theState, nextName, nextVal, alternateVal);

    }

    if (elementId != null) {
      IElement object = (IElement) theState.getObject();
      if (object instanceof IIdentifiableElement) {
        ((IIdentifiableElement) object).setElementSpecificId(elementId);
      } else if (object instanceof IResource) {
        ((IResource) object).setId(new IdDt(elementId));
      }
View Full Code Here

        theEventWriter.writeEnd();
      }
    }

    private void writeUndeclaredExt(RuntimeResourceDefinition theResDef, IResource theResource, JsonGenerator theEventWriter, ExtensionDt ext) throws IOException {
      IElement value = ext.getValue();

      theEventWriter.writeStartObject();
      theEventWriter.write("url", ext.getUrl().getValue());

      boolean noValue = value == null || value.isEmpty();
      if (noValue && ext.getAllUndeclaredExtensions().isEmpty()) {
        ourLog.debug("Extension with URL[{}] has no value", ext.getUrl().getValue());
      } else if (noValue) {
        theEventWriter.writeStartArray("extension");
        for (ExtensionDt next : ext.getUndeclaredExtensions()) {
          writeUndeclaredExt(theResDef, theResource, theEventWriter, next);
        }
        theEventWriter.writeEnd();
      } else {
        RuntimeChildUndeclaredExtensionDefinition extDef = myContext.getRuntimeChildUndeclaredExtensionDefinition();
        String childName = extDef.getChildNameByDatatype(value.getClass());
        if (childName == null) {
          throw new ConfigurationException("Unable to encode extension, unregognized child element type: " + value.getClass().getCanonicalName());
        }
        BaseRuntimeElementDefinition<?> childDef = extDef.getChildElementDefinitionByDatatype(value.getClass());
        encodeChildElementToStreamWriter(theResDef, theResource, theEventWriter, value, childDef, childName);
      }

      // theEventWriter.name(myUndeclaredExtension.get);
View Full Code Here

    for (ExtensionDt next : extensions) {
      theWriter.writeStartElement(tagName);
      theWriter.writeAttribute("url", next.getUrl().getValue());

      if (next.getValue() != null) {
        IElement nextValue = next.getValue();
        RuntimeChildUndeclaredExtensionDefinition extDef = myContext.getRuntimeChildUndeclaredExtensionDefinition();
        String childName = extDef.getChildNameByDatatype(nextValue.getClass());
        if (childName == null) {
          throw new ConfigurationException("Unable to encode extension, unregognized child element type: " + nextValue.getClass().getCanonicalName());
        }
        BaseRuntimeElementDefinition<?> childDef = extDef.getChildElementDefinitionByDatatype(nextValue.getClass());
        encodeChildElementToStreamWriter(theResDef, theResource, theWriter, nextValue, childName, childDef, null, theIncludedResource);
      }

      // child extensions
      encodeExtensionsIfPresent(theResDef, theResource, theWriter, next, theIncludedResource);
View Full Code Here

      parseChildren(theState, nextName, nextVal, alternateVal);

    }

    if (elementId != null) {
      IElement object = (IElement) theState.getObject();
      if (object instanceof IIdentifiableElement) {
        ((IIdentifiableElement) object).setId(new IdDt(elementId));
      }
    }
  }
View Full Code Here

TOP

Related Classes of ca.uhn.fhir.model.api.IElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.