Package org.drools.process.core

Examples of org.drools.process.core.Work


        final GridLayout gridLayout = new GridLayout();
        gridLayout.horizontalSpacing = 2;
        container.setLayout(gridLayout);
        headersTabItem.setControl(container);
       
        Work work = (Work) getValue();
       
        Label nameLabel = new Label(container, SWT.NONE);
        nameLabel.setText("Name: ");
        nameText = new Text(container, SWT.NONE);
        GridData gridData = new GridData();
        gridData.grabExcessHorizontalSpace = true;
        gridData.horizontalAlignment = GridData.FILL;
        nameText.setLayoutData(gridData);
        String name = (String) work.getParameter("TaskName");
        nameText.setText(name == null ? "" : name);
       
    Label label = new Label(container, SWT.NONE);
    label.setText("Actor(s): ");
    actorText = new Text(container, SWT.NONE);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    actorText.setLayoutData(gridData);
    String value = (String) work.getParameter("ActorId");
    actorText.setText(value == null ? "" : value);

    label = new Label(container, SWT.NONE);
    label.setText("Group(s): ");
    groupText = new Text(container, SWT.NONE);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    groupText.setLayoutData(gridData);
    value = (String) work.getParameter("GroupId");
    groupText.setText(value == null ? "" : value);

    label = new Label(container, SWT.NONE);
    label.setText("Comment: ");
    commentText = new Text(container, SWT.MULTI);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    commentText.setLayoutData(gridData);
    value = (String) work.getParameter("Comment");
    commentText.setText(value == null ? "" : value.toString());

    label = new Label(container, SWT.NONE);
    label.setText("Priority: ");
    priorityText = new Text(container, SWT.NONE);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    priorityText.setLayoutData(gridData);
    value = (String) work.getParameter("Priority");
    priorityText.setText(value == null ? "" : value);

    skippableButton = new Button(container, SWT.CHECK | SWT.LEFT);
    skippableButton.setText("Skippable");
    value = (String) work.getParameter("Skippable");
    skippableButton.setSelection("true".equals(value));
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    skippableButton.setLayoutData(gridData);

    label = new Label(container, SWT.NONE);
    label.setText("Content: ");
    contentText = new Text(container, SWT.MULTI);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    contentText.setLayoutData(gridData);
    value = (String) work.getParameter("Content");
    contentText.setText(value == null ? "" : value.toString());
   
    label = new Label(container, SWT.NONE);
    label.setText("Locale: ");
    localeText = new Text(container, SWT.NONE);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    localeText.setLayoutData(gridData);
    value = (String) work.getParameter("Locale");
    localeText.setText(value == null ? "en-UK" : value.toString());
  }
View Full Code Here


    }
   
    public void setNode(Node node) {
        super.setNode(node);
        if (this.workDefinition != null) {
            Work work = getWorkItemNode().getWork();
            if (work == null) {
                work = new WorkImpl();
                work.setName(workDefinition.getName());
                getWorkItemNode().setWork(work);
            }
            work.setParameterDefinitions(workDefinition.getParameters());
        }
    }
View Full Code Here

        }
    }
   
    public void setWorkDefinition(WorkDefinition workDefinition) {
        this.workDefinition = workDefinition;
        Work work = getWorkItemNode().getWork();
        if (work == null) {
            work = new WorkImpl();
            work.setName(workDefinition.getName());
            getWorkItemNode().setWork(work);
        }
        work.setParameterDefinitions(workDefinition.getParameters());
    }
View Full Code Here

            return new TimerWrapper();
        } else if (node instanceof HumanTaskNode) {
            return new HumanTaskNodeWrapper();
        } else if (node instanceof WorkItemNode) {
            WorkItemWrapper workItemWrapper = new WorkItemWrapper();
            Work work = ((WorkItemNode) node).getWork();
            if (work != null && work.getName() != null) {
                try {
                    WorkDefinition workDefinition =
                        WorkItemDefinitions.getWorkDefinitions(project)
                            .get(work.getName());
                    if (workDefinition == null) {
    //                    DroolsEclipsePlugin.log(
    //                        new IllegalArgumentException("Could not find work definition for work " + work.getName()));
                        workDefinition = new WorkDefinitionImpl();
                        ((WorkDefinitionImpl) workDefinition).setName(work.getName());
                    }
                    workItemWrapper.setWorkDefinition(workDefinition);
                } catch (Throwable t) {
                    // an error might be thrown when parsing the work definitions,
                    // but this should already be displayed to the user
View Full Code Here

        // open custom editor pane if one exists
        WorkDefinition workDefinition = getWorkDefinition();
        if (workDefinition instanceof WorkDefinitionExtension) {
            String editor = ((WorkDefinitionExtension) workDefinition).getCustomEditor();
            if (editor != null) {
                Work work = openEditor(editor, workDefinition);
                if (work != null) {
                    SetWorkCommand setCommand = new SetWorkCommand();
                    setCommand.setPropertyValue(work);
                    CommandStack stack = getViewer().getEditDomain().getCommandStack();
                    stack.execute(setCommand);
View Full Code Here

        final GridLayout gridLayout = new GridLayout();
        gridLayout.horizontalSpacing = 2;
        container.setLayout(gridLayout);
        headersTabItem.setControl(container);
       
        Work work = (Work) getValue();
       
        Label nameLabel = new Label(container, SWT.NONE);
        nameLabel.setText("Name: ");
        nameText = new Text(container, SWT.NONE);
        GridData gridData = new GridData();
        gridData.grabExcessHorizontalSpace = true;
        gridData.horizontalAlignment = GridData.FILL;
        nameText.setLayoutData(gridData);
        String name = (String) work.getParameter("TaskName");
        nameText.setText(name == null ? "" : name);
       
    Label label = new Label(container, SWT.NONE);
    label.setText("Actor(s): ");
    actorText = new Text(container, SWT.NONE);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    actorText.setLayoutData(gridData);
    String value = (String) work.getParameter("ActorId");
    actorText.setText(value == null ? "" : value);

    label = new Label(container, SWT.NONE);
    label.setText("Group(s): ");
    groupText = new Text(container, SWT.NONE);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    groupText.setLayoutData(gridData);
    value = (String) work.getParameter("GroupId");
    groupText.setText(value == null ? "" : value);

    label = new Label(container, SWT.NONE);
    label.setText("Comment: ");
    commentText = new Text(container, SWT.MULTI);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    commentText.setLayoutData(gridData);
    value = (String) work.getParameter("Comment");
    commentText.setText(value == null ? "" : value.toString());

    label = new Label(container, SWT.NONE);
    label.setText("Priority: ");
    priorityText = new Text(container, SWT.NONE);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    priorityText.setLayoutData(gridData);
    value = (String) work.getParameter("Priority");
    priorityText.setText(value == null ? "" : value);

    skippableButton = new Button(container, SWT.CHECK | SWT.LEFT);
    skippableButton.setText("Skippable");
    value = (String) work.getParameter("Skippable");
    skippableButton.setSelection("true".equals(value));
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    skippableButton.setLayoutData(gridData);

    label = new Label(container, SWT.NONE);
    label.setText("Content: ");
    contentText = new Text(container, SWT.MULTI);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.grabExcessVerticalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    gridData.verticalAlignment = GridData.FILL;
    contentText.setLayoutData(gridData);
    value = (String) work.getParameter("Content");
    contentText.setText(value == null ? "" : value.toString());
   
    label = new Label(container, SWT.NONE);
    label.setText("Locale: ");
    localeText = new Text(container, SWT.NONE);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    localeText.setLayoutData(gridData);
    value = (String) work.getParameter("Locale");
    localeText.setText(value == null ? "en-UK" : value.toString());
  }
View Full Code Here

    value = (String) work.getParameter("Locale");
    localeText.setText(value == null ? "en-UK" : value.toString());
  }

  private void createReassignmentTab(TabFolder tabFolder) {
    Work work = (Work) getValue();
   
    String notStartedReassign = (String) work.getParameter("NotStartedReassign");
    String notCompletedReassign = (String) work.getParameter("NotCompletedReassign");
   
    if (notStartedReassign != null) {
      String[] reassigns = notStartedReassign.split(COMPONENT_SEPARATOR_ESCAPED);
     
      for (String reassign : reassigns) {
View Full Code Here

            }
        });
  }
 
  private void createNotificationTab(TabFolder tabFolder) {
    Work work = (Work) getValue();
   
    String notStartedNotify = (String) work.getParameter("NotStartedNotify");
    String notCompletedNotify = (String) work.getParameter("NotCompletedNotify");
   
    if (notStartedNotify != null) {
      String[] notifies = notStartedNotify.split(COMPONENT_SEPARATOR_ESCAPED);
     
      for (String notification : notifies) {
View Full Code Here

        });
   
  }

  protected Work updateValue(Work value) {
        Work work = new WorkImpl();
        work.setName("Human Task");
        work.setParameter("TaskName", nameText.getText());
        work.setParameter("ActorId", actorText.getText());
        work.setParameter("GroupId", groupText.getText());
        work.setParameter("Comment", commentText.getText());
        work.setParameter("Priority", priorityText.getText());
        work.setParameter("Skippable", skippableButton.getSelection() + "");
        String content = contentText.getText();
        work.setParameter("Content", content.trim().length() == 0 ? null : content);
        work.setParameter("Locale", localeText.getText());
       
        // process reassignment
        if (!reassignments.isEmpty()) {
          StringBuffer notStartedReassignments = new StringBuffer();
          StringBuffer notCompletedReassignments = new StringBuffer();
          for (Reassignment reassign : reassignments) {
            if ("not-started".equalsIgnoreCase(reassign.getTypeAsString())) {
              if (notStartedReassignments.length() > 0) {
                notStartedReassignments.append(COMPONENT_SEPARATOR);
              }
              notStartedReassignments.append(reassign.toDataInput());
            } else if ("not-completed".equalsIgnoreCase(reassign.getTypeAsString())) {
              if (notCompletedReassignments.length() > 0) {
                notCompletedReassignments.append(COMPONENT_SEPARATOR);
              }
              notCompletedReassignments.append(reassign.toDataInput());
            }
          }
          if (notStartedReassignments.length() > 0) {
            work.setParameter("NotStartedReassign", notStartedReassignments.toString());
          }
          if (notCompletedReassignments.length() > 0) {
            work.setParameter("NotCompletedReassign", notCompletedReassignments.toString());
          }
        }
       
        // process notifications
        if (!notifications.isEmpty()) {
          StringBuffer notStartedNotifications = new StringBuffer();
          StringBuffer notCompletedNotifications = new StringBuffer();
          for (Notification notification : notifications) {
            if ("not-started".equalsIgnoreCase(notification.getType())) {
              if (notStartedNotifications.length() > 0) {
                notStartedNotifications.append(COMPONENT_SEPARATOR);
              }
              notStartedNotifications.append(notification.toDataInput());
            } else if ("not-completed".equalsIgnoreCase(notification.getType())) {
              if (notCompletedNotifications.length() > 0) {
                notCompletedNotifications.append(COMPONENT_SEPARATOR);
              }
              notCompletedNotifications.append(notification.toDataInput());
            }
          }
          if (notStartedNotifications.length() > 0) {
            work.setParameter("NotStartedNotify", notStartedNotifications.toString());
          }
          if (notCompletedNotifications.length() > 0) {
            work.setParameter("NotCompletedNotify", notCompletedNotifications.toString());
          }
        }
       
       
        work.setParameterDefinitions(((Work) value).getParameterDefinitions());
        return work;
    }
View Full Code Here

        Composite composite = (Composite) super.createDialogArea(parent);
        GridLayout gridLayout = new GridLayout();
        gridLayout.numColumns = 2;
        composite.setLayout(gridLayout);
       
        Work work = (Work) getValue();
       
        Label nameLabel = new Label(composite, SWT.NONE);
        nameLabel.setText("Name: ");
        Text nameText = new Text(composite, SWT.NONE);
        nameText.setEditable(false);
        GridData gridData = new GridData();
        gridData.grabExcessHorizontalSpace = true;
        gridData.horizontalAlignment = GridData.FILL;
        nameText.setLayoutData(gridData);
        String name = work.getName();
        nameText.setText(name == null ? "" : name);
       
        Set<ParameterDefinition> parameters = workDefinition.getParameters();
        for (ParameterDefinition param: parameters) {
            Label label = new Label(composite, SWT.NONE);
            label.setText(param.getName() + ": ");
            Text text = new Text(composite, SWT.NONE);
            gridData = new GridData();
            gridData.grabExcessHorizontalSpace = true;
            gridData.horizontalAlignment = GridData.FILL;
            text.setLayoutData(gridData);
            texts.put(param.getName(), text);
            Object value = work.getParameter(param.getName());
            text.setText(value == null ? "" : value.toString());
        }
       
        return composite;
    }
View Full Code Here

TOP

Related Classes of org.drools.process.core.Work

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.