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

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

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

origin: pentaho/pentaho-kettle

  new HL7Value( message.getVersion(), rootGroup.getName(), group.getName(), structure.getName(),
    structureNumber, names[n - 1], coordinates, types[t].getName(), description, string );
values.add( value );
origin: openmrs/openmrs-core

private void validate(Message message) throws HL7Exception {
  message.getVersion();
}

origin: pentaho/pentaho-kettle

Structure structure = msg.get( "MSH" );
String messageType = null;
String version = msg.getVersion();
origin: ca.uhn.hapi/hapi-base

private void initVersionIfNeeded() throws HL7Exception {
  if (myMessageClass != null && myVersion == null) {
    myVersion = ReflectionUtil.instantiateMessage(myMessageClass, this).getVersion();
  }
}
origin: ca.uhn.hapi/hapi-osgi-base

private void initVersionIfNeeded() throws HL7Exception {
  if (myMessageClass != null && myVersion == null) {
    myVersion = ReflectionUtil.instantiateMessage(myMessageClass, this).getVersion();
  }
}
origin: ca.uhn.hapi/hapi-osgi-base

public String getVersion() {
  return getDelegate().getVersion();
}
origin: ca.uhn.hapi/hapi-base

public String getVersion() {
  return getDelegate().getVersion();
}
origin: ca.uhn.hapi/hapi-osgi-base

public ValidationException[] apply(Message msg) {
  List<ValidationException> exceptions = new ArrayList<ValidationException>();
  ValidationException ve = new ValidationException("Invalid version: " + msg.getVersion());
  Location location = new Location()
    .withSegmentName("MSH")
    .withField(12);
  ve.setLocation(location);
  ve.setError(ErrorCode.UNSUPPORTED_VERSION_ID);
  exceptions.add(ve);
  return exceptions.toArray(new ValidationException[exceptions.size()]);
}
origin: ca.uhn.hapi/hapi-base

public ValidationException[] apply(Message msg) {
  List<ValidationException> exceptions = new ArrayList<ValidationException>();
  ValidationException ve = new ValidationException("Invalid version: " + msg.getVersion());
  Location location = new Location()
    .withSegmentName("MSH")
    .withField(12);
  ve.setLocation(location);
  ve.setError(ErrorCode.UNSUPPORTED_VERSION_ID);
  exceptions.add(ve);
  return exceptions.toArray(new ValidationException[exceptions.size()]);
}
origin: ca.uhn.hapi/hapi-base

public static void fixMFE4(Segment segment, ModelClassFactory factory, ParserConfiguration parserConfiguration)
    throws HL7Exception {
  if (!(segment.getName().contains("MFE")) &&
      Version.versionOf(segment.getMessage().getVersion()).isGreaterThan(Version.V23)) {
    throw new IllegalArgumentException("Expected MFE segment, but was: " + segment.getName());
  }
  fix(segment, 5, 4, null, null, factory, parserConfiguration);
}
origin: ca.uhn.hapi/hapi-base

private EncodingCharacters getValidEncodingCharacters(char fieldSep, Segment msh) throws HL7Exception {
  String encCharString = Terser.get(msh, 2, 0, 1, 1);
  if (encCharString == null) {
    throw new HL7Exception("Can't encode message: MSH-2 (encoding characters) is missing");
  }
  if (Version.V27.isGreaterThan(Version.versionOf(msh.getMessage().getVersion())) && encCharString.length() != 4) {
    throw new HL7Exception("Encoding characters (MSH-2) value '" + encCharString + "' invalid -- must be 4 characters", ErrorCode.DATA_TYPE_ERROR);
  } else if (encCharString.length() != 4 && encCharString.length() != 5) {
    throw new HL7Exception("Encoding characters (MSH-2) value '" + encCharString + "' invalid -- must be 4 or 5 characters", ErrorCode.DATA_TYPE_ERROR);
  }
  return new EncodingCharacters(fieldSep, encCharString);
}
origin: ca.uhn.hapi/hapi-osgi-base

public static void fixMFE4(Segment segment, ModelClassFactory factory, ParserConfiguration parserConfiguration)
    throws HL7Exception {
  if (!(segment.getName().contains("MFE")) &&
      Version.versionOf(segment.getMessage().getVersion()).isGreaterThan(Version.V23)) {
    throw new IllegalArgumentException("Expected MFE segment, but was: " + segment.getName());
  }
  fix(segment, 5, 4, null, null, factory, parserConfiguration);
}
origin: ca.uhn.hapi/hapi-base

/**
 * Formats a Message object into an HL7 message string using the given encoding.
 * 
 * @param source a Message object from which to construct an encoded message string
 * @param encoding the name of the HL7 encoding to use (eg "XML"; most implementations support
 *            only one encoding)
 * @return the encoded message
 * @throws HL7Exception if the data fields in the message do not permit encoding (e.g. required
 *             fields are null)
 * @throws EncodingNotSupportedException if the requested encoding is not supported by this
 *             parser.
 */
public String encode(Message source, String encoding) throws HL7Exception {
  assertMessageValidates(source);
  String result = doEncode(source, encoding);
  assertMessageValidates(result, encoding, source.getVersion());
  return result;
}
origin: ca.uhn.hapi/hapi-osgi-base

/**
 * Formats a Message object into an HL7 message string using the given encoding.
 * 
 * @param source a Message object from which to construct an encoded message string
 * @param encoding the name of the HL7 encoding to use (eg "XML"; most implementations support
 *            only one encoding)
 * @return the encoded message
 * @throws HL7Exception if the data fields in the message do not permit encoding (e.g. required
 *             fields are null)
 * @throws EncodingNotSupportedException if the requested encoding is not supported by this
 *             parser.
 */
public String encode(Message source, String encoding) throws HL7Exception {
  assertMessageValidates(source);
  String result = doEncode(source, encoding);
  assertMessageValidates(result, encoding, source.getVersion());
  return result;
}
origin: ca.uhn.hapi/hapi-osgi-base

private EncodingCharacters getValidEncodingCharacters(char fieldSep, Segment msh) throws HL7Exception {
  String encCharString = Terser.get(msh, 2, 0, 1, 1);
  if (encCharString == null) {
    throw new HL7Exception("Can't encode message: MSH-2 (encoding characters) is missing");
  }
  if (Version.V27.isGreaterThan(Version.versionOf(msh.getMessage().getVersion())) && encCharString.length() != 4) {
    throw new HL7Exception("Encoding characters (MSH-2) value '" + encCharString + "' invalid -- must be 4 characters", ErrorCode.DATA_TYPE_ERROR);
  } else if (encCharString.length() != 4 && encCharString.length() != 5) {
    throw new HL7Exception("Encoding characters (MSH-2) value '" + encCharString + "' invalid -- must be 4 or 5 characters", ErrorCode.DATA_TYPE_ERROR);
  }
  return new EncodingCharacters(fieldSep, encCharString);
}
origin: ca.uhn.hapi/hapi-base

private void testMessageRules(Message message, ValidationExceptionHandler<R> handler)
    throws HL7Exception {
  Terser t = new Terser(message);
  String messageType = t.get("MSH-9-1");
  String triggerEvent = t.get("MSH-9-2");
  List<MessageRule> rules = new ArrayList<MessageRule>();
  if (getValidationContext() != null) {
    rules.addAll(getValidationContext().getMessageRules(message.getVersion(), messageType,
        triggerEvent));
  }
  LOG.debug("Validating message against {} message rules", rules.size());
  for (MessageRule rule : rules) {
    ValidationException[] ex = rule.apply(message);
    if (ex != null && ex.length > 0) {
      handler.onExceptions(ex);
    }
  }
}
origin: ca.uhn.hapi/hapi-osgi-base

/**
 * Formats a Message object into an HL7 message string using this parser's default encoding.
 * 
 * @param source a Message object from which to construct an encoded message string
 * @return the encoded message
 * @throws HL7Exception if the data fields in the message do not permit encoding (e.g. required
 *             fields are null)
 */
public String encode(Message source) throws HL7Exception {
  assertMessageValidates(source);
  String result = doEncode(source);
  assertMessageValidates(result, getDefaultEncoding(), source.getVersion());
  return result;
}
origin: ca.uhn.hapi/hapi-base

/**
 * Formats a Message object into an HL7 message string using this parser's default encoding.
 * 
 * @param source a Message object from which to construct an encoded message string
 * @return the encoded message
 * @throws HL7Exception if the data fields in the message do not permit encoding (e.g. required
 *             fields are null)
 */
public String encode(Message source) throws HL7Exception {
  assertMessageValidates(source);
  String result = doEncode(source);
  assertMessageValidates(result, getDefaultEncoding(), source.getVersion());
  return result;
}
origin: ca.uhn.hapi/hapi-base

private void testPrimitive(Primitive p, ValidationExceptionHandler<R> handler, Location l) {
  List<PrimitiveTypeRule> rules = new ArrayList<PrimitiveTypeRule>();
  Message m = p.getMessage();
  if (getValidationContext() != null) {
    rules.addAll(getValidationContext().getPrimitiveRules(m.getVersion(), p.getName(), p));
  }
  for (PrimitiveTypeRule rule : rules) {
    ValidationException[] exceptions = rule.apply(p.getValue());
    for (ValidationException ve : exceptions) {
      ve.setLocation(l);
    }
    if (exceptions.length > 0) {
      handler.onExceptions(exceptions);
    }
  }
}
origin: ca.uhn.hapi/hapi-osgi-base

private void testPrimitive(Primitive p, ValidationExceptionHandler<R> handler, Location l) {
  List<PrimitiveTypeRule> rules = new ArrayList<PrimitiveTypeRule>();
  Message m = p.getMessage();
  if (getValidationContext() != null) {
    rules.addAll(getValidationContext().getPrimitiveRules(m.getVersion(), p.getName(), p));
  }
  for (PrimitiveTypeRule rule : rules) {
    ValidationException[] exceptions = rule.apply(p.getValue());
    for (ValidationException ve : exceptions) {
      ve.setLocation(l);
    }
    if (exceptions.length > 0) {
      handler.onExceptions(exceptions);
    }
  }
}
ca.uhn.hl7v2.modelMessagegetVersion

Javadoc

Returns the version number of the HL7 version in which this message structure is defined (e.g. "2.4")

Popular methods of Message

  • get
  • generateACK
    Generates and returns an ACK message which would be used to acknowledge this message successfully.
  • 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

  • Updating database using SQL prepared statement
  • scheduleAtFixedRate (Timer)
  • notifyDataSetChanged (ArrayAdapter)
  • compareTo (BigDecimal)
  • ObjectMapper (com.fasterxml.jackson.databind)
    ObjectMapper provides functionality for reading and writing JSON, either to and from basic POJOs (Pl
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • BoxLayout (javax.swing)
  • Github Copilot alternatives
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