Exemplo n.º 1
0
 /** @param log Log to be sketched. */
 public LogSketch(LogReader log) {
   int i = 0;
   Iterator logInstanceIterator = log.instanceIterator();
   while (logInstanceIterator.hasNext()) {
     ProcessInstance pi = (ProcessInstance) logInstanceIterator.next();
     // usa il metodo di raggruppamento
     // int numSimilarPis =
     // MethodsForWorkflowLogDataStructures.getNumberSimilarProcessInstances(pi);
     m.put(pi.getName(), new Integer(i));
     i++;
   }
 }
  /**
   * Constructor method.
   *
   * @param pi process instance to be stored.
   */
  public FilterPerWorkflowModelElementAndEvent(ProcessInstance pi, int numberSimilarPIs) {

    if (pi != null) {
      AuditTrailEntryListImpl ates = null;

      try {
        ates = new AuditTrailEntryListImpl();

        for (int i = 0; i < pi.getAuditTrailEntryList().size(); i++) {
          AuditTrailEntry ate = new AuditTrailEntryImpl();
          ate.setElement(pi.getAuditTrailEntryList().get(i).getElement());
          ate.setType(pi.getAuditTrailEntryList().get(i).getType());
          ates.append(ate);
        }
      } catch (IOException ioe) {
        System.err.println(
            "Could not create an AuditTrailEntryListImpl in constructor of the class org.processmining.exporting.log.util.FilterPerWorkflowModelElementAndEvent!");
      }

      if (pi.getAttributes().containsKey(IDENTIFIERS)) {
        processInstance = new ProcessInstanceImpl(pi.getProcess(), ates, pi.getModelReferences());
        processInstance.setDataAttributes(pi.getDataAttributes());
        processInstance.setName(pi.getName());
        processInstance.setDescription(pi.getDescription());

      } else {

        processInstance = new ProcessInstanceImpl(pi.getProcess(), ates, pi.getModelReferences());
        processInstance.setDataAttributes(new DataSection());
        processInstance.setName(pi.getName());
        processInstance.setDescription(pi.getDescription());
        addGroupedPiIdentifier(pi.getName());
      }

      setNumberSimilarPIs(Integer.toString(numberSimilarPIs));

    } else {
      throw new NullPointerException("pi equals null!");
    }
  }