Пример #1
0
  /**
   * estrae i metadati della cas e li associa all'oggetto Event.
   *
   * @param event event da salvare su hpm
   * @param cas oggetto cas
   */
  private void addEventMetadata(final Event event, final JCas cas) {
    if (logger.isDebugEnabled()) {
      logger.debug("addEventMetadata - BEGIN");
    }

    addEventMetadata("author", getUserAuthorAnnotation(cas).getEmail(), event);

    addEventMetadata("action-reference", getActionReferenceAnnotation(cas).getValue(), event);

    addEventMetadata("action-type", getActionTypeAnnotation(cas).getValue(), event);

    addEventMetadata("event-id", getEventIdAnnotation(cas).getValue(), event);

    SystemAnnotation systemAnnotation = getSystemAnnotation(cas);
    addEventMetadata("system-id", systemAnnotation.getSystemId(), event);
    addEventMetadata("system-type", systemAnnotation.getSystemType(), event);

    BodyAnnotation bodyAnnotation = getBodyAnnotation(cas);
    if (bodyAnnotation != null) {
      addEventMetadata("body-value", bodyAnnotation.getValue(), event);
      addEventMetadata("body-type", bodyAnnotation.getBodyType(), event);
    }

    addEventMetadata("creation-date", getDateCreationDateAnnotation(cas).getValue(), event);

    DetailsAnnotation detailsAnnotation = getDetailsAnnotation(cas);
    if (detailsAnnotation != null) {
      addEventMetadata("details", detailsAnnotation.getValue(), event);
    }

    addEventMetadata("title", getTitleAnnotation(cas).getValue(), event);

    logger.debug("addEventMetadata - END");
  }
Пример #2
0
  /**
   * Imposta il campo emailBody per l'oggetto Email.
   *
   * @param cas cas da elaborare
   * @return valore del campo
   */
  private String getEmailBody(final JCas cas) {
    Type annotationType = cas.getTypeSystem().getType(BodyAnnotation.class.getCanonicalName());
    FSIterator<Annotation> it = cas.getAnnotationIndex(annotationType).iterator();

    String emailBody = "";
    if (it.hasNext()) {
      BodyAnnotation ann = (BodyAnnotation) it.next();

      String value = ann.getValue();
      if (value != null) {
        emailBody = value;
      }
    }

    return emailBody;
  }