Package org.jbpm.wire.operation

Examples of org.jbpm.wire.operation.FieldOperation


* @see WireParser
*/
public class FieldBinding implements Binding {

  public Object parse(Element element, Parse parse, Parser parser) {
    FieldOperation fieldOperation = new FieldOperation();
    if (element.hasAttribute("name")) {
      fieldOperation.setFieldName(element.getAttribute("name"));
    } else {
      parse.addProblem("field must have name : "+XmlUtil.toString(element));
    }
    Element descriptorElement = XmlUtil.element(element);
    if (descriptorElement!=null) {
      Descriptor descriptor = (Descriptor) parser.parseElement(descriptorElement, parse, WireParser.CATEGORY_DESCRIPTOR);
      if (descriptor!=null) {
        fieldOperation.setDescriptor(descriptor);
      } else {
        parse.addProblem("unknown descriptor element "+descriptorElement.getTagName()+" inside field operation: "+XmlUtil.toString(element));
      }
    } else {
      parse.addProblem("field must have 1 descriptor element out of "+parser.getBindings().getTagNames(WireParser.CATEGORY_DESCRIPTOR)+" as content: "+XmlUtil.toString(element));
View Full Code Here


  public Object parse(Element element, Parse parse, Parser parser) {
    TypeRefDescriptor typeRefDescriptor = new TypeRefDescriptor();
    typeRefDescriptor.setContextClass(HibernatePvmDbSession.class);

    FieldOperation persistenceServiceInjection = new FieldOperation();
    persistenceServiceInjection.setFieldName("hibernateSession");
    persistenceServiceInjection.setDescriptor(typeRefDescriptor);
   
    ObjectDescriptor objectDescriptor = new ObjectDescriptor();
    objectDescriptor.setClassName(StandardJobSession.class.getName());
    objectDescriptor.addOperation(persistenceServiceInjection);
   
View Full Code Here

    // inject the command executor
    TypeRefDescriptor commandExecutorDescriptor = new TypeRefDescriptor();
    commandExecutorDescriptor.setContextClass(CommandService.class);

    FieldOperation commandExecutorInjection = new FieldOperation();
    commandExecutorInjection.setFieldName("commandService");
    commandExecutorInjection.setDescriptor(commandExecutorDescriptor);
   
    descriptor.addOperation(commandExecutorInjection);

    if (element.hasAttribute("name")) {
      StringDescriptor nameDescriptor = new StringDescriptor();
      nameDescriptor.setValue(element.getAttribute("name"));
      FieldOperation nameInjection = new FieldOperation();
      nameInjection.setFieldName("name");
      nameInjection.setDescriptor(nameDescriptor);
    }

    parseIntAttribute(element, "threads", descriptor, "nbrOfThreads", parse);
    parseIntAttribute(element, "idle", descriptor, "idleMillis", parse);
    parseIntAttribute(element, "idle-max", descriptor, "idleMillisMax", parse);
View Full Code Here

      String intText = element.getAttribute(attributeName);
      try {
        int intValue = Integer.parseInt(intText);
        IntegerDescriptor intValueDescriptor = new IntegerDescriptor();
        intValueDescriptor.setValue(intValue);
        FieldOperation intValueInjection = new FieldOperation();
        intValueInjection.setFieldName(fieldName);
        intValueInjection.setDescriptor(intValueDescriptor);
        descriptor.addOperation(intValueInjection);
      } catch (NumberFormatException e) {
        parse.addProblem("couldn't parse attribute "+attributeName+" as an integer: "+intText);
      }
    }
View Full Code Here

 
  /** convenience method to add a type based field injection */
  public void addTypedInjection(Class<?> type, String fieldName) {
    TypeRefDescriptor typeRefDescriptor = new TypeRefDescriptor();
    typeRefDescriptor.setEnvironmentClass(type);
    FieldOperation injectionOperation = new FieldOperation();
    injectionOperation.setFieldName(fieldName);
    injectionOperation.setDescriptor(typeRefDescriptor);
    addOperation(injectionOperation);
  }
View Full Code Here

TOP

Related Classes of org.jbpm.wire.operation.FieldOperation

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.