Package org.activiti.designer.integration.servicetask

Examples of org.activiti.designer.integration.servicetask.CustomServiceTask


    final ServiceTask serviceTask = getServiceTask();

    if (serviceTask != null) {

      CustomServiceTask targetTask = null;

      for (final CustomServiceTask customServiceTask : customServiceTasks) {
        if (customServiceTask.getId().equals(serviceTask.getExtensionId())) {
          targetTask = customServiceTask;
          break;
        }
      }

      if (targetTask != null) {

        final List<Class<CustomServiceTask>> classHierarchy = new ArrayList<Class<CustomServiceTask>>();
        final List<FieldInfo> fieldInfoObjects = new ArrayList<FieldInfo>();

        Class clazz = targetTask.getClass();
        classHierarchy.add(clazz);

        boolean hierarchyOpen = true;
        while (hierarchyOpen) {
          clazz = clazz.getSuperclass();
          if (CustomServiceTask.class.isAssignableFrom(clazz)) {
            classHierarchy.add(clazz);
          } else {
            hierarchyOpen = false;
          }
        }

        for (final Class<CustomServiceTask> currentClass : classHierarchy) {
          for (final Field field : currentClass.getDeclaredFields()) {
            if (field.isAnnotationPresent(Property.class)) {
              fieldInfoObjects.add(new FieldInfo(field));
            }
          }
        }

        // Sort the list so the fields are in the correct order
        Collections.sort(fieldInfoObjects);

        Control previousAnchor = workParent;

        final CLabel labelNodeName = factory.createCLabel(workParent, targetTask.getName(), SWT.NONE);
        labelNodeName.setFont(boldFont);
        data = new FormData();
        data.top = new FormAttachment(previousAnchor, VSPACE);
        labelNodeName.setLayoutData(data);

        previousAnchor = labelNodeName;

        if (targetTask.getClass().isAnnotationPresent(Help.class)) {
          final Help helpAnnotation = targetTask.getClass().getAnnotation(Help.class);

          final CLabel labelShort = factory.createCLabel(workParent, helpAnnotation.displayHelpShort(), SWT.WRAP);

          data = new FormData();
          data.top = new FormAttachment(previousAnchor, VSPACE);
View Full Code Here


    newServiceTask.setExtensionId(customServiceTaskId);

    // Process custom service tasks
    if (newServiceTask.isExtended()) {

      CustomServiceTask targetTask = findCustomServiceTask(newServiceTask);

      if (targetTask != null) {
        newServiceTask.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_CLASS);
        newServiceTask.setImplementation(targetTask.getRuntimeClassname());
        newServiceTask.setName(targetTask.getName());
      }
    }

    addObjectToContainer(context, newServiceTask, newServiceTask.getName());
View Full Code Here

    return new Object[] { newServiceTask };
  }

  private CustomServiceTask findCustomServiceTask(ServiceTask serviceTask) {
    CustomServiceTask result = null;

    if (serviceTask.isExtended()) {

      final List<CustomServiceTask> customServiceTasks = ExtensionUtil.getCustomServiceTasks(ActivitiUiUtil.getProjectFromDiagram(getDiagram()));
View Full Code Here

    if (ExtensionUtil.isCustomServiceTask(addedTask)) {
      final ServiceTask serviceTask = (ServiceTask) addedTask;
      final List<CustomServiceTask> customServiceTasks = ExtensionUtil.getCustomServiceTasks(ActivitiUiUtil.getProjectFromDiagram(getDiagram()));

      CustomServiceTask targetTask = null;

      for (final CustomServiceTask customServiceTask : customServiceTasks) {
        if (customServiceTask.getId().equals(serviceTask.getExtensionId())) {
          targetTask = customServiceTask;
          break;
        }
      }

      if (!DiagramBaseShape.ACTIVITY.equals(targetTask.getDiagramBaseShape())) {
        baseShape = targetTask.getDiagramBaseShape();
      }
    }

    int width = 0;
    int height = 0;
View Full Code Here

          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());
View Full Code Here

      }
    }
  }

  private CustomServiceTask findCustomServiceTask(ServiceTask serviceTask) {
    CustomServiceTask result = null;
    if (serviceTask.isExtended()) {

      final List<CustomServiceTask> customServiceTasks = ExtensionUtil.getCustomServiceTasks(
              ActivitiUiUtil.getProjectFromDiagram(getDiagramTypeProvider().getDiagram()));
View Full Code Here

                          // that way; we can't
                          // instantiate the class
                          // anyway
                          if (!Modifier.isAbstract(clazz.getModifiers()) && CustomServiceTask.class.isAssignableFrom(clazz)) {
                            try {
                              CustomServiceTask customServiceTask = (CustomServiceTask) clazz.newInstance();
                              // Add this
                              // CustomServiceTask
                              // to
                              // the result,
                              // wrapped
View Full Code Here

    if (providedCustomServiceTaskDescriptors != null) {
      for (CustomServiceTaskDescriptor dscr : providedCustomServiceTaskDescriptors) {
        Class< ? extends CustomServiceTask> clazz = dscr.getClazz();
        if (clazz != null && !Modifier.isAbstract(clazz.getModifiers()) && CustomServiceTask.class.isAssignableFrom(clazz)) {
          try {
            CustomServiceTask customServiceTask = (CustomServiceTask) clazz.newInstance();
            result.add(new CustomServiceTaskContextImpl(customServiceTask, dscr.getExtensionName(), dscr.getExtensionJarPath()));
          } catch (Exception e) {
            e.printStackTrace();
          }
        }
View Full Code Here

TOP

Related Classes of org.activiti.designer.integration.servicetask.CustomServiceTask

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.