Ejemplo n.º 1
0
  /**
   * Imposta il campo fieldCc per l'oggetto Email.
   *
   * @param email email da popolare
   * @param cas cas da cui estrarre le annotations
   * @return valore del campo
   */
  private String addEmailCc(final Email email, final JCas cas) {
    Type annotationType =
        cas.getTypeSystem().getType(UserReceiverCcAnnotation.class.getCanonicalName());
    FSIterator<Annotation> it = cas.getAnnotationIndex(annotationType).iterator();

    //      uso la mappa per evitare l'inserimento di email duplicate
    Hashtable<String, String> emailMap = new Hashtable<String, String>();

    while (it.hasNext()) {
      UserReceiverCcAnnotation ann = (UserReceiverCcAnnotation) it.next();
      emailMap.put(ann.getEmail(), "Y");
    }

    Enumeration<String> en = emailMap.keys();
    while (en.hasMoreElements()) {
      String element = en.nextElement();
      email.getEmailCc().add(element);
    }

    return "";
  }