FileDocCategorySizeDatePackage
PostMessageJDOM.javaAPI DocExample1630Sun Sep 02 14:59:04 BST 2001com.oreilly.forum.xml

PostMessageJDOM

public class PostMessageJDOM extends Object
Produce JDOM for the "Post Message" page.

Fields Summary
Constructors Summary
private PostMessageJDOM()

    
Methods Summary
public static ElementproduceElement(BoardSummary board, MessageSummary inResponseToMsg, boolean showError, java.lang.String subject, java.lang.String authorEmail, java.lang.String msgText)

        Element messageElem = new Element("postMsg");

        // reuse the BoardSummaryJDOM class to produce a
        // fragment of the XML
        messageElem.addContent(BoardSummaryJDOM.produceNameIDElement(board));

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

        if (showError) {
            messageElem.addContent(new Element("error")
                    .addAttribute("code", "ALL_FIELDS_REQUIRED"));
        }

        Element prefill = new Element("prefill");
        prefill.addContent(new Element("subject")
                .setText(subject));
        prefill.addContent(new Element("authorEmail")
                .setText(authorEmail));
        prefill.addContent(new Element("message")
                .setText(msgText));
        messageElem.addContent(prefill);

        return messageElem;