remoteHost = (String) in.readObject(); remoteAddr = (String) in.readObject(); setLastUpdated((Date) in.readObject());
/** * @param mail * @param newName * @throws MessagingException */ public MailImpl(Mail mail, String newName) throws MessagingException { this(newName, mail.getSender(), mail.getRecipients(), mail.getMessage()); setRemoteHost(mail.getRemoteHost()); setRemoteAddr(mail.getRemoteAddr()); setLastUpdated(mail.getLastUpdated()); try { if (mail instanceof MailImpl) { setAttributesRaw((HashMap) cloneSerializableObject(((MailImpl) mail).getAttributesRaw())); } else { HashMap attribs = new HashMap(); for (Iterator i = mail.getAttributeNames(); i.hasNext(); ) { String hashKey = (String) i.next(); attribs.put(hashKey,cloneSerializableObject(mail.getAttribute(hashKey))); } setAttributesRaw(attribs); } } catch (IOException e) { // should never happen for in memory streams setAttributesRaw(new HashMap()); } catch (ClassNotFoundException e) { // should never happen as we just serialized it setAttributesRaw(new HashMap()); } }
/** * Reads a mail message from the given mail node. * * @param node * mail node * @return mail message * @throws MessagingException * if a messaging error occurs * @throws RepositoryException * if a repository error occurs * @throws IOException * if an IO error occurs */ private Mail getMail(Node node) throws MessagingException, RepositoryException, IOException { String name = Text.unescapeIllegalJcrChars(node.getName()); MailImpl mail = new MailImpl(name, getSender(node), getRecipients(node), getMessage(node)); mail.setState(getState(node)); mail.setLastUpdated(getLastUpdated(node)); mail.setErrorMessage(getError(node)); mail.setRemoteHost(getRemoteHost(node)); mail.setRemoteAddr(getRemoteAddr(node)); getAttributes(node, mail); return mail; }