public HapiField(final Type type) { this.value = PipeParser.encode(type, EncodingCharacters.defaultInstance()); final List<HL7Component> componentList = new ArrayList<>(); if (type instanceof Composite) { final Composite composite = (Composite) type; for (final Type component : composite.getComponents()) { componentList.add(new HapiField(component)); } } final ExtraComponents extra = type.getExtraComponents(); if (extra != null && extra.numComponents() > 0) { final String singleFieldValue; if (type instanceof Primitive) { singleFieldValue = ((Primitive) type).getValue(); } else { singleFieldValue = this.value; } componentList.add(new SingleValueField(singleFieldValue)); for (int i = 0; i < extra.numComponents(); i++) { componentList.add(new HapiField(extra.getComponent(i))); } } this.components = Collections.unmodifiableList(componentList); }
@Override public Variable getComponent(int comp) { if (comp >= numComponents()) { throw new IllegalArgumentException(String.format( "Extra Component with index %d is not available and cannot be added to unmodifiable type", comp)); } return unmodifiableType(delegate.getComponent(comp)); }
@Override public Variable getComponent(int comp) { if (comp >= numComponents()) { throw new IllegalArgumentException(String.format( "Extra Component with index %d is not available and cannot be added to unmodifiable type", comp)); } return unmodifiableType(delegate.getComponent(comp)); }
NodeList matchingElements = datatypeElement.getElementsByTagNameNS(NS, makeElementName(datatypeObject, children.length + nextExtraCmpIndex + 1)); if (matchingElements.getLength() > 0) { parse(datatypeObject.getExtraComponents().getComponent(nextExtraCmpIndex), (Element) matchingElements.item(0)); foundExtraComponent = true;
NodeList matchingElements = datatypeElement.getElementsByTagNameNS(NS, makeElementName(datatypeObject, children.length + nextExtraCmpIndex + 1)); if (matchingElements.getLength() > 0) { parse(datatypeObject.getExtraComponents().getComponent(nextExtraCmpIndex), (Element) matchingElements.item(0)); foundExtraComponent = true;
return type.getExtraComponents().getComponent(comp - numStandardComponents(type) - 1);
return type.getExtraComponents().getComponent(comp - numStandardComponents(type) - 1);
if (index != -1) { String nextSubComponent = string.substring(prevIndex, index); getExtraComponents().getComponent(getExtraComponents().numComponents()).parse(nextSubComponent); } else { String nextSubComponent = string.substring(prevIndex); if (nextSubComponent.length() > 0) { getExtraComponents().getComponent(getExtraComponents().numComponents()).parse(nextSubComponent);
if (index != -1) { String nextSubComponent = string.substring(prevIndex, index); getExtraComponents().getComponent(getExtraComponents().numComponents()).parse(nextSubComponent); } else { String nextSubComponent = string.substring(prevIndex); if (nextSubComponent.length() > 0) { getExtraComponents().getComponent(getExtraComponents().numComponents()).parse(nextSubComponent);
public boolean accept(MessageVisitor visitor, Location location) throws HL7Exception { if (visitor.start(this, location)) { Type[] types = getComponents(); for (int i = 0; i < types.length; i++) { Type t = getComponent(i); Location nextLocation = t.provideLocation(location, i + 1, location.getFieldRepetition()); if (!t.accept(visitor, nextLocation)) break; } ExtraComponents ec = getExtraComponents(); for (int i = 0; i < ec.numComponents(); i++) { Variable v = ec.getComponent(i); Location nextLocation = v.provideLocation(location, i + types.length, -1); if (!v.accept(visitor, nextLocation)) break; } } return visitor.end(this, location); }
public boolean accept(MessageVisitor visitor, Location location) throws HL7Exception { if (visitor.start(this, location)) { Type[] types = getComponents(); for (int i = 0; i < types.length; i++) { Type t = getComponent(i); Location nextLocation = t.provideLocation(location, i + 1, location.getFieldRepetition()); if (!t.accept(visitor, nextLocation)) break; } ExtraComponents ec = getExtraComponents(); for (int i = 0; i < ec.numComponents(); i++) { Variable v = ec.getComponent(i); Location nextLocation = v.provideLocation(location, i + types.length, -1); if (!v.accept(visitor, nextLocation)) break; } } return visitor.end(this, location); }
ST extraSubcomponent = new ST(message); extraSubcomponent.setValue("MDT"); observationIdentifier.getExtraComponents().getComponent(0).setData(extraSubcomponent );