Package org.jbpm.pvm.internal.wire.descriptor

Examples of org.jbpm.pvm.internal.wire.descriptor.PropertiesDescriptor


  public PropertiesBinding() {
    super("properties");
  }

  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"));
    }
   
    Boolean isXml = XmlUtil.attributeBoolean(element, "is-xml", false, parse);
    if (isXml!=null) {
      descriptor.setXml(isXml.booleanValue());
    }

    List<Descriptor> keyDescriptors = new ArrayList<Descriptor>();
    List<Descriptor> valueDescriptors = new ArrayList<Descriptor>();

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

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

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

    return descriptor;
  }
View Full Code Here


        } else {
          parse.addProblem("exactly 1 attribute in {resource, file, class, url} was expected in mapping: "+XmlUtil.toString(element));
        }

      } else if ("properties".equals(XmlUtil.getTagLocalName(configElement))) {
        PropertiesDescriptor propertiesDescriptor = (PropertiesDescriptor) propertiesBinding.parse(configElement, parse, parser);
        descriptor.setPropertiesDescriptor(propertiesDescriptor);

      } else if ("cache-configuration".equals(XmlUtil.getTagLocalName(configElement))) {
        StreamInput streamSource = null;
View Full Code Here

        } else {
          parse.addProblem("exactly 1 attribute in {resource, file, class, url} was expected in mapping: "+XmlUtil.toString(element));
        }

      } else if ("properties".equals(XmlUtil.getTagLocalName(configElement))) {
        PropertiesDescriptor propertiesDescriptor = (PropertiesDescriptor) propertiesBinding.parse(configElement, parse, parser);
        descriptor.setPropertiesDescriptor(propertiesDescriptor);

      } else if ("cache-configuration".equals(XmlUtil.getTagLocalName(configElement))) {
        StreamInput streamSource = null;
View Full Code Here

TOP

Related Classes of org.jbpm.pvm.internal.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.