/**
   * @see it.webscience.kpeople.ega.adapter.sharepoint
   *     .actionDataProcessor.actionDataInterface.ActionDataParserInterface
   *     #parser(org.apache.axiom.om.OMElement, it.webscience.kpeople.domain.model.KpeopleAction).
   * @param action azione che è stata intercettata.
   * @param response indica il valore di ritorno della chiamata al webservice di sharepoint
   *     contenente le informazioni sulle liste monitorate
   * @return hashmap da sostituire.
   * @throws Exception eccezione.
   */
  public KpeopleSimpleEvent parser(final GetItemResponse response, final KpeopleAction action)
      throws Exception {

    KpeopleLogger.getInstance()
        .getService()
        .logInfo(
            KpeopleLabel.getSystemId(), this.getClass() + ".parser()" + KpeopleLabel.getLogStart());

    manageActionInfo(action);

    String operation = action.getActionType().split("/")[1];
    eventResult.setOperation(operation);

    manageEventInfo(response, operation);

    DataHandler stream = response.getStream();

    manageDetails(response, stream);

    manageAttachments(action, stream);

    KpeopleLogger.getInstance()
        .getService()
        .logInfo(
            KpeopleLabel.getSystemId(), this.getClass() + ".parser()" + KpeopleLabel.getLogStop());

    return eventResult;
  }
  private void manageEventInfo(GetItemResponse response, String operation) {
    FieldInformationCollection fields = response.getFields();

    FieldInformation[] fieldsInformation = fields.getFieldInformation();

    String createdBy = null;
    String modifiedBy = null;
    String created = null;

    String modified = null;
    String contentType = null;
    String eventCreationDate = null;
    String eventAuthor = null;
    HashMap<String, String> hm = new HashMap<String, String>();

    for (int i = 0; i < fieldsInformation.length; i++) {
      FieldInformation field = fieldsInformation[i];
      String name = field.getInternalName();
      if (name.equalsIgnoreCase("BaseName")) {
        fileName = field.getValue();
        eventResult.setTitle(fileName);
      }
      if (name.equalsIgnoreCase("Created_x0020_By")) {
        createdBy = field.getValue();
      }
      if (name.equalsIgnoreCase("Modified_x0020_By")) {
        modifiedBy = field.getValue();
      }
      if (name.equalsIgnoreCase("Created_x0020_Date")) {
        created = field.getValue();
      }
      if (name.equalsIgnoreCase("Last_x0020_Modified")) {
        modified = field.getValue();
      }
      if (name.equalsIgnoreCase("File_x0020_Type")) {
        contentType = field.getValue();
      }
      if (name.equalsIgnoreCase("Process")) {
        String processValue[] = field.getValue().split("-");
        hm.put("kpeopletag", processValue[0]);
      }
    }

    if (operation.equalsIgnoreCase("modified")) {
      eventCreationDate = modified;
      eventAuthor = modifiedBy;
    }
    if (operation.equalsIgnoreCase("created")) {
      eventCreationDate = created;
      eventAuthor = createdBy;
    }

    eventResult.setContentType(contentType);

    eventResult.setCreationDate(ActionDataProcessorUtil.getDateString(eventCreationDate));
    Author author = new Author();
    author.setUsername(eventAuthor);
    eventResult.setAuthor(author);
    eventResult.setProperties(hm);
    // eventResult.setAuthor(eventAuthor);

  }