final String componentKey = componentEntry.getKey(); final Type component = componentEntry.getValue(); final String componentValue = HL7_ESCAPING.unescape(component.encode(), HL7_ENCODING); if (!StringUtils.isEmpty(componentValue)) { attributes.put(componentKey, componentValue); final String fieldValue = HL7_ESCAPING.unescape(field.encode(), HL7_ENCODING); if (!StringUtils.isEmpty(fieldValue)) { attributes.put(fieldKey, fieldValue);
private static boolean isTimestamp(final Type field) throws HL7Exception { if (isEmpty(field)) { return false; } final String fieldName = field.getName(); return (fieldName.equals("TS") || fieldName.equals("DT") || fieldName.equals("TM")); }
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); }
/** * {@inheritDoc } */ public boolean isEmpty() throws HL7Exception { return data.isEmpty(); }
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); }
/** * {@inheritDoc } */ public void clear() { data.clear(); }
public Message getMessage() { return unmodifiableMessage(getDelegate().getMessage()); }
public boolean accept(MessageVisitor visitor, Location currentLocation) throws HL7Exception { return data.accept(visitor, currentLocation); }
public Location provideLocation(Location location, int index, int repetition) { return data.provideLocation(location, index, repetition); }
/** * {@inheritDoc } */ public boolean isEmpty() throws HL7Exception { return data.isEmpty(); }
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); }
/** * {@inheritDoc } */ public void clear() { data.clear(); }
public Message getMessage() { return unmodifiableMessage(getDelegate().getMessage()); }
public boolean accept(MessageVisitor visitor, Location currentLocation) throws HL7Exception { return data.accept(visitor, currentLocation); }
public Location provideLocation(Location location, int index, int repetition) { return data.provideLocation(location, index, repetition); }
final Type type = types[i]; if (!isEmpty(type)) { String fieldName = field.getName(); if (fieldName.equals("CM_MSG")) { fieldName = "CM";
public String encode() throws HL7Exception { return getDelegate().encode(); }
public ExtraComponents getExtraComponents() { return this.data.getExtraComponents(); }
/** * @see ca.uhn.hl7v2.model.Segment#isEmpty() */ public boolean isEmpty() throws HL7Exception { for (int i = 1; i <= numFields(); i++) { Type[] types = getField(i); for (Type type : types) { if (!type.isEmpty()) return false; } } return true; }
@Override public void clear() { super.clear(); for (Type component : getComponents()) { component.clear(); } }