Package ca.uhn.hl7v2.parser

Examples of ca.uhn.hl7v2.parser.Parser


    }

    DefaultValidator val = new DefaultValidator();
    try {
      String msgString = loadFile(args[0]);
      Parser parser = new GenericParser();
      Message message = parser.parse(msgString);

      String profileString = loadFile(args[1]);
      ProfileParser profParser = new ProfileParser(true);
      RuntimeProfile profile = profParser.parse(profileString);
View Full Code Here


    /**
     * {@inheritDoc }
     */
    @Override
    public String encode() throws HL7Exception {
        Parser p = getMessage().getParser();
        return p.doEncode(this, EncodingCharacters.getInstance(getMessage()));
    }
View Full Code Here

    {
        JexlContext jc = new MapContext();
        jc.set("aString", "Hello");
        Foo foo = new Foo();
        jc.set("foo", foo);
        Parser parser = new Parser(new StringReader(";"));
        parser.parse(new StringReader("aString = 'World';"), null);
       
        assertExpression(jc, "hello = 'world'", "world");
        assertEquals("hello variable not changed", "world", jc.get("hello"));
        assertExpression(jc, "result = 1 + 1", new Integer(2));
        assertEquals("result variable not changed", new Integer(2), jc.get("result"));
View Full Code Here

     * @throws InvalidSearchConditionException in case of errors retrieving identifiers
     */
    private Set<String> getWhereClause(final String expression, final String value, final AttributableUtil attrUtil)
            throws InvalidSearchConditionException {

        final Parser parser = new Parser(new StringReader(expression));

        // Schema names
        final List<String> identifiers = new ArrayList<String>();

        // Literals
        final List<String> literals = new ArrayList<String>();

        // Get schema names and literals
        Token token;
        while ((token = parser.getNextToken()) != null && StringUtils.hasText(token.toString())) {
            if (token.kind == ParserConstants.STRING_LITERAL) {
                literals.add(token.toString().substring(1, token.toString().length() - 1));
            }

            if (token.kind == ParserConstants.IDENTIFIER) {
View Full Code Here

     * @return where clauses to use to build the query.
     * @throws InvalidSearchConditionException in case of errors retrieving identifiers.
     */
    private Set<String> getWhereClause(final String expression, final String value)
            throws InvalidSearchConditionException {
        final Parser parser = new Parser(new StringReader(expression));

        // Schema names
        final List<String> identifiers = new ArrayList<String>();

        // Literals
        final List<String> literals = new ArrayList<String>();

        // Get schema names and literals
        Token token;
        while ((token = parser.getNextToken()) != null && StringUtils.isNotBlank(token.toString())) {
            if (token.kind == ParserConstants.STRING_LITERAL) {
                literals.add(token.toString().substring(1, token.toString().length() - 1));
            }

            if (token.kind == ParserConstants.IDENTIFIER) {
View Full Code Here

      this.literals = entry.getLiterals();
      this.terms = entry.getTerms();
      this.rootNode = entry.getRootNode();
      this.tree = entry.getTree();
    } else {
      Parser p = new Parser(new StringReader(";"));
      rootNode = p.parse(new StringReader(query), null);
      rootNode.childrenAccept(this, null);
      TreeBuilder builder = new TreeBuilder(rootNode);
      tree = builder.getRootNode();
      entry = new CacheEntry(this.negatedTerms, this.andTerms, this.orTerms, this.literals, this.terms, rootNode, tree);
      synchronized (cache) {
View Full Code Here

  private TreeNode rootNode = null;
  private TreeNode currentNode = null;
  private boolean currentlyInCheckChildren = false;
 
  public TreeBuilder(String query) throws ParseException {
    Parser p = new Parser(new StringReader(";"));
    ASTJexlScript script = p.parse(new StringReader(query), null);
    // Check to see if the child node is an AND or OR. If not, then
    // there must be just a single value in the query expression
    rootNode = new TreeNode();
    rootNode.setType(RootNode.class);
    currentNode = rootNode;
View Full Code Here

     * @return where clauses to use to build the query.
     * @throws InvalidSearchConditionException in case of errors retrieving identifiers.
     */
    private Set<String> getWhereClause(final String expression, final String value)
            throws InvalidSearchConditionException {
        final Parser parser = new Parser(new StringReader(expression));

        // Schema names
        final List<String> identifiers = new ArrayList<String>();

        // Literals
        final List<String> literals = new ArrayList<String>();

        // Get schema names and literals
        Token token;
        while ((token = parser.getNextToken()) != null && StringUtils.hasText(token.toString())) {

            if (token.kind == ParserConstants.STRING_LITERAL) {
                literals.add(token.toString().substring(1, token.toString().length() - 1));
            }

View Full Code Here

     * @return where clauses to use to build the query.
     * @throws InvalidSearchConditionException in case of errors retrieving identifiers.
     */
    private Set<String> getWhereClause(final String expression, final String value)
            throws InvalidSearchConditionException {
        final Parser parser = new Parser(new StringReader(expression));

        // Schema names
        final List<String> identifiers = new ArrayList<String>();

        // Literals
        final List<String> literals = new ArrayList<String>();

        // Get schema names and literals
        Token token;
        while ((token = parser.getNextToken()) != null && StringUtils.hasText(token.toString())) {

            if (token.kind == ParserConstants.STRING_LITERAL) {
                literals.add(token.toString().substring(1, token.toString().length() - 1));
            }

View Full Code Here

    {
        JexlContext jc = new MapContext();
        jc.set("aString", "Hello");
        Foo foo = new Foo();
        jc.set("foo", foo);
        Parser parser = new Parser(new StringReader(";"));
        parser.parse(new StringReader("aString = 'World';"), null);
       
        assertExpression(jc, "hello = 'world'", "world");
        assertEquals("hello variable not changed", "world", jc.get("hello"));
        assertExpression(jc, "result = 1 + 1", new Integer(2));
        assertEquals("result variable not changed", new Integer(2), jc.get("result"));
View Full Code Here

TOP

Related Classes of ca.uhn.hl7v2.parser.Parser

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.