Package ca.uhn.hl7v2.conf

Examples of ca.uhn.hl7v2.conf.ProfileException


   * @return Element
   * @throws ProfileException Element
   */
  private List<String> getCodeTable(String codeSystem) throws ProfileException {
    if (codeSystem == null) {
      throw new ProfileException("The input codeSystem parameter cannot be null");
    }
    if (codeSystem.length() < 4) {
      throw new ProfileException(
          "The input codeSystem parameter cannot be less than 4 characters long");
    }
    // Extract the last 4 characters from the codeSystem param
    String tableId = codeSystem.substring(codeSystem.length() - 4);
    return codes.get(tableId);
View Full Code Here


        struct.setMax((short) -1);
      } else {
        struct.setMax(Short.parseShort(max));
      }
    } catch (NumberFormatException e) {
      throw new ProfileException("Min and max must be short integers: " + min + ", " + max, e);
    }

    struct.setImpNote(getValueOfFirstElement("ImpNote", elem));
    struct.setDescription(getValueOfFirstElement("Description", elem));
    struct.setReference(getValueOfFirstElement("Reference", elem));
View Full Code Here

    try {
      if (itemNo.length() > 0) {
        field.setItemNo(Short.parseShort(itemNo));
      }
    } catch (NumberFormatException e) {
      throw new ProfileException("Invalid ItemNo: " + itemNo + "( for name "
          + elem.getAttribute("Name") + ")", e);
    } // try-catch

    try {
      field.setMin(Short.parseShort(min));
      if (max.indexOf('*') >= 0) {
        field.setMax((short) -1);
      } else {
        field.setMax(Short.parseShort(max));
      }
    } catch (NumberFormatException e) {
      throw new ProfileException("Min and max must be short integers: " + min + ", " + max, e);
    }

    parseAbstractComponentData(field, elem);

    int childIndex = 1;
View Full Code Here

    String length = elem.getAttribute("Length");
    if (length != null && length.length() > 0) {
      try {
        comp.setLength(Long.parseLong(length));
      } catch (NumberFormatException e) {
        throw new ProfileException("Length must be a long integer: " + length, e);
      }
    }
    comp.setConstantValue(elem.getAttribute("ConstantValue"));
    String table = elem.getAttribute("Table");
    if (table != null && table.length() > 0) {
      try {
        comp.setTable(table);
      } catch (NumberFormatException e) {
        throw new ProfileException("Table must be a short integer: " + table, e);
      }
    }

    comp.setImpNote(getValueOfFirstElement("ImpNote", elem));
    comp.setDescription(getValueOfFirstElement("Description", elem));
View Full Code Here

      Document doc = XMLUtils.parse(profileString, true);
      if (alwaysValidate)
        XMLUtils.validate(doc, PROFILE_XSD, errorHandler);
      return doc;
    } catch (Exception e) {
      throw new ProfileException("Exception parsing message profile: " + e.getMessage(), e);
    }
  }
View Full Code Here

        Node n = el.getFirstChild();
        if (n.getNodeType() == Node.TEXT_NODE) {
          val = n.getNodeValue();
        }
      } catch (Exception e) {
        throw new ProfileException("Unable to get value of node " + name, e);
      }
    }
    return val;
  }
View Full Code Here

                ProfileParser profParser = new ProfileParser(true);
                RuntimeProfile profile = profParser.parse(profileString);
               
                exceptions = val.validate(message, profile.getMessage());
            } else {
                throw new ProfileException("Unable to find the profile " + id);
            }
        } catch (IOException e) {
            throw new ProfileException("Error retreiving profile " + id, e);
        }
       
        ValidationException[] result = new ValidationException[exceptions.length];
        for (int i = 0; i < exceptions.length; i++) {
            result[i] = new ValidationException(exceptions[i].getMessage(), exceptions[i]);
View Full Code Here

                                    + " appears in the message but not in the profile");
                            exList.add(e);
                        }
                    }
                } catch (HL7Exception he) {
                    throw new ProfileException("Problem checking profile", he);
                }
            }
        }
        return toArray(exList);
    }
View Full Code Here

                                "Field " + i + " in " + segment.getName() + " appears in the message but not in the profile");
                            exList.add(e);
                        }
                    }
                } catch (HL7Exception he) {
                    throw new ProfileException("Problem testing against profile", he);
                }
            }
        }    
        return this.toArray(exList);
    }
View Full Code Here

                if (s.length() > 0) {
                    extra.append(s);
                    extra.append(enc.getComponentSeparator());
                }
            } catch (DataTypeException de) {
                throw new ProfileException("Problem testing against profile", de);
            }
        }
       
        if (extra.toString().length() > 0) {
            exList.add(new XElementPresentException("The following components are not defined in the profile: " + extra.toString()));
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.conf.ProfileException

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.