Package org.jbpm.wire.descriptor

Examples of org.jbpm.wire.descriptor.PropertiesDescriptor


* @author Tom Baeyens
*/
public class PropertiesBinding implements Binding {
 
  public Object parse(Element element, Parse parse, Parser parser) {
    PropertiesDescriptor descriptor = new PropertiesDescriptor();
   
    if (element.hasAttribute("file")) {
      descriptor.setFile(element.getAttribute("file"));
    }
   
    if (element.hasAttribute("resource")) {
      descriptor.setResource(element.getAttribute("resource"));
    }
   
    if (element.hasAttribute("url")) {
      descriptor.setUrl(element.getAttribute("url"));
    }
   
    if (element.hasAttribute("is-xml")) {
      String isXmlText = element.getAttribute("is-xml");
      Boolean isXml = XmlUtil.booleanEquals(isXmlText, null);
      if (isXml!=null) {
        descriptor.setXml(isXml);
      }
    }
   
    List<Descriptor> keyDescriptors = new ArrayList<Descriptor>();
    List<Descriptor> valueDescriptors = new ArrayList<Descriptor>();

    List<Element> elements = XmlUtil.elements(element);
    if (elements!=null) {
      for (Element propertyElement: elements) {
        if ("property".equals(XmlUtil.getTagName(propertyElement))) {
          // key
          String name = XmlUtil.attribute(propertyElement, "name");
          // value
          String value = XmlUtil.attribute(propertyElement, "value");

          if ( (name!=null)
               && (value!=null)
             ) {
            StringDescriptor nameDescriptor = new StringDescriptor();
            nameDescriptor.setValue(name);
            keyDescriptors.add(nameDescriptor);
            StringDescriptor valueDescriptor = new StringDescriptor();
            valueDescriptor.setValue(value);
            valueDescriptors.add(valueDescriptor);
          } else {
            parse.addProblem("property must have name and value attributes: "+XmlUtil.toString(propertyElement));
          }
        } else {
          parse.addProblem("properties can only contain property elements: "+XmlUtil.toString(propertyElement));
        }

      }
    }
    descriptor.setKeyDescriptors(keyDescriptors);
    descriptor.setValueDescriptors(valueDescriptors);

    return descriptor;
  }
View Full Code Here


        } else if ("mapping".equals(XmlUtil.getTagName(configElement))) {
         
          parseMapping(configElement, descriptor, parse);
         
        } else if ("properties".equals(XmlUtil.getTagName(configElement))) {
          PropertiesDescriptor propertiesDescriptor = (PropertiesDescriptor) propertiesBinding.parse(configElement, parse, parser);
          descriptor.setPropertiesDescriptor(propertiesDescriptor);
         
        } else if ("cache-configuration".equals(XmlUtil.getTagName(configElement))) {
          InputStream stream = null;
         
View Full Code Here

TOP

Related Classes of org.jbpm.wire.descriptor.PropertiesDescriptor

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.