[jboss-cvs] jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action ...
Christian Bauer
christian at hibernate.org
Mon Jul 9 12:37:40 EDT 2007
User: cbauer
Date: 07/07/09 12:37:40
Modified: examples/wiki/src/main/org/jboss/seam/wiki/core/action
Menu.java DirectoryHome.java NodeHome.java
AdminHome.java
Log:
Make unit tests run on Embeddable JBoss
Revision Changes Path
1.8 +7 -7 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Menu.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: Menu.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Menu.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- Menu.java 6 Jul 2007 14:38:36 -0000 1.7
+++ Menu.java 9 Jul 2007 16:37:40 -0000 1.8
@@ -18,6 +18,10 @@
* For performance reasons we cache this in the session context and refresh it through observing of
* modification events. This might be PAGE scoped once we have a nested set model for the node tree.
* </p>
+ * Looks up the <tt>menuBase</tt> contextual variable; if present, this is the root <tt>Directory</tt>
+ * of the rendered menu. Otherwise, the wiki root is the base. Note that the menu is only rendered two
+ * levels deep visually but that it includes all subtree nodes that are menu items. Everything deeper
+ * than the second level is rendered on the second level.
*
* @author Christian Bauer
*/
@@ -37,15 +41,15 @@
/**
* This is very inefficient. There really is no better way if we want recursively have
- * all documents and directories with isMenuItem() in the main menu. Not even a direct
+ * all documents and directories with isMenuItem() in the menu. Not even a direct
* SQL query would help (multicolumn ordering would require by PK, not good). If this
* can't be made performant with caching, we need to replace it with a simple one
* or two level menu item search. Currently optimizing with batch fetching, future
- * implementation might use a nested set approach (we need one anyway for recursive
- * deletion of subtrees).
+ * implementation might use a nested set approach.
*/
@Observer("Nodes.menuStructureModified")
public void refreshMenuItems() {
+ System.out.println("################################ REFRESHING MENU ########################### ");
items = new ArrayList<MenuItem>();
if (menuBase != null && lastMenuBase != menuBase) {
lastMenuBase = menuBase;
@@ -54,9 +58,6 @@
}
for(Node child: menuBase.getChildren())
addNodesToMenuTree(items, 0, child);
-
-
-
}
// Recursive
@@ -98,5 +99,4 @@
public void setUrl(String url) { this.url = url; }
}
-
}
1.12 +0 -5 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryHome.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: DirectoryHome.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryHome.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -b -r1.11 -r1.12
--- DirectoryHome.java 21 Jun 2007 06:06:15 -0000 1.11
+++ DirectoryHome.java 9 Jul 2007 16:37:40 -0000 1.12
@@ -132,11 +132,6 @@
/* -------------------------- Public Features ------------------------------ */
- @Restrict("#{s:hasPermission('Node', 'editMenu', directoryHome.instance)}")
- public void previewMenuItems() {
- refreshMenuItems();
- }
-
private boolean hasFeed;
public boolean isHasFeed() {
1.20 +6 -3 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: NodeHome.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/NodeHome.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- NodeHome.java 6 Jul 2007 14:38:36 -0000 1.19
+++ NodeHome.java 9 Jul 2007 16:37:40 -0000 1.20
@@ -12,11 +12,13 @@
import org.jboss.seam.wiki.preferences.PreferenceProvider;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Out;
+import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.web.RequestParameter;
import org.jboss.seam.annotations.security.Restrict;
import org.jboss.seam.core.Events;
import org.jboss.seam.ScopeType;
import org.jboss.seam.Component;
+import org.jboss.seam.log.Log;
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.security.AuthorizationException;
import org.jboss.seam.security.Identity;
@@ -34,6 +36,8 @@
*/
public abstract class NodeHome<N extends Node> extends EntityHome<N> {
+ @Logger static Log log;
+
/* -------------------------- Context Wiring ------------------------------ */
@In private NodeDAO nodeDAO;
@@ -112,7 +116,7 @@
parentDirectory = nodeDAO.findDirectory(parentDirId);
if (parentDirectory == null)
- throw new RuntimeException("############ REPRODUCE THIS BUG ####################");
+ log.warn("######### THIS SHOULD NEVER BE NULL UNLESS WE EDIT THE WIKI ROOT");
// Permission checks
if (!isManaged() && !Identity.instance().hasPermission("Node", "create", getParentDirectory()) ) {
@@ -250,7 +254,6 @@
}
protected void refreshMenuItems() {
- if (getInstance().isMenuItem())
Events.instance().raiseEvent("Nodes.menuStructureModified");
}
1.8 +2 -1 jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/AdminHome.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: AdminHome.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/examples/wiki/src/main/org/jboss/seam/wiki/core/action/AdminHome.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -b -r1.7 -r1.8
--- AdminHome.java 6 Jul 2007 14:38:36 -0000 1.7
+++ AdminHome.java 9 Jul 2007 16:37:40 -0000 1.8
@@ -36,10 +36,11 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.io.Serializable;
@Name("adminHome")
@Scope(ScopeType.CONVERSATION)
-public class AdminHome {
+public class AdminHome implements Serializable {
@Logger
static Log log;
More information about the jboss-cvs-commits
mailing list