public BaseRuntimeElementDefinition<?> getSingleChildOrThrow() { if (getValidChildNames().size() != 1) { throw new IllegalStateException("This child has " + getValidChildNames().size() + " children, expected 1. This is a HAPI bug. Found: " + getValidChildNames()); } return getChildByName(getValidChildNames().iterator().next()); }
int unknownCount = 0; for (BaseRuntimeDeclaredChildDefinition nextEntry : orderToElementDef.values()) { if (!forcedOrder.containsKey(nextEntry.getElementName())) { newOrderToExtensionDef.put(unknownCount, nextEntry); unknownCount++; if (forcedOrder.containsKey(nextEntry.getElementName())) { Integer newOrder = forcedOrder.get(nextEntry.getElementName()); newOrderToExtensionDef.put(newOrder + unknownCount, nextEntry);
private String determineSystemIfMissing(String theParamName, String code, String theSystem) { String retVal = theSystem; if (retVal == null) { RuntimeResourceDefinition resourceDef = myContext.getResourceDefinition(myResourceName); RuntimeSearchParam param = mySearchParamRegistry.getSearchParamByName(resourceDef, theParamName); if (param != null) { Set<String> valueSetUris = Sets.newHashSet(); for (String nextPath : param.getPathsSplit()) { BaseRuntimeChildDefinition def = myContext.newTerser().getDefinition(myResourceType, nextPath); if (def instanceof BaseRuntimeDeclaredChildDefinition) { String valueSet = ((BaseRuntimeDeclaredChildDefinition) def).getBindingValueSet(); if (isNotBlank(valueSet)) { valueSetUris.add(valueSet); } } } if (valueSetUris.size() == 1) { String valueSet = valueSetUris.iterator().next(); List<VersionIndependentConcept> candidateCodes = myTerminologySvc.expandValueSet(valueSet); for (VersionIndependentConcept nextCandidate : candidateCodes) { if (nextCandidate.getCode().equals(code)) { retVal = nextCandidate.getSystem(); break; } } } } } return retVal; }
BaseRuntimeDeclaredChildDefinition nextDef = nextEntry.getValue(); if (nextDef instanceof RuntimeChildDeclaredExtensionDefinition) { if (nextDef.getExtensionUrl().equals(extensionAttr.url())) { orderIsReplaceParent = true; order = nextEntry.getKey(); if (elementName.equals(nextDef.getElementName())) { orderIsReplaceParent = true; order = nextEntry.getKey(); throw new ConfigurationException("Detected duplicate field order '" + childAnnotation.order() + "' for element named '" + elementName + "' in type '" + declaringClass.getCanonicalName() + "' - Already had: " + orderMap.get(order).getElementName()); if (bindingAnnotation != null) { if (isNotBlank(bindingAnnotation.valueSet())) { def.setBindingValueSet(bindingAnnotation.valueSet());
private void fillMinAndMaxAndDefinitions(BaseRuntimeDeclaredChildDefinition child, StructureElement elem) { elem.getDefinition().setMin(child.getMin()); if (child.getMax() == Child.MAX_UNLIMITED) { elem.getDefinition().setMax("*"); } else { elem.getDefinition().setMax(Integer.toString(child.getMax())); } if (isNotBlank(child.getShortDefinition())) { elem.getDefinition().getShort().setValue(child.getShortDefinition()); } if (isNotBlank(child.getFormalDefinition())) { elem.getDefinition().getFormal().setValue(child.getFormalDefinition()); } }
RuntimeResourceBlockDefinition nextDef = (RuntimeResourceBlockDefinition) child.getSingleChildOrThrow(); fillProfile(theStruct, elem, nextDef, path, child, theServerBase); } else if (child instanceof RuntimeChildContainedResources) { throw new IllegalStateException("Unexpected child type: " + child.getClass().getCanonicalName()); } else if (child instanceof RuntimeChildCompositeDatatypeDefinition || child instanceof RuntimeChildPrimitiveDatatypeDefinition || child instanceof RuntimeChildChoiceDefinition || child instanceof RuntimeChildResourceDefinition) { Iterator<String> childNamesIter = child.getValidChildNames().iterator(); String nextName = childNamesIter.next(); BaseRuntimeElementDefinition<?> nextDef = child.getChildByName(nextName); fillBasics(elem, nextDef, path, child); fillName(elem, nextDef, theServerBase); while (childNamesIter.hasNext()) { nextDef = child.getChildByName(childNamesIter.next()); fillName(elem, nextDef, theServerBase);
BaseRuntimeDeclaredChildDefinition nextDef = nextEntry.getValue(); if (nextDef instanceof RuntimeChildDeclaredExtensionDefinition) { if (nextDef.getExtensionUrl().equals(extensionAttr.url())) { orderIsReplaceParent = true; order = nextEntry.getKey(); if (elementName.equals(nextDef.getElementName())) { orderIsReplaceParent = true; order = nextEntry.getKey(); throw new ConfigurationException("Detected duplicate field order '" + childAnnotation.order() + "' for element named '" + elementName + "' in type '" + declaringClass.getCanonicalName() + "' - Already had: " + orderMap.get(order).getElementName()); if (bindingAnnotation != null) { if (isNotBlank(bindingAnnotation.valueSet())) { def.setBindingValueSet(bindingAnnotation.valueSet());
public BaseRuntimeElementDefinition<?> getSingleChildOrThrow() { if (getValidChildNames().size() != 1) { throw new IllegalStateException("This child has " + getValidChildNames().size() + " children, expected 1. This is a HAPI bug. Found: " + getValidChildNames()); } return getChildByName(getValidChildNames().iterator().next()); }
private void fillBasics(StructureElement theElement, BaseRuntimeElementDefinition<?> def, LinkedList<String> path, BaseRuntimeDeclaredChildDefinition theChild) { if (path.isEmpty()) { path.add(def.getName()); theElement.setName(def.getName()); } else { path.add(WordUtils.uncapitalize(theChild.getElementName())); theElement.setName(theChild.getElementName()); } theElement.setPath(StringUtils.join(path, '.')); }
private String determineSystemIfMissing(String theParamName, String code, String theSystem) { String retVal = theSystem; if (retVal == null) { RuntimeResourceDefinition resourceDef = myContext.getResourceDefinition(myResourceName); RuntimeSearchParam param = mySearchParamRegistry.getSearchParamByName(resourceDef, theParamName); if (param != null) { Set<String> valueSetUris = Sets.newHashSet(); for (String nextPath : param.getPathsSplit()) { BaseRuntimeChildDefinition def = myContext.newTerser().getDefinition(myResourceType, nextPath); if (def instanceof BaseRuntimeDeclaredChildDefinition) { String valueSet = ((BaseRuntimeDeclaredChildDefinition) def).getBindingValueSet(); if (isNotBlank(valueSet)) { valueSetUris.add(valueSet); } } } if (valueSetUris.size() == 1) { String valueSet = valueSetUris.iterator().next(); List<VersionIndependentConcept> candidateCodes = myTerminologySvc.expandValueSet(valueSet); for (VersionIndependentConcept nextCandidate : candidateCodes) { if (nextCandidate.getCode().equals(code)) { retVal = nextCandidate.getSystem(); break; } } } } } return retVal; }
int unknownCount = 0; for (BaseRuntimeDeclaredChildDefinition nextEntry : orderToElementDef.values()) { if (!forcedOrder.containsKey(nextEntry.getElementName())) { newOrderToExtensionDef.put(unknownCount, nextEntry); unknownCount++; if (forcedOrder.containsKey(nextEntry.getElementName())) { Integer newOrder = forcedOrder.get(nextEntry.getElementName()); newOrderToExtensionDef.put(newOrder + unknownCount, nextEntry);