|
From: Philipp H. <p-...@us...> - 2006-05-30 14:48:15
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/discussion In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv26797/src/org/cobricks/discussion Modified Files: DiscussionManager.java DiscussionServlet.java itemontology.xml properties.txt DiscussionPresenter.java DiscussionManagerImpl.java Added Files: ChronologicalPostingComparator.java Posting.java TreePostingComparator.java DiscussionCategory.java OrderComparator.java Log Message: discussion modul without input forms --- NEW FILE: DiscussionCategory.java --- package org.cobricks.discussion; import org.cobricks.category.Category; public class DiscussionCategory extends Category { public DiscussionCategory() { super(); // TODO Auto-generated constructor stub } } Index: itemontology.xml =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/discussion/itemontology.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- itemontology.xml 2 May 2006 11:56:31 -0000 1.3 +++ itemontology.xml 30 May 2006 14:48:06 -0000 1.4 @@ -1,30 +1,17 @@ <itemontology> -<!-- Forum as Category -<class name="forum" parent="item" javaclassname="org.cobricks.discussion.Forum"> -<description lang="de">Forum</description> -<description lang="en">Forum</description> -<attr name="forumid" type="int" /> -<attr name="children" type="item[]" /> -<attr name="parent" type="item" /> ---> <class name="discussion_topic" parent="item"> <description lang="en">Topic in the discussion component</description> -<attr name="first_posting" type="item" /> -<attr name="parent_cat" type="discussion_forum" /> -<attr name="test_int" type="int" /> -<attr name="test_boolean" type="boolean" /> +<attr name="parent_cat" type="category(discussion_forum)" /> </class> <class name="discussion_posting" parent="item"> <description lang="de">Beitrag</description> <description lang="en">Posting</description> -<attr name="topicid" type="item" /> -<attr name="children" type="posting[]" /> -<attr name="parent" type="posting" /> - - - +<attr name="topicId" type="item(discussion_topic)" /> +<attr name="parent" type="item(discussion_posting)" /> +<attr name="ip" type="string" /> +<attr name="email" type="string" /> </class> </itemontology> --- NEW FILE: TreePostingComparator.java --- package org.cobricks.discussion; import java.sql.Timestamp; import java.util.Comparator; /** * Used to sort Lists of Postings. * @author Philipp Hemmer * */ public class TreePostingComparator implements Comparator { private boolean news_on_top = false; public TreePostingComparator() { super(); } public TreePostingComparator(boolean news_on_top) { super(); this.news_on_top = news_on_top; } public int compare(Object o1, Object o2) { int return_val = 0; if (o1 instanceof Posting && o2 instanceof Posting) { Posting p1 = (Posting) o1; Posting p2 = (Posting) o2; if(news_on_top){ Timestamp[] time_arr1 = p1.getNews_on_top_sorting_array(); Timestamp[] time_arr2 = p2.getNews_on_top_sorting_array(); int result = 0; for (int i = 0; i < time_arr1.length; i++) { if(i == time_arr2.length){ return 1; // first Array is longer } result = time_arr1[i].compareTo(time_arr2[i]); if(result != 0){ return result; } } return -1; // second Array is longer }else{ Timestamp[] time_arr1 = p1.getSorting_array(); Timestamp[] time_arr2 = p2.getSorting_array(); int result = 0; for (int i = 0; i < time_arr1.length; i++) { if(i == time_arr2.length){ return 1; // first Array is longer } result = time_arr1[i].compareTo(time_arr2[i]); if(result != 0){ return result * -1; } } return -1; // second Array is longer } } return return_val; } } --- NEW FILE: ChronologicalPostingComparator.java --- package org.cobricks.discussion; import java.sql.Date; import java.sql.Timestamp; import java.util.Comparator; import org.apache.log4j.Logger; import org.cobricks.item.Item; public class ChronologicalPostingComparator implements Comparator { private static Logger logger = Logger.getLogger(ChronologicalPostingComparator.class); private boolean reverse = false; public ChronologicalPostingComparator() { super(); } public ChronologicalPostingComparator(boolean reverse) { super(); this.reverse = reverse; } public int compare(Object o1, Object o2) { int return_val = 0; if (o1 instanceof Item && o2 instanceof Item) { Item i1 = (Item) o1; Item i2 = (Item) o2; Object dateObj1 = i1.getAttribute("creationtime"); Object dateObj2 = i2.getAttribute("creationtime"); if(dateObj1 instanceof Timestamp && dateObj2 instanceof Timestamp && dateObj1 != null && dateObj2 != null){ return_val = ((Timestamp)dateObj1).compareTo((Timestamp)dateObj2); } } if(reverse){ return_val *= -1; } return return_val; } } --- NEW FILE: OrderComparator.java --- package org.cobricks.discussion; import java.util.Comparator; import org.apache.log4j.Logger; import org.cobricks.category.Category; public class OrderComparator implements Comparator { private static Logger logger = Logger.getLogger(OrderComparator.class); public int compare(Object o1, Object o2) { // the not null value comes first than the null value if (o1 == null) { if (o2 == null) { return 0; } else { return 1; } } else if (o2 == null) { return -1; } // the object from type Category come first than the other objects if (o1 instanceof Category) { if (o2 instanceof Category) { int i1 = 0; int i2 = 0; Object order1 =((Category) o1).getAttribute("order"); Object order2 =((Category) o2).getAttribute("order"); // if one of the Categories has no order it comes last if (order1 == null) { if (order2 == null) { return 0; } else { return 1; } } else if (order2 == null) { return -1; } if (order1 instanceof String) { i1 = Integer.parseInt((String) order1); }else if(order1 instanceof Integer){ i1 = ((Integer)order1).intValue(); } if (order2 instanceof String) { i2 = Integer.parseInt((String) order2); }else if(order2 instanceof Integer){ i2 = ((Integer)order2).intValue(); } return i1 - i2; }else { return -1; } }else if (o2 instanceof Category) { return 1; } return 0; } } Index: properties.txt =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/discussion/properties.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- properties.txt 6 Apr 2006 16:25:53 -0000 1.2 +++ properties.txt 30 May 2006 14:48:06 -0000 1.3 @@ -20,14 +20,68 @@ discussion.presenter.timestyle=short discussion.languages=en,de -#item.display.template.details.posting=/discussion/itemtemplate-posting.html +#item.display.template.details.discussion_topic=/discussion/itemtemplate-topic.html +#item.display.template.details.discussion_posting=/discussion/itemtemplate-posting.html -#---------------------------------- +#------------------------------------------------- # settings for the discussion component +#------------------------------------------------- -# org.cobricks.discussion.settings.open=true -# (true: everyone can view the discussion component -# false: only users with accessControll to discussion.read can enter) +org.cobricks.discussion.settings.forum_headline=Discussion Component +org.cobricks.discussion.settings.forum_headline.descr=the headline shown on the webpage -# org.cobricks.discussion.settings.test=value -# (description) \ No newline at end of file +org.cobricks.discussion.settings.forum_descr=Support of Discussion, FAQ, Weblog and Guestbook functionality +org.cobricks.discussion.settings.forum_descr.descr=the headline shown on the webpage + +org.cobricks.discussion.settings.offline=false +org.cobricks.discussion.settings.offline.descr=true: nobody can enter the discussion component<br/>false: the component is online +org.cobricks.discussion.settings.offline.choice1=true +org.cobricks.discussion.settings.offline.choice2=false + +org.cobricks.discussion.settings.start_with_forums=true +org.cobricks.discussion.settings.start_with_forums.descr=true: startpage shows categories with its forums and subcategories<br/>false: startpage shows only list of categories +org.cobricks.discussion.settings.start_with_forums.choice1=true +org.cobricks.discussion.settings.start_with_forums.choice2=false + +org.cobricks.discussion.settings.display_count=15 +org.cobricks.discussion.settings.display_count.descr=how much forums and topics on one page + +org.cobricks.discussion.settings.guestbook_with_form=true +org.cobricks.discussion.settings.guestbook_with_form.descr=if entry form ist displayed in the guestbook view or on new page +org.cobricks.discussion.settings.guestbook_with_form.choice1=true +org.cobricks.discussion.settings.guestbook_with_forme.choice2=false + +org.cobricks.discussion.settings.weblog_with_form=true +org.cobricks.discussion.settings.weblog_with_form.descr=if entry form ist displayed in the weblog view or on new page<br/>only for users who can create entry +org.cobricks.discussion.settings.weblog_with_form.choice1=true +org.cobricks.discussion.settings.weblog_with_form.choice2=false + +org.cobricks.discussion.settings.forum_view=list +org.cobricks.discussion.settings.forum_view.descr=how the forum is initialy displayed +org.cobricks.discussion.settings.forum_view.choice1=tree +org.cobricks.discussion.settings.forum_view.choice2=list +org.cobricks.discussion.settings.forum_view.choice3=hybrid + +org.cobricks.discussion.settings.tree_sorting=chronologic +org.cobricks.discussion.settings.tree_sorting.descr=how the tree view is sorted<br/>chronologic: first the old then the new topics<br/>news_on_top: in every level of the tree the newes topic is on top +org.cobricks.discussion.settings.tree_sorting.choice1=chronologic +org.cobricks.discussion.settings.tree_sorting.choice2=news_on_top + +org.cobricks.discussion.settings.user_change_view=true +org.cobricks.discussion.settings.user_change_view.descr=if user can change the view +org.cobricks.discussion.settings.user_change_view.choice1=true +org.cobricks.discussion.settings.user_change_view.choice2=false + +org.cobricks.discussion.settings.text_input=text +org.cobricks.discussion.settings.text_input.descr=how the user can enter the entries (bbcode not supportet yet) +org.cobricks.discussion.settings.text_input.choice1=text +org.cobricks.discussion.settings.text_input.choice2=html +#org.cobricks.discussion.settings.text_input.choice3=bbcode(not yet) + +org.cobricks.discussion.settings.faq_show_incomplete=marked +org.cobricks.discussion.settings.faq_show_incomplete.descr=if incomplete FAQ entries are marked as such or hidden +org.cobricks.discussion.settings.faq_show_incomplete.choice1=marked +org.cobricks.discussion.settings.faq_show_incomplete.choice2=hidden + +org.cobricks.discussion.settings.hybrid_indent=20 +org.cobricks.discussion.settings.hybrid_indent.descr=the number of pixels the postings are indented in hybrid view --- NEW FILE: Posting.java --- package org.cobricks.discussion; import java.sql.Timestamp; import org.cobricks.item.Item; public class Posting { private Item item = null; private int indent = 0; private boolean marked = false; /** * used for sorting the tree chronological */ private Timestamp[] sorting_array = null; /** * used for sorting the tree news on top */ private Timestamp[] news_on_top_sorting_array = null; public Posting(Item item) { this.item = item; } public Posting(Item item, int indent) { this(item); this.indent = indent; } public String getTitle() { return item.getTitle(); } public Object getAttribute(String aname) { return item.getAttribute(aname); } public String getContent() { return item.getContent(); } public String getContent(String lang) { return item.getContent(lang); } public int getIndent() { return indent; } public void setIndent(int indent) { this.indent = indent; } public Timestamp[] getSorting_array() { return sorting_array; } public void setSorting_array(Timestamp[] sorting_array) { this.sorting_array = sorting_array; } public Timestamp[] getNews_on_top_sorting_array() { return news_on_top_sorting_array; } public void setNews_on_top_sorting_array(Timestamp[] news_on_top_sorting_array) { this.news_on_top_sorting_array = news_on_top_sorting_array; } public int getLocalId() { return item.getLocalId(); } public boolean isMarked() { return marked; } public void setMarked(boolean marked) { this.marked = marked; } } Index: DiscussionManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/discussion/DiscussionManagerImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- DiscussionManagerImpl.java 6 Apr 2006 16:25:53 -0000 1.2 +++ DiscussionManagerImpl.java 30 May 2006 14:48:06 -0000 1.3 @@ -1,5 +1,10 @@ package org.cobricks.discussion; +import java.sql.Timestamp; +import java.util.Calendar; +import java.util.Date; +import java.util.GregorianCalendar; +import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -8,6 +13,7 @@ import org.apache.log4j.Logger; import org.cobricks.category.Category; import org.cobricks.category.CategoryManager; +import org.cobricks.core.CobricksException; import org.cobricks.core.ComponentManagerAdaptor; import org.cobricks.core.CoreManager; import org.cobricks.core.Ontology; @@ -15,6 +21,11 @@ import org.cobricks.core.db.DBAccess; import org.cobricks.item.Item; import org.cobricks.item.ItemManager; +import org.cobricks.user.AccessControl; +import org.cobricks.user.AccessHandler; +import org.cobricks.user.User; +import org.cobricks.user.UserAccessHandler; +import org.cobricks.user.UserManager; public class DiscussionManagerImpl extends ComponentManagerAdaptor implements DiscussionManager @@ -45,6 +56,10 @@ private Ontology itemOntology; + private AccessControl accessControl; + + private UserManager userManager; + // public DiscussionManagerImpl(String componentId, // String managerId, // Properties p, @@ -77,12 +92,13 @@ CoreManager coreManager, DBAccess dbAccess) throws Exception { - logger.info("PAH_ " + "init(...) start"); super.init(componentId, managerId, properties, coreManager, dbAccess); this.itemManager = (ItemManager) componentDirectory .getManager("itemManager"); this.categoryManager = (CategoryManager) componentDirectory .getManager("categoryManager"); + this.userManager = (UserManager) componentDirectory + .getManager("userManager"); categoryOntology = coreManager.getOntology("category"); itemOntology = coreManager.getOntology("item"); @@ -97,96 +113,725 @@ managerList += ", "; } } - logger.info("PAH_ " + managerList); - logger.info("PAH_ " + "init(...) end"); - // + + // and finally initialize all other modules of the user manager + accessControl = new AccessControl((UserManager) componentDirectory + .getManager("userManager"), dbAccess); + AccessHandler accesshandler = null; + accesshandler = new UserAccessHandler(); + accesshandler.init(coreManager, dbAccess); + accessControl.registerAccessHandler(accesshandler); + + //if no discussion data is present create default discussion_categorie, forum, topic and postings + Map attrs = new HashMap(); + attrs.put("categoryclass", "discussion_category"); + List cats = categoryManager.searchCategories(attrs); + //everything in the component is unter the categories, if there are no categories + //there are no valid other data from the discussion component + if(cats.size() == 0){ + logger.debug("no discussion data is present, fill will default data"); + insertDefaultData(); + } + logger.info("discussionManager initialized"); } - public Category createCategory(Map attrs) + private void insertDefaultData() { + GregorianCalendar cal = new GregorianCalendar(1979, 4, 12, 12, 00); + // default category + Map attrs = new HashMap(); + User admin = userManager.getUser(userManager.getUserIdForUserLogin("admin")); + logger.debug("admin for inserting default data ="+admin); + + attrs.put("categoryclass", "discussion_category"); + attrs.put("title_de", "Beispielkategorie"); + attrs.put("title_en", "Example category"); + attrs.put("visible", new Boolean(true)); - // if there is a long_title and no title in the attrs map - // create title with the first 10 chars in long_title - if (attrs.get("long_title") == null) - { - attrs.put("long_title", ""); + attrs.put("creationtime", cal.getTime()); + attrs.put("updatetime", cal.getTime()); + cal.add(Calendar.MINUTE, 1); + + attrs.put("open", new Boolean(true)); +// attrs.put("members", ); +// attrs.put("managers", ); + attrs.put("description_de", ""); + attrs.put("description_en", ""); + attrs.put("type", new Integer(0)); + attrs.put("order", new Integer(10)); + + Category category = categoryManager.createCategory(attrs, admin); + + + //first forum of type "Forum" + attrs = new HashMap(); + + attrs.put("categoryclass", "discussion_forum"); + attrs.put("title_de", "Das erste Forum"); + attrs.put("title_en", "The first forum"); + attrs.put("visible", new Boolean(true)); + + attrs.put("creationtime", cal.getTime()); + attrs.put("updatetime", cal.getTime()); + cal.add(Calendar.MINUTE, 1); + + attrs.put("parent", new Integer(category.getLocalId())); + attrs.put("open", new Boolean(true)); +// attrs.put("members", ); +// attrs.put("managers", ); + attrs.put("description_de", "Beispielforum mit Beispieleinträgen"); + attrs.put("description_en", "Example forum with example postings"); + attrs.put("type", new Integer(0)); + attrs.put("order", new Integer(10)); + attrs.put("forumtype", "Forum"); + + Category forum = categoryManager.createCategory(attrs, admin); + + //first forum of type "FAQ" + attrs = new HashMap(); + + attrs.put("categoryclass", "discussion_forum"); + attrs.put("title_de", "Häufig gestellte Fragen (FAQ)"); + attrs.put("title_en", "Frequently Asked Questions (FAQ)"); + attrs.put("visible", new Boolean(true)); + + attrs.put("creationtime", cal.getTime()); + attrs.put("updatetime", cal.getTime()); + cal.add(Calendar.MINUTE, 1); + + attrs.put("parent", new Integer(category.getLocalId())); + attrs.put("open", new Boolean(true)); +// attrs.put("members", ); +// attrs.put("managers", ); + attrs.put("description_de", "Zuerst hier schauen!"); + attrs.put("description_en", "First look here!"); + attrs.put("type", new Integer(0)); + attrs.put("order", new Integer(10)); + attrs.put("forumtype", "FAQ"); + + Category faq = categoryManager.createCategory(attrs, admin); + + //first forum of type "Weblog" + attrs = new HashMap(); + + attrs.put("categoryclass", "discussion_forum"); + attrs.put("title_de", "Informationen als Weblog"); + attrs.put("title_en", "Information weblog"); + attrs.put("visible", new Boolean(true)); + + attrs.put("creationtime", cal.getTime()); + attrs.put("updatetime", cal.getTime()); + cal.add(Calendar.MINUTE, 1); + + attrs.put("parent", new Integer(category.getLocalId())); + attrs.put("open", new Boolean(true)); +// attrs.put("members", ); +// attrs.put("managers", ); + attrs.put("description_de", "Offizielles Weblog"); + attrs.put("description_en", "Official Weblog"); + attrs.put("type", new Integer(0)); + attrs.put("order", new Integer(10)); + attrs.put("forumtype", "Weblog"); + + Category weblog = categoryManager.createCategory(attrs, admin); + + //first forum of type "Guestbook" + attrs = new HashMap(); + + attrs.put("categoryclass", "discussion_forum"); + attrs.put("title_de", "Gästebuch"); + attrs.put("title_en", "Guestbook"); + attrs.put("visible", new Boolean(true)); + + attrs.put("creationtime", cal.getTime()); + attrs.put("updatetime", cal.getTime()); + cal.add(Calendar.MINUTE, 1); + + attrs.put("parent", new Integer(category.getLocalId())); + attrs.put("open", new Boolean(true)); +// attrs.put("members", ); +// attrs.put("managers", ); + attrs.put("description_de", "Meinungen zur Homepage"); + attrs.put("description_en", "Opinions from visitors"); + attrs.put("type", new Integer(0)); + attrs.put("order", new Integer(10)); + attrs.put("forumtype", "Guestbook"); + + Category guestbook = categoryManager.createCategory(attrs, admin); + + + //topic for "Forum" + Item topic = null; + if(forum != null){ + attrs = new HashMap(); + + attrs.put("itemclass", "discussion_topic"); + attrs.put("title_de", "Ein schönes Thema"); + attrs.put("title_en", "A nice topic"); + attrs.put("content_de", "Beispielforum mit Beispieleinträgen"); + attrs.put("content_en", "Example forum with example postings"); + attrs.put("state", new Integer(1)); + + attrs.put("creationtime", cal.getTime()); + attrs.put("updatetime", cal.getTime()); + cal.add(Calendar.MINUTE, 1); + + attrs.put("parent_cat", new Integer(forum.getLocalId())); + + try + { + topic = itemManager.createItem(attrs, admin); + } catch (CobricksException e) + { + logger.warn("fail to create default topic for forum"); + } } - if (attrs.get("title") == null) - { - attrs.put("title", ((String) attrs.get("long_title")).substring( - 0, 10)); + //postings for "Forum" topic + Item first_posting = null; + Item second_posting = null; + Item third_posting = null; + if(topic != null){ + attrs = new HashMap(); + + attrs.put("itemclass", "discussion_posting"); + attrs.put("title_de", "Erste Antwort"); + attrs.put("title_en", "First answer"); + attrs.put("content_de", "Lorem ipsum quo ut inani feugait scaevola, vis possim inermis definitionem te. Te per regione persius. Inani summo democritum usu ex, at vocent periculis vis, nam eu nihil delectus. Cu porro alterum facilisis pro, no vim tibique voluptaria."); + attrs.put("content_en", "Lorem ipsum quo ut inani feugait scaevola, vis possim inermis definitionem te. Te per regione persius. Inani summo democritum usu ex, at vocent periculis vis, nam eu nihil delectus. Cu porro alterum facilisis pro, no vim tibique voluptaria."); + attrs.put("state", new Integer(1)); + + attrs.put("creationtime", cal.getTime()); + attrs.put("updatetime", cal.getTime()); + cal.add(Calendar.MINUTE, 1); + + attrs.put("topicId", new Integer(topic.getLocalId())); +// attrs.put("parent", new Integer(forum.getLocalId())); +// attrs.put("ip", new Integer(forum.getLocalId())); +// attrs.put("email", new Integer(forum.getLocalId())); + + try + { + first_posting = itemManager.createItem(attrs, admin); + } catch (CobricksException e) + { + logger.warn("fail to create default first answer for forum"); + } + + attrs = new HashMap(); + + attrs.put("itemclass", "discussion_posting"); + attrs.put("title_de", "Zweite Antwort"); + attrs.put("title_en", "Second answer"); + attrs.put("content_de", "Lorem ipsum tota lobortis ut quo, duo rebum modus quidam cu. Sea eu apeirian evertitur. Vim melius audiam detraxit ex, ut debet noluisse vulputate vix, natum paulo tibique usu te. Te augue vivendo mel. Eu mel reque solet sapientem, ne natum facer assum sit."); + attrs.put("content_en", "Lorem ipsum tota lobortis ut quo, duo rebum modus quidam cu. Sea eu apeirian evertitur. Vim melius audiam detraxit ex, ut debet noluisse vulputate vix, natum paulo tibique usu te. Te augue vivendo mel. Eu mel reque solet sapientem, ne natum facer assum sit."); + attrs.put("state", new Integer(1)); + + attrs.put("creationtime", cal.getTime()); + attrs.put("updatetime", cal.getTime()); + cal.add(Calendar.MINUTE, 1); + + attrs.put("topicId", new Integer(topic.getLocalId())); +// attrs.put("parent", new Integer(forum.getLocalId())); +// attrs.put("ip", new Integer(forum.getLocalId())); +// attrs.put("email", new Integer(forum.getLocalId())); + + try + { + second_posting = itemManager.createItem(attrs, admin); + } catch (CobricksException e) + { + logger.warn("fail to create default second answer for forum"); + } + + + attrs = new HashMap(); + + attrs.put("itemclass", "discussion_posting"); + attrs.put("title_de", "Dritte Antwort"); + attrs.put("title_en", "Third answer"); + attrs.put("content_de", "Lorem ipsum ex nec utinam ornatus copiosae, elitr definitiones vis eu. Ut animal fabellas inciderint cum. Ea facer doming scribentur vis. Unum nostro vocibus duo ne, id usu verterem splendide, quo ex dicta deleniti."); + attrs.put("content_en", "Lorem ipsum ex nec utinam ornatus copiosae, elitr definitiones vis eu. Ut animal fabellas inciderint cum. Ea facer doming scribentur vis. Unum nostro vocibus duo ne, id usu verterem splendide, quo ex dicta deleniti."); + attrs.put("state", new Integer(1)); + + attrs.put("creationtime", cal.getTime()); + attrs.put("updatetime", cal.getTime()); + cal.add(Calendar.MINUTE, 1); + + attrs.put("topicId", new Integer(topic.getLocalId())); +// attrs.put("parent", new Integer(forum.getLocalId())); +// attrs.put("ip", new Integer(forum.getLocalId())); +// attrs.put("email", new Integer(forum.getLocalId())); + + try + { + third_posting = itemManager.createItem(attrs, admin); + } catch (CobricksException e) + { + logger.warn("fail to create default item for forum"); + } } - // categoryclass has to be discussion_category - // test if it exists, if not add it - // , if test if value is "discussion_category" - // if not change it - String catClass = (String) attrs.get("categoryclass"); - if(catClass != null){ - if(!catClass.equals("discussion_category")){ - attrs.put("categoryclass", "discussion_category"); + + if(first_posting != null){ + attrs = new HashMap(); + + attrs.put("itemclass", "discussion_posting"); + attrs.put("title_de", "Antwort auf erste Antwort"); + attrs.put("title_en", "Answer to first answer"); + attrs.put("content_de", "Lorem ipsum per quidam laboramus tincidunt id, in nec quod probo aperiam. Malorum sensibus duo ei, harum nihil necessitatibus mei et. Quando epicurei et mea, eam probo incorrupte eu. Est mutat erroribus appellantur ut, zzril iuvaret voluptatum i... [truncated message content] |