Package model

Examples of model.Message


   * fillDetails().
   */
  public Message processMessage(Message in) throws ApplicationException {
    try {
      // get default ACK
      Message out = makeACK(in);
      fillDetails(out);
      return out;
    } catch (Exception e) {
      throw new ApplicationException("Couldn't create response message: "
          + e.getMessage());
View Full Code Here


              + inboundHeader.getName() + ")");

    // make ACK of correct version
    Class<? extends Message> clazz = null;
    try {
      Message inbound = inboundHeader.getMessage();
      Parser p = inbound.getParser();
      ModelClassFactory mcf = p != null ? p.getFactory() : new DefaultModelClassFactory();
      String version = inbound.getVersion();
      if (version == null)
        version = "2.4"; // TODO: This should be set dynamically based on available HL7 version
      clazz = mcf.getMessageClass("ACK", version, false);
      Message out = clazz.newInstance();
      Terser terser = new Terser(out);

      // populate outbound MSH using data from inbound message ...
      Segment outHeader = (Segment) out.get("MSH");
      fillResponseHeader(inboundHeader, outHeader);

      terser.set("/MSH-9-1", "ACK");
      terser.set("/MSH-9-2", Terser.get(inboundHeader, 9, 0, 2, 1));
      terser.set("/MSH-12", Terser.get(inboundHeader, 12, 0, 1, 1));
View Full Code Here

     */
    protected Message doParse(String message, String version) throws HL7Exception, EncodingNotSupportedException {

        // try to instantiate a message object of the right class
        MessageStructure structure = getStructure(message);
        Message m = instantiateMessage(structure.messageStructure, version, structure.explicitlyDefined);

        parse(m, message);

        return m;
    }
View Full Code Here

     */
    protected Message doParseForSpecificPackage(String message, String version, String packageName) throws HL7Exception, EncodingNotSupportedException {

        // try to instantiate a message object of the right class
        MessageStructure structure = getStructure(message);
        Message m = instantiateMessageInASpecificPackage(structure.messageStructure, version, structure.explicitlyDefined, packageName);

        parse(m, message);

        return m;
    }
View Full Code Here

       
        if (clazz.isAnnotationPresent(DoNotCacheStructure.class)) {
            Holder<StructureDefinition> previousLeaf = new Holder<StructureDefinition>();
            retVal = createStructureDefinition(theMessage, previousLeaf);
        } else {
          Message message = ReflectionUtil.instantiateMessage(clazz, getFactory());
          Holder<StructureDefinition> previousLeaf = new Holder<StructureDefinition>();
          retVal = createStructureDefinition(message, previousLeaf);
          myStructureDefinitions.put(clazz, retVal);
        }
       
View Full Code Here

     * @throws EncodingNotSupportedException if the message encoded
     *     is not supported by this parser.
     */
    protected Message doParse(String message, String version) throws HL7Exception, EncodingNotSupportedException {
        Parser parser = getAppropriateParser(message);
    Message retVal = parser.doParse(message, version);
    return retVal;
    }
View Full Code Here

    /**
   * {@inheritDoc}
   */
  @Override
  public Message parse(String theMessage) throws HL7Exception, EncodingNotSupportedException {
    Message retVal = super.parse(theMessage);
    Parser parser = getAppropriateParser(theMessage);
    retVal.setParser(parser);
    return retVal;
  }
View Full Code Here

        "AL1|1||^PORK^|\r" +
        "AL1|2||^PENICILLIN^|";
   
    GenericParser parser = new GenericParser();
    parser.setValidationContext(ValidationContextFactory.noValidation());
    Message msg = parser.parse(msgString);
    System.out.println(msg.getClass().getName());
     
  }
View Full Code Here

          + version + "' - version not recognized",
          HL7Exception.UNSUPPORTED_VERSION_ID);
    }

    myValidator.validate(message, encoding.equals("XML"), version);
    Message result = doParse(message, version);
    myValidator.validate(result);

    result.setParser(this);

    return result;
  }
View Full Code Here

          HL7Exception.UNSUPPORTED_VERSION_ID);
    }

    myValidator.validate(message, encoding.equals("XML"), version);

    Message result = doParseForSpecificPackage(message, version,
        packageName);

    myValidator.validate(result);

    result.setParser(this);

    return result;
  }
View Full Code Here

TOP

Related Classes of model.Message

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.