new HL7Value( message.getVersion(), rootGroup.getName(), group.getName(), structure.getName(), structureNumber, names[n - 1], coordinates, types[t].getName(), description, string ); values.add( value );
public boolean evaluate(Structure obj) { return desired.equals(obj.getName()); }
public boolean evaluate(Structure obj) { return desired.equals(obj.getName()); }
public String getName() { return getDelegate().getName(); }
public String getName() { return getDelegate().getName(); }
/** * As getSegment() but will only return a group. */ public Group getGroup(String namePattern, int rep) throws HL7Exception { Structure s = getStructure(namePattern, rep); if (!Group.class.isAssignableFrom(s.getClass())) { throw new HL7Exception(s.getName() + " is not a group"); } return (Group) s; }
/** * As getSegment() but will only return a group. */ public Group getGroup(String namePattern, int rep) throws HL7Exception { Structure s = getStructure(namePattern, rep); if (!Group.class.isAssignableFrom(s.getClass())) { throw new HL7Exception(s.getName() + " is not a group"); } return (Group) s; }
public ValidationException[] apply(Message msg) { List<ValidationException> exceptions = new ArrayList<ValidationException>(); for (Iterator<Structure> iter = ReadOnlyMessageIterator .createPopulatedStructureIterator(msg, GenericSegment.class); iter.hasNext();) { String segmentName = iter.next().getName(); ValidationException ve = new ValidationException("Found unknown segment: " + segmentName); Location location = new Location().withSegmentName(segmentName); ve.setLocation(location); exceptions.add(ve); } return exceptions.toArray(new ValidationException[exceptions.size()]); }
/** * Returns the first segment with a name matching the given pattern that is a sibling of * the structure at the current location. Other parts of the message are * not searched (in contrast to findSegment). * As a special case, if the pointer is at the root, the children of the root * are searched. * @param namePattern the name of the segment to get. The wildcad * means any number * of arbitrary characters; the wildard ? one arbitrary character * (eg "P*" or "*ID" or "???" or "P??" would match on PID). * @param rep the repetition of the segment to return */ public Segment getSegment(String namePattern, int rep) throws HL7Exception { Structure s = getStructure(namePattern, rep); if (!Segment.class.isAssignableFrom(s.getClass())) { throw new HL7Exception(s.getName() + " is not a segment"); } return (Segment) s; }
public ValidationException[] apply(Message msg) { List<ValidationException> exceptions = new ArrayList<ValidationException>(); for (Iterator<Structure> iter = ReadOnlyMessageIterator .createPopulatedStructureIterator(msg, GenericSegment.class); iter.hasNext();) { String segmentName = iter.next().getName(); ValidationException ve = new ValidationException("Found unknown segment: " + segmentName); Location location = new Location().withSegmentName(segmentName); ve.setLocation(location); exceptions.add(ve); } return exceptions.toArray(new ValidationException[exceptions.size()]); }
/** * Returns the first segment with a name matching the given pattern that is a sibling of * the structure at the current location. Other parts of the message are * not searched (in contrast to findSegment). * As a special case, if the pointer is at the root, the children of the root * are searched. * @param namePattern the name of the segment to get. The wildcad * means any number * of arbitrary characters; the wildard ? one arbitrary character * (eg "P*" or "*ID" or "???" or "P??" would match on PID). * @param rep the repetition of the segment to return */ public Segment getSegment(String namePattern, int rep) throws HL7Exception { Structure s = getStructure(namePattern, rep); if (!Segment.class.isAssignableFrom(s.getClass())) { throw new HL7Exception(s.getName() + " is not a segment"); } return (Segment) s; }
/** * Returns the index of the given structure as a child of the * given parent. Returns null if the child isn't found. */ public static Index getIndex(Group parent, Structure child) { Index index = null; String[] names = parent.getNames(); findChild : for (int i = 0; i < names.length; i++) { if (names[i].startsWith(child.getName())) { try { Structure[] reps = parent.getAll(names[i]); for (int j = 0; j < reps.length; j++) { if (child.equals(reps[j])) { index = new Index(names[i], j); break findChild; } } } catch (HL7Exception e) { log.error(e.getMessage(), e); throw new Error("Internal HL7Exception finding structure index: " + e.getMessage()); } } } return index; }
/** * Returns the index of the given structure as a child of the * given parent. Returns null if the child isn't found. */ public static Index getIndex(Group parent, Structure child) { Index index = null; String[] names = parent.getNames(); findChild : for (int i = 0; i < names.length; i++) { if (names[i].startsWith(child.getName())) { try { Structure[] reps = parent.getAll(names[i]); for (int j = 0; j < reps.length; j++) { if (child.equals(reps[j])) { index = new Index(names[i], j); break findChild; } } } catch (HL7Exception e) { log.error(e.getMessage(), e); throw new Error("Internal HL7Exception finding structure index: " + e.getMessage()); } } } return index; }
boolean contains = false; if (Segment.class.isAssignableFrom(s.getClass())) { if (s.getName().equals(name)) contains = true; } else { Group g = (Group) s;
boolean contains = false; if (Segment.class.isAssignableFrom(s.getClass())) { if (s.getName().equals(name)) contains = true; } else { Group g = (Group) s;
/** * Returns true if another object exists in the iteration sequence. */ public boolean hasNext() { boolean has = true; if (next == null) { if (Group.class.isAssignableFrom(currentStructure.getClass())) { groupNext((Group) currentStructure); } else { Group parent = currentStructure.getParent(); Index i = getIndex(parent, currentStructure); Position currentPosition = new Position(parent, i); try { if (parent.isRepeating(i.name) && currentStructure.getName().equals(direction)) { nextRep(currentPosition); } else { has = nextPosition(currentPosition, this.direction, this.handleUnexpectedSegments); } } catch (HL7Exception e) { throw new Error("HL7Exception arising from bad index: " + e.getMessage()); } } } log.debug("MessageIterator.hasNext() in direction {}? {}", direction, has); return has; }
/** * Returns true if another object exists in the iteration sequence. */ public boolean hasNext() { boolean has = true; if (next == null) { if (Group.class.isAssignableFrom(currentStructure.getClass())) { groupNext((Group) currentStructure); } else { Group parent = currentStructure.getParent(); Index i = getIndex(parent, currentStructure); Position currentPosition = new Position(parent, i); try { if (parent.isRepeating(i.name) && currentStructure.getName().equals(direction)) { nextRep(currentPosition); } else { has = nextPosition(currentPosition, this.direction, this.handleUnexpectedSegments); } } catch (HL7Exception e) { throw new Error("HL7Exception arising from bad index: " + e.getMessage()); } } } log.debug("MessageIterator.hasNext() in direction {}? {}", direction, has); return has; }
/** * Returns the first matching structure AFTER the current position */ private Structure findStructure(String namePattern, int rep) throws HL7Exception { Structure s = null; while (s == null) { String currentNameInParent = iterate(false, false); String currentName = getCurrentStructure(0).getName(); if (matches(namePattern, currentName) || matches(namePattern, currentNameInParent)) { s = getCurrentStructure(rep); } } return s; }
/** * Returns the first matching structure AFTER the current position */ private Structure findStructure(String namePattern, int rep) throws HL7Exception { Structure s = null; while (s == null) { String currentNameInParent = iterate(false, false); String currentName = getCurrentStructure(0).getName(); if (matches(namePattern, currentName) || matches(namePattern, currentNameInParent)) { s = getCurrentStructure(rep); } } return s; }
private StructureDefinition createStructureDefinition(Structure theStructure, Holder<StructureDefinition> thePreviousLeaf, String theStructureName) throws HL7Exception { retVal.setName(theStructure.getName());