/** * Take all values from this object. * * @param user * The other object to take values from. */ protected void setAll(Message other) { // copy the header m_header = newMessageHeader(this, other.getHeader()); // body m_body = other.getBody(); // setup for properties m_properties = new BaseResourcePropertiesEdit(); m_properties.addAll(other.getProperties()); } // setAll
/** * check permissions for the message, to be able to edit or save it. * * @param m * The message. * @return true if the user is allowed to update the message, false if not. */ protected boolean allowEditMessage(Message m, String fOwn, String fAny) { // is this the user's own? if (m.getHeader().getFrom().getId().equals(m_sessionManager.getCurrentSessionUserId())) { // own or any return unlockCheck2(fOwn, fAny, m.getReference()); } else { // just any return unlockCheck(fAny, m.getReference()); } }
/** * Are these objects equal? If they are both Message objects, and they have matching id's, they are. * * @return true if they are equal, false if not. */ public boolean equals(Object obj) { if (!(obj instanceof Message)) return false; return ((Message) obj).getId().equals(getId()); } // equals
/** * Does this object satisfy the criteria of the filter? * * @return true if the object is accepted by the filter, false if not. */ public boolean accept(Object o) { // reject if not a public message if (o instanceof Message) { Message msg = (Message) o; if ((msg.getProperties().getProperty(ResourceProperties.PROP_PUBVIEW) == null || !msg.getProperties().getProperty(ResourceProperties.PROP_PUBVIEW).equals(Boolean.TRUE.toString())) && !m_isChannelPublic) return false; else if (msg.getHeader().getDraft()) return false; } // next, use the specified filter, if present if (m_filter != null) return m_filter.accept(o); return true; } // accept
/** * Access the resource date. * * @param r * The resource. * @return The resource date. */ public Time getDate(Entity r) { return ((Message) r).getHeader().getDate(); }
/** * Collect the fields that need to be stored outside the XML (for the resource). * * @return An array of field values to store in the record outside the XML (for the resource). */ public Object[] storageFields(Entity r) { Object[] rv = new Object[6]; rv[0] = ((Message) r).getHeader().getDate(); rv[1] = ((Message) r).getHeader().getFrom().getId(); rv[2] = "0"; rv[3] = r.getProperties().getProperty(ResourceProperties.PROP_PUBVIEW) == null ? "0" : "1"; rv[4] = ((MailArchiveMessage) r).getMailArchiveHeader().getSubject(); rv[5] = ((Message) r).getBody(); return rv; }
MessageHeader mh = m.getHeader(); StringBuilder sb = new StringBuilder(); Class c = mh.getClass(); if (contextualUserDisplayService != null) Reference ref1 = entityManager.newReference(m.getReference()); String context = siteService.siteReference(ref1.getContext()); displayName = contextualUserDisplayService.getUserDisplayName(mh.getFrom(), context); String mBody = m.getBody();
protected String getSummaryFromHeader(Message item, MessageHeader header) { String newtext; String body = item.getBody(); if ( body.length() > 50 ) body = body.substring(1,49); String newText = body + ", " + header.getFrom().getDisplayName() + ", " + header.getDate().toStringLocalFull(); return newText; }
if (m.getId().equals(messageId)) m_threadLocalManager.set(m.getReference(), m);
/** * Does this object satisfy the criteria of the filter? * * @param o * The object to test. * @return true if the object is accepted by the filter, false if not. */ public boolean accept(Object o) { // we want to test only messages if (!(o instanceof Message)) { return false; } // if the item cannot be read, reject it if (!unlockCheck(SECURE_READ, ((Message) o).getReference())) { return false; } // accept this one return true; } // accept
rv = message.getProperties();
url = message.getUrl();
/** * Access the resource date. * * @param r * The resource. * @return The resource date. */ public Time getDate(Entity r) { return ((Message) r).getHeader().getDate(); }
/** * Does this object satisfy the criteria of the filter? * * @return true if the object is accepted by the filter, false if not. */ public boolean accept(Object o) { // reject if not a public message if (o instanceof Message) { Message msg = (Message) o; if (msg.getProperties().getProperty(ResourceProperties.PROP_PUBVIEW) == null || !msg.getProperties().getProperty(ResourceProperties.PROP_PUBVIEW).equals(Boolean.TRUE.toString())) return false; else if (msg.getHeader().getDraft()) return false; } // next, use the specified filter, if present if (m_filter != null) return m_filter.accept(o); return true; } // accept
protected String getSummaryFromHeader(Message item, MessageHeader header) { String newtext; String body = item.getBody(); if ( body.length() > 50 ) body = body.substring(1,49); String newText = body + ", " + header.getFrom().getDisplayName() + ", " + header.getDate().toStringLocalFull(); return newText; }
if (m.getId().equals(messageId)) m_threadLocalManager.set(m.getReference(), m);
/** * Does this object satisfy the criteria of the filter? * * @param o * The object to test. * @return true if the object is accepted by the filter, false if not. */ public boolean accept(Object o) { // we want to test only messages if (!(o instanceof Message)) { return false; } // if the item cannot be read, reject it if (!unlockCheck(SECURE_READ, ((Message) o).getReference())) { return false; } // accept this one return true; } // accept