Package ca.uhn.fhir.model.dstu.resource.Profile

Examples of ca.uhn.fhir.model.dstu.resource.Profile.StructureElement


    theElement.setPath(StringUtils.join(path, '.'));
  }

  private void fillExtensions(Structure theStruct, LinkedList<String> path, List<RuntimeChildDeclaredExtensionDefinition> extList, String elementName, boolean theIsModifier) {
    if (extList.size() > 0) {
      StructureElement extSlice = theStruct.addElement();
      extSlice.setName(elementName);
      extSlice.setPath(join(path, '.') + '.' + elementName);
      extSlice.getSlicing().getDiscriminator().setValue("url");
      extSlice.getSlicing().setOrdered(false);
      extSlice.getSlicing().setRules(SlicingRulesEnum.OPEN);
      extSlice.getDefinition().addType().setCode(DataTypeEnum.EXTENSION);

      for (RuntimeChildDeclaredExtensionDefinition nextExt : extList) {
        StructureElement nextProfileExt = theStruct.addElement();
        nextProfileExt.getDefinition().setIsModifier(theIsModifier);
        nextProfileExt.setName(extSlice.getName());
        nextProfileExt.setPath(extSlice.getPath());
        fillMinAndMaxAndDefinitions(nextExt, nextProfileExt);
        StructureElementDefinitionType type = nextProfileExt.getDefinition().addType();
        type.setCode(DataTypeEnum.EXTENSION);
        if (nextExt.isDefinedLocally()) {
          type.setProfile(nextExt.getExtensionUrl().substring(nextExt.getExtensionUrl().indexOf('#')));
        } else {
          type.setProfile(nextExt.getExtensionUrl());
        }
      }
    } else {
      StructureElement extSlice = theStruct.addElement();
      extSlice.setName(elementName);
      extSlice.setPath(join(path, '.') + '.' + elementName);
      extSlice.getDefinition().setIsModifier(theIsModifier);
      extSlice.getDefinition().addType().setCode(DataTypeEnum.EXTENSION);
      extSlice.getDefinition().setMin(0);
      extSlice.getDefinition().setMax("*");
    }
  }
 
View Full Code Here


    fillExtensions(theStruct, path, def.getExtensionsNonModifier(), "extension", false);
    fillExtensions(theStruct, path, def.getExtensionsModifier(), "modifierExtension", true);

    if (def.getChildType() == ChildTypeEnum.RESOURCE) {
      StructureElement narrative = theStruct.addElement();
      narrative.setName("text");
      narrative.setPath(join(path, '.') + ".text");
      narrative.getDefinition().addType().setCode(DataTypeEnum.NARRATIVE);
      narrative.getDefinition().setIsModifier(false);
      narrative.getDefinition().setMin(0);
      narrative.getDefinition().setMax("1");

      StructureElement contained = theStruct.addElement();
      contained.setName("contained");
      contained.setPath(join(path, '.') + ".contained");
      contained.getDefinition().addType().getCode().setValue("Resource");
      contained.getDefinition().setIsModifier(false);
      contained.getDefinition().setMin(0);
      contained.getDefinition().setMax("1");
    }

    if (def instanceof BaseRuntimeElementCompositeDefinition) {
      BaseRuntimeElementCompositeDefinition<?> cdef = ((BaseRuntimeElementCompositeDefinition<?>) def);
      for (BaseRuntimeChildDefinition nextChild : cdef.getChildren()) {
        if (nextChild instanceof RuntimeChildUndeclaredExtensionDefinition) {
          continue;
        }

        BaseRuntimeDeclaredChildDefinition child = (BaseRuntimeDeclaredChildDefinition) nextChild;
        StructureElement elem = theStruct.addElement();
        fillMinAndMaxAndDefinitions(child, elem);

        if (child instanceof RuntimeChildResourceBlockDefinition) {
          RuntimeResourceBlockDefinition nextDef = (RuntimeResourceBlockDefinition) child.getSingleChildOrThrow();
          fillProfile(theStruct, elem, nextDef, path, child);
View Full Code Here

    // Scan for children
    retVal.setName(getName());
    Structure struct = retVal.addStructure();
    LinkedList<String> path = new LinkedList<String>();

    StructureElement element = struct.addElement();
    element.getDefinition().setMin(1);
    element.getDefinition().setMax("1");

    fillProfile(struct, element, def, path, null);

    retVal.getStructure().get(0).getElement().get(0).getDefinition().addType().getCode().setValue("Resource");
View Full Code Here

    // Scan for children
    retVal.setName(getName());
    Structure struct = retVal.addStructure();
    LinkedList<String> path = new LinkedList<String>();

    StructureElement element = struct.addElement();
    element.getDefinition().setMin(1);
    element.getDefinition().setMax("1");

    fillProfile(struct, element, def, path, null);

    retVal.getStructure().get(0).getElement().get(0).getDefinition().addType().getCode().setValue("Resource");
View Full Code Here

    theElement.setPath(StringUtils.join(path, '.'));
  }

  private void fillExtensions(Structure theStruct, LinkedList<String> path, List<RuntimeChildDeclaredExtensionDefinition> extList, String elementName, boolean theIsModifier) {
    if (extList.size() > 0) {
      StructureElement extSlice = theStruct.addElement();
      extSlice.setName(elementName);
      extSlice.setPath(join(path, '.') + '.' + elementName);
      extSlice.getSlicing().getDiscriminator().setValue("url");
      extSlice.getSlicing().setOrdered(false);
      extSlice.getSlicing().setRules(SlicingRulesEnum.OPEN);
      extSlice.getDefinition().addType().setCode(DataTypeEnum.EXTENSION);

      for (RuntimeChildDeclaredExtensionDefinition nextExt : extList) {
        StructureElement nextProfileExt = theStruct.addElement();
        nextProfileExt.getDefinition().setIsModifier(theIsModifier);
        nextProfileExt.setName(extSlice.getName());
        nextProfileExt.setPath(extSlice.getPath());
        fillMinAndMaxAndDefinitions(nextExt, nextProfileExt);
        StructureElementDefinitionType type = nextProfileExt.getDefinition().addType();
        type.setCode(DataTypeEnum.EXTENSION);
        if (nextExt.isDefinedLocally()) {
          type.setProfile(nextExt.getExtensionUrl().substring(nextExt.getExtensionUrl().indexOf('#')));
        } else {
          type.setProfile(nextExt.getExtensionUrl());
        }
      }
    } else {
      StructureElement extSlice = theStruct.addElement();
      extSlice.setName(elementName);
      extSlice.setPath(join(path, '.') + '.' + elementName);
      extSlice.getDefinition().setIsModifier(theIsModifier);
      extSlice.getDefinition().addType().setCode(DataTypeEnum.EXTENSION);
      extSlice.getDefinition().setMin(0);
      extSlice.getDefinition().setMax("*");
    }
  }
 
View Full Code Here

    fillExtensions(theStruct, path, def.getExtensionsNonModifier(), "extension", false);
    fillExtensions(theStruct, path, def.getExtensionsModifier(), "modifierExtension", true);

    if (def.getChildType() == ChildTypeEnum.RESOURCE) {
      StructureElement narrative = theStruct.addElement();
      narrative.setName("text");
      narrative.setPath(join(path, '.') + ".text");
      narrative.getDefinition().addType().setCode(DataTypeEnum.NARRATIVE);
      narrative.getDefinition().setIsModifier(false);
      narrative.getDefinition().setMin(0);
      narrative.getDefinition().setMax("1");

      StructureElement contained = theStruct.addElement();
      contained.setName("contained");
      contained.setPath(join(path, '.') + ".contained");
      contained.getDefinition().addType().getCode().setValue("Resource");
      contained.getDefinition().setIsModifier(false);
      contained.getDefinition().setMin(0);
      contained.getDefinition().setMax("1");
    }

    if (def instanceof BaseRuntimeElementCompositeDefinition) {
      BaseRuntimeElementCompositeDefinition<?> cdef = ((BaseRuntimeElementCompositeDefinition<?>) def);
      for (BaseRuntimeChildDefinition nextChild : cdef.getChildren()) {
        if (nextChild instanceof RuntimeChildUndeclaredExtensionDefinition) {
          continue;
        }

        BaseRuntimeDeclaredChildDefinition child = (BaseRuntimeDeclaredChildDefinition) nextChild;
        StructureElement elem = theStruct.addElement();
        fillMinAndMaxAndDefinitions(child, elem);

        if (child instanceof RuntimeChildResourceBlockDefinition) {
          RuntimeResourceBlockDefinition nextDef = (RuntimeResourceBlockDefinition) child.getSingleChildOrThrow();
          fillProfile(theStruct, elem, nextDef, path, child);
View Full Code Here

    // Scan for children
    retVal.setName(getName());
    Structure struct = retVal.addStructure();
    LinkedList<String> path = new LinkedList<String>();

    StructureElement element = struct.addElement();
    element.getDefinition().setMin(1);
    element.getDefinition().setMax("1");

    fillProfile(struct, element, def, path, null);

    retVal.getStructure().get(0).getElement().get(0).getDefinition().addType().getCode().setValue("Resource");
View Full Code Here

    theElement.setPath(StringUtils.join(path, '.'));
  }

  private void fillExtensions(Structure theStruct, LinkedList<String> path, List<RuntimeChildDeclaredExtensionDefinition> extList, String elementName, boolean theIsModifier) {
    if (extList.size() > 0) {
      StructureElement extSlice = theStruct.addElement();
      extSlice.setName(elementName);
      extSlice.setPath(join(path, '.') + '.' + elementName);
      extSlice.getSlicing().getDiscriminator().setValue("url");
      extSlice.getSlicing().setOrdered(false);
      extSlice.getSlicing().setRules(SlicingRulesEnum.OPEN);
      extSlice.getDefinition().addType().setCode(DataTypeEnum.EXTENSION);

      for (RuntimeChildDeclaredExtensionDefinition nextExt : extList) {
        StructureElement nextProfileExt = theStruct.addElement();
        nextProfileExt.getDefinition().setIsModifier(theIsModifier);
        nextProfileExt.setName(extSlice.getName());
        nextProfileExt.setPath(extSlice.getPath());
        fillMinAndMaxAndDefinitions(nextExt, nextProfileExt);
        StructureElementDefinitionType type = nextProfileExt.getDefinition().addType();
        type.setCode(DataTypeEnum.EXTENSION);
        if (nextExt.isDefinedLocally()) {
          type.setProfile(nextExt.getExtensionUrl().substring(nextExt.getExtensionUrl().indexOf('#')));
        } else {
          type.setProfile(nextExt.getExtensionUrl());
        }
      }
    } else {
      StructureElement extSlice = theStruct.addElement();
      extSlice.setName(elementName);
      extSlice.setPath(join(path, '.') + '.' + elementName);
      extSlice.getDefinition().setIsModifier(theIsModifier);
      extSlice.getDefinition().addType().setCode(DataTypeEnum.EXTENSION);
      extSlice.getDefinition().setMin(0);
      extSlice.getDefinition().setMax("*");
    }
  }
 
View Full Code Here

    fillExtensions(theStruct, path, def.getExtensionsNonModifier(), "extension", false);
    fillExtensions(theStruct, path, def.getExtensionsModifier(), "modifierExtension", true);

    if (def.getChildType() == ChildTypeEnum.RESOURCE) {
      StructureElement narrative = theStruct.addElement();
      narrative.setName("text");
      narrative.setPath(join(path, '.') + ".text");
      narrative.getDefinition().addType().setCode(DataTypeEnum.NARRATIVE);
      narrative.getDefinition().setIsModifier(false);
      narrative.getDefinition().setMin(0);
      narrative.getDefinition().setMax("1");

      StructureElement contained = theStruct.addElement();
      contained.setName("contained");
      contained.setPath(join(path, '.') + ".contained");
      contained.getDefinition().addType().getCode().setValue("Resource");
      contained.getDefinition().setIsModifier(false);
      contained.getDefinition().setMin(0);
      contained.getDefinition().setMax("1");
    }

    if (def instanceof BaseRuntimeElementCompositeDefinition) {
      BaseRuntimeElementCompositeDefinition<?> cdef = ((BaseRuntimeElementCompositeDefinition<?>) def);
      for (BaseRuntimeChildDefinition nextChild : cdef.getChildren()) {
        if (nextChild instanceof RuntimeChildUndeclaredExtensionDefinition) {
          continue;
        }

        BaseRuntimeDeclaredChildDefinition child = (BaseRuntimeDeclaredChildDefinition) nextChild;
        StructureElement elem = theStruct.addElement();
        fillMinAndMaxAndDefinitions(child, elem);

        if (child instanceof RuntimeChildResourceBlockDefinition) {
          RuntimeResourceBlockDefinition nextDef = (RuntimeResourceBlockDefinition) child.getSingleChildOrThrow();
          fillProfile(theStruct, elem, nextDef, path, child);
View Full Code Here

    // Scan for children
    retVal.setName(getName());
    Structure struct = retVal.addStructure();
    LinkedList<String> path = new LinkedList<String>();

    StructureElement element = struct.addElement();
    element.getDefinition().setMin(1);
    element.getDefinition().setMax("1");

    fillProfile(struct, element, def, path, null);

    retVal.getStructure().get(0).getElement().get(0).getDefinition().addType().getCode().setValue("Resource");
View Full Code Here

TOP

Related Classes of ca.uhn.fhir.model.dstu.resource.Profile.StructureElement

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.