Mercurial > hg > Members > shoshi > TreeCMS > TreeCMSPrototype1
view src/treecms/demo/ContentsTreeBuilder.java @ 53:7a558c7d4f41
added storage-conf.xml
author | shoshi |
---|---|
date | Wed, 16 Feb 2011 18:43:58 +0900 |
parents | 1b78f1f3add3 |
children |
line wrap: on
line source
package treecms.demo; import java.io.File; import java.io.FileInputStream; import treecms.proto.api.Node; import treecms.proto.simple.SimpleBrowser; public class ContentsTreeBuilder { public static Node blogSite() throws Exception { Node root = SimpleBrowser.getSingleton().useContents(); root.setTitle("ブログ形式サイト"); //contents Node contents = root.createNode(); root.addChild(contents); contents.setTitle("contents"); //contents - 2009年12月 Node y09m12 = root.createNode(); contents.addChild(y09m12); y09m12.setTitle("2009年12月"); //contents - 2009年12月 - 今日はレクチャの日です Node lecture = root.createNode(); y09m12.addChild(lecture); lecture.setTitle("今日はレクチャの日です"); lecture.setAttribute("layout","Blog/Main/BlogPage".getBytes()); lecture.setAttribute("publish_date","2009-12-22-00-00-00".getBytes()); //contents - 2009年12月 - 今日はレクチャの日です - 本文 Node body = root.createNode(); lecture.addChild(body); body.setTitle("本文"); body.setAttribute("data","今日は二子玉川のオフィスでレイアウトの練習をしています。\n難しそうです。\nたいへんです。\n困ったです。".getBytes()); //contents - 2009年12月 - 今日はレクチャの日です - 画像 File picFile = new File("contents/cat.jpeg"); byte buf[] = new byte[(int)picFile.length()]; FileInputStream in = new FileInputStream(picFile); in.read(buf); in.close(); Node pic = root.createNode(); lecture.addChild(pic); pic.setTitle("画像"); pic.setAttribute("data",buf); //contents - 2010年01月 Node y10m01 = root.createNode(); contents.addChild(y10m01); y10m01.setTitle("2010年1月"); //contents - 2010年01月 - 整体 Node seitai = root.createNode(); y10m01.addChild(seitai); seitai.setTitle("整体"); seitai.setAttribute("layout","Blog/Main/BlogPage".getBytes()); seitai.setAttribute("publish_date","2009-01-05-00-00-00".getBytes()); //contents - 2010年01月 - 整体 - 本文 Node bSeitai = root.createNode(); seitai.addChild(bSeitai); bSeitai.setTitle("本文"); bSeitai.setAttribute("data","今日は整体の先生のところへ行きました。昨年 11 月に腰を痛めてから、ずっと通っています。歩けなくなったのが 3 日で一応歩けるようになりました。でも朝とか痛いし、重い物もてないし、台所にずっと立ってるのがつらいんです。".getBytes()); //contents - 2010年01月 - 仕事始め Node hajime = root.createNode(); y10m01.addChild(hajime); hajime.setTitle("仕事始め"); hajime.setAttribute("layout","Blog/Main/BlogPage".getBytes()); lecture.setAttribute("publish_date","2009-01-07-00-00-00".getBytes()); //contents - 2010年01月 - 仕事始め - 本文 Node bHajime = root.createNode(); hajime.addChild(bHajime); bHajime.setTitle("本文"); bHajime.setAttribute("data","なんかひどい一日でした。\n佐野厄除け大師の電車広告によると、今年はなんとか厄みたいなんで、ちょっといやだなぁ。".getBytes()); //comments Node comments = root.createNode(); root.addChild(comments); comments.setTitle("comments"); //application Node application = root.createNode(); root.addChild(application); application.setTitle("#APPLICATION"); //application - css Node css = root.createNode(); application.addChild(css); css.setTitle("css"); css.setAttribute("data","#header {background-image: url(/cgi-bin/WebObjects/Atropos_TRAIN.woa/wa/imageP/12606f53c0b);}".getBytes()); return root; } }