FileDocCategorySizeDatePackage
ViewMessageJDOM.javaAPI DocExample1859Sun Sep 02 14:59:04 BST 2001com.oreilly.forum.xml

ViewMessageJDOM

public class ViewMessageJDOM extends Object
Generate JDOM for the View Message page.

Fields Summary
Constructors Summary
private ViewMessageJDOM()

    
Methods Summary
public static ElementproduceElement(Message message, MessageSummary inResponseTo)

param
message the message to view.
param
inResponseTo the message this one is in response to, or perhaps null.

        Element messageElem = new Element("message");
        messageElem.addAttribute("id", Long.toString(message.getID()));
        DayMonthYear d = message.getCreateDate();
        messageElem.addAttribute("month",
                Integer.toString(d.getMonth()));
        messageElem.addAttribute("day",
                Integer.toString(d.getDay()));
        messageElem.addAttribute("year",
                Integer.toString(d.getYear()));

        Element boardElem = BoardSummaryJDOM.produceNameIDElement(
                message.getBoard());
        messageElem.addContent(boardElem);


        if (inResponseTo != null) {
            Element inRespToElem = new Element("inResponseTo")
                    .addAttribute("id", Long.toString(inResponseTo.getID()));
            inRespToElem.addContent(new Element("subject")
                    .setText(inResponseTo.getSubject()));
            messageElem.addContent(inRespToElem);
        }

        messageElem.addContent(new Element("subject")
                .setText(message.getSubject()));
        messageElem.addContent(new Element("authorEmail")
                .setText(message.getAuthorEmail()));
        messageElem.addContent(new Element("text")
                .setText(message.getText()));
        return messageElem;