public static List<HL7Value> extractValues( Message message ) throws Exception { Terser terser = new Terser( message ); SegmentFinder finder = terser.getFinder(); List<HL7Value> values = new ArrayList<HL7Value>(); int childNr = 1; while ( finder.hasNextChild() ) { // next group in the message (MSH, PID, EVN and so on) // finder.nextChild(); Structure[] structures = finder.getCurrentChildReps(); for ( int i = 0; i < structures.length; i++ ) { Structure structure = structures[i]; parseStructure( values, message, terser, structure, Integer.toString( childNr ) ); } childNr++; } return values; }
Type[] types = segment.getField( n ); for ( int t = 0; t < types.length; t++ ) { int nrComponents = Terser.numComponents( types[t] ); for ( int c = 1; c <= nrComponents; c++ ) { int nrSub = Terser.numSubComponents( types[t], c ); for ( int sc = 1; sc <= nrSub; sc++ ) { String string = Terser.get( segment, n, t, c, sc );
private String[] getCurrentValues(String[] thePaths) throws HL7Exception { String[] paths = composePaths(thePaths); String[] values = new String[paths.length]; for (int i = 0; i < paths.length; i++) { values[i] = myTerser.get(paths[i]); if (values[i] == null) { values[i] = ""; } } return values; }
/** * @return structure of the message, e.g. '2.5.1' */ public static String messageVersion(Terser t) throws HL7Exception { return t.get("/MSH-12-1"); }
/** * @param theRoot root of depth first iteration, which starts with the first child * @param c structure class to look for * @return an iterator that skips all structures that do not match the parameter */ public static Iterator<Structure> createPopulatedStructureIterator(Group theRoot, Class<? extends Structure> c) { return createPopulatedStructureIterator(theRoot, new StructurePredicate(c)); }
/** * @param theRoot root of depth first iteration, which starts with the first child * @param structureName structure name to look for * @return an iterator that skips all structures that do not match the parameter */ public static Iterator<Structure> createPopulatedStructureIterator(Group theRoot, String structureName) { return createPopulatedStructureIterator(theRoot, new StructureNamePredicate(structureName)); }
/** * A convenience method that returns an interface code from an underlying * CodeMapper instance by calling <code>CodeMapper.getInstance().getInterfaceCode(...)</code> */ public static String getInt(String interfaceName, int hl7Table, String localCode) throws HL7Exception { return CodeMapper.getInstance().getInterfaceCode(interfaceName, hl7Table, localCode); }
/** * {@inheritDoc} */ public boolean hasNext() { return myWrapped.hasNext(); }
/** * A convenience method that returns a local code from an underlying * CodeMapper instance by calling <code>CodeMapper.getInstance().getLocalCode(...)</code> */ public static String getLocal(String interfaceName, int hl7Table, String interfaceCode) throws HL7Exception { return CodeMapper.getInstance().getLocalCode(interfaceName, hl7Table, interfaceCode); }
/** * Constructor * * @param theReader * The reader to read from * @param theHapiContext * The HapiContext from which to obtain the parser */ public Hl7InputStreamMessageIterator(Reader theReader, HapiContext theHapiContext) { super(theHapiContext); myWrapped = new Hl7InputStreamMessageStringIterator(theReader); }
public Position(Group parent, String name, int rep) { this.parent = parent; this.index = new Index(name, rep); } public Position(Group parent, Index i) {
public boolean hasNext() { if (nextObjectSet) { return true; } else { return setNextObject(); } }
private int[] getMaxNumEmpty(String[] theLoopPoints) { int[] retVal = new int[theLoopPoints.length]; for (int i = 0; i < theLoopPoints.length; i++) { retVal[i] = getMaxNumEmpty(theLoopPoints[i]); } return retVal; }
private boolean referencesLoop(String theFieldPath, int theLoopPoint) { String path = theFieldPath; int lp; while ((lp = getLoopPointReference(path)) >= 0) { if (lp == theLoopPoint) { return true; } else { path = myLoopPoints[lp]; } } return false; }
public AcceptorThread(int port, boolean tls, ExecutorService service, BlockingQueue<AcceptedSocket> queue, SocketFactory socketFactory) { super("Socket Acceptor", service); this.port = port; this.queue = queue; this.tls = tls; if (socketFactory == null) { socketFactory = new StandardSocketFactory(); } this.socketFactory = socketFactory; }
/** * Returns a singleton instance of CodeMapper. This is currently * a FileCodeMapper by default. */ public synchronized static CodeMapper getInstance() throws HL7Exception { if (codeMapper == null) { //create new file code mapper codeMapper = new FileCodeMapper(); } return codeMapper; }
private String[] getCurrentValues(String[] thePaths) throws HL7Exception { String[] paths = composePaths(thePaths); String[] values = new String[paths.length]; for (int i = 0; i < paths.length; i++) { values[i] = myTerser.get(paths[i]); if (values[i] == null) { values[i] = ""; } } return values; }
/** * @param theRoot root of depth first iteration, which starts with the first child * @param c structure class to look for * @return an iterator that skips all structures that do not match the parameter */ public static Iterator<Structure> createPopulatedStructureIterator(Group theRoot, Class<? extends Structure> c) { return createPopulatedStructureIterator(theRoot, new StructurePredicate(c)); }
/** * @param theRoot root of depth first iteration, which starts with the first child * @param structureName structure name to look for * @return an iterator that skips all structures that do not match the parameter */ public static Iterator<Structure> createPopulatedStructureIterator(Group theRoot, String structureName) { return createPopulatedStructureIterator(theRoot, new StructureNamePredicate(structureName)); }
/** * A convenience method that returns an interface code from an underlying * CodeMapper instance by calling <code>CodeMapper.getInstance().getInterfaceCode(...)</code> */ public static String getInt(String interfaceName, int hl7Table, String localCode) throws HL7Exception { return CodeMapper.getInstance().getInterfaceCode(interfaceName, hl7Table, localCode); }