Tabnine Logo
Message.generateACK
Code IndexAdd Tabnine to your IDE (free)

How to use
generateACK
method
in
ca.uhn.hl7v2.model.Message

Best Java code snippets using ca.uhn.hl7v2.model.Message.generateACK (Showing top 20 results out of 315)

origin: pentaho/pentaho-kettle

parser.setValidationContext( validationContext );
Message msg = parser.parse( message );
Message ack = msg.generateACK();
origin: org.openehealth.ipf.commons/ipf-commons-ihe-hl7v2

/**
 * Generates an HL7v2 NAK response message on the basis
 * of the thrown exception and the original HAPI request message.
 *
 * @param exception       thrown exception.
 * @param originalMessage original HAPI request message.
 * @param ackTypeCode     HL7v2 acknowledgement type code.
 */
public Message createNak(Message originalMessage, HL7Exception exception, AcknowledgmentCode ackTypeCode) throws HL7Exception, IOException {
  return originalMessage.generateACK(ackTypeCode, exception);
}
origin: org.openehealth.ipf.commons/ipf-commons-ihe-hl7v2

/**
 * Generates a transaction-specific HL7v2 ACK response message on the basis
 * of the original HAPI request message.
 *
 * @param originalMessage original HAPI request message.
 */
public Message createAck(Message originalMessage) throws HL7Exception, IOException {
  return originalMessage.generateACK(useCAckTypeCodes ? AcknowledgmentCode.CA : AcknowledgmentCode.AA, null);
}
origin: ca.uhn.hapi/hapi-base

/**
 * Creates an ACK message with the minimum required information from an
 * inbound message. Optional fields can be filled in afterwards, before the
 * message is returned. Please note that MSH-10, the outbound message
 * control ID, is also set using the class
 * <code>ca.uhn.hl7v2.util.MessageIDGenerator</code>. Also note that the ACK
 * messages returned is the same version as the version stated in the
 * inbound MSH if there is a generic ACK for that version, otherwise a
 * version 2.4 ACK is returned. MSA-1 is set to AA by default.
 * 
 * @param message message
 *            the MSH segment if the inbound message
 * 
 * @deprecated use {@link Message#generateACK()}
 */
public static Message makeACK(Message message) throws HL7Exception, IOException {
  return message.generateACK();
}

origin: ca.uhn.hapi/hapi-osgi-base

/**
 * Creates an ACK message with the minimum required information from an
 * inbound message. Optional fields can be filled in afterwards, before the
 * message is returned. Please note that MSH-10, the outbound message
 * control ID, is also set using the class
 * <code>ca.uhn.hl7v2.util.MessageIDGenerator</code>. Also note that the ACK
 * messages returned is the same version as the version stated in the
 * inbound MSH if there is a generic ACK for that version, otherwise a
 * version 2.4 ACK is returned. MSA-1 is set to AA by default.
 * 
 * @param message message
 *            the MSH segment if the inbound message
 * 
 * @deprecated use {@link Message#generateACK()}
 */
public static Message makeACK(Message message) throws HL7Exception, IOException {
  return message.generateACK();
}

origin: ca.uhn.hapi/hapi-osgi-base

public Message processMessage(Message theMessage, Map<String, Object> theMetadata) throws ReceivingApplicationException {
  try {
    if (myMessage != null) {
      return theMessage.generateACK(myAcknowledgmentCode, new HL7Exception(myMessage));
    } else {
      return theMessage.generateACK(myAcknowledgmentCode, null);
    }
  } catch (Exception e) {
    throw new ReceivingApplicationException("Couldn't create response message: "
        + e.getMessage());
  }
}
origin: ca.uhn.hapi/hapi-base

public Message processMessage(Message theMessage, Map<String, Object> theMetadata) throws ReceivingApplicationException {
  try {
    if (myMessage != null) {
      return theMessage.generateACK(myAcknowledgmentCode, new HL7Exception(myMessage));
    } else {
      return theMessage.generateACK(myAcknowledgmentCode, null);
    }
  } catch (Exception e) {
    throw new ReceivingApplicationException("Couldn't create response message: "
        + e.getMessage());
  }
}
origin: ca.uhn.hapi/hapi-base

public Message generateACK() throws HL7Exception, IOException {
  return getDelegate().generateACK();
}
origin: ca.uhn.hapi/hapi-base

public Message generateACK(AcknowledgmentCode theAcknowlegementCode, HL7Exception theException) throws HL7Exception, IOException {
  return getDelegate().generateACK(theAcknowlegementCode, theException);
}
origin: ca.uhn.hapi/hapi-osgi-base

public Message generateACK(String theAcknowlegementCode, HL7Exception theException) throws HL7Exception, IOException {
  return getDelegate().generateACK(theAcknowlegementCode, theException);
}
origin: ca.uhn.hapi/hapi-base

public Message generateACK(String theAcknowlegementCode, HL7Exception theException) throws HL7Exception, IOException {
  return getDelegate().generateACK(theAcknowlegementCode, theException);
}
origin: ca.uhn.hapi/hapi-osgi-base

public Message generateACK() throws HL7Exception, IOException {
  return getDelegate().generateACK();
}
origin: ca.uhn.hapi/hapi-osgi-base

public Message generateACK(AcknowledgmentCode theAcknowlegementCode, HL7Exception theException) throws HL7Exception, IOException {
  return getDelegate().generateACK(theAcknowlegementCode, theException);
}
origin: ca.uhn.hapi/hapi-base

/**
 * @deprecated use {@link Message#generateACK()}
 */
public static Message makeACK(Segment inboundHeader) throws HL7Exception,
    IOException {
  // Make sure that the referenced message is not just a dummy
  DeepCopy.copy(inboundHeader, (Segment)inboundHeader.getMessage().get("MSH"));
  return inboundHeader.getMessage().generateACK();
}
origin: ca.uhn.hapi/hapi-osgi-base

/**
 * @deprecated use {@link Message#generateACK()}
 */
public static Message makeACK(Segment inboundHeader) throws HL7Exception,
    IOException {
  // Make sure that the referenced message is not just a dummy
  DeepCopy.copy(inboundHeader, (Segment)inboundHeader.getMessage().get("MSH"));
  return inboundHeader.getMessage().generateACK();
}
origin: ca.uhn.hapi/hapi-base

if (out == null) {
  Message in = getInMessage(inHeader);
  out = in.generateACK(defaultAcknowledgementMode, hl7e);
origin: ca.uhn.hapi/hapi-osgi-base

/**
 * Generates an empty response message. This class generates an
 * ACKnowledgement using the code returned by {@link #getSuccessAcknowledgementCode()}.
 * 
 * @param request request message, either a {@link String} or a
 *            {@link Message}
 * @return acknowledgment to the request
 * @throws HL7Exception
 */
protected Message generateResponseMessage(Object request) throws HL7Exception {
  try {
    Message in;
    if (request instanceof String) {
      Segment s = getHapiContext().getGenericParser().getCriticalResponseData(
          (String)request);
      in = s.getMessage();
      DeepCopy.copy(s, (Segment) in.get("MSH"));
    } else if (request instanceof Message) {
      in = (Message) request;
    } else {
      throw new HL7Exception("Validated message must be either Message or String");
    }
    return in.generateACK(getSuccessAcknowledgementCode(), null);
  } catch (IOException e) {
    throw new HL7Exception(e);
  }
}
origin: ca.uhn.hapi/hapi-base

/**
 * Generates an empty response message. This class generates an
 * ACKnowledgement using the code returned by {@link #getSuccessAcknowledgementCode()}.
 * 
 * @param request request message, either a {@link String} or a
 *            {@link Message}
 * @return acknowledgment to the request
 * @throws HL7Exception
 */
protected Message generateResponseMessage(Object request) throws HL7Exception {
  try {
    Message in;
    if (request instanceof String) {
      Segment s = getHapiContext().getGenericParser().getCriticalResponseData(
          (String)request);
      in = s.getMessage();
      DeepCopy.copy(s, (Segment) in.get("MSH"));
    } else if (request instanceof Message) {
      in = (Message) request;
    } else {
      throw new HL7Exception("Validated message must be either Message or String");
    }
    return in.generateACK(getSuccessAcknowledgementCode(), null);
  } catch (IOException e) {
    throw new HL7Exception(e);
  }
}
origin: ca.uhn.hapi/hapi-osgi-base

private static Transportable makeAcceptAck(Transportable theMessage, String theAckCode, ErrorCode theErrorCode, String theDescription) throws HL7Exception {        
  Segment header = ourParser.getCriticalResponseData(theMessage.getMessage());
  Message dummy = header.getMessage();
  // MSH header refers to dummy, but not the other way round!
  DeepCopy.copy(header, (Segment)dummy.get("MSH"));
  try {
    HL7Exception hl7e = new HL7Exception(theDescription, theErrorCode);
    AcknowledgmentCode code = theAckCode == null ?
        AcknowledgmentCode.CR :
        AcknowledgmentCode.valueOf(theAckCode);
    Message out = dummy.generateACK(code, hl7e);
    String originalEncoding = ourParser.getEncoding(theMessage.getMessage());
    String ackText = ourParser.encode(out, originalEncoding);
    return new TransportableImpl(ackText);
  } catch (IOException e) {
    throw new HL7Exception(e);
  }
  
}    

origin: ca.uhn.hapi/hapi-base

private static Transportable makeAcceptAck(Transportable theMessage, String theAckCode, ErrorCode theErrorCode, String theDescription) throws HL7Exception {        
  Segment header = ourParser.getCriticalResponseData(theMessage.getMessage());
  Message dummy = header.getMessage();
  // MSH header refers to dummy, but not the other way round!
  DeepCopy.copy(header, (Segment)dummy.get("MSH"));
  try {
    HL7Exception hl7e = new HL7Exception(theDescription, theErrorCode);
    AcknowledgmentCode code = theAckCode == null ?
        AcknowledgmentCode.CR :
        AcknowledgmentCode.valueOf(theAckCode);
    Message out = dummy.generateACK(code, hl7e);
    String originalEncoding = ourParser.getEncoding(theMessage.getMessage());
    String ackText = ourParser.encode(out, originalEncoding);
    return new TransportableImpl(ackText);
  } catch (IOException e) {
    throw new HL7Exception(e);
  }
  
}    

ca.uhn.hl7v2.modelMessagegenerateACK

Javadoc

Generates and returns an ACK message which would be used to acknowledge this message successfully, with an MSA-1 code of "AA". The ACK generated will be of the same version as the value of MSH-12 in this message (as opposed to the version of the message class instance, if they are different)

Note that this method will fail if it is not possible to generate an ACK for any reason, such as

  • Message version is invalid
  • First segment is not an MSH

Popular methods of Message

  • get
  • getVersion
    Returns the version number of the HL7 version in which this message structure is defined (e.g. "2.4"
  • encode
    Encodes this message using the parser returned by #getParser()
  • getName
  • getParser
    Returns the parser to be used when parse/encode methods are called on this Message, as well as its c
  • addNonstandardSegment
  • getEncodingCharactersValue
    Convenience method which retrieves the encoding characters value from the second field of the first
  • getFieldSeparatorValue
    Convenience method which retrieves the field separator value from the first field of the first segme
  • getNames
  • parse
    Parses the string into this message using the parser returned by #getParser()
  • printStructure
    Prints a summary of the contents and structure of this message. This is useful for debugging purpos
  • setParser
    Sets the parser to be used when parse/encode methods are called on this Message, as well as its chil
  • printStructure,
  • setParser

Popular in Java

  • Making http requests using okhttp
  • putExtra (Intent)
  • startActivity (Activity)
  • scheduleAtFixedRate (Timer)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • List (java.util)
    An ordered collection (also known as a sequence). The user of this interface has precise control ove
  • ReentrantLock (java.util.concurrent.locks)
    A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now