Package ca.uhn.hl7v2.model

Examples of ca.uhn.hl7v2.model.Structure


        clearNext();
        return currentStructure;
    }

    private Structure navigateToStructure(List<Position> theDefinitionPath) throws Error {
        Structure currentStructure = null;
        for (Position next : theDefinitionPath) {
            if (currentStructure == null) {
                currentStructure = myMessage;
            } else {
                try {
View Full Code Here


    public Object next() {
        if (!hasNext()) {
            throw new NoSuchElementException("No more nodes in message");
        }
       
        Structure next = (Structure) myRemaining.remove(myRemaining.size() - 1);
       
        if (next instanceof Group) {
            addChildren((Group) next);
        }
       
View Full Code Here

                log.debug("Parsing segment " + name);

                messageIter.setDirection(name);
                FilterIterator.Predicate byDirection = new FilterIterator.Predicate() {
                    public boolean evaluate(Object obj) {
                        Structure s = (Structure) obj;
                        log.debug("PipeParser iterating message in direction " + name + " at " + s.getName());
                        if (s.getName().matches(name + "\\d*")) {
                            return true;
                        } else {
                            return false;
                        }
                    }
View Full Code Here

    public static boolean matchExistsAfterPosition(Position pos, String name, boolean firstDescendentsOnly, boolean upToFirstRequired) throws HL7Exception {
        boolean matchExists = false;
       
        //check next rep of self (if any)
        if (pos.parent.isRepeating(pos.index.name)) {           
            Structure s = pos.parent.get(pos.index.name, pos.index.rep);
            matchExists = contains(s, name, firstDescendentsOnly, upToFirstRequired);
        }
       
        //check later siblings (if any)
        if (!matchExists) {
View Full Code Here

        String newIndexName;
        int i=1;
        try  {
          for (i = 1; i < reps.size(); i++) {
            newIndexName = childName+(i+1);
            Structure st = groupObject.get(newIndexName);
            parseRep(reps.get(i), st);
          }
        } catch(Throwable t) {
          log.info("Issue Parsing: " + t);
          newIndexName = groupObject.addNonstandardSegment(childName);
View Full Code Here

        }
        childNames = ((SuperStructure) theStructure).getChildNamesForStructure(struct);
      }
     
      for (String nextName : childNames) {
        Structure nextChild = group.get(nextName);
        StructureDefinition structureDefinition = createStructureDefinition(nextChild, thePreviousLeaf, theStructureName);
        structureDefinition.setNameAsItAppearsInParent(nextName);
        structureDefinition.setRepeating(group.isRepeating(nextName));
        structureDefinition.setRequired(group.isRequired(nextName));
        structureDefinition.setChoiceElement(group.isChoiceElement(nextName));
View Full Code Here

                log.debug("Parsing segment {}", name);

                messageIter.setDirection(name);
                FilterIterator.Predicate<Structure> byDirection = new FilterIterator.Predicate<Structure>() {
                    public boolean evaluate(Structure obj) {
                        Structure s = (Structure) obj;
                        log.debug("PipeParser iterating message in direction {} at {} ", name, s.getName());
                        return s.getName().matches(name + "\\d*");
                    }
                };
                FilterIterator<Structure> dirIter = new FilterIterator<Structure>(segmentIter, byDirection);
                if (dirIter.hasNext()) {
                    parse((Segment) dirIter.next(), segments[i], getEncodingChars(string));
View Full Code Here

    /**
     * Creates a new ADT_AXX message with DefaultModelClassFactory.
     */
    public ADT_AXX() {
       this(new DefaultModelClassFactory());
    }
View Full Code Here

                handleException("Error on writing HL7 Error to output stream", e);
            }
        } else {
            try {
                String xmlFormat = omElement.toString();
                Message message = new DefaultXMLParser().parse(xmlFormat);
                String msg = new PipeParser().encode(message);
                if (log.isDebugEnabled()) {
                    log.debug("Message inside the formatter : " + message);
                }
                outputStream.write(msg.getBytes());
View Full Code Here

     * Serialize HL7 message to XML
     * @param rowHL7
     * @return XML String
     */
    private String serializeHL7toXML(String rowHL7) {
        Parser xmlParser = new DefaultXMLParser();
        Parser ediParser = new PipeParser();
        ediParser.setValidationContext(new NoValidation());
        String xmlDoc = null;
        try {
            Message message = ediParser.parse(rowHL7);
            ConformanceProfileRule rule = new ConformanceProfileRule();
        ValidationException[] exs = rule.test(message);
        if (exs != null && exs.length > 0) {
          throw new HL7Exception(exs[0].getMessage());
       
            if(log.isDebugEnabled()){
                log.debug("HL7 parsing completed." + message);
            }
            xmlDoc = xmlParser.encode(message);
        } catch (HL7Exception e) {
            handleException("Error on converting to HL7",e);
        }
        return xmlDoc;
    }
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.model.Structure

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.