public void addGroupedPiIdentifier(String idToAppend) {
   if (processInstance.getAttributes().containsKey(IDENTIFIERS)) {
     String identifiers = (String) processInstance.getAttributes().get(IDENTIFIERS);
     identifiers += ", " + idToAppend;
     processInstance.getAttributes().put(IDENTIFIERS, identifiers);
   } else {
     processInstance.getAttributes().put(IDENTIFIERS, idToAppend);
   }
 }
 /** @return The number of similar process instance. */
 public int getNumberSimilarPIs() {
   return Integer.parseInt(
       (String)
           processInstance
               .getAttributes()
               .get(MethodsForWorkflowLogDataStructures.NUM_SIMILAR_INSTANCES));
 }
  /**
   * 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!");
    }
  }
 private void setNumberSimilarPIs(String number) {
   processInstance
       .getAttributes()
       .put(MethodsForWorkflowLogDataStructures.NUM_SIMILAR_INSTANCES, number);
 }