Package org.activiti.bpmn.model

Examples of org.activiti.bpmn.model.ServiceTask


          context.setLocation((int) graphicInfo.getX(), (int) graphicInfo.getY());
        }

        if (flowElement instanceof ServiceTask) {

          ServiceTask serviceTask = (ServiceTask) flowElement;

          if (serviceTask.isExtended()) {

            CustomServiceTask targetTask = findCustomServiceTask(serviceTask);

            if (targetTask != null) {
              serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
              serviceTask.setImplementation(targetTask.getRuntimeClassname());
              for (FieldExtension field : serviceTask.getFieldExtensions()) {
                CustomProperty customFieldProperty = new CustomProperty();
                customFieldProperty.setName(field.getFieldName());
                if (StringUtils.isNotEmpty(field.getExpression())) {
                  customFieldProperty.setSimpleValue(field.getExpression());
                } else {
                  customFieldProperty.setSimpleValue(field.getStringValue());
                }
                serviceTask.getCustomProperties().add(customFieldProperty);
              }

              serviceTask.getFieldExtensions().clear();
            }
          }

        }
View Full Code Here


      final Object bo = ModelHandler.getModel(EcoreUtil.getURI(diagram)).getFeatureProvider().getBusinessObjectForPictogramElement(pictogramElement);
      if (bo instanceof ServiceTask) {
        TransactionalEditingDomain editingDomain = diagramEditor.getEditingDomain();
        ActivitiUiUtil.runModelChange(new Runnable() {
          public void run() {
            ServiceTask serviceTask = (ServiceTaskbo;
            for (TableItem item : getItems()) {
              String fieldName = item.getText(0);
              String fieldStringValue = item.getText(1);
              String fieldExpression = item.getText(2);
              if(StringUtils.isNotEmpty(fieldName) &&
                      (StringUtils.isNotEmpty(fieldStringValue) || StringUtils.isNotEmpty(fieldExpression))) {
               
                FieldExtension fieldExtension = fieldExtensionExists(serviceTask, fieldName);
                if(fieldExtension != null) {
                  fieldExtension.setStringValue(fieldStringValue);
                  fieldExtension.setExpression(fieldExpression);
                } else {
                  FieldExtension newFieldExtension = new FieldExtension();
                  newFieldExtension.setFieldName(fieldName);
                  newFieldExtension.setStringValue(fieldStringValue);
                  newFieldExtension.setExpression(fieldExpression);
                  serviceTask.getFieldExtensions().add(newFieldExtension);
                }
              }
            }
            removeFieldExtensionsNotInList(getItems(), serviceTask);
          }
View Full Code Here

  @Override
  protected boolean accept(PictogramElement pe) {
    Object bo = getBusinessObject(pe);
    if (bo instanceof ServiceTask && !ExtensionUtil.isCustomServiceTask(bo)) {
      ServiceTask serviceTask = (ServiceTask) bo;
      if (AlfrescoScriptTask.ALFRESCO_SCRIPT_DELEGATE.equalsIgnoreCase(serviceTask.getImplementation()) == false &&
              ServiceTask.MAIL_TASK.equalsIgnoreCase(serviceTask.getType()) == false) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

    return ELEMENT_TASK_SERVICE;
  }

  @Override
  protected BaseElement convertXMLToElement(XMLStreamReader xtr) {
    ServiceTask serviceTask = new ServiceTask();
    if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_CLASS))) {
      serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
      serviceTask.setImplementation(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_CLASS));
     
    } else if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_EXPRESSION))) {
      serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION);
      serviceTask.setImplementation(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_EXPRESSION));
     
    } else if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_DELEGATEEXPRESSION))) {
      serviceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
      serviceTask.setImplementation(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_DELEGATEEXPRESSION));
    }
 
    serviceTask.setResultVariableName(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_RESULTVARIABLE));
    serviceTask.setType(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TYPE));
 
    parseChildElements(getXMLElementName(), serviceTask, xtr);
   
    return serviceTask;
  }
View Full Code Here

  }
 
  @Override
  protected void writeAdditionalAttributes(BaseElement element, XMLStreamWriter xtw) throws Exception {
   
    ServiceTask serviceTask = (ServiceTask) element;
   
    if (ImplementationType.IMPLEMENTATION_TYPE_CLASS.equals(serviceTask.getImplementationType())) {
      writeQualifiedAttribute(ATTRIBUTE_TASK_SERVICE_CLASS, serviceTask.getImplementation(), xtw);
    } else if (ImplementationType.IMPLEMENTATION_TYPE_EXPRESSION.equals(serviceTask.getImplementationType())) {
      writeQualifiedAttribute(ATTRIBUTE_TASK_SERVICE_EXPRESSION, serviceTask.getImplementation(), xtw);
    } else if (ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION.equals(serviceTask.getImplementationType())) {
      writeQualifiedAttribute(ATTRIBUTE_TASK_SERVICE_DELEGATEEXPRESSION, serviceTask.getImplementation(), xtw);
    }
   
    if (StringUtils.isNotEmpty(serviceTask.getResultVariableName())) {
      writeQualifiedAttribute(ATTRIBUTE_TASK_SERVICE_RESULTVARIABLE, serviceTask.getResultVariableName(), xtw);
    }
    if (StringUtils.isNotEmpty(serviceTask.getType())) {
      writeQualifiedAttribute(ATTRIBUTE_TYPE, serviceTask.getType(), xtw);
    }
  }
View Full Code Here

   *         otherwise
   */
  public static final boolean isCustomServiceTask(final Object bo) {
    boolean result = false;
    if (bo instanceof ServiceTask) {
      final ServiceTask serviceTask = (ServiceTask) bo;
      return StringUtils.isNotEmpty(serviceTask.getExtensionId());
    }
    return result;
  }
View Full Code Here

 
  @Override
  protected boolean accept(PictogramElement pe) {
    Object bo = getBusinessObject(pe);
    if (bo instanceof ServiceTask) {
      ServiceTask serviceTask = (ServiceTask) bo;
      if (AlfrescoScriptTask.ALFRESCO_SCRIPT_DELEGATE.equalsIgnoreCase(serviceTask.getImplementation()) &&
              isAlfrescoMailScriptTask((ServiceTask) bo)) {
       
        return true;
      }
    }
View Full Code Here

    } else if (context.getNewObject() instanceof ReceiveTask) {
      return new AddReceiveTaskFeature(this);
    } else if (context.getNewObject() instanceof BusinessRuleTask) {
      return new AddBusinessRuleTaskFeature(this);
    } else if (context.getNewObject() instanceof ServiceTask) {
      ServiceTask serviceTask = (ServiceTask) context.getNewObject();
      if (ServiceTask.MAIL_TASK.equalsIgnoreCase(serviceTask.getType())) {
        return new AddMailTaskFeature(this);
      } else if (AlfrescoScriptTask.ALFRESCO_SCRIPT_DELEGATE.equalsIgnoreCase(serviceTask.getImplementation())) {
        boolean isMailTask = false;
        for (FieldExtension fieldExtension : serviceTask.getFieldExtensions()) {
          if ("script".equalsIgnoreCase(fieldExtension.getFieldName())) {
            if (fieldExtension.getStringValue().contains("mail.execute(bpm_package);")) {
              isMailTask = true;
            }
          }
View Full Code Here

   *          the object to clone
   * @return a clone of the original object
   */
  private static final ServiceTask clone(final ServiceTask original, final Diagram diagram) {

    ServiceTask result = new ServiceTask();

    result.setId(ActivitiUiUtil.getNextId(result.getClass(), CreateServiceTaskFeature.FEATURE_ID_KEY, diagram));
    result.setImplementation(original.getImplementation());
    result.setExtensionId(original.getExtensionId());

    for (FieldExtension extension : original.getFieldExtensions()) {
      result.getFieldExtensions().add(clone(extension));
    }
   
    for (CustomProperty property : original.getCustomProperties()) {
      final CustomProperty clone = clone(property);
      // Reset the id
      clone.setId(ExtensionUtil.wrapCustomPropertyId(result, ExtensionUtil.upWrapCustomPropertyId(clone.getId())));
      result.getCustomProperties().add(clone);
    }

    return result;
  }
View Full Code Here

 
  @Override
  protected boolean accept(PictogramElement pe) {
    Object bo = getBusinessObject(pe);
    if (bo instanceof ServiceTask) {
      ServiceTask serviceTask = (ServiceTask) bo;
      if (AlfrescoScriptTask.ALFRESCO_SCRIPT_DELEGATE.equalsIgnoreCase(serviceTask.getImplementation()) &&
              isAlfrescoMailScriptTask((ServiceTask) bo) == false) {
       
        return true;
      }
    }
View Full Code Here

TOP

Related Classes of org.activiti.bpmn.model.ServiceTask

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.