Package org.jbpm.pvm.internal.type

Examples of org.jbpm.pvm.internal.type.Matcher


    }
   
    String hibernateSessionFactoryName = XmlUtil.attribute(element, "hibernate-session-factory");
   
    // first we get the matcher
    Matcher matcher = null;
    if (element.hasAttribute("class")) {
      String className = element.getAttribute("class");
     
      // if type="serializable"
      if ("serializable".equals(className)) {
        matcher = new SerializableMatcher();
       
      // if type="persistable"
      } else if ("persistable".equals(className)) {
        if (element.hasAttribute("id-type")) {
          String idType = element.getAttribute("id-type");
          if ("long".equalsIgnoreCase(idType)) {
            matcher = new HibernateLongIdMatcher(hibernateSessionFactoryName);
          } else if ("string".equalsIgnoreCase(idType)) {
            matcher = new HibernateStringIdMatcher(hibernateSessionFactoryName);
          } else {
            parse.addProblem("id-type was not 'long' or 'string': "+idType, element);
          }
        } else {
          parse.addProblem("id-type is required in a persistable type", element);
        }

      // otherwise, we expect type="some.java.ClassName"
      } else {
        matcher = new ClassNameMatcher(className);
      }

    } else {
      // look for the matcher element
      Element matcherElement = XmlUtil.element(element, "matcher");
      Element matcherObjectElement = XmlUtil.element(matcherElement);
      if (matcherObjectElement!=null) {
        try {
          matcher = (Matcher) parser.parseElement(matcherObjectElement, parse);
        } catch (ClassCastException e) {
          parse.addProblem("matcher is not a "+Matcher.class.getName()+": "+(matcher!=null ? matcher.getClass().getName() : "null"), element);
        }
      } else {
        parse.addProblem("no matcher specified in "+XmlUtil.toString(element), element);
      }
    }
View Full Code Here


    }
   
    String hibernateSessionFactoryName = XmlUtil.attribute(element, "hibernate-session-factory");
   
    // first we get the matcher
    Matcher matcher = null;
    if (element.hasAttribute("class")) {
      String className = element.getAttribute("class");
     
      // if type="serializable"
      if ("serializable".equals(className)) {
        matcher = new SerializableMatcher();
       
      // if type="hibernatable"
      } else if ("hibernatable".equals(className)) {
        if (element.hasAttribute("id-type")) {
          String idType = element.getAttribute("id-type");
          if ("long".equalsIgnoreCase(idType)) {
            matcher = new HibernateLongIdMatcher(hibernateSessionFactoryName);
          } else if ("string".equalsIgnoreCase(idType)) {
            matcher = new HibernateStringIdMatcher(hibernateSessionFactoryName);
          } else {
            parse.addProblem("id-type was not 'long' or 'string': "+idType, element);
          }
        } else {
          parse.addProblem("id-type is required in a persistable type", element);
        }

      // otherwise, we expect type="some.java.ClassName"
      } else {
        matcher = new ClassNameMatcher(className);
      }

    } else {
      // look for the matcher element
      Element matcherElement = XmlUtil.element(element, "matcher");
      Element matcherObjectElement = XmlUtil.element(matcherElement);
      if (matcherObjectElement!=null) {
        try {
          Descriptor descriptor = (Descriptor) parser.parseElement(matcherObjectElement, parse);
          matcher = (Matcher) WireContext.create(descriptor);
        } catch (ClassCastException e) {
          parse.addProblem("matcher is not a "+Matcher.class.getName()+": "+(matcher!=null ? matcher.getClass().getName() : "null"), element);
        }
      } else {
        parse.addProblem("no matcher specified in "+XmlUtil.toString(element), element);
      }
    }
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.internal.type.Matcher

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.