Ejemplo n.º 1
0
 private void addStartedWorkItem(YWorkItem item, boolean inSequence) {
   String caseIDStr = item.getCaseID().toString();
   String taskID = item.getTaskID();
   YSpecificationID specificationID = item.getSpecificationID();
   YTask task = _engineClient.getTaskDefinition(specificationID, taskID);
   String taskDescription = task.getDecompositionPrototype().getID();
   if (null == taskDescription) {
     taskDescription = taskID;
   }
   boolean allowsDynamicInstanceCreation = true;
   try {
     _engineClient.checkElegibilityToAddInstances(item.getIDString());
   } catch (YAWLException e) {
     allowsDynamicInstanceCreation = false;
   }
   _myActiveTasks.addRow(
       caseIDStr + taskID,
       new Object[] {
         caseIDStr,
         taskID,
         taskDescription,
         _formatter.format(item.getEnablementTime()),
         _formatter.format(item.getFiringTime()),
         _formatter.format(item.getStartTime()),
         inSequence ? "Y" : "N",
         new Boolean(allowsDynamicInstanceCreation),
         item.getDataString(),
         getOutputSkeletonXML(caseIDStr, taskID)
       });
 }
Ejemplo n.º 2
0
 public String getOutputSkeletonXML(String caseID, String taskID) {
   YParametersSchema params = _paramsDefinitions.getParamsForTask(taskID);
   YWorkItem item = _engineClient.getWorkItem(caseID + ":" + taskID);
   YSpecificationID specID = item.getSpecificationID();
   YTask task = _engineClient.getTaskDefinition(specID, item.getTaskID());
   return Marshaller.getOutputParamsInXML(
       params, task.getDecompositionPrototype().getRootDataElementName());
 }
Ejemplo n.º 3
0
  private JPanel createTopPanel(YWorkItem item) {
    JPanel topPanel = new JPanel(new BorderLayout());
    topPanel.setBackground(YAdminGUI._apiColour);

    JPanel leftPanel = new JPanel(new BorderLayout());
    leftPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    JTextArea explanatoryText = new JTextArea();
    explanatoryText.setText(
        "The data you submitted for this work item was \n"
            + "validated against a schema (see below).  For some reason the\n"
            + "this data did not succeed in passing the constrainst set\n"
            + "inside the schema.\n"
            + "Usage Note: If this is causing problems try using the Web server\n"
            + "version of YAWL, which supports automatic forms generation.\n"
            + "Otherwise you could copy the schema from this page and use it\n "
            + "to create a valid output document using an XML development tool.");
    explanatoryText.setEditable(false);
    explanatoryText.setFont(new Font("Arial", Font.BOLD, 12));
    explanatoryText.setForeground(Color.DARK_GRAY);
    explanatoryText.setBackground(YAdminGUI._apiColour);
    leftPanel.add(explanatoryText);
    topPanel.add(leftPanel, BorderLayout.WEST);

    JPanel rightPanel = new JPanel(new GridLayout(4, 2));

    rightPanel.setBackground(YAdminGUI._apiColour);
    rightPanel.setBorder(
        BorderFactory.createCompoundBorder(
            BorderFactory.createTitledBorder(
                BorderFactory.createEtchedBorder(), "Work Item Details"),
            BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    YTask task =
        YEngine.getInstance().getTaskDefinition(item.getSpecificationID(), item.getTaskID());
    String taskName = task.getName();

    String[] text = {
      item.getSpecificationID().toString(), taskName, item.getIDString(), item.getStartTimeStr()
    };
    String[] labels = {"Specification ID", "Task Name", "WorkItem ID", "Task Started"};
    for (int i = 0; i < text.length; i++) {
      String s = text[i];
      rightPanel.add(new JLabel(labels[i]));
      JTextField t = new JTextField(s);
      t.setEditable(false);
      rightPanel.add(t);
    }
    topPanel.add(rightPanel, BorderLayout.CENTER);
    return topPanel;
  }
Ejemplo n.º 4
0
 private void addFiredWorkItem(YWorkItem workItem, boolean inSequence) {
   String caseIDStr = workItem.getCaseID().toString();
   String taskID = workItem.getTaskID();
   YSpecificationID specificationID = workItem.getSpecificationID();
   YTask task = _engineClient.getTaskDefinition(specificationID, taskID);
   String taskDescription = task.getDecompositionPrototype().getID();
   if (null == taskDescription) {
     taskDescription = taskID;
   }
   _availableWork.addRow(
       caseIDStr + taskID,
       new Object[] {
         caseIDStr,
         taskID,
         taskDescription,
         "Fired",
         _formatter.format(workItem.getEnablementTime()),
         _formatter.format(workItem.getFiringTime()),
         inSequence ? "Y" : "N"
       });
 }
Ejemplo n.º 5
0
  private void updateSelf() {
    boolean inSequence = false;
    Set availableWorkItems = _engineClient.getAvailableWorkItems();
    for (Iterator iterator = availableWorkItems.iterator(); iterator.hasNext(); ) {
      YWorkItem item = (YWorkItem) iterator.next();

      if (inSequenceWorkitemIDs.contains(item.getTaskID())) {
        inSequence = true;
      } else {
        inSequence = false;
      }

      if (item.getStatus().equals(YWorkItemStatus.statusEnabled)) {
        addEnabledWorkItem(item, inSequence);
      } else if (item.getStatus().equals(YWorkItemStatus.statusFired)) {
        addFiredWorkItem(item, inSequence);
      }
    }
    Set allWorkItems = _engineClient.getAllWorkItems();
    for (Iterator iterator = allWorkItems.iterator(); iterator.hasNext(); ) {
      YWorkItem item = (YWorkItem) iterator.next();

      if (inSequenceWorkitemIDs.contains(item.getTaskID())) {
        inSequence = true;
      } else {
        inSequence = false;
      }

      if (item.getStatus().equals(YWorkItemStatus.statusExecuting)) {
        addStartedWorkItem(item, inSequence);
      }
      if (_paramsDefinitions.getParamsForTask(item.getTaskID()) == null) {
        YTask task = _engineClient.getTaskDefinition(item.getSpecificationID(), item.getTaskID());
        String paramsAsXML = task.getInformation();
        TaskInformation taskInfo = Marshaller.unmarshalTaskInformation(paramsAsXML);
        YParametersSchema paramsForTask = taskInfo.getParamSchema();
        _paramsDefinitions.setParamsForTask(item.getTaskID(), paramsForTask);
      }
    }
  }
Ejemplo n.º 6
0
  /**
   * Innermost method for a reduction rule. Implementation of the abstract method from superclass.
   *
   * @net YNet to perform reduction
   * @element an for consideration. returns a reduced YNet or null if a given net cannot be reduced.
   */
  public YNet reduceElement(YNet net, YExternalNetElement nextElement) {
    YNet reducedNet = net;
    if (nextElement instanceof YCondition) {
      YCondition condition = (YCondition) nextElement;
      Set postSet = condition.getPostsetElements();
      Set preSet = condition.getPresetElements();

      // \pre{p} = 1, \post{p} = 1
      if (preSet.size() == 1 && postSet.size() == 1) {
        YTask t = (YTask) preSet.toArray()[0];
        YTask u = (YTask) postSet.toArray()[0];
        Set preSetOfu = u.getPresetElements();
        Set postSetOfu = u.getPostsetElements();
        // t,u and p are not reset
        // u does not have reset arcs

        Set postSetOft = new HashSet(t.getPostsetElements());
        postSetOft.retainAll(postSetOfu);

        if (t.getSplitType() == YTask._AND
            && u.getSplitType() == YTask._AND
            && preSetOfu.size() == 1
            && u.getRemoveSet().isEmpty()
            && t.getCancelledBySet().isEmpty()
            && u.getCancelledBySet().isEmpty()
            && condition.getCancelledBySet().isEmpty()
            && (!checkReset(postSetOfu))
            && postSetOft.isEmpty()) {

          // set postflows from u to t

          Iterator postFlowIter = postSetOfu.iterator();
          while (postFlowIter.hasNext()) {
            YExternalNetElement next = (YExternalNetElement) postFlowIter.next();
            t.addPostset(new YFlow(t, next));
          }

          // remove condition from postset of t
          t.removePostsetFlow(new YFlow(condition, t));

          reducedNet.removeNetElement(condition);
          reducedNet.removeNetElement(u);

          t.addToYawlMappings(condition);
          t.addToYawlMappings(condition.getYawlMappings());
          t.addToYawlMappings(u);
          t.addToYawlMappings(u.getYawlMappings());

          return reducedNet;
        } // if nested
      } // if - size 1
    } // endif - condition

    return null;
  }