Package org.drools.core.process.core

Examples of org.drools.core.process.core.Work


        super(parentShell, "Custom Work Editor");
        setBlockOnOpen(true);
    }

    protected Control createDialogArea(Composite parent) {
        Work work = (Work) getValue();
        String from = (String) work.getParameter("From");
        String to = (String)work.getParameter("To");
        String body = (String)work.getParameter("Body");
        String subject = (String)work.getParameter("Subject");
        if (to != null) {
            for (String email: to.split(";")) {
                if (!"".equals(email)) {
                    Recipient recipient = new Recipient();
                    recipient.setEmail(email);
View Full Code Here


        gd_bodyText.heightHint = 175;
        bodyText.setLayoutData(gd_bodyText);
    }

    protected Object updateValue(Object value) {
        Work work = new WorkImpl();
        work.setName(((Work) value).getName());
        work.setParameter("From", fromText.getText());
        String to = "";
        for (int i = 0; i < recipients.size(); i++) {
            to += recipients.get(i).getEmail();
            if (i != recipients.size() - 1) {
                to += ";";
            }
        }
        work.setParameter("To", to);
        work.setParameter("Subject", subjectText.getText());
        work.setParameter("Body", bodyText.getText());
        work.setParameterDefinitions(((Work) value).getParameterDefinitions());
        return work;
    }
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

        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("Created by: ");
    createdByText = new Text(container, SWT.NONE);
    gridData = new GridData();
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = GridData.FILL;
    createdByText.setLayoutData(gridData);
    value = (String) work.getParameter("CreatedBy");
    createdByText.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("CreatedBy", createdByText.getText());
        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

        // 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

                            actionNode,
                            Node.CONNECTION_DEFAULT_TYPE );
        WorkItemNode workItemNode = new WorkItemNode();
        workItemNode.setId( 3 );
        workItemNode.setName( "WorkItem1" );
        Work work = new WorkImpl();
        work.setName( "MyWork" );
        workItemNode.setWork( work );
        process.addNode( workItemNode );
        new ConnectionImpl( actionNode,
                            Node.CONNECTION_DEFAULT_TYPE,
                            workItemNode,
                            Node.CONNECTION_DEFAULT_TYPE );
        WorkItemNode workItemNode2 = new WorkItemNode();
        workItemNode2.setId( 4 );
        workItemNode2.setName( "WorkItem2" );
        work = new WorkImpl();
        work.setName( "MyWork" );
        workItemNode2.setWork( work );
        process.addNode( workItemNode2 );
        new ConnectionImpl( workItemNode,
                            Node.CONNECTION_DEFAULT_TYPE,
                            workItemNode2,
                            Node.CONNECTION_DEFAULT_TYPE );
        WorkItemNode workItemNode3 = new WorkItemNode();
        workItemNode3.setId( 5 );
        workItemNode3.setName( "WorkItem3" );
        work = new WorkImpl();
        work.setName( "MyWork" );
        workItemNode3.setWork( work );
        process.addNode( workItemNode3 );
        new ConnectionImpl( workItemNode2,
                            Node.CONNECTION_DEFAULT_TYPE,
                            workItemNode3,
View Full Code Here

                            actionNode,
                            Node.CONNECTION_DEFAULT_TYPE );
        WorkItemNode workItemNode = new WorkItemNode();
        workItemNode.setId( 3 );
        workItemNode.setName( "WorkItem1" );
        Work work = new WorkImpl();
        work.setName( "MyWork" );
        workItemNode.setWork( work );
        process.addNode( workItemNode );
        new ConnectionImpl( actionNode,
                            Node.CONNECTION_DEFAULT_TYPE,
                            workItemNode,
View Full Code Here

TOP

Related Classes of org.drools.core.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.