FileDocCategorySizeDatePackage
BoardSummaryJDOM.javaAPI DocExample1472Sun Sep 02 14:59:04 BST 2001com.oreilly.forum.xml

BoardSummaryJDOM

public class BoardSummaryJDOM extends Object
Produces JDOM for a BoardSummary object.

Fields Summary
Constructors Summary
private BoardSummaryJDOM()

    
Methods Summary
public static ElementproduceElement(BoardSummary board)

        Element boardElem = produceNameIDElement(board);

        // add the list of messages
        Iterator iter = board.getMonthsWithMessages();
        while (iter.hasNext()) {
            MonthYear curMonth = (MonthYear) iter.next();
            Element elem = new Element("messages");
            elem.addAttribute("month", Integer.toString(curMonth.getMonth()));
            elem.addAttribute("year", Integer.toString(curMonth.getYear()));
            boardElem.addContent(elem);
        }

        return boardElem;
    
public static ElementproduceNameIDElement(BoardSummary board)

        // produce the following:
        // <board id="123">
        //   <name>the board name</name>
        //   <description>board description</description>
        // </board>
        Element boardElem = new Element("board");
        boardElem.addAttribute("id", Long.toString(board.getID()));
        boardElem.addContent(new Element("name")
                .setText(board.getName()));
        boardElem.addContent(new Element("description")
                .setText(board.getDescription()));
        return boardElem;