Ejemplo n.º 1
0
  /**
   * Esegue il process nel caso default.
   *
   * @param cas cas
   * @throws SQLException errore nel salvataggio
   */
  private void processDefaultCas(final JCas cas) throws SQLException {
    //      recupero le annotations presenti nella CAS
    String eventId = getEventIdAnnotation(cas).getValue();

    SystemAnnotation systemAnnotation = getSystemAnnotation(cas);
    String systemId = systemAnnotation.getSystemId();

    String title = getTitleAnnotation(cas).getValue();

    //      costruisco l'oggetto Hpm Event
    Event event = new Event();
    event.setHpmEventId(eventId);
    event.setHpmSystemId(systemId);

    //      associa all'oggetto Event i suoi metadati
    addEventMetadata(event, cas);

    //      aggiunge le proprietà
    addProperties(event, cas);

    String actionType = getActionTypeAnnotation(cas).getValue();

    if (checkValidAction(actionType)) {
      Email email = new Email();
      email.setAttachmentType(new AttachmentType(1));

      addEmailTo(email, cas);
      addEmailCc(email, cas);
      addEmailCcn(email, cas);
      addEmailFrom(email, cas);

      email.setEmailObject(title);
      email.setEmailBody(getEmailBody(cas));
      event.getAttachments().add(email);

      addDocuments(event, email, cas);
    } else {
      addDocuments(event, null, cas);
    }

    HpmDao dao = new HpmDao();
    dao.saveEventManager(event);
  }