Ejemplo n.º 1
0
  @Override
  public final void pre_commit(boolean dirty) throws DataFault {

    /* All commits to this object forces a write back of the message
     * as it is hard to tell if the message has changed.
     *
     */
    hash = -1;
    try {
      if (m != null) {
        // StreamData sd = new MessageStreamData(m);
        StreamData sd = new ByteArrayStreamData();
        // can't call saveChanges on imported imap message
        if (auto_save) {
          m.saveChanges();
        }
        m.writeTo(sd.getOutputStream());
        // getLogger().debug("update value to "+sd);
        record.setProperty(MESSAGE, sd);
        m = null; // force re-read
      }
    } catch (Exception e) {
      getContext().error(e, "Error writing mail message");
    }
  }
Ejemplo n.º 2
0
 /* (non-Javadoc)
  * @see uk.ac.hpcx.model.helpdesk.MessageProvider#getMessage()
  */
 public final MimeMessage getMessage() throws DataFault, MessagingException {
   if (m == null) {
     Session session = Session.getInstance(getContext().getProperties(), null);
     StreamData sd = record.getStreamDataProperty(MESSAGE);
     if (sd == null) {
       return null;
     }
     m = new MimeMessage(session, sd.getInputStream());
     auto_save = true; // These we can save
   }
   return m;
 }