/** * Imposta il campo fieldFrom per l'oggetto Email. * * @param email email da popolare * @param cas cas da cui estrarre le annotations * @return valore del campo */ private String addEmailFrom(final Email email, final JCas cas) { Type annotationType = cas.getTypeSystem().getType(UserAuthorAnnotation.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()) { UserAuthorAnnotation ann = (UserAuthorAnnotation) it.next(); emailMap.put(ann.getEmail(), "Y"); } Enumeration<String> en = emailMap.keys(); while (en.hasMoreElements()) { String element = en.nextElement(); email.getEmailFrom().add(element); } return ""; }