Seam SVN: r11999 - in modules/xml/trunk/src: main/java/org/jboss/seam/xml/model and 6 other directories.
by seam-commits@lists.jboss.org
Author: swd847
Date: 2010-01-30 17:39:47 -0500 (Sat, 30 Jan 2010)
New Revision: 11999
Modified:
modules/xml/trunk/src/main/java/org/jboss/seam/xml/bootstrap/XmlExtension.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/AbstractXmlItem.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/AnnotationXmlItem.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ArrayXmlItem.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/DependsXmlItem.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/EntryXmlItem.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/FieldXmlItem.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/KeyXmlItem.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/MethodXmlItem.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ModelBuilder.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ValueXmlItem.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/VetoXmlItem.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/XmlItem.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/ParserMain.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/SaxNode.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/CompositeNamespaceElementResolver.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/NamespaceElementResolver.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/NamespaceUtils.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/PackageNamespaceElementResolver.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/RootNamespaceElementResolver.java
modules/xml/trunk/src/main/java/org/jboss/seam/xml/util/XmlConfigurationException.java
modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/NamespaceResolverTest.java
modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/injection/qualifier-attributes-test-beans.xml
modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/method/method-beans.xml
Log:
updated error handling to better report where in the XML document the error occurred
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/bootstrap/XmlExtension.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/bootstrap/XmlExtension.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/bootstrap/XmlExtension.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -32,7 +32,6 @@
import org.jboss.seam.xml.parser.ParserMain;
import org.jboss.seam.xml.parser.SaxNode;
import org.jboss.seam.xml.util.FileDataReader;
-import org.jboss.seam.xml.util.XmlParseException;
import org.jboss.weld.extensions.util.AnnotationInstanceProvider;
public class XmlExtension implements Extension
@@ -55,16 +54,13 @@
*/
Map<Integer, List<FieldValueObject>> fieldValues = new HashMap<Integer, List<FieldValueObject>>();
- List<XmlParseException> parseErrors = new ArrayList<XmlParseException>();
+ List<Exception> errors = new ArrayList<Exception>();
/**
* This is the entry point for the extension
*/
public void beforeBeanDiscovery(@Observes BeforeBeanDiscovery event)
{
- boolean problems = false;
- StringBuilder problemString = new StringBuilder();
-
List<Class<? extends XmlDocumentProvider>> providers = getDocumentProviders();
for (Class<? extends XmlDocumentProvider> cl : providers)
{
@@ -77,14 +73,14 @@
{
ParserMain parser = new ParserMain();
ModelBuilder builder = new ModelBuilder();
- SaxNode parentNode = parser.parse(d.getInputSource(), d.getFileUrl(), parseErrors);
+ SaxNode parentNode = parser.parse(d.getInputSource(), d.getFileUrl(), errors);
;
results.add(builder.build(parentNode));
}
}
catch (Exception e)
{
- throw new RuntimeException(e);
+ errors.add(e);
}
}
@@ -92,11 +88,10 @@
{
if (!r.getProblems().isEmpty())
{
- problems = true;
+
for (String i : r.getProblems())
{
- problemString.append(i);
- problemString.append("\n");
+ errors.add(new RuntimeException(i));
}
}
for (BeanResult<?> b : r.getFieldValues().keySet())
@@ -146,10 +141,6 @@
veto.addAll(r.getVeto());
}
- if (problems)
- {
- throw new RuntimeException(problemString.toString());
- }
}
public <T> void processAnotated(@Observes ProcessAnnotatedType<T> event)
@@ -176,7 +167,7 @@
public void processAfterBeanDeployment(@Observes AfterBeanDiscovery event)
{
- for (XmlParseException t : parseErrors)
+ for (Exception t : errors)
{
event.addDefinitionError(t);
}
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/AbstractXmlItem.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/AbstractXmlItem.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/AbstractXmlItem.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -23,12 +23,16 @@
final String innerText;
final Map<String, String> attributes;
+ final int lineno;
+
+ final String document;
+
public String getInnerText()
{
return innerText;
}
- public AbstractXmlItem(XmlItemType type, XmlItem parent, Class<?> javaClass, String innerText, Map<String, String> attributes)
+ public AbstractXmlItem(XmlItemType type, XmlItem parent, Class<?> javaClass, String innerText, Map<String, String> attributes, String document, int lineno)
{
this.type = type;
this.parent = parent;
@@ -42,8 +46,20 @@
{
this.attributes = attributes;
}
+ this.lineno = lineno;
+ this.document = document;
}
+ public int getLineno()
+ {
+ return lineno;
+ }
+
+ public String getDocument()
+ {
+ return document;
+ }
+
final List<XmlItem> children = new ArrayList<XmlItem>();
public void addChild(XmlItem xmlItem)
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/AnnotationXmlItem.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/AnnotationXmlItem.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/AnnotationXmlItem.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -21,9 +21,9 @@
* @param innerText
* @param attributes
*/
- public AnnotationXmlItem(XmlItem parent, Class<?> c, String innerText, Map<String, String> attributes)
+ public AnnotationXmlItem(XmlItem parent, Class<?> c, String innerText, Map<String, String> attributes, String document, int lineno)
{
- super(XmlItemType.ANNOTATION, parent, c, innerText, attributes);
+ super(XmlItemType.ANNOTATION, parent, c, innerText, attributes, document, lineno);
if (innerText != null)
{
if (!innerText.trim().equals(""))
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ArrayXmlItem.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ArrayXmlItem.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ArrayXmlItem.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -13,6 +13,7 @@
import java.util.Set;
import org.jboss.seam.xml.fieldset.FieldValueObject;
+import org.jboss.seam.xml.util.XmlConfigurationException;
public class ArrayXmlItem implements XmlItem
{
@@ -21,12 +22,28 @@
Class<?> javaClass;
- public ArrayXmlItem(XmlItem parent)
+ final String document;
+
+ final int lineno;
+
+ public ArrayXmlItem(XmlItem parent, String document, int lineno)
{
allowed.add(XmlItemType.CLASS);
this.parent = parent;
+ this.document = document;
+ this.lineno = lineno;
}
+ public String getDocument()
+ {
+ return document;
+ }
+
+ public int getLineno()
+ {
+ return lineno;
+ }
+
Set<XmlItemType> allowed = new HashSet<XmlItemType>();
public Set<XmlItemType> getAllowedItem()
@@ -38,7 +55,7 @@
{
if (child != null)
{
- throw new RuntimeException("Array elements can only have one child");
+ throw new XmlConfigurationException("Array elements can only have one child", getDocument(), getLineno());
}
child = xmlItem;
}
@@ -93,7 +110,7 @@
{
if (child == null)
{
- throw new RuntimeException("<array> element must have a child specifying the array type");
+ throw new XmlConfigurationException("<array> element must have a child specifying the array type", getDocument(), getLineno());
}
Class<?> l = child.getJavaClass();
try
@@ -108,7 +125,7 @@
}
catch (ClassNotFoundException e2)
{
- throw new RuntimeException("Cannot create array class from " + l.getName());
+ throw new XmlConfigurationException("Cannot create array class from " + l.getName(), getDocument(), getLineno());
}
}
return true;
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ClassXmlItem.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -22,9 +22,9 @@
* @param innerText
* @param attributes
*/
- public ClassXmlItem(XmlItem parent, Class<?> c)
+ public ClassXmlItem(XmlItem parent, Class<?> c, String document, int lineno)
{
- super(XmlItemType.CLASS, parent, c, null, null);
+ super(XmlItemType.CLASS, parent, c, null, null, document, lineno);
if (innerText != null)
{
if (!innerText.trim().equals(""))
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/DependsXmlItem.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/DependsXmlItem.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/DependsXmlItem.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -10,9 +10,9 @@
public class DependsXmlItem extends AbstractXmlItem
{
- public DependsXmlItem(XmlItem parent, String innerTest)
+ public DependsXmlItem(XmlItem parent, String innerTest, String document, int lineno)
{
- super(XmlItemType.DEPENDENCY, parent, null, innerTest, null);
+ super(XmlItemType.DEPENDENCY, parent, null, innerTest, null, document, lineno);
}
public Set<XmlItemType> getAllowedItem()
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/EntryXmlItem.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/EntryXmlItem.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/EntryXmlItem.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -7,6 +7,8 @@
import java.util.HashSet;
import java.util.Set;
+import org.jboss.seam.xml.util.XmlConfigurationException;
+
public class EntryXmlItem extends AbstractXmlItem
{
@@ -15,9 +17,9 @@
XmlItem key;
XmlItem value;
- public EntryXmlItem(XmlItem parent)
+ public EntryXmlItem(XmlItem parent, String document, int lineno)
{
- super(XmlItemType.ENTRY, parent, null, null, null);
+ super(XmlItemType.ENTRY, parent, null, null, null, document, lineno);
allowed.add(XmlItemType.VALUE);
allowed.add(XmlItemType.KEY);
}
@@ -32,7 +34,7 @@
{
if (children.size() != 2)
{
- throw new RuntimeException("<entry> tags must have two children, a <key> and a <value>");
+ throw new XmlConfigurationException("<entry> tags must have two children, a <key> and a <value>", getDocument(), getLineno());
}
for (XmlItem i : children)
{
@@ -40,7 +42,7 @@
{
if (value != null)
{
- throw new RuntimeException("<entry> tags must have two children, a <key> and a <value>");
+ throw new XmlConfigurationException("<entry> tags must have two children, a <key> and a <value>", getDocument(), getLineno());
}
value = i;
}
@@ -48,7 +50,7 @@
{
if (key != null)
{
- throw new RuntimeException("<entry> tags must have two children, a <key> and a <value>");
+ throw new XmlConfigurationException("<entry> tags must have two children, a <key> and a <value>", getDocument(), getLineno());
}
key = i;
}
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/FieldXmlItem.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/FieldXmlItem.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/FieldXmlItem.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -21,6 +21,7 @@
import org.jboss.seam.xml.fieldset.MapFieldSet;
import org.jboss.seam.xml.fieldset.MethodFieldSetter;
import org.jboss.seam.xml.fieldset.SimpleFieldValue;
+import org.jboss.seam.xml.util.XmlConfigurationException;
public class FieldXmlItem extends AbstractXmlItem
{
@@ -30,9 +31,9 @@
Field field;
HashSet<XmlItemType> allowed = new HashSet<XmlItemType>();
- public FieldXmlItem(XmlItem parent, Field c, String innerText)
+ public FieldXmlItem(XmlItem parent, Field c, String innerText, String document, int lineno)
{
- super(XmlItemType.FIELD, parent, parent.getJavaClass(), innerText, null);
+ super(XmlItemType.FIELD, parent, parent.getJavaClass(), innerText, null, document, lineno);
this.field = c;
this.fieldSetter = getFieldValueSetter(c);
if (innerText != null && innerText.length() > 0)
@@ -80,7 +81,7 @@
{
if (!valueEntries.isEmpty())
{
- throw new RuntimeException("Map fields cannot have <value> elements as children,only <entry> elements Field:" + field.getDeclaringClass().getName() + '.' + field.getName());
+ throw new XmlConfigurationException("Map fields cannot have <value> elements as children,only <entry> elements Field:" + field.getDeclaringClass().getName() + '.' + field.getName(), getDocument(), getLineno());
}
if (!mapEntries.isEmpty())
{
@@ -91,7 +92,7 @@
{
if (!mapEntries.isEmpty())
{
- throw new RuntimeException("Collection fields must be set using <value> not <entry> Field:" + field.getDeclaringClass().getName() + '.' + field.getName());
+ throw new XmlConfigurationException("Collection fields must be set using <value> not <entry> Field:" + field.getDeclaringClass().getName() + '.' + field.getName(), getDocument(), getLineno());
}
if (!valueEntries.isEmpty())
{
@@ -109,11 +110,11 @@
{
if (!mapEntries.isEmpty())
{
- throw new RuntimeException("Only Map fields can be set using <entry> Field:" + field.getDeclaringClass().getName() + '.' + field.getName());
+ throw new XmlConfigurationException("Only Map fields can be set using <entry> Field:" + field.getDeclaringClass().getName() + '.' + field.getName(), getDocument(), getLineno());
}
if (valueEntries.size() != 1)
{
- throw new RuntimeException("Non collection fields can only have a single <value> element Field:" + field.getDeclaringClass().getName() + '.' + field.getName());
+ throw new XmlConfigurationException("Non collection fields can only have a single <value> element Field:" + field.getDeclaringClass().getName() + '.' + field.getName(), getDocument(), getLineno());
}
fieldValue = new SimpleFieldValue(parent.getJavaClass(), fieldSetter, valueEntries.get(0).getInnerText());
}
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/KeyXmlItem.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/KeyXmlItem.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/KeyXmlItem.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -10,9 +10,9 @@
public class KeyXmlItem extends AbstractXmlItem
{
- public KeyXmlItem(XmlItem parent, String innerText)
+ public KeyXmlItem(XmlItem parent, String innerText, String document, int lineno)
{
- super(XmlItemType.KEY, parent, null, innerText, null);
+ super(XmlItemType.KEY, parent, null, innerText, null, document, lineno);
}
public Set<XmlItemType> getAllowedItem()
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/MethodXmlItem.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/MethodXmlItem.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/MethodXmlItem.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -10,6 +10,8 @@
import java.util.List;
import java.util.Set;
+import org.jboss.seam.xml.util.XmlConfigurationException;
+
public class MethodXmlItem extends AbstractXmlItem
{
@@ -18,9 +20,9 @@
Method method;
HashSet<XmlItemType> allowed = new HashSet<XmlItemType>();
- public MethodXmlItem(XmlItem parent, String methodName)
+ public MethodXmlItem(XmlItem parent, String methodName, String document, int lineno)
{
- super(XmlItemType.METHOD, parent, parent.getJavaClass(), null, null);
+ super(XmlItemType.METHOD, parent, parent.getJavaClass(), null, null, document, lineno);
// methods are lazily resolved once we know the parameter types
this.methodName = methodName;
Method found = null;
@@ -83,11 +85,11 @@
}
catch (SecurityException e)
{
- throw new RuntimeException("Security Exception resolving method " + methodName + " on class " + javaClass.getName());
+ throw new XmlConfigurationException("Security Exception resolving method " + methodName + " on class " + javaClass.getName(), getDocument(), getLineno());
}
catch (NoSuchMethodException e)
{
- throw new RuntimeException("NoSuchMethodException resolving method " + methodName + " on class " + javaClass.getName());
+ throw new XmlConfigurationException("NoSuchMethodException resolving method " + methodName + " on class " + javaClass.getName(), getDocument(), getLineno());
}
}
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ModelBuilder.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ModelBuilder.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ModelBuilder.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -21,14 +21,13 @@
import org.jboss.seam.xml.core.XmlResult;
import org.jboss.seam.xml.fieldset.FieldValueObject;
import org.jboss.seam.xml.parser.SaxNode;
-import org.jboss.seam.xml.parser.namespace.InvalidElementException;
+import org.jboss.seam.xml.parser.namespace.CompositeNamespaceElementResolver;
import org.jboss.seam.xml.parser.namespace.NamespaceElementResolver;
-import org.jboss.seam.xml.parser.namespace.PackageNamespaceElementResolver;
import org.jboss.seam.xml.parser.namespace.RootNamespaceElementResolver;
+import org.jboss.seam.xml.util.XmlConfigurationException;
import org.jboss.seam.xml.util.XmlObjectConverter;
import org.jboss.weld.extensions.util.AnnotationInstanceProvider;
import org.jboss.weld.extensions.util.annotated.NewAnnotatedTypeBuilder;
-import org.w3c.dom.DOMException;
/**
* Parser for xml configration
@@ -54,11 +53,11 @@
if (!root.getName().equals("Beans"))
{
- throw new RuntimeException("Wrong root element for XML config file, expected:<Beans> found:" + root.getName());
+ throw new XmlConfigurationException("Wrong root element for XML config file, expected:<Beans> found:" + root.getName(), root.getDocument(), root.getLineNo());
}
if (!ROOT_NAMESPACE.equals(root.getNamespaceUri()))
{
- throw new RuntimeException("Wrong root namespace for XML config file, expected:" + ROOT_NAMESPACE + " found:" + root.getNamespaceUri());
+ throw new XmlConfigurationException("Wrong root namespace for XML config file, expected:" + ROOT_NAMESPACE + " found:" + root.getNamespaceUri(), root.getDocument(), root.getLineNo());
}
resolvers.put(ROOT_NAMESPACE, new RootNamespaceElementResolver());
@@ -86,7 +85,7 @@
}
@SuppressWarnings("unchecked")
- private void addNodeToResult(XmlResult ret, XmlItem rb) throws InvalidElementException
+ private void addNodeToResult(XmlResult ret, XmlItem rb)
{
if (rb.getType() == XmlItemType.CLASS || rb.getType() == XmlItemType.ANNOTATION)
@@ -136,21 +135,15 @@
}
}
- protected XmlItem resolveNode(SaxNode node, XmlItem parent) throws DOMException, InvalidElementException
+ protected XmlItem resolveNode(SaxNode node, XmlItem parent)
{
NamespaceElementResolver resolver = resolveNamepsace(node.getNamespaceUri());
- Map<String, String> attributes = node.getAttributes();
- String innerText = node.getInnerText().trim();
- if (innerText.equals(""))
- {
- innerText = null;
- }
- XmlItem ret = resolver.getItemForNamespace(node.getName(), parent, innerText, attributes);
+ XmlItem ret = resolver.getItemForNamespace(node, parent);
if (ret == null)
{
- throw new InvalidElementException("Could not resolve node " + node.getName() + " in namespace " + node.getNamespaceUri());
+ throw new XmlConfigurationException("Could not resolve node " + node.getName() + " in namespace " + node.getNamespaceUri(), node.getDocument(), node.getLineNo());
}
List<SaxNode> children = node.getChildren();
for (SaxNode n : children)
@@ -173,7 +166,7 @@
return resolvers.get(namespaceURI);
}
String ns = namespaceURI.replaceFirst("urn:java:", "");
- PackageNamespaceElementResolver res = new PackageNamespaceElementResolver(ns);
+ CompositeNamespaceElementResolver res = new CompositeNamespaceElementResolver(ns.split(":"));
resolvers.put(namespaceURI, res);
return res;
}
@@ -181,7 +174,7 @@
/**
* Determines the type of an element by examining its child nodes
*/
- protected ResultType getItemType(XmlItem item) throws InvalidElementException
+ protected ResultType getItemType(XmlItem item)
{
ResultType ret = null;
@@ -193,7 +186,7 @@
{
if (ret != null)
{
- throw new InvalidElementException("Element cannot be both an INTERCEPTOR_BINDING and a " + ret.toString());
+ throw new XmlConfigurationException("Element cannot be both an INTERCEPTOR_BINDING and a " + ret.toString(), item.getDocument(), item.getLineno());
}
else
{
@@ -204,7 +197,7 @@
{
if (ret != null)
{
- throw new InvalidElementException("Element cannot be both an QUALIFIER and a " + ret.toString());
+ throw new XmlConfigurationException("Element cannot be both an QUALIFIER and a " + ret.toString(), item.getDocument(), item.getLineno());
}
else
{
@@ -215,7 +208,7 @@
{
if (ret != null)
{
- throw new InvalidElementException("Element cannot be both an STEREOTYPE and a " + ret.toString());
+ throw new XmlConfigurationException("Element cannot be both an STEREOTYPE and a " + ret.toString(), item.getDocument(), item.getLineno());
}
else
{
@@ -227,7 +220,7 @@
{
if (ret != null)
{
- throw new InvalidElementException("Element cannot be both an VETO and a " + ret.toString());
+ throw new XmlConfigurationException("Element cannot be both an VETO and a " + ret.toString(), item.getDocument(), item.getLineno());
}
else
{
@@ -244,7 +237,7 @@
}
@SuppressWarnings("unchecked")
- <T> BeanResult<T> buildAnnotatedType(XmlItem rb) throws InvalidElementException
+ <T> BeanResult<T> buildAnnotatedType(XmlItem rb)
{
BeanResult<T> result = new BeanResult<T>(rb.getJavaClass());
NewAnnotatedTypeBuilder<T> type = result.getBuilder();
@@ -298,7 +291,7 @@
}
else
{
- throw new RuntimeException("Method parameters may only have annotations as children in " + item.getJavaClass().getName());
+ throw new XmlConfigurationException("Method parameters may only have annotations as children in " + item.getJavaClass().getName(), rb.getDocument(), rb.getLineno());
}
}
}
@@ -317,7 +310,7 @@
}
@SuppressWarnings("unchecked")
- void addSteriotypeToResult(XmlResult ret, XmlItem rb) throws InvalidElementException
+ void addSteriotypeToResult(XmlResult ret, XmlItem rb)
{
Annotation[] values = new Annotation[rb.getChildren().size()];
@@ -331,7 +324,7 @@
}
else
{
- throw new InvalidElementException("Setereotype " + rb.getJavaClass() + " has an item that does not represent an annotation in its XML configurations");
+ throw new XmlConfigurationException("Setereotype " + rb.getJavaClass() + " has an item that does not represent an annotation in its XML configurations", rb.getDocument(), rb.getLineno());
}
count++;
}
@@ -340,7 +333,7 @@
}
@SuppressWarnings("unchecked")
- Annotation createAnnotation(XmlItem item) throws InvalidElementException
+ Annotation createAnnotation(XmlItem item)
{
Map<String, Object> typedVars = new HashMap<String, Object>();
Class<?> anClass = item.getJavaClass();
@@ -354,7 +347,7 @@
}
catch (Exception e1)
{
- throw new InvalidElementException("Annotation " + item.getJavaClass().getName() + " does not have a member named " + mname + " ,error in XML");
+ throw new XmlConfigurationException("Annotation " + item.getJavaClass().getName() + " does not have a member named " + mname + " ,error in XML", item.getDocument(), item.getLineno());
}
Class<?> returnType = m.getReturnType();
typedVars.put(mname, XmlObjectConverter.convert(returnType, e.getValue()));
@@ -370,7 +363,7 @@
{
if (!allowed.contains(item.getType()))
{
- throw new RuntimeException("Item " + item.getType() + " is not allowed to contain " + i.getType());
+ throw new XmlConfigurationException("Item " + item.getType() + " is not allowed to contain " + i.getType(), item.getDocument(), item.getLineno());
}
validateXmlItem(i);
}
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ValueXmlItem.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ValueXmlItem.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/ValueXmlItem.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -10,9 +10,9 @@
public class ValueXmlItem extends AbstractXmlItem
{
- public ValueXmlItem(XmlItem parent, String innerText)
+ public ValueXmlItem(XmlItem parent, String innerText, String document, int lineno)
{
- super(XmlItemType.VALUE, parent, null, innerText, null);
+ super(XmlItemType.VALUE, parent, null, innerText, null, document, lineno);
}
public Set<XmlItemType> getAllowedItem()
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/VetoXmlItem.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/VetoXmlItem.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/VetoXmlItem.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -10,9 +10,9 @@
public class VetoXmlItem extends AbstractXmlItem
{
- public VetoXmlItem(XmlItem parent)
+ public VetoXmlItem(XmlItem parent, String document, int lineno)
{
- super(XmlItemType.VETO, parent, null, null, null);
+ super(XmlItemType.VETO, parent, null, null, null, document, lineno);
}
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/XmlItem.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/XmlItem.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/model/XmlItem.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -45,4 +45,8 @@
public Set<XmlItemType> getAllowedItem();
+ int getLineno();
+
+ String getDocument();
+
}
\ No newline at end of file
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/ParserMain.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/ParserMain.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/ParserMain.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -38,9 +38,9 @@
String document;
- List<XmlParseException> errors;
+ List<Exception> errors;
- public SaxNode parse(InputSource inputSource, String fileUrl, List<XmlParseException> errors)
+ public SaxNode parse(InputSource inputSource, String fileUrl, List<Exception> errors)
{
this.errors = errors;
document = fileUrl;
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/SaxNode.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/SaxNode.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/SaxNode.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -12,7 +12,7 @@
public class SaxNode
{
- SaxNode(String name, String uri, Map<String, String> attributes, SaxNode parent, String document, int lineNo)
+ public SaxNode(String name, String uri, Map<String, String> attributes, SaxNode parent, String document, int lineNo)
{
this.name = name;
this.namespaceUri = uri;
@@ -33,12 +33,16 @@
public String getInnerText()
{
+ if (innerText != null && innerText.isEmpty())
+ {
+ return null;
+ }
return innerText;
}
public void setInnerText(String innerText)
{
- this.innerText = innerText;
+ this.innerText = innerText.trim();
}
public String getNamespaceUri()
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/CompositeNamespaceElementResolver.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/CompositeNamespaceElementResolver.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/CompositeNamespaceElementResolver.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -8,10 +8,10 @@
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
-import java.util.Map;
import java.util.Set;
import org.jboss.seam.xml.model.XmlItem;
+import org.jboss.seam.xml.parser.SaxNode;
/**
* Namespace resolver that searches through a list of packages
@@ -41,22 +41,22 @@
}
}
- public XmlItem getItemForNamespace(String item, XmlItem parent, String innerText, Map<String, String> attributes) throws InvalidElementException
+ public XmlItem getItemForNamespace(SaxNode node, XmlItem parent)
{
- if (notFound.contains(item))
+ if (notFound.contains(node.getName()))
{
return null;
}
for (PackageNamespaceElementResolver p : resolvers)
{
- XmlItem xi = p.getItemForNamespace(item, parent, innerText, attributes);
+ XmlItem xi = p.getItemForNamespace(node, parent);
if (xi != null)
{
return xi;
}
}
- notFound.add(item);
+ notFound.add(node.getName());
return null;
}
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/NamespaceElementResolver.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/NamespaceElementResolver.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/NamespaceElementResolver.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -4,13 +4,12 @@
*/
package org.jboss.seam.xml.parser.namespace;
-import java.util.Map;
-
import org.jboss.seam.xml.model.XmlItem;
+import org.jboss.seam.xml.parser.SaxNode;
public interface NamespaceElementResolver
{
- XmlItem getItemForNamespace(String item, XmlItem parent, String innerText, Map<String, String> attributes) throws InvalidElementException;
+ XmlItem getItemForNamespace(SaxNode node, XmlItem parent);
}
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/NamespaceUtils.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/NamespaceUtils.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/NamespaceUtils.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -10,10 +10,11 @@
import org.jboss.seam.xml.model.FieldXmlItem;
import org.jboss.seam.xml.model.MethodXmlItem;
import org.jboss.seam.xml.model.XmlItem;
+import org.jboss.seam.xml.util.XmlConfigurationException;
class NamespaceUtils
{
- static XmlItem resolveMethodOrField(String name, XmlItem parent, String innerText) throws InvalidElementException
+ static XmlItem resolveMethodOrField(String name, XmlItem parent, String innerText, String document, int lineno)
{
Class<?> p = parent.getJavaClass();
Field f = null;
@@ -29,15 +30,15 @@
}
if (methodFound && f != null)
{
- throw new InvalidElementException(parent.getJavaClass().getName() + " has both a method and a field named " + name + " and so cannot be configured via XML");
+ throw new XmlConfigurationException(parent.getJavaClass().getName() + " has both a method and a field named " + name + " and so cannot be configured via XML", document, lineno);
}
if (methodFound)
{
- return new MethodXmlItem(parent, name);
+ return new MethodXmlItem(parent, name, document, lineno);
}
else if (f != null)
{
- return new FieldXmlItem(parent, f, innerText);
+ return new FieldXmlItem(parent, f, innerText, document, lineno);
}
return null;
}
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/PackageNamespaceElementResolver.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/PackageNamespaceElementResolver.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/PackageNamespaceElementResolver.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -13,6 +13,7 @@
import org.jboss.seam.xml.model.ClassXmlItem;
import org.jboss.seam.xml.model.XmlItem;
import org.jboss.seam.xml.model.XmlItemType;
+import org.jboss.seam.xml.parser.SaxNode;
public class PackageNamespaceElementResolver implements NamespaceElementResolver
{
@@ -25,8 +26,9 @@
this.pack = pack + ".";
}
- public XmlItem getItemForNamespace(String name, XmlItem parent, String innerText, Map<String, String> attributes) throws InvalidElementException
+ public XmlItem getItemForNamespace(SaxNode node, XmlItem parent)
{
+ String name = node.getName();
if (notFound.contains(name))
{
return null;
@@ -46,11 +48,11 @@
}
if (c.isAnnotation())
{
- return new AnnotationXmlItem(parent, c, innerText, attributes);
+ return new AnnotationXmlItem(parent, c, node.getInnerText(), node.getAttributes(), node.getDocument(), node.getLineNo());
}
else
{
- return new ClassXmlItem(parent, c);
+ return new ClassXmlItem(parent, c, node.getDocument(), node.getLineNo());
}
}
@@ -68,7 +70,7 @@
// if the item can be a method of a FIELD
if (parent.getAllowedItem().contains(XmlItemType.METHOD) || parent.getAllowedItem().contains(XmlItemType.FIELD))
{
- return NamespaceUtils.resolveMethodOrField(name, parent, innerText);
+ return NamespaceUtils.resolveMethodOrField(name, parent, node.getInnerText(), node.getDocument(), node.getLineNo());
}
else
{
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/RootNamespaceElementResolver.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/RootNamespaceElementResolver.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/parser/namespace/RootNamespaceElementResolver.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -4,8 +4,6 @@
*/
package org.jboss.seam.xml.parser.namespace;
-import java.util.Map;
-
import org.jboss.seam.xml.model.ArrayXmlItem;
import org.jboss.seam.xml.model.DependsXmlItem;
import org.jboss.seam.xml.model.EntryXmlItem;
@@ -13,6 +11,7 @@
import org.jboss.seam.xml.model.ValueXmlItem;
import org.jboss.seam.xml.model.VetoXmlItem;
import org.jboss.seam.xml.model.XmlItem;
+import org.jboss.seam.xml.parser.SaxNode;
public class RootNamespaceElementResolver implements NamespaceElementResolver
{
@@ -25,40 +24,41 @@
delegate = new CompositeNamespaceElementResolver(namspaces);
}
- public XmlItem getItemForNamespace(String item, XmlItem parent, String innerText, Map<String, String> attributes) throws InvalidElementException
+ public XmlItem getItemForNamespace(SaxNode node, XmlItem parent)
{
- XmlItem ret = getRootItem(item, parent, innerText);
+ XmlItem ret = getRootItem(node, parent);
if (ret != null)
return ret;
- return delegate.getItemForNamespace(item, parent, innerText, attributes);
+ return delegate.getItemForNamespace(node, parent);
}
- XmlItem getRootItem(String item, XmlItem parent, String innerText)
+ XmlItem getRootItem(SaxNode node, XmlItem parent)
{
+ String item = node.getName();
if (item.equals("value") || item.equals("v"))
{
- return new ValueXmlItem(parent, innerText);
+ return new ValueXmlItem(parent, node.getInnerText(), node.getDocument(), node.getLineNo());
}
else if (item.equals("key") || item.equals("k"))
{
- return new KeyXmlItem(parent, innerText);
+ return new KeyXmlItem(parent, node.getInnerText(), node.getDocument(), node.getLineNo());
}
else if (item.equals("entry") || item.equals("e"))
{
- return new EntryXmlItem(parent);
+ return new EntryXmlItem(parent, node.getDocument(), node.getLineNo());
}
else if (item.equals("array"))
{
- return new ArrayXmlItem(parent);
+ return new ArrayXmlItem(parent, node.getDocument(), node.getLineNo());
}
else if (item.equals("veto"))
{
- return new VetoXmlItem(parent);
+ return new VetoXmlItem(parent, node.getDocument(), node.getLineNo());
}
else if (item.equals("depends"))
{
- return new DependsXmlItem(parent, innerText);
+ return new DependsXmlItem(parent, node.getInnerText(), node.getDocument(), node.getLineNo());
}
return null;
}
Modified: modules/xml/trunk/src/main/java/org/jboss/seam/xml/util/XmlConfigurationException.java
===================================================================
--- modules/xml/trunk/src/main/java/org/jboss/seam/xml/util/XmlConfigurationException.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/main/java/org/jboss/seam/xml/util/XmlConfigurationException.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -1,6 +1,6 @@
package org.jboss.seam.xml.util;
-public class XmlConfigurationException extends Exception
+public class XmlConfigurationException extends RuntimeException
{
int lineno;
String document;
Modified: modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/NamespaceResolverTest.java
===================================================================
--- modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/NamespaceResolverTest.java 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/NamespaceResolverTest.java 2010-01-30 22:39:47 UTC (rev 11999)
@@ -9,8 +9,8 @@
import org.jboss.seam.xml.model.XmlItem;
import org.jboss.seam.xml.model.XmlItemType;
+import org.jboss.seam.xml.parser.SaxNode;
import org.jboss.seam.xml.parser.namespace.CompositeNamespaceElementResolver;
-import org.jboss.seam.xml.parser.namespace.InvalidElementException;
import org.jboss.seam.xml.parser.namespace.NamespaceElementResolver;
import org.jboss.seam.xml.parser.namespace.PackageNamespaceElementResolver;
import org.jboss.seam.xml.test.simple.Bean1;
@@ -20,14 +20,14 @@
{
@Test
- public void testPackageResolver() throws InvalidElementException
+ public void testPackageResolver()
{
PackageNamespaceElementResolver resolver = new PackageNamespaceElementResolver("org.jboss.seam.xml.test.simple");
testResolver(resolver);
}
@Test
- public void testCompositePackageResolver() throws InvalidElementException
+ public void testCompositePackageResolver()
{
List<String> namespaces = new ArrayList<String>();
namespaces.add("java.lang");
@@ -37,13 +37,13 @@
testResolver(resolver);
}
- public void testResolver(NamespaceElementResolver resolver) throws InvalidElementException
+ public void testResolver(NamespaceElementResolver resolver)
{
- XmlItem item = resolver.getItemForNamespace("Bean1", null, null, null);
+ XmlItem item = resolver.getItemForNamespace(new SaxNode("Bean1", null, null, null, null, 0), null);
assert item.getJavaClass() == Bean1.class : "Namespace resolver returned wrong class type";
assert item.getType() == XmlItemType.CLASS : "Namespace resolver did not return class";
- XmlItem method = resolver.getItemForNamespace("method1", item, null, null);
+ XmlItem method = resolver.getItemForNamespace(new SaxNode("method1", null, null, null, null, 0), item);
assert method.getType() == XmlItemType.METHOD : "Item returned wrong type";
method.resolveChildren();
@@ -51,7 +51,7 @@
assert method.getMethod() != null : "Could not resolve method";
assert method.getMethod().getParameterTypes().length == 0 : "Wrong method was resolved";
- XmlItem field = resolver.getItemForNamespace("field1", item, null, null);
+ XmlItem field = resolver.getItemForNamespace(new SaxNode("field1", null, null, null, null, 0), item);
assert field.getType() == XmlItemType.FIELD : "Element of wrong type returned";
assert field.getField() != null : "field was not set";
Modified: modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/injection/qualifier-attributes-test-beans.xml
===================================================================
--- modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/injection/qualifier-attributes-test-beans.xml 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/injection/qualifier-attributes-test-beans.xml 2010-01-30 22:39:47 UTC (rev 11999)
@@ -2,6 +2,10 @@
<Beans xmlns="urn:seam:core"
xmlns:test="urn:java:org.jboss.seam.xml.test.injection">
+ <veto>
+ <test:QualifierTestBean/>
+ </veto>
+
<test:OtherQualifier>
<Qualifier/>
</test:OtherQualifier>
Modified: modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/method/method-beans.xml
===================================================================
--- modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/method/method-beans.xml 2010-01-28 15:13:41 UTC (rev 11998)
+++ modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/method/method-beans.xml 2010-01-30 22:39:47 UTC (rev 11999)
@@ -22,7 +22,6 @@
<test:method>
<Produces/>
<test:Qualifier1/>
-
<test:MethodValueBean>
<test:Qualifier2/>
</test:MethodValueBean>
14 years, 9 months
Seam SVN: r11998 - branches/community/Seam_2_2/src/main/org/jboss/seam/core.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-01-28 10:13:41 -0500 (Thu, 28 Jan 2010)
New Revision: 11998
Modified:
branches/community/Seam_2_2/src/main/org/jboss/seam/core/ResourceLoader.java
Log:
JBSEAM-4325
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/core/ResourceLoader.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/core/ResourceLoader.java 2010-01-28 02:47:51 UTC (rev 11997)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/core/ResourceLoader.java 2010-01-28 15:13:41 UTC (rev 11998)
@@ -76,6 +76,15 @@
Locale.instance(),
Thread.currentThread().getContextClassLoader()
);
+
+ // for getting bundle from page level message properties
+ if (bundle == null){
+ bundle = java.util.ResourceBundle.getBundle(
+ bundleName,
+ Locale.instance(),
+ ServletLifecycle.getCurrentServletContext().getClass().getClassLoader()
+ );
+ }
log.debug("loaded resource bundle: " + bundleName);
return bundle;
}
14 years, 10 months
Seam SVN: r11997 - in modules/xml/trunk/src/test: java/org/jboss/seam/xml/test/producer and 4 other directories.
by seam-commits@lists.jboss.org
Author: swd847
Date: 2010-01-27 21:47:51 -0500 (Wed, 27 Jan 2010)
New Revision: 11997
Added:
modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/
modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/MultipleProducerBeanTest.java
modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/Producer.java
modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/ProducerQualifier.java
modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/Reciever.java
modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/producer/
modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/producer/multiple-producers.xml
Modified:
modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/injection/producer-field-value-beans.xml
modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/simple/simple-beans.xml
Log:
added new tests to do with multiple annotated types
Added: modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/MultipleProducerBeanTest.java
===================================================================
--- modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/MultipleProducerBeanTest.java (rev 0)
+++ modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/MultipleProducerBeanTest.java 2010-01-28 02:47:51 UTC (rev 11997)
@@ -0,0 +1,37 @@
+/*
+ * Distributed under the LGPL License
+ *
+ */
+package org.jboss.seam.xml.test.producer;
+
+import org.jboss.seam.xml.test.AbstractXMLTest;
+import org.testng.annotations.Test;
+
+public class MultipleProducerBeanTest extends AbstractXMLTest
+{
+
+ @Override
+ protected String getXmlFileName()
+ {
+ return "multiple-producers.xml";
+ }
+
+ @Test
+ public void testProducerField()
+ {
+
+ Reciever s = getReference(Reciever.class);
+ assert s.val1==1;
+ assert s.val2==2;
+ }
+
+
+ @Test
+ public void testProducerMethod()
+ {
+
+ Reciever s = getReference(Reciever.class);
+ assert s.meth1==1;
+ assert s.meth2==2;
+ }
+}
Added: modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/Producer.java
===================================================================
--- modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/Producer.java (rev 0)
+++ modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/Producer.java 2010-01-28 02:47:51 UTC (rev 11997)
@@ -0,0 +1,11 @@
+package org.jboss.seam.xml.test.producer;
+
+public class Producer
+{
+ public int value;
+
+ public int meth()
+ {
+ return value;
+ }
+}
Added: modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/ProducerQualifier.java
===================================================================
--- modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/ProducerQualifier.java (rev 0)
+++ modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/ProducerQualifier.java 2010-01-28 02:47:51 UTC (rev 11997)
@@ -0,0 +1,13 @@
+package org.jboss.seam.xml.test.producer;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import javax.inject.Qualifier;
+
+(a)Retention(RetentionPolicy.RUNTIME)
+@Qualifier
+public @interface ProducerQualifier
+{
+ int value();
+}
Added: modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/Reciever.java
===================================================================
--- modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/Reciever.java (rev 0)
+++ modules/xml/trunk/src/test/java/org/jboss/seam/xml/test/producer/Reciever.java 2010-01-28 02:47:51 UTC (rev 11997)
@@ -0,0 +1,13 @@
+package org.jboss.seam.xml.test.producer;
+
+
+public class Reciever
+{
+ public int val1;
+
+ public int val2;
+
+ public int meth1;
+
+ public int meth2;
+}
Modified: modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/injection/producer-field-value-beans.xml
===================================================================
--- modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/injection/producer-field-value-beans.xml 2010-01-27 22:28:52 UTC (rev 11996)
+++ modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/injection/producer-field-value-beans.xml 2010-01-28 02:47:51 UTC (rev 11997)
@@ -2,6 +2,11 @@
<Beans xmlns="urn:seam:core"
xmlns:test="urn:java:org.jboss.seam.xml.test.injection">
+ <veto>
+ <test:ProducerBean/>
+ <test:RecieverBean/>
+ </veto>
+
<test:ProducerQualifier>
<Qualifier/>
</test:ProducerQualifier>
Added: modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/producer/multiple-producers.xml
===================================================================
--- modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/producer/multiple-producers.xml (rev 0)
+++ modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/producer/multiple-producers.xml 2010-01-28 02:47:51 UTC (rev 11997)
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Beans xmlns="urn:seam:core"
+ xmlns:test="urn:java:org.jboss.seam.xml.test.producer">
+ <veto>
+ <test:Producer/>
+ <test:Reciever/>
+ </veto>
+
+ <test:Producer>
+ <test:value>
+ <Produces/>
+ <test:ProducerQualifier value="1" />
+ <value>1</value>
+ </test:value>
+ <test:meth>
+ <Produces/>
+ <test:ProducerQualifier value="3" />
+ </test:meth>
+ </test:Producer>
+
+ <test:Producer>
+ <test:value>
+ <Produces/>
+ <test:ProducerQualifier value="2" />
+ <value>2</value>
+ </test:value>
+ <test:meth>
+ <Produces/>
+ <test:ProducerQualifier value="4" />
+ </test:meth>
+ </test:Producer>
+
+
+ <test:Reciever>
+ <test:val1>
+ <Inject/>
+ <test:ProducerQualifier value="1" />
+ </test:val1>
+ <test:val2>
+ <Inject/>
+ <test:ProducerQualifier value="2" />
+ </test:val2>
+ <test:meth1>
+ <Inject/>
+ <test:ProducerQualifier value="3" />
+ </test:meth1>
+ <test:meth2>
+ <Inject/>
+ <test:ProducerQualifier value="4" />
+ </test:meth2>
+
+ </test:Reciever>
+
+
+
+</Beans>
\ No newline at end of file
Modified: modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/simple/simple-beans.xml
===================================================================
--- modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/simple/simple-beans.xml 2010-01-27 22:28:52 UTC (rev 11996)
+++ modules/xml/trunk/src/test/resources/org/jboss/seam/xml/test/simple/simple-beans.xml 2010-01-28 02:47:51 UTC (rev 11997)
@@ -1,7 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<Beans xmlns="urn:seam:core"
xmlns:test="urn:java:org.jboss.seam.xml.test.simple">
+ <veto>
+ <test:Bean2/>
+ </veto>
+
<test:Bean1>
<test:bean2>
<Inject/>
14 years, 10 months
Seam SVN: r11996 - branches/community/Seam_2_2/examples.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-01-27 17:28:52 -0500 (Wed, 27 Jan 2010)
New Revision: 11996
Modified:
branches/community/Seam_2_2/examples/build.xml
Log:
JBSEAM-4036 - fixed wicket example for deploying on tomcat with jbembedded
Modified: branches/community/Seam_2_2/examples/build.xml
===================================================================
--- branches/community/Seam_2_2/examples/build.xml 2010-01-27 17:13:25 UTC (rev 11995)
+++ branches/community/Seam_2_2/examples/build.xml 2010-01-27 22:28:52 UTC (rev 11996)
@@ -974,6 +974,11 @@
<fileset refid="jbpm.jar" />
<fileset refid="tomcat.jbpm.jar" />
<fileset refid="seam.remoting.jar" />
+ <fileset refid="seam.wicket.jar"/>
+ <fileset refid="seam.debug.jar" />
+ <fileset refid="wicket-extensions.jar"/>
+ <fileset refid="wicket-datetime.jar"/>
+ <fileset refid="seam.debug.jar"/>
<fileset refid="spring.jar" />
<fileset refid="gwt.jar" />
<fileset refid="openid.jar" />
14 years, 10 months
Seam SVN: r11995 - in branches/community/Seam_2_2/examples/wiki: src/etc/META-INF and 30 other directories.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2010-01-27 12:13:25 -0500 (Wed, 27 Jan 2010)
New Revision: 11995
Added:
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiTreeNode.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTreeNodeEntityConverter.java
Removed:
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Queries.hbm.xml
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectoryDisplayPositionComparator.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectoryNameComparator.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentCountComment.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentLastComment.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/nestedset/
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/dirMenuItem.xhtml
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/browse/DisplayMenu.java
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/model/MenuTests.java
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/nestedset/
branches/community/Seam_2_2/examples/wiki/view/includes/mainMenuItem.xhtml
Modified:
branches/community/Seam_2_2/examples/wiki/src/etc/META-INF/persistence-dev-war.xml
branches/community/Seam_2_2/examples/wiki/src/etc/META-INF/persistence-prod-war.xml
branches/community/Seam_2_2/examples/wiki/src/etc/META-INF/persistence-test-war.xml
branches/community/Seam_2_2/examples/wiki/src/etc/WEB-INF/components.xml
branches/community/Seam_2_2/examples/wiki/src/etc/WEB-INF/pages.xml
branches/community/Seam_2_2/examples/wiki/src/etc/i18n/messages_en.properties
branches/community/Seam_2_2/examples/wiki/src/etc/production.sql
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Authenticator.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentNodeRemover.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentQuery.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryBrowser.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Menu.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/prefs/CommentsPreferences.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/TagDAO.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserRoleAccessFactory.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeDAO.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeFactory.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedDAO.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/WikiCommentFeedEntryManager.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/DatabaseObjects.hbm.xml
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/NativeQueries.hbm.xml
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiComment.java
branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectory.java
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/DirMenu.java
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/DirTocQuery.java
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/dirMenu.xhtml
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/dirToc.xhtml
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/default/css/dirMenu.css
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/default/css/dirToc.css
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/inrelationto/css/dirMenu.css
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/inrelationto/css/dirToc.css
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/sfwkorg/css/dirMenu.css
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/sfwkorg/css/dirToc.css
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/BlogDAO.java
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/FaqBrowser.java
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/FaqBrowserDAO.java
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/FaqQuestionHome.java
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/templates/faqControls.xhtml
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumDAO.java
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumQueries.hbm.xml
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumReplyFeedEntryManager.java
branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ReplyHome.java
branches/community/Seam_2_2/examples/wiki/src/test/AllTests.tng.xml
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/DocumentFeedEntries.dbunit.xml
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/FAQData.dbunit.xml
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/ForumData.dbunit.xml
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/HelpDocuments.dbunit.xml
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/KnowledgeBase.dbunit.xml
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/browse/DisplayComments.java
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/dao/TagDAOTests.java
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/dao/WikiNodeDAOTests.java
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/BasicNodeOperations.java
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/ClipboardTests.java
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/Commenting.java
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/model/CommentTests.java
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/model/DirectoryTests.java
branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/plugin/TopicHomeTests.java
branches/community/Seam_2_2/examples/wiki/view/dirDisplay_d.xhtml
branches/community/Seam_2_2/examples/wiki/view/docDisplay_d.xhtml
branches/community/Seam_2_2/examples/wiki/view/includes/commentsDisplay.xhtml
branches/community/Seam_2_2/examples/wiki/view/includes/directoryBrowserPath.xhtml
branches/community/Seam_2_2/examples/wiki/view/includes/directoryBrowserTree.xhtml
branches/community/Seam_2_2/examples/wiki/view/includes/mainMenu.xhtml
branches/community/Seam_2_2/examples/wiki/view/themes/default/css/mainMenu.css
branches/community/Seam_2_2/examples/wiki/view/themes/inrelationto/css/inrelationto.css
branches/community/Seam_2_2/examples/wiki/view/themes/sfwkorg/css/sfwk.css
Log:
JBSEAM-4499, removed nested set datamodel
Modified: branches/community/Seam_2_2/examples/wiki/src/etc/META-INF/persistence-dev-war.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/etc/META-INF/persistence-dev-war.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/etc/META-INF/persistence-dev-war.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -75,14 +75,6 @@
<property name="hibernate.ejb.collectioncache.org.jboss.seam.wiki.core.model.Feed.feedEntries"
value="read-write, WikiFeedEntryCollection"/>
- <!-- Nested Set handling through special Hibernate event listeners -->
- <property name="hibernate.ejb.event.flush"
- value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetFlushEventListener"/>
- <property name="hibernate.ejb.event.post-insert"
- value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetPostInsertEventListener"/>
- <property name="hibernate.ejb.event.post-delete"
- value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetPostDeleteEventListener"/>
-
</properties>
</persistence-unit>
Modified: branches/community/Seam_2_2/examples/wiki/src/etc/META-INF/persistence-prod-war.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/etc/META-INF/persistence-prod-war.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/etc/META-INF/persistence-prod-war.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -72,14 +72,6 @@
<property name="hibernate.ejb.collectioncache.org.jboss.seam.wiki.core.model.Feed.feedEntries"
value="read-write, WikiFeedEntryCollection"/>
- <!-- Nested Set handling through special Hibernate event listeners -->
- <property name="hibernate.ejb.event.flush"
- value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetFlushEventListener"/>
- <property name="hibernate.ejb.event.post-insert"
- value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetPostInsertEventListener"/>
- <property name="hibernate.ejb.event.post-delete"
- value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetPostDeleteEventListener"/>
-
</properties>
</persistence-unit>
Modified: branches/community/Seam_2_2/examples/wiki/src/etc/META-INF/persistence-test-war.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/etc/META-INF/persistence-test-war.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/etc/META-INF/persistence-test-war.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -47,14 +47,6 @@
<property name="hibernate.generate_statistics" value="true"/>
<property name="hibernate.session_factory_name" value="SessionFactories/lacewikiSF"/>
- <!-- Nested Set handling through special Hibernate event listeners -->
- <property name="hibernate.ejb.event.flush"
- value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetFlushEventListener"/>
- <property name="hibernate.ejb.event.post-insert"
- value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetPostInsertEventListener"/>
- <property name="hibernate.ejb.event.post-delete"
- value="org.jboss.seam.wiki.core.nestedset.listener.NestedSetPostDeleteEventListener"/>
-
</properties>
</persistence-unit>
Modified: branches/community/Seam_2_2/examples/wiki/src/etc/WEB-INF/components.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/etc/WEB-INF/components.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/etc/WEB-INF/components.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -59,8 +59,8 @@
scope="CONVERSATION" precedence="20" entity-loader="#{restrictedEntityLoader}"/>
<ui:jpa-entity-loader name="restrictedEntityLoader" entity-manager="#{restrictedEntityManager}"/>
- <ui:entity-converter name="nestedSetNodeWrapperRestrictedEntityConverter"
- class="org.jboss.seam.wiki.core.nestedset.ui.NestedSetNodeWrapperEntityConverter"
+ <ui:entity-converter name="wikiTreeNodeRestrictedEntityConverter"
+ class="org.jboss.seam.wiki.core.ui.WikiTreeNodeEntityConverter"
scope="CONVERSATION" precedence="20" entity-loader="#{restrictedEntityLoader}"/>
<!-- Login and security -->
Modified: branches/community/Seam_2_2/examples/wiki/src/etc/WEB-INF/pages.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/etc/WEB-INF/pages.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/etc/WEB-INF/pages.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -339,13 +339,6 @@
</redirect>
</exception>
- <exception class="org.jboss.seam.wiki.core.nestedset.listener.NestedSetLockTimeoutException">
- <end-conversation before-redirect="true"/>
- <redirect view-id="/wiki.xhtml">
- <message severity="WARN">#{messages['lacewiki.msg.LockTimeoutError']}</message>
- </redirect>
- </exception>
-
<!-- This occurs on concurrent delete of comments -->
<exception class="javax.persistence.EntityNotFoundException" log="false">
<end-conversation before-redirect="true"/>
Modified: branches/community/Seam_2_2/examples/wiki/src/etc/i18n/messages_en.properties
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/etc/i18n/messages_en.properties 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/etc/i18n/messages_en.properties 2010-01-27 17:13:25 UTC (rev 11995)
@@ -773,7 +773,6 @@
lacewiki.preferences.comments.Name=Core: Comments
lacewiki.preferences.comments.ListAscending=List flat comments ascending by date (or descending)
lacewiki.preferences.comments.EnableByDefault=Enable comments by default for new documents
-lacewiki.preferences.comments.Threaded=Threaded comment display (or flat)
# Templates
Modified: branches/community/Seam_2_2/examples/wiki/src/etc/production.sql
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/etc/production.sql 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/etc/production.sql 2010-01-27 17:13:25 UTC (rev 11995)
@@ -30,9 +30,8 @@
INSERT INTO PREFERENCE VALUES(64,'UserManagement','createHomeAfterUserActivation',NULL,NULL,NULL,FALSE,NULL,0,NULL);
INSERT INTO PREFERENCE VALUES(65,'UserManagement','homepageDefaultContent',NULL,NULL,NULL,NULL,'This is your homepage, login to edit it.',0,NULL);
-INSERT INTO PREFERENCE VALUES(70,'Comments','listAscending',NULL,NULL,NULL,FALSE,NULL,0,NULL);
+INSERT INTO PREFERENCE VALUES(70,'Comments','listAscending',NULL,NULL,NULL,TRUE,NULL,0,NULL);
INSERT INTO PREFERENCE VALUES(71,'Comments','enableByDefault',NULL,NULL,NULL,TRUE,NULL,0,NULL);
-INSERT INTO PREFERENCE VALUES(72,'Comments','threaded',NULL,NULL,NULL,TRUE,NULL,0,NULL);
INSERT INTO PREFERENCE VALUES(110,'LastModifiedDocuments','numberOfItems',5,NULL,NULL,NULL,NULL,0,NULL);
INSERT INTO PREFERENCE VALUES(111,'LastModifiedDocuments','showUsernames',NULL,NULL,NULL,TRUE,NULL,0,NULL);
@@ -115,12 +114,12 @@
INSERT INTO `WIKI_FILE` (`NODE_ID`, `FILE_REVISION`) VALUES (3,0);
INSERT INTO `WIKI_FILE` (`NODE_ID`, `FILE_REVISION`) VALUES (7,0);
-INSERT INTO `WIKI_DIRECTORY` (`NODE_ID`, `DESCRIPTION`, `NS_LEFT`, `NS_RIGHT`, `NS_THREAD`, `DEFAULT_FILE_ID`) VALUES (1,'Root Area',1,12,1,NULL);
-INSERT INTO `WIKI_DIRECTORY` (`NODE_ID`, `DESCRIPTION`, `NS_LEFT`, `NS_RIGHT`, `NS_THREAD`, `DEFAULT_FILE_ID`) VALUES (2,'Start Area',2,3,1,3);
-INSERT INTO `WIKI_DIRECTORY` (`NODE_ID`, `DESCRIPTION`, `NS_LEFT`, `NS_RIGHT`, `NS_THREAD`, `DEFAULT_FILE_ID`) VALUES (4,'Default member area',8,9,1,NULL);
-INSERT INTO `WIKI_DIRECTORY` (`NODE_ID`, `DESCRIPTION`, `NS_LEFT`, `NS_RIGHT`, `NS_THREAD`, `DEFAULT_FILE_ID`) VALUES (5,'Help documents',4,7,1,NULL);
-INSERT INTO `WIKI_DIRECTORY` (`NODE_ID`, `DESCRIPTION`, `NS_LEFT`, `NS_RIGHT`, `NS_THREAD`, `DEFAULT_FILE_ID`) VALUES (6,'Creating and editing wiki documents',5,6,1,NULL);
-INSERT INTO `WIKI_DIRECTORY` (`NODE_ID`, `DESCRIPTION`, `NS_LEFT`, `NS_RIGHT`, `NS_THREAD`, `DEFAULT_FILE_ID`) VALUES (8,'Trash Area',10,11,1,NULL);
+INSERT INTO `WIKI_DIRECTORY` (`NODE_ID`, `DESCRIPTION`, `DEFAULT_FILE_ID`) VALUES (1,'Root Area',NULL);
+INSERT INTO `WIKI_DIRECTORY` (`NODE_ID`, `DESCRIPTION`, `DEFAULT_FILE_ID`) VALUES (2,'Start Area',3);
+INSERT INTO `WIKI_DIRECTORY` (`NODE_ID`, `DESCRIPTION`, `DEFAULT_FILE_ID`) VALUES (4,'Default member area',NULL);
+INSERT INTO `WIKI_DIRECTORY` (`NODE_ID`, `DESCRIPTION`, `DEFAULT_FILE_ID`) VALUES (5,'Help documents',NULL);
+INSERT INTO `WIKI_DIRECTORY` (`NODE_ID`, `DESCRIPTION`, `DEFAULT_FILE_ID`) VALUES (6,'Creating and editing wiki documents',NULL);
+INSERT INTO `WIKI_DIRECTORY` (`NODE_ID`, `DESCRIPTION`, `DEFAULT_FILE_ID`) VALUES (8,'Trash Area',NULL);
INSERT INTO `WIKI_DOCUMENT` (`NODE_ID`, `CONTENT`, `CONTENT_MACROS`, `ENABLE_COMMENT_FORM`, `ENABLE_COMMENTS`, `ENABLE_COMMENTS_ON_FEEDS`, `FOOTER`, `FOOTER_MACROS`, `HEADER`, `HEADER_MACROS`, `NAME_AS_TITLE`) VALUES (3,'Welcome to LaceWiki.\n\nLogin with admin-admin and rebuild the search index in the administration area.',NULL,true,true,true,NULL,NULL,NULL,NULL,true);
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Authenticator.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Authenticator.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Authenticator.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -138,7 +138,8 @@
// Create home directory
WikiDirectory memberArea = (WikiDirectory)Component.getInstance("memberArea");
- WikiDirectory homeDirectory = new WikiDirectory(user.getUsername());
+ WikiDirectory homeDirectory = new WikiDirectory();
+ homeDirectory.setName(user.getUsername());
homeDirectory.setWikiname(WikiUtil.convertToWikiName(homeDirectory.getName()));
homeDirectory.setAreaNumber(memberArea.getAreaNumber());
homeDirectory.setCreatedBy(user);
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentHome.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -133,7 +133,12 @@
@Override
public String persist() {
+ // TODO: This is not pretty but this has really not been designed for non-threaded comments
+ WikiNode oldParent = getParentNode(); // Remember old parent
+ setParentNode(documentHome.getInstance()); // Set the "real" parent, which is the document
String outcome = super.persist();
+ setParentNode(oldParent); // Reset old parent afterwards
+
if (outcome != null) {
if (documentHome.getInstance().isEnableCommentsOnFeeds()) {
@@ -144,10 +149,6 @@
getEntityManager().flush();
}
- getLog().debug("updating last comment aggregation for: " + documentHome.getInstance());
- getWikiNodeDAO().updateWikiDocumentComments(documentHome.getInstance());
- getEntityManager().flush();
-
Events.instance().raiseEvent("Comment.persisted");
endConversation();
WikiRedirect.instance()
@@ -178,12 +179,6 @@
remove();
getEntityManager().clear();
-
- getLog().debug("updating last comment aggregation for: " + documentHome.getInstance());
- getWikiNodeDAO().updateWikiDocumentComments(documentHome.getInstance());
- getEntityManager().flush();
-
- getEntityManager().clear();
Events.instance().raiseEvent("Comment.commentListRefresh");
}
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentNodeRemover.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentNodeRemover.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentNodeRemover.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -10,7 +10,6 @@
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.wiki.core.model.WikiComment;
-import java.util.List;
import java.io.Serializable;
/**
@@ -34,18 +33,6 @@
public void removeDependencies(WikiComment comment) {
getLog().debug("removing dependencies of: " + comment);
- List<WikiComment> children = getWikiNodeDAO().findWikiCommentSubtree(comment, true);
- // These are ordered by level, deepest first, so no FK violation if we delete in that order
- // (does it matter? Hibernate should sort it...)
- for (WikiComment child : children) {
- getLog().debug("deleting child comment: " + child);
- feedDAO.removeFeedEntry(
- feedDAO.findFeeds(child),
- feedDAO.findFeedEntry(child)
- );
- getEntityManager().remove(child);
- }
-
feedDAO.removeFeedEntry(
feedDAO.findFeeds(comment),
feedDAO.findFeedEntry(comment)
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentQuery.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentQuery.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/CommentQuery.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -54,11 +54,7 @@
return;
}
- if (commentsPreferences.getThreaded()) {
- comments = wikiNodeDAO.findWikiCommentsThreaded(documentHome.getInstance());
- } else {
- comments = wikiNodeDAO.findWikiCommentsFlat(documentHome.getInstance(), commentsPreferences.getListAscending());
- }
+ comments = wikiNodeDAO.findWikiComments(documentHome.getInstance(), commentsPreferences.getListAscending());
}
}
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryBrowser.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryBrowser.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/DirectoryBrowser.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -17,7 +17,6 @@
import org.jboss.seam.log.Log;
import org.jboss.seam.security.Identity;
import org.jboss.seam.wiki.core.model.*;
-import org.jboss.seam.wiki.core.nestedset.query.NestedSetNodeWrapper;
import org.jboss.seam.wiki.core.dao.WikiNodeDAO;
import org.jboss.seam.wiki.core.dao.UserDAO;
import org.jboss.seam.wiki.core.exception.InvalidWikiRequestException;
@@ -73,7 +72,10 @@
private Long directoryId;
private WikiDirectory instance;
- private NestedSetNodeWrapper<WikiDirectory> treeRoot;
+
+ // TODO: No more nested set, rewriting this with the same functionality is more difficult...
+ //private NestedSetNodeWrapper<WikiDirectory> treeRoot;
+
private List<WikiNode> childNodes;
private Map<WikiNode, Boolean> selectedNodes = new HashMap<WikiNode,Boolean>();
private Pager pager;
@@ -109,10 +111,12 @@
pager = new Pager(settings.getPageSize());
}
+ /*
public NestedSetNodeWrapper<WikiDirectory> getTreeRoot() {
if (treeRoot == null) loadTree();
return treeRoot;
}
+ */
public void showTree() {
settings.setTreeVisible(true);
@@ -122,6 +126,7 @@
settings.setTreeVisible(false);
}
+ /*
// Open a node in the visible UI tree if its identifier is in the current path
public boolean adviseTreeNodeOpened(UITree tree) {
@@ -170,6 +175,7 @@
log.debug("selecting tree node: " + currentTreeNodeId);
selectDirectory(currentTreeNodeId);
}
+ */
public void findInstance() {
if (getDirectoryId() == null)
@@ -206,11 +212,13 @@
refreshChildNodes();
}
+ /*
@Observer(value = {"Node.removed"}, create = false)
public void loadTree() {
WikiDirectory wikiRoot = (WikiDirectory) Component.getInstance("wikiRoot");
treeRoot = wikiNodeDAO.findWikiDirectoryTree(wikiRoot);
}
+ */
@Observer(value = {"Node.removed", "Pager.pageChanged"}, create = false)
public void refreshChildNodes() {
@@ -355,7 +363,7 @@
// TODO: Ugly and memory intensive, better use a database query but HQL updates are limited with joins
if (n.isInstance(WikiDocument.class)) {
- List<WikiComment> comments = wikiNodeDAO.findWikiCommentsFlat((WikiDocument)n, true);
+ List<WikiComment> comments = wikiNodeDAO.findWikiComments((WikiDocument)n, true);
for (WikiComment comment : comments) {
comment.setAreaNumber(n.getAreaNumber());
}
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Menu.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Menu.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/Menu.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -14,11 +14,12 @@
import org.jboss.seam.wiki.core.action.prefs.WikiPreferences;
import org.jboss.seam.wiki.core.dao.WikiNodeDAO;
import org.jboss.seam.wiki.core.model.WikiDirectory;
-import org.jboss.seam.wiki.core.nestedset.query.NestedSetNodeWrapper;
+import org.jboss.seam.wiki.core.model.WikiTreeNode;
import org.jboss.seam.wiki.core.cache.PageFragmentCache;
import org.jboss.seam.wiki.preferences.Preferences;
import java.io.Serializable;
+import java.util.List;
/**
* Holds the nodes that are displayed in the site menu
@@ -38,12 +39,12 @@
@In
Integer currentAccessLevel;
- NestedSetNodeWrapper<WikiDirectory> root;
- public NestedSetNodeWrapper<WikiDirectory> getRoot() {
- if (root == null) {
- refreshRoot();
+ List<WikiTreeNode<WikiDirectory>> tree;
+ public List<WikiTreeNode<WikiDirectory>> getTree() {
+ if (tree == null) {
+ refreshTree();
}
- return root;
+ return tree;
}
public String getCacheRegion() {
@@ -59,13 +60,13 @@
public void invalidateCache() {
log.debug("invaliding menu items tree cache");
PageFragmentCache.instance().removeAll(CACHE_REGION);
- root = null;
+ tree = null;
}
- private void refreshRoot() {
+ private void refreshTree() {
log.debug("Loading menu items tree");
WikiPreferences wikiPreferences = Preferences.instance().get(WikiPreferences.class);
- root = WikiNodeDAO.instance().findMenuItemTree(
+ tree = WikiNodeDAO.instance().findMenuItemTree(
(WikiDirectory)Component.getInstance("wikiRoot"),
wikiPreferences.getMainMenuDepth(),
wikiPreferences.getMainMenuLevels(),
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/prefs/CommentsPreferences.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/prefs/CommentsPreferences.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/action/prefs/CommentsPreferences.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -24,13 +24,6 @@
@NotNull
private Boolean enableByDefault;
- @PreferenceProperty(
- description = "#{messages['lacewiki.preferences.comments.Threaded']}",
- visibility = {PreferenceVisibility.SYSTEM, PreferenceVisibility.USER}
- )
- @NotNull
- private Boolean threaded;
-
public Boolean getListAscending() {
return listAscending;
}
@@ -39,7 +32,4 @@
return enableByDefault;
}
- public Boolean getThreaded() {
- return threaded;
- }
}
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/TagDAO.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/TagDAO.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/TagDAO.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,18 +1,14 @@
package org.jboss.seam.wiki.core.dao;
-import org.hibernate.Query;
import org.hibernate.Session;
+import org.hibernate.Query;
import org.hibernate.transform.Transformers;
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.log.Log;
-import org.jboss.seam.wiki.core.model.DisplayTagCount;
-import org.jboss.seam.wiki.core.model.WikiDirectory;
-import org.jboss.seam.wiki.core.model.WikiFile;
-import org.jboss.seam.wiki.core.model.WikiNode;
-import org.jboss.seam.wiki.core.nestedset.query.NestedSetQueryBuilder;
+import org.jboss.seam.wiki.core.model.*;
import javax.persistence.EntityManager;
import java.util.Collections;
@@ -28,34 +24,32 @@
@In
protected EntityManager restrictedEntityManager;
- // TODO: This query needs to be optimized, the nested subselect with in() is not good for MySQL, needs to be a join
+ @In
+ protected WikiNodeDAO wikiNodeDAO;
+
public List<DisplayTagCount> findTagCounts(WikiDirectory startDir, WikiFile ignoreFile, int limit, long minimumCount) {
StringBuilder queryString = new StringBuilder();
-
queryString.append("select t as tag, count(t) as count").append(" ");
queryString.append("from WikiFile f join f.tags as t").append(" ");
- queryString.append("where f.parent.id in");
- queryString.append("(").append(getNestedDirectoryQuery(startDir)).append(")").append(" ");
+ queryString.append("where f.parent.id in (:parentDirIds) ");
if (ignoreFile != null && ignoreFile.getId() != null) queryString.append("and not f = :ignoreFile").append(" ");
queryString.append("group by t").append(" ");
queryString.append("having count(t) >= :minimumCount").append(" ");
queryString.append("order by count(t) desc, t asc ");
- Query nestedSetQuery = getSession().createQuery(queryString.toString());
- nestedSetQuery.setParameter("nsThread", startDir.getNodeInfo().getNsThread());
- nestedSetQuery.setParameter("nsLeft", startDir.getNodeInfo().getNsLeft());
- nestedSetQuery.setParameter("nsRight", startDir.getNodeInfo().getNsRight());
- nestedSetQuery.setParameter("minimumCount", minimumCount);
+ Query tagQuery = getSession().createQuery(queryString.toString());
+ tagQuery.setParameterList("parentDirIds", wikiNodeDAO.findWikiDirectoryTreeIDs(startDir));
+ tagQuery.setParameter("minimumCount", minimumCount);
if (ignoreFile != null && ignoreFile.getId() != null)
- nestedSetQuery.setParameter("ignoreFile", ignoreFile);
+ tagQuery.setParameter("ignoreFile", ignoreFile);
if (limit > 0) {
- nestedSetQuery.setMaxResults(limit);
+ tagQuery.setMaxResults(limit);
}
- nestedSetQuery.setResultTransformer(Transformers.aliasToBean(DisplayTagCount.class));
+ tagQuery.setResultTransformer(Transformers.aliasToBean(DisplayTagCount.class));
- return nestedSetQuery.list();
+ return tagQuery.list();
}
public List<WikiFile> findWikFiles(WikiDirectory startDir, WikiFile ignoreFile, final String tag,
@@ -65,32 +59,21 @@
StringBuilder queryString = new StringBuilder();
- queryString.append("select distinct f from WikiFile f join f.tags as t where f.parent.id in");
- queryString.append("(").append(getNestedDirectoryQuery(startDir)).append(")").append(" ");
+ queryString.append("select distinct f from WikiFile f join f.tags as t ");
+ queryString.append("where f.parent.id in (:parentDirIds) ");
if (ignoreFile != null && ignoreFile.getId() != null) queryString.append("and not f = :ignoreFile").append(" ");
queryString.append("and t = :tag").append(" ");
queryString.append("order by f.").append(orderBy.name()).append(" ").append(orderAscending ? "asc" : "desc");
- Query nestedSetQuery = getSession().createQuery(queryString.toString());
- nestedSetQuery.setParameter("nsThread", startDir.getNodeInfo().getNsThread());
- nestedSetQuery.setParameter("nsLeft", startDir.getNodeInfo().getNsLeft());
- nestedSetQuery.setParameter("nsRight", startDir.getNodeInfo().getNsRight());
+ Query fileQuery = getSession().createQuery(queryString.toString());
+ fileQuery.setParameterList("parentDirIds", wikiNodeDAO.findWikiDirectoryTreeIDs(startDir));
if (ignoreFile != null && ignoreFile.getId() != null)
- nestedSetQuery.setParameter("ignoreFile", ignoreFile);
- nestedSetQuery.setParameter("tag", tag);
+ fileQuery.setParameter("ignoreFile", ignoreFile);
+ fileQuery.setParameter("tag", tag);
- return nestedSetQuery.list();
+ return fileQuery.list();
}
- private String getNestedDirectoryQuery(WikiDirectory dir) {
- NestedSetQueryBuilder builder = new NestedSetQueryBuilder(dir, true);
- StringBuilder queryString = new StringBuilder();
- queryString.append("select distinct ").append(NestedSetQueryBuilder.NODE_ALIAS).append(".id").append(" ");
- queryString.append("from ").append(builder.getFromClause()).append(" ");
- queryString.append("where ").append(builder.getWhereClause()).append(" ");
- return queryString.toString();
- }
-
private Session getSession() {
return ((Session)((org.jboss.seam.persistence.EntityManagerProxy) restrictedEntityManager).getDelegate());
}
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserRoleAccessFactory.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserRoleAccessFactory.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/UserRoleAccessFactory.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -36,6 +36,15 @@
@Factory(value = "guestUser", scope = ScopeType.SESSION)
public User getGuestUser() {
try {
+ /*
+ This causes the following warning in Hibernate 3.3:
+
+ WARN [org.hibernate.hql.ast.QueryTranslatorImpl] firstResult/maxResults specified with collection fetch; applying in memory!
+
+ Of course that is just wrong and it looks like this warning was added in a hurry between 3.2 and 3.3. Or this is not the
+ query that is causing the warning - who knows! It probably would have been too easy printing the offending query string
+ with the message...
+ */
User guestUser =
(User) entityManager
.createQuery("select u from User u left join fetch u.roles where u.username = '"+User.GUEST_USERNAME+"'")
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeDAO.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeDAO.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeDAO.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -9,11 +9,6 @@
import org.jboss.seam.annotations.Name;
import org.jboss.seam.log.Log;
import org.jboss.seam.wiki.core.model.*;
-import org.jboss.seam.wiki.core.nestedset.NestedSetNode;
-import org.jboss.seam.wiki.core.nestedset.query.NestedSetDuplicator;
-import org.jboss.seam.wiki.core.nestedset.query.NestedSetNodeWrapper;
-import org.jboss.seam.wiki.core.nestedset.query.NestedSetQueryBuilder;
-import org.jboss.seam.wiki.core.nestedset.query.NestedSetResultTransformer;
import javax.persistence.EntityManager;
import javax.persistence.EntityNotFoundException;
@@ -56,8 +51,8 @@
.setHint("org.hibernate.comment", "Find wikinode by id")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
@@ -85,8 +80,8 @@
.setHint("org.hibernate.comment", "Find node in area")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -99,8 +94,8 @@
.setHint("org.hibernate.comment", "Find number of wikinode children")
.setHint("org.hibernate.cacheable", true)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -138,99 +133,23 @@
.setHint("org.hibernate.comment", "Find comment by id")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
- public List<WikiComment> findWikiCommentsThreaded(WikiDocument document) {
- return findWikiComments(document, true, false);
+ public List<WikiComment> findWikiComments(WikiDocument document, boolean orderbyDateAscending) {
+ String query =
+ "select c from WikiComment c where c.parent = :parentDoc order by c.createdOn " +
+ (orderbyDateAscending ? "asc" : "desc");
+ return (List<WikiComment>)restrictedEntityManager
+ .createQuery(query)
+ .setParameter("parentDoc", document)
+ .setHint("org.hibernate.comment", "Finding all comments of document")
+ .getResultList();
}
- public List<WikiComment> findWikiCommentsFlat(WikiDocument document, boolean orderbyDateAscending) {
- return findWikiComments(document, false, orderbyDateAscending);
- }
-
- private List<WikiComment> findWikiComments(WikiDocument document, final boolean threaded, boolean unthreadedAscending) {
- StringBuilder queryString = new StringBuilder();
-
- NestedSetQueryBuilder queryBuilder = new NestedSetQueryBuilder(new WikiComment(), false, true);
- queryString.append("select ").append(queryBuilder.getSelectLevelClause()).append(", ");
- queryString.append(queryBuilder.getSelectNodeClause()).append(" ");
- queryString.append("from ").append(queryBuilder.getFromClause()).append(" ");
- queryString.append("where ").append(queryBuilder.getWhereClause(false)).append(" ");
- queryString.append("and ").append(NestedSetQueryBuilder.NODE2_ALIAS).append(".nodeInfo.nsThread in ");
- queryString.append("(select c3.nodeInfo.nsThread from WikiComment c3 where c3.parent = :doc)").append(" ");
- queryString.append("group by ").append(queryBuilder.getGroupByClause()).append(" ");
- queryString.append("order by ");
- if (threaded) {
- queryString.append(NestedSetQueryBuilder.NODE_ALIAS).append(".nodeInfo.nsThread asc").append(", ");
- queryString.append(queryBuilder.getOrderByClause());
- } else {
- queryString.append(NestedSetQueryBuilder.NODE_ALIAS).append(".createdOn ").append(unthreadedAscending ? "asc" : "desc");
- }
-
- org.hibernate.Query nsQuery = getSession(true).createQuery(queryString.toString());
- nsQuery.setParameter("doc", document);
- nsQuery.setComment("Find wikicomments (tree)");
- nsQuery.setCacheable(false);
- nsQuery.setResultTransformer(
- new ResultTransformer() {
- public Object transformTuple(Object[] objects, String[] aliases) {
- Long level = (Long)objects[0];
- WikiComment c = (WikiComment)objects[1];
- if (threaded) c.setLevel(level);
- return c;
- }
- public List transformList(List list) {
- return list;
- }
- }
- );
- return nsQuery.list();
- }
-
- public List<WikiComment> findWikiCommentSubtree(WikiComment root) {
- return findWikiCommentSubtree(root, false);
- }
-
- public List<WikiComment> findWikiCommentSubtree(WikiComment root, boolean orderByLevelDescending) {
- NestedSetQueryBuilder queryBuilder;
- if (orderByLevelDescending) {
- queryBuilder = new NestedSetQueryBuilder(new WikiComment(), false, false) {
- public String getOrderByClause() {
- StringBuilder clause = new StringBuilder();
- clause.append("count(").append(NestedSetQueryBuilder.NODE_ALIAS).append(".id) desc");
- return clause.toString();
- }
- };
- } else {
- queryBuilder = new NestedSetQueryBuilder(new WikiComment(), false, false);
- }
-
- org.hibernate.Query nsQuery = getSession(true).createQuery(queryBuilder.getSimpleQuery());
- nsQuery.setParameter("nsThread", root.getNodeInfo().getNsThread());
- nsQuery.setParameter("nsLeft", root.getNodeInfo().getNsLeft());
- nsQuery.setParameter("nsRight", root.getNodeInfo().getNsRight());
- nsQuery.setComment("Find wikicomments subtree");
- nsQuery.setCacheable(false);
- nsQuery.setResultTransformer(
- new ResultTransformer() {
- public Object transformTuple(Object[] objects, String[] aliases) {
- Long level = (Long)objects[0];
- WikiComment c = (WikiComment)objects[1];
- c.setLevel(level);
- return c;
- }
- public List transformList(List list) {
- return list;
- }
- }
- );
- return nsQuery.list();
- }
-
public WikiFile findWikiFile(Long fileId) {
try {
return (WikiFile) restrictedEntityManager
@@ -239,8 +158,8 @@
.setHint("org.hibernate.comment", "Find wikifile by id")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -258,8 +177,8 @@
.setHint("org.hibernate.comment", "Find wikifile in area")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -272,8 +191,8 @@
.setHint("org.hibernate.comment", "Find document by id")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -288,8 +207,8 @@
.setHint("org.hibernate.comment", "Find default file")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -303,8 +222,8 @@
.setHint("org.hibernate.comment", "Find default doc")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -334,8 +253,8 @@
.setHint("org.hibernate.comment", "Find document in area")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -366,8 +285,8 @@
.setMaxResults(1)
.setParameter("current", currentDocument)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -380,8 +299,8 @@
.setHint("org.hibernate.comment", "Find upload by id")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -406,8 +325,8 @@
.setHint("org.hibernate.comment", "Find directory by id")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -419,8 +338,8 @@
.setParameter("id", directoryId)
.setHint("org.hibernate.comment", "Find user for directory member home by id")
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -442,12 +361,70 @@
.setHint("org.hibernate.comment", "Find directory in area")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
+ public List<Long> findWikiDirectoryTreeIDs(WikiDirectory startDir) {
+ List<Long> parentDirIds = new ArrayList();
+ List<WikiTreeNode<WikiDirectory>> directoryTree = findWikiDirectoryTree(startDir, WikiNode.SortableProperty.createdOn, true);
+ for (WikiTreeNode<WikiDirectory> treeNode : directoryTree) {
+ parentDirIds.add(treeNode.getNode().getId());
+ }
+ return parentDirIds;
+ }
+
+ public List<WikiTreeNode<WikiDirectory>> findWikiDirectoryTree(WikiDirectory rootDir, WikiNode.SortableProperty sortByProperty, boolean sortAscending) {
+ List<WikiTreeNode<WikiDirectory>> tree = new ArrayList();
+ long level = 1;
+ tree.add(new WikiTreeNode<WikiDirectory>(level++, rootDir));
+
+ String query = "select d from WikiDirectory d where d.parent.id = :parentNodeId and d.readAccessLevel <= :readAccessLevel order by " +
+ sortByProperty.name() + " " + (sortAscending ? "asc" : "desc");
+
+ appendWikiNodeChildren(query, tree, rootDir.getId(), level, null, null);
+ return tree;
+ }
+
+ public List<WikiTreeNode<WikiDirectory>> findMenuItemTree(WikiDirectory rootDir, Long maxDepth, Long flattenToLevel, boolean onlyCreatedByAdminUser) {
+ List<WikiTreeNode<WikiDirectory>> tree = new ArrayList();
+ long level = 1;
+ // TODO: Root in or out?
+ // tree.add(new WikiTreeNode<WikiDirectory>(level++, rootDir));
+
+ String query = "select d from WikiMenuItem mi join mi.directory d" +
+ " where d.parent.id = :parentNodeId" +
+ " and d.readAccessLevel <= :readAccessLevel" +
+ (onlyCreatedByAdminUser ? " and d.createdBy.id = '"+((User)Component.getInstance("adminUser")).getId()+"'" : "") +
+ " order by mi.displayPosition asc";
+
+ appendWikiNodeChildren(query, tree, rootDir.getId(), level, maxDepth, flattenToLevel);
+ return tree;
+ }
+
+ // Recursive! Don't use for large trees...
+ private void appendWikiNodeChildren(String query, List tree, long parentNodeId, long currentLevel, Long maxDepth, Long flattenToLevel) {
+ List<WikiNode> nodes = restrictedEntityManager.createQuery(query)
+ .setHint("org.hibernate.comment", "Querying children of wiki node: " + parentNodeId)
+ .setParameter("parentNodeId", parentNodeId)
+ .setParameter("readAccessLevel", Component.getInstance("currentAccessLevel"))
+ .getResultList();
+ for (WikiNode node : nodes) {
+ tree.add(new WikiTreeNode(currentLevel, node));
+ if (maxDepth == null || currentLevel < maxDepth) {
+ if (flattenToLevel == null || currentLevel < flattenToLevel) {
+ currentLevel++;
+ appendWikiNodeChildren(query, tree, node.getId(), currentLevel, maxDepth, flattenToLevel);
+ currentLevel--;
+ } else {
+ appendWikiNodeChildren(query, tree, node.getId(), currentLevel, maxDepth, flattenToLevel);
+ }
+ }
+ }
+ }
+
public WikiDirectory findAreaUnrestricted(String wikiname) {
return findArea(wikiname, entityManager);
}
@@ -464,8 +441,8 @@
.setHint("org.hibernate.comment", "Find area by wikiname")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -478,8 +455,8 @@
.setHint("org.hibernate.comment", "Find area by area number")
.setHint("org.hibernate.cacheable", false)
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
}
@@ -555,8 +532,8 @@
.setParameter("dir", dir)
.setHint("org.hibernate.comment", "Find menu item of directory")
.getSingleResult();
- } catch (EntityNotFoundException ex) {
- } catch (NoResultException ex) {
+ } catch (EntityNotFoundException ignored) {
+ } catch (NoResultException ignored) {
}
return null;
@@ -568,167 +545,6 @@
.getResultList();
}
- public NestedSetNodeWrapper<WikiDirectory> findMenuItemTree(WikiDirectory startDir, Long maxDepth, Long flattenToLevel, boolean showAdminOnly) {
-
- NestedSetNodeWrapper<WikiDirectory> startNodeWrapper =
- new NestedSetNodeWrapper<WikiDirectory>(startDir, new WikiDirectoryDisplayPositionComparator());
-
- NestedSetResultTransformer<WikiDirectory> transformer =
- new NestedSetResultTransformer<WikiDirectory>(startNodeWrapper, flattenToLevel);
-
- transformer.getAdditionalProjections().put("displayPosition", "m.displayPosition");
-
- // Make hollow copies for menu display so that changes to the model in the persistence context don't appear
- transformer.setNestedSetDuplicator(
- new NestedSetDuplicator<WikiDirectory>() {
- public WikiDirectory duplicate(WikiDirectory original) {
- WikiDirectory copy = new WikiDirectory();
- copy.flatCopy(original, false);
- copy.setId(original.getId());
- copy.setParent(original.getParent());
- return copy;
- }
- }
- );
-
- appendNestedSetNodes(transformer, maxDepth, showAdminOnly, "WikiMenuItem m", "m.id = n1.id");
- return startNodeWrapper;
-
- }
-
- public NestedSetNodeWrapper<WikiDirectory> findWikiDirectoryTree(WikiDirectory startDir) {
- return findWikiDirectoryTree(startDir, null, 0l, false);
- }
-
- public NestedSetNodeWrapper<WikiDirectory> findWikiDirectoryTree(WikiDirectory startDir,
- Long maxDepth, Long flattenToLevel,
- boolean showAdminOnly) {
-
- NestedSetNodeWrapper<WikiDirectory> startNodeWrapper =
- new NestedSetNodeWrapper<WikiDirectory>(startDir, new WikiDirectoryNameComparator());
-
- NestedSetResultTransformer<WikiDirectory> transformer =
- new NestedSetResultTransformer<WikiDirectory>(startNodeWrapper, flattenToLevel);
-
- appendNestedSetNodes(transformer, maxDepth, showAdminOnly, null);
- return startNodeWrapper;
-
- }
-
- public <N extends NestedSetNode> void appendNestedSetNodes(NestedSetResultTransformer<N> transformer,
- Long maxDepth,
- boolean showAdminOnly,
- String selectionFragment,
- String... restrictionFragment) {
-
- N startNode = transformer.getRootWrapper().getWrappedNode();
-
- log.debug("appending nested set nodes to node: " + startNode + ", " + startNode.getNodeInfo());
-
- NestedSetQueryBuilder builder = new NestedSetQueryBuilder(startNode, false);
-
- StringBuilder queryString = new StringBuilder();
-
- queryString.append("select").append(" ");
- queryString.append(builder.getSelectLevelClause()).append(", ");
- queryString.append(builder.getSelectNodeClause()).append(" ");
- for (Map.Entry<String, String> entry : transformer.getAdditionalProjections().entrySet()) {
- queryString.append(", ").append(entry.getValue()).append(" as ").append(entry.getKey()).append(" ");
- }
- queryString.append("from ").append(builder.getFromClause());
- if (selectionFragment != null) {
- queryString.append(", ").append(selectionFragment);
- }
- queryString.append(" where ").append(builder.getWhereClause()).append(" ");
- if (showAdminOnly) {
- queryString.append("and ").append(NestedSetQueryBuilder.NODE_ALIAS).append(".createdBy = :adminUser").append(" ");
- }
- for (String fragment: restrictionFragment) {
- queryString.append("and ").append(fragment).append(" ");
- }
- queryString.append("group by ").append(builder.getGroupByClause()).append(" ");
- for (Map.Entry<String, String> entry : transformer.getAdditionalProjections().entrySet()) {
- queryString.append(", ").append(entry.getValue()).append(" ");
- }
-
- if (maxDepth != null) {
- queryString.append("having count(").append(NestedSetQueryBuilder.NODE_ALIAS).append(".id) <= :maxDepth").append(" ");
- }
-
- queryString.append("order by ").append(builder.getOrderByClause());
-
- org.hibernate.Query nestedSetQuery = getSession(true).createQuery(queryString.toString());
- nestedSetQuery.setParameter("nsThread", startNode.getNodeInfo().getNsThread());
- nestedSetQuery.setParameter("nsLeft", startNode.getNodeInfo().getNsLeft());
- nestedSetQuery.setParameter("nsRight", startNode.getNodeInfo().getNsRight());
- if (showAdminOnly) nestedSetQuery.setParameter("adminUser", Component.getInstance("adminUser"));
- if (maxDepth != null) nestedSetQuery.setParameter("maxDepth", maxDepth);
-
- nestedSetQuery.setComment("Appending nested set nodes to startnode: " + startNode.getId());
-
- nestedSetQuery.setResultTransformer(transformer);
- nestedSetQuery.list(); // Append all children hierarchically to the transformers rootWrapper
- }
-
- // TODO: This is not great
- public void updateWikiDocumentComments(WikiDocument document) {
-
- // First, the denormalized "last comment" data duplication
-
- // TODO: This probably is vulnerable to a race condition if we don't lock the whole WIKI_DOCUMENT_LAST_COMMENT table
-
- Long lastCommentId = (Long)
- getSession(true).getNamedQuery("findLastCommentOfDocument")
- .setParameter("documentId", document.getId())
- .setComment("Finding last comment of document: " + document.getId())
- .uniqueResult();
-
- WikiComment lastComment = null;
- if (lastCommentId!= null) {
- lastComment = restrictedEntityManager.find(WikiComment.class, lastCommentId);
- }
-
- WikiDocumentLastComment existingLastCommentEntry
- = restrictedEntityManager.find(WikiDocumentLastComment.class, document.getId());
-
- if (existingLastCommentEntry != null && lastComment == null) {
- restrictedEntityManager.remove(existingLastCommentEntry);
- } else if (existingLastCommentEntry != null) {
- existingLastCommentEntry.setLastCommentId(lastComment.getId());
- existingLastCommentEntry.setLastCommentCreatedOn(lastComment.getCreatedOn());
- } else if (lastComment != null){
- existingLastCommentEntry = new WikiDocumentLastComment();
- existingLastCommentEntry.setDocumentId(document.getId());
- existingLastCommentEntry.setLastCommentId(lastComment.getId());
- existingLastCommentEntry.setLastCommentCreatedOn(lastComment.getCreatedOn());
- restrictedEntityManager.persist(existingLastCommentEntry);
- }
-
- // Next, the denormalized "total comment count" data duplication
-
- Long commentCount = 0l;
- try {
- commentCount = (Long)
- getSession(true).getNamedQuery("countCommentOfDocument")
- .setParameter("documentId", document.getId())
- .setComment("Counting comments of document: " + document.getId())
- .uniqueResult();
- } catch (Exception ex) {
- // Ugh
- }
-
- WikiDocumentCountComment existingCommentCount =
- restrictedEntityManager.find(WikiDocumentCountComment.class, document.getId());
- if (existingCommentCount != null) {
- existingCommentCount.setCommentCount(commentCount);
- } else {
- existingCommentCount = new WikiDocumentCountComment();
- existingCommentCount.setDocumentId(document.getId());
- existingCommentCount.setCommentCount(commentCount);
- restrictedEntityManager.persist(existingCommentCount);
- }
- }
-
private Session getSession(boolean restricted) {
if (restricted) {
return ((Session)((org.jboss.seam.persistence.EntityManagerProxy) restrictedEntityManager).getDelegate());
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeFactory.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeFactory.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/dao/WikiNodeFactory.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -38,7 +38,7 @@
public void checkPreferences() {
log.info("checking wiki preferences...");
-/* TODO: needs to be disabled in testing
+ /* TODO: needs to be disabled in testing
// We need a fake user so we can retrieve preferences without a request, on startup
Contexts.getEventContext().set("currentPreferencesUser", new User());
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedDAO.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedDAO.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/FeedDAO.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -14,14 +14,15 @@
import org.jboss.seam.log.Log;
import org.jboss.seam.wiki.core.model.*;
import org.jboss.seam.wiki.core.ui.WikiURLRenderer;
+import org.jboss.seam.wiki.core.dao.WikiNodeDAO;
import javax.persistence.EntityManager;
import javax.persistence.EntityNotFoundException;
import javax.persistence.NoResultException;
-import javax.persistence.Query;
import java.util.Date;
import java.util.List;
import java.util.Iterator;
+import java.util.ArrayList;
/**
* DAO for feeds.
@@ -95,23 +96,24 @@
}
public List<WikiFeed> findParentFeeds(WikiDirectory startDir, boolean includeSiteFeed) {
- StringBuilder queryString = new StringBuilder();
+ WikiDirectory currentDir = WikiNodeDAO.instance().findWikiDirectory(startDir.getId()); // Use restricted PC!
- queryString.append("select f from WikiDirectory d join d.feed f ");
- queryString.append("where d.nodeInfo.nsThread = :nsThread and ");
- queryString.append("d.nodeInfo.nsLeft <= :nsLeft and d.nodeInfo.nsRight >= :nsRight ");
- if (!includeSiteFeed) queryString.append("and not d = :wikiRoot ");
- queryString.append("order by f.publishedDate desc ");
+ List<WikiFeed> feeds = new ArrayList();
+ if (currentDir.getParent() == null && currentDir.getFeed() != null) {
+ feeds.add(currentDir.getFeed());
+ }
+ while (currentDir.getParent() != null) {
+ if (currentDir.getFeed() != null)
+ feeds.add(currentDir.getFeed());
+ currentDir = (WikiDirectory)currentDir.getParent();
+ }
- Query query = restrictedEntityManager.createQuery(queryString.toString())
- .setParameter("nsThread", startDir.getNodeInfo().getNsThread())
- .setParameter("nsLeft", startDir.getNodeInfo().getNsLeft())
- .setParameter("nsRight", startDir.getNodeInfo().getNsRight());
+ if (includeSiteFeed) {
+ WikiDirectory wikiRoot = (WikiDirectory)Component.getInstance("wikiRoot");
+ feeds.add(WikiNodeDAO.instance().findWikiDirectory(wikiRoot.getId()).getFeed()); // Use restricted PC!
+ }
- if (!includeSiteFeed)
- query.setParameter("wikiRoot", Component.getInstance("wikiRoot"));
-
- return query.getResultList();
+ return feeds;
}
public WikiDocumentFeedEntry findFeedEntry(WikiDocument document) {
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/WikiCommentFeedEntryManager.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/WikiCommentFeedEntryManager.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/feeds/WikiCommentFeedEntryManager.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -58,8 +58,8 @@
StringBuilder desc = new StringBuilder();
desc.append(Messages.instance().get("lacewiki.msg.comment.FeedIntro"));
desc.append(" ");
- desc.append("<a href=\"").append(wikiURLRenderer.renderURL(comment.getParentDocument())).append("\">");
- desc.append("'").append(comment.getParentDocument().getName()).append("'");
+ desc.append("<a href=\"").append(wikiURLRenderer.renderURL(comment.getParent())).append("\">");
+ desc.append("'").append(comment.getParent().getName()).append("'");
desc.append("</a>.");
desc.append("<hr/>");
desc.append(
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/DatabaseObjects.hbm.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/DatabaseObjects.hbm.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/DatabaseObjects.hbm.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -46,22 +46,6 @@
<dialect-scope name="org.hibernate.dialect.HSQLDialect"/>
</database-object>
- <database-object>
- <create>
- alter table WIKI_DOCUMENT_LAST_COMMENT add constraint FK_WIKI_DOCUMENT_LAST_COMMENT_DOCUMENT_ID foreign key (WIKI_DOCUMENT_ID) references WIKI_DOCUMENT (NODE_ID) on delete cascade;
- </create>
- <drop/>
- <dialect-scope name="org.hibernate.dialect.HSQLDialect"/>
- </database-object>
-
- <database-object>
- <create>
- alter table WIKI_DOCUMENT_COUNT_COMMENT add constraint FK_WIKI_DOCUMENT_COUNT_COMMENT_DOCUMENT_ID foreign key (WIKI_DOCUMENT_ID) references WIKI_DOCUMENT (NODE_ID) on delete cascade;
- </create>
- <drop/>
- <dialect-scope name="org.hibernate.dialect.HSQLDialect"/>
- </database-object>
-
<!-- ############################### MySQL ############################### -->
@@ -112,22 +96,6 @@
<database-object>
<create>
- alter table WIKI_DOCUMENT_LAST_COMMENT add index FK_WIKI_DOCUMENT_LAST_COMMENT_DOCUMENT_ID (WIKI_DOCUMENT_ID), add constraint FK_WIKI_DOCUMENT_LAST_COMMENT_DOCUMENT_ID foreign key (WIKI_DOCUMENT_ID) references WIKI_DOCUMENT (NODE_ID) on delete cascade;
- </create>
- <drop/>
- <dialect-scope name="org.jboss.seam.wiki.util.WikiMySQL5HibernateDialect"/>
- </database-object>
-
- <database-object>
- <create>
- alter table WIKI_DOCUMENT_COUNT_COMMENT add index FK_WIKI_DOCUMENT_COUNT_COMMENT_DOCUMENT_ID (WIKI_DOCUMENT_ID), add constraint FK_WIKI_DOCUMENT_COUNT_COMMENT_DOCUMENT_ID foreign key (WIKI_DOCUMENT_ID) references WIKI_DOCUMENT (NODE_ID) on delete cascade;
- </create>
- <drop/>
- <dialect-scope name="org.jboss.seam.wiki.util.WikiMySQL5HibernateDialect"/>
- </database-object>
-
- <database-object>
- <create>
create index IDX_PREFERENCE_ENTITY_NAME on PREFERENCE (ENTITY_NAME)
</create>
<drop>
@@ -178,66 +146,6 @@
<database-object>
<create>
- create index IDX_WIKI_DIRECTORY_NS_LEFT on WIKI_DIRECTORY (NS_LEFT)
- </create>
- <drop>
- drop index IDX_WIKI_DIRECTORY_NS_LEFT
- </drop>
- <dialect-scope name="org.jboss.seam.wiki.util.WikiMySQL5HibernateDialect"/>
- </database-object>
-
- <database-object>
- <create>
- create index IDX_WIKI_DIRECTORY_NS_RIGHT on WIKI_DIRECTORY (NS_RIGHT)
- </create>
- <drop>
- drop index IDX_WIKI_DIRECTORY_NS_RIGHT
- </drop>
- <dialect-scope name="org.jboss.seam.wiki.util.WikiMySQL5HibernateDialect"/>
- </database-object>
-
- <database-object>
- <create>
- create index IDX_WIKI_DIRECTORY_NS_THREAD on WIKI_DIRECTORY (NS_THREAD)
- </create>
- <drop>
- drop index IDX_WIKI_DIRECTORY_NS_THREAD
- </drop>
- <dialect-scope name="org.jboss.seam.wiki.util.WikiMySQL5HibernateDialect"/>
- </database-object>
-
- <database-object>
- <create>
- create index IDX_WIKI_COMMENT_NS_LEFT on WIKI_COMMENT (NS_LEFT)
- </create>
- <drop>
- drop index IDX_WIKI_COMMENT_NS_LEFT
- </drop>
- <dialect-scope name="org.jboss.seam.wiki.util.WikiMySQL5HibernateDialect"/>
- </database-object>
-
- <database-object>
- <create>
- create index IDX_WIKI_COMMENT_NS_RIGHT on WIKI_COMMENT (NS_RIGHT)
- </create>
- <drop>
- drop index IDX_WIKI_COMMENT_NS_RIGHT
- </drop>
- <dialect-scope name="org.jboss.seam.wiki.util.WikiMySQL5HibernateDialect"/>
- </database-object>
-
- <database-object>
- <create>
- create index IDX_WIKI_COMMENT_NS_THREAD on WIKI_COMMENT (NS_THREAD)
- </create>
- <drop>
- drop index IDX_WIKI_COMMENT_NS_THREAD
- </drop>
- <dialect-scope name="org.jboss.seam.wiki.util.WikiMySQL5HibernateDialect"/>
- </database-object>
-
- <database-object>
- <create>
create index IDX_WIKI_DOCUMENT_HEADER_MACROS on WIKI_DOCUMENT (HEADER_MACROS)
</create>
<drop>
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/FeedEntry.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -173,6 +173,26 @@
return (getPublishedDate().getTime() == other.getPublishedDate().getTime() ? 0 : 1);
}
+/*
+ // Equality needs to be consistent with comparable/ordering!
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ FeedEntry feedEntry = (FeedEntry) o;
+
+ if (!publishedDate.equals(feedEntry.publishedDate)) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return publishedDate.hashCode();
+ }
+*/
+
public String toString() {
return "FeedEntry (" + getId() + ")";
}
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/NativeQueries.hbm.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/NativeQueries.hbm.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/NativeQueries.hbm.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -4,33 +4,6 @@
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
- <sql-query name="findLastCommentOfDocument">
- <return-scalar column="LAST_COMMENT_ID" type="long"/>
- select
- ct3.NODE_ID as LAST_COMMENT_ID
- from WIKI_COMMENT ct
- inner join WIKI_NODE ct1 on ct.NODE_ID = ct1.NODE_ID
- inner join WIKI_COMMENT ct2 on ct2.NS_THREAD in (ct.NS_THREAD)
- inner join WIKI_NODE ct3 on ct2.NODE_ID = ct3.NODE_ID,
- WIKI_NODE doc0
- inner join WIKI_DOCUMENT doc1 on doc0.NODE_ID = doc1.NODE_ID
- where
- ct1.PARENT_NODE_ID = :documentId
- order by
- ct3.CREATED_ON desc
- limit 1
- </sql-query>
+ <!-- No externalized queries at this time... -->
- <sql-query name="countCommentOfDocument">
- <return-scalar column="COMMENT_COUNT" type="long"/>
- select
- count(distinct c0.NODE_ID) as COMMENT_COUNT
- from
- WIKI_NODE ct0
- inner join WIKI_COMMENT ct1 on ct0.NODE_ID = ct1.NODE_ID
- inner join WIKI_COMMENT c0 on c0.NS_THREAD in (ct1.NS_THREAD)
- where
- ct0.PARENT_NODE_ID = :documentId
- </sql-query>
-
</hibernate-mapping>
\ No newline at end of file
Deleted: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Queries.hbm.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Queries.hbm.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/Queries.hbm.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,40 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE hibernate-mapping PUBLIC
- "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
- "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
-
-<!--
-
-Workarounds for Hibernate bugs, mostly.
-
-@author Christian Bauer
--->
-<hibernate-mapping package="org.jboss.seam.wiki.core.model" default-access="field">
-
- <!--
- TODO: http://opensource.atlassian.com/projects/hibernate/browse/HHH-1657
- -->
- <sql-query name="updateNestedSet.org.jboss.seam.wiki.core.model.WikiComment">
- <query-param name="left" type="long"/>
- <query-param name="right" type="long"/>
- <query-param name="thread" type="long"/>
- <query-param name="id" type="long"/>
- update WIKI_COMMENT set NS_LEFT = :left, NS_RIGHT = :right, NS_THREAD = :thread where NODE_ID = :id
- </sql-query>
- <sql-query name="updateNestedSet.org.jboss.seam.wiki.core.model.WikiDirectory">
- <query-param name="left" type="long"/>
- <query-param name="right" type="long"/>
- <query-param name="thread" type="long"/>
- <query-param name="id" type="long"/>
- update WIKI_DIRECTORY set NS_LEFT = :left, NS_RIGHT = :right, NS_THREAD = :thread where NODE_ID = :id
- </sql-query>
- <sql-query name="updateNestedSet.org.jboss.seam.wiki.test.nestedset.TestDirectory">
- <query-param name="left" type="long"/>
- <query-param name="right" type="long"/>
- <query-param name="thread" type="long"/>
- <query-param name="id" type="long"/>
- update TEST_DIRECTORY set NS_LEFT = :left, NS_RIGHT = :right, NS_THREAD = :thread where ITEM_ID = :id
- </sql-query>
-
-</hibernate-mapping>
-
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiComment.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiComment.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiComment.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -2,8 +2,6 @@
import org.hibernate.validator.Email;
import org.hibernate.validator.Length;
-import org.jboss.seam.wiki.core.nestedset.NestedSetNode;
-import org.jboss.seam.wiki.core.nestedset.NestedSetNodeInfo;
import org.jboss.seam.wiki.core.search.annotations.Searchable;
import org.jboss.seam.wiki.core.search.annotations.SearchableType;
import org.jboss.seam.wiki.core.search.annotations.CompositeSearchables;
@@ -25,7 +23,7 @@
properties = {"subject", "content"}
)
)
-public class WikiComment extends WikiNode<WikiComment> implements NestedSetNode<WikiComment>, Serializable {
+public class WikiComment extends WikiNode<WikiComment> implements Serializable {
@Column(name = "SUBJECT", nullable = false)
@Length(min = 3, max = 255)
@@ -54,16 +52,6 @@
@Column(name = "USE_WIKI_TEXT", nullable = false)
private boolean useWikiText = true;
- @Transient
- private Long level;
-
- @Embedded
- private NestedSetNodeInfo<WikiComment> nodeInfo;
-
- public WikiComment () {
- nodeInfo = new NestedSetNodeInfo<WikiComment>(this);
- }
-
public String getSubject() { return subject; }
public void setSubject(String subject) { this.subject = subject; }
@@ -82,9 +70,6 @@
public boolean isUseWikiText() { return useWikiText; }
public void setUseWikiText(boolean useWikiText) { this.useWikiText = useWikiText; }
- public Long getLevel() { return level; }
- public void setLevel(Long level) { this.level = level; }
-
public void flatCopy(WikiComment original, boolean copyLazyProperties) {
super.flatCopy(original, copyLazyProperties);
this.subject = original.subject;
@@ -103,16 +88,6 @@
return dupe;
}
- public NestedSetNodeInfo<WikiComment> getNodeInfo() {
- return nodeInfo;
- }
-
- public NestedSetNodeInfo<WikiComment> getParentNodeInfo() {
- if (getParent() != null && WikiComment.class.isAssignableFrom(getParent().getClass()))
- return ((WikiComment)getParent()).getNodeInfo();
- return null;
- }
-
public String[] getPropertiesForGroupingInQueries() {
return new String[]{
"version", "parent", "rating",
@@ -128,31 +103,19 @@
public String getPermURL(String suffix) {
- return getParentDocument().getId() + suffix + "#comment" + getId();
+ return getParent().getId() + suffix + "#comment" + getId();
}
public String getWikiURL() {
- return getArea().getWikiname() + "/" + getParentDocument().getWikiname() + "#comment" + getId();
+ return getArea().getWikiname() + "/" + getParent().getWikiname() + "#comment" + getId();
}
- // TODO: Everything can have comments, this has the wrong name and it's crude
- public WikiNode getParentDocument() {
- WikiNode current = this.getParent();
- if (WikiDocument.class.isAssignableFrom(current.getClass())) return current;
- while (current.getParent() != null && WikiComment.class.isAssignableFrom(current.getParent().getClass())) {
- current = current.getParent();
- }
- return current.getParent(); // Let's just assume that the parent of a comment is at some point a document
-
- }
-
public void setDerivedName(WikiNode node) {
setName(node.getName() + ".Comment" + new Date().getTime());
}
public String toString() {
return "Comment (" + getId() + ")," +
- " Level: " + getLevel() +
" Subject: '" + getSubject() + "'";
}
Modified: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectory.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectory.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectory.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,8 +1,6 @@
package org.jboss.seam.wiki.core.model;
import org.hibernate.validator.Length;
-import org.jboss.seam.wiki.core.nestedset.NestedSetNode;
-import org.jboss.seam.wiki.core.nestedset.NestedSetNodeInfo;
import javax.persistence.*;
import java.io.Serializable;
@@ -13,17 +11,17 @@
@Entity
@Table(name = "WIKI_DIRECTORY")
@org.hibernate.annotations.ForeignKey(name = "FK_WIKI_DIRECTORY_NODE_ID")
-public class WikiDirectory extends WikiNode<WikiDirectory> implements NestedSetNode<WikiDirectory>, Serializable {
+public class WikiDirectory extends WikiNode<WikiDirectory> implements Serializable {
@Column(name = "DESCRIPTION", nullable = true)
@Length(min = 0, max = 512)
private String description;
-// This does not work, as usual. Hibernate just ignores it and gives me a proxy sometimes, leading to CCE later on
-// Maybe because I query directories with "from WikiNode where parentId", so the instrumentation of the WikiDirectory
-// subclass has no effect.
-// @ManyToOne(fetch = FetchType.LAZY)
-// @org.hibernate.annotations.LazyToOne(org.hibernate.annotations.LazyToOneOption.NO_PROXY)
+ // This does not work, as usual. Hibernate just ignores it and gives me a proxy sometimes, leading to CCE later on
+ // Maybe because I query directories with "from WikiNode where parentId", so the instrumentation of the WikiDirectory
+ // subclass has no effect.
+ // @ManyToOne(fetch = FetchType.LAZY)
+ // @org.hibernate.annotations.LazyToOne(org.hibernate.annotations.LazyToOneOption.NO_PROXY)
@ManyToOne(fetch = FetchType.EAGER)
@JoinColumn(name = "DEFAULT_FILE_ID", nullable = true, unique = true)
@org.hibernate.annotations.ForeignKey(name = "FK_WIKI_DIRECTORY_DEFAULT_FILE_ID")
@@ -33,18 +31,6 @@
@org.hibernate.annotations.Fetch(org.hibernate.annotations.FetchMode.JOIN)
private WikiFeed feed;
- @Embedded
- private NestedSetNodeInfo<WikiDirectory> nodeInfo;
-
- public WikiDirectory() {
- nodeInfo = new NestedSetNodeInfo<WikiDirectory>(this);
- }
-
- public WikiDirectory(String name) {
- super(name);
- nodeInfo = new NestedSetNodeInfo<WikiDirectory>(this);
- }
-
public String getDescription() { return description; }
public void setDescription(String description) { this.description = description; }
@@ -64,7 +50,6 @@
public void flatCopy(WikiDirectory original, boolean copyLazyProperties) {
super.flatCopy(original, copyLazyProperties);
this.description = original.description;
- this.nodeInfo = original.nodeInfo;
}
public WikiDirectory duplicate(boolean copyLazyProperties) {
@@ -73,16 +58,6 @@
return dupe;
}
- public NestedSetNodeInfo<WikiDirectory> getNodeInfo() {
- return nodeInfo;
- }
-
- public NestedSetNodeInfo<WikiDirectory> getParentNodeInfo() {
- if (getParent() != null && WikiDirectory.class.isAssignableFrom(getParent().getClass()))
- return ((WikiDirectory)getParent()).getNodeInfo();
- return null;
- }
-
public String[] getPropertiesForGroupingInQueries() {
return new String[]{
"version", "parent", "rating",
@@ -133,6 +108,23 @@
return path;
}
+
+ public List<WikiDirectory> getParentsRecursive() {
+ if (this.getParent() == null) return Collections.EMPTY_LIST;
+ List parents = new ArrayList();
+ WikiNode currentNode = this.getParent();
+ while (true) {
+ if (currentNode.getParent() == null) {
+ parents.add(currentNode);
+ break;
+ } else {
+ parents.add(currentNode);
+ currentNode = currentNode.getParent();
+ }
+ }
+ return parents;
+ }
+
public String toString() {
return "WikiDirectory (" + getId() + "): " + getName();
}
Deleted: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectoryDisplayPositionComparator.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectoryDisplayPositionComparator.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectoryDisplayPositionComparator.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,36 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.seam.wiki.core.model;
-
-import org.jboss.seam.wiki.core.nestedset.query.NestedSetNodeWrapper;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-/**
- * Needs to be equals() safe (SortedSet): compare by display position, if equal compare by name,
- * if equal compare by id.
- *
- * @author Christian Bauer
- */
-public class WikiDirectoryDisplayPositionComparator
- implements Comparator<NestedSetNodeWrapper<WikiDirectory>>, Serializable {
-
- public int compare(NestedSetNodeWrapper<WikiDirectory> o1, NestedSetNodeWrapper<WikiDirectory> o2) {
- WikiDirectory node1 = o1.getWrappedNode();
- Long node1DisplayPosition = (Long)o1.getAdditionalProjections().get("displayPosition");
- WikiDirectory node2 = o2.getWrappedNode();
- Long node2DisplayPosition = (Long)o2.getAdditionalProjections().get("displayPosition");
- if (node1DisplayPosition.compareTo(node2DisplayPosition) != 0) {
- return node1DisplayPosition.compareTo(node2DisplayPosition);
- } else if (node1.getName().compareTo(node2.getName()) != 0) {
- return node1.getName().compareTo(node2.getName());
- }
- return node1.getId().compareTo(node2.getId());
- }
-
-}
Deleted: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectoryNameComparator.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectoryNameComparator.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDirectoryNameComparator.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,31 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.seam.wiki.core.model;
-
-import org.jboss.seam.wiki.core.nestedset.query.NestedSetNodeWrapper;
-
-import java.io.Serializable;
-import java.util.Comparator;
-
-/**
- * Needs to be equals() safe (SortedSet), compare by name, if equal compare by id.
- *
- * @author Christian Bauer
- */
-public class WikiDirectoryNameComparator
- implements Comparator<NestedSetNodeWrapper<WikiDirectory>>, Serializable {
-
- public int compare(NestedSetNodeWrapper<WikiDirectory> o1, NestedSetNodeWrapper<WikiDirectory> o2) {
- WikiDirectory node1 = o1.getWrappedNode();
- WikiDirectory node2 = o2.getWrappedNode();
- if (node1.getName().compareTo(node2.getName()) != 0) {
- return node1.getName().compareTo(node2.getName());
- }
- return node1.getId().compareTo(node2.getId());
- }
-
-}
Deleted: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentCountComment.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentCountComment.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentCountComment.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,42 +0,0 @@
-package org.jboss.seam.wiki.core.model;
-
-import javax.persistence.Column;
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.Table;
-
-/**
- * An ugly denormalization and duplication of data, so aggregation queries
- * can execute faster on nested set trees.
- *
- * @author Christian Bauer
- */
-@Entity
-@Table(name = "WIKI_DOCUMENT_COUNT_COMMENT")
-public class WikiDocumentCountComment {
-
- @Id
- @Column(name = "WIKI_DOCUMENT_ID", nullable = false)
- private Long documentId;
-
- @Column(name = "COMMENT_COUNT", nullable = false)
- protected Long commentCount = 0l;
-
- public WikiDocumentCountComment() {}
-
- public Long getDocumentId() {
- return documentId;
- }
-
- public void setDocumentId(Long documentId) {
- this.documentId = documentId;
- }
-
- public Long getCommentCount() {
- return commentCount;
- }
-
- public void setCommentCount(Long commentCount) {
- this.commentCount = commentCount;
- }
-}
\ No newline at end of file
Deleted: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentLastComment.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentLastComment.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiDocumentLastComment.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,57 +0,0 @@
-package org.jboss.seam.wiki.core.model;
-
-import javax.persistence.*;
-import java.util.Date;
-
-/**
- * A not-so-pretty denormalization and duplication of data, so aggregation queries
- * can execute faster on nested set trees.
- *
- * @author Christian Bauer
- */
-@Entity
-@Table(
- name = "WIKI_DOCUMENT_LAST_COMMENT",
- uniqueConstraints = {
- @UniqueConstraint(columnNames = {"WIKI_DOCUMENT_ID", "LAST_COMMENT_ID"})
- }
-)
-
-public class WikiDocumentLastComment {
-
- @Id
- @Column(name = "WIKI_DOCUMENT_ID", nullable = false)
- private Long documentId;
-
- @Column(name = "LAST_COMMENT_ID", nullable = false)
- protected Long lastCommentId;
-
- @Column(name = "LAST_COMMENT_CREATED_ON", nullable = false)
- protected Date lastCommentCreatedOn;
-
- public WikiDocumentLastComment() {}
-
- public Long getDocumentId() {
- return documentId;
- }
-
- public void setDocumentId(Long documentId) {
- this.documentId = documentId;
- }
-
- public Long getLastCommentId() {
- return lastCommentId;
- }
-
- public void setLastCommentId(Long lastCommentId) {
- this.lastCommentId = lastCommentId;
- }
-
- public Date getLastCommentCreatedOn() {
- return lastCommentCreatedOn;
- }
-
- public void setLastCommentCreatedOn(Date lastCommentCreatedOn) {
- this.lastCommentCreatedOn = lastCommentCreatedOn;
- }
-}
Added: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiTreeNode.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiTreeNode.java (rev 0)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/model/WikiTreeNode.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -0,0 +1,56 @@
+package org.jboss.seam.wiki.core.model;
+
+/**
+ * A simple wrapper for hierarchical display (with level) of wiki nodes.
+ *
+ * @author Christian Bauer
+ */
+public class WikiTreeNode<N extends WikiNode> {
+
+ private long level;
+ private N node;
+ private Object payload; // This can be anything we want to attach for display
+
+ public WikiTreeNode(long level, N node) {
+ this.level = level;
+ this.node = node;
+ }
+
+ public long getLevel() {
+ return level;
+ }
+
+ public N getNode() {
+ return node;
+ }
+
+ public Object getPayload() {
+ return payload;
+ }
+
+ public void setPayload(Object payload) {
+ this.payload = payload;
+ }
+
+ @Override
+ public String toString() {
+ return "(WikiTreeNode) L: " + getLevel() + " - " + getNode().toString();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ WikiTreeNode that = (WikiTreeNode) o;
+
+ if (!node.getId().equals(that.node.getId())) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return node.getId().hashCode();
+ }
+}
Added: branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTreeNodeEntityConverter.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTreeNodeEntityConverter.java (rev 0)
+++ branches/community/Seam_2_2/examples/wiki/src/main/org/jboss/seam/wiki/core/ui/WikiTreeNodeEntityConverter.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -0,0 +1,37 @@
+package org.jboss.seam.wiki.core.ui;
+
+import org.jboss.seam.ui.EntityConverter;
+import org.jboss.seam.wiki.core.model.WikiNode;
+import org.jboss.seam.wiki.core.model.WikiTreeNode;
+
+import javax.faces.convert.ConverterException;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+
+/**
+ * Making the broken JSF implementation happy.
+ */
+public class WikiTreeNodeEntityConverter extends EntityConverter {
+
+ @Override
+ public String getAsString(FacesContext facesContext,
+ UIComponent uiComponent, Object o)
+ throws ConverterException {
+ String result;
+ if (o instanceof WikiTreeNode) {
+ result = super.getAsString(facesContext, uiComponent, ((WikiTreeNode) o).getNode());
+ return result;
+ } else {
+ throw new IllegalArgumentException("Can not convert: " + o);
+ }
+ }
+
+ @Override
+ public Object getAsObject(FacesContext facesContext,
+ UIComponent uiComponent, String s)
+ throws ConverterException {
+ Object o = super.getAsObject(facesContext, uiComponent, s);
+ return new WikiTreeNode(0, (WikiNode) o);
+ }
+
+}
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/DirMenu.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/DirMenu.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/DirMenu.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -12,11 +12,13 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.wiki.core.dao.WikiNodeDAO;
import org.jboss.seam.wiki.core.model.WikiDirectory;
-import org.jboss.seam.wiki.core.nestedset.query.NestedSetNodeWrapper;
+import org.jboss.seam.wiki.core.model.WikiTreeNode;
+import org.jboss.seam.wiki.core.model.WikiNode;
import org.jboss.seam.wiki.core.plugin.WikiPluginMacro;
import org.jboss.seam.wiki.preferences.Preferences;
import java.io.Serializable;
+import java.util.List;
/**
* Menu tree, base is the current directory.
@@ -27,24 +29,24 @@
@Scope(ScopeType.PAGE)
public class DirMenu implements Serializable {
- public static final String MACRO_ATTR_ROOT = "dirMenuRoot";
+ public static final String MACRO_ATTR_DIRMENUTREE = "dirMenuTree";
@In
WikiDirectory currentDirectory;
- public NestedSetNodeWrapper<WikiDirectory> getRoot(WikiPluginMacro macro) {
+ public List<WikiTreeNode<WikiDirectory>> getTree(WikiPluginMacro macro) {
// We cache the result in the macro, so that when the getter is called over and over during rendering, we have it
- if (macro.getAttributes().get(MACRO_ATTR_ROOT) == null) {
- NestedSetNodeWrapper<WikiDirectory> root;
+ if (macro.getAttributes().get(MACRO_ATTR_DIRMENUTREE) == null) {
+ List<WikiTreeNode<WikiDirectory>> tree;
DirMenuPreferences prefs = Preferences.instance().get(DirMenuPreferences.class, macro);
if (prefs.getOnlyMenuItems() != null && prefs.getOnlyMenuItems()) {
- root = WikiNodeDAO.instance().findMenuItemTree(currentDirectory, 3l, 3l, false);
+ tree = WikiNodeDAO.instance().findMenuItemTree(currentDirectory, 3l, 3l, false);
} else {
- root = WikiNodeDAO.instance().findWikiDirectoryTree(currentDirectory, 3l, 3l, false);
+ tree = WikiNodeDAO.instance().findWikiDirectoryTree(currentDirectory, WikiNode.SortableProperty.name, true);
}
- macro.getAttributes().put(MACRO_ATTR_ROOT, root);
+ macro.getAttributes().put(MACRO_ATTR_DIRMENUTREE, tree);
}
- return (NestedSetNodeWrapper<WikiDirectory>)macro.getAttributes().get(MACRO_ATTR_ROOT);
+ return (List<WikiTreeNode<WikiDirectory>>)macro.getAttributes().get(MACRO_ATTR_DIRMENUTREE);
}
}
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/DirTocQuery.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/DirTocQuery.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/DirTocQuery.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -17,7 +17,8 @@
import org.jboss.seam.wiki.core.wikitext.engine.WikiLinkResolver;
import org.jboss.seam.wiki.core.model.WikiDirectory;
import org.jboss.seam.wiki.core.model.WikiDocument;
-import org.jboss.seam.wiki.core.nestedset.query.NestedSetNodeWrapper;
+import org.jboss.seam.wiki.core.model.WikiNode;
+import org.jboss.seam.wiki.core.model.WikiTreeNode;
import org.jboss.seam.wiki.core.plugin.WikiPluginMacro;
import org.jboss.seam.wiki.preferences.Preferences;
import org.richfaces.component.UITree;
@@ -33,7 +34,7 @@
@Scope(ScopeType.CONVERSATION)
public class DirTocQuery implements Serializable {
- public static final String MACRO_ATTR_TOCROOT = "dirTocRoot";
+ public static final String MACRO_ATTR_TOCTREE = "dirTocTree";
@In
EntityManager restrictedEntityManager;
@@ -44,11 +45,11 @@
@In
WikiDirectory currentDirectory;
- public NestedSetNodeWrapper<WikiDirectory> getTocRoot(WikiPluginMacro macro) {
+ public List<WikiTreeNode<WikiDirectory>> getToc(WikiPluginMacro macro) {
- NestedSetNodeWrapper<WikiDirectory> tocRoot =
- (NestedSetNodeWrapper<WikiDirectory>)macro.getAttributes().get(MACRO_ATTR_TOCROOT);
- if (tocRoot == null) {
+ // We cache the result in the macro, so that when the getter is called over and over during rendering, we have it
+ if (macro.getAttributes().get(MACRO_ATTR_TOCTREE) == null) {
+
DirTocPreferences prefs = Preferences.instance().get(DirTocPreferences.class, macro);
if (prefs.getRootDocumentLink() != null) {
@@ -60,11 +61,17 @@
}
// Query the directory tree
- tocRoot = WikiNodeDAO.instance().findWikiDirectoryTree(currentDirectory);
+ List<WikiTreeNode<WikiDirectory>>
+ tree = WikiNodeDAO.instance().findWikiDirectoryTree(currentDirectory, WikiNode.SortableProperty.createdOn, true);
- Set<Long> directoryIds = new HashSet<Long>(tocRoot.getFlatTree().keySet());
- if (prefs.getShowRootDocuments() != null && prefs.getShowRootDocuments()) {
- directoryIds.add(tocRoot.getWrappedNode().getId());
+ Set<Long> directoryIds = new HashSet<Long>();
+ for (WikiTreeNode<WikiDirectory> treeNode : tree) {
+ if (currentDirectory.getId().equals(treeNode.getNode().getId())
+ && (prefs.getShowRootDocuments() != null && prefs.getShowRootDocuments())) {
+ directoryIds.add(treeNode.getNode().getId());
+ } else if (!currentDirectory.getId().equals(treeNode.getNode().getId())){
+ directoryIds.add(treeNode.getNode().getId());
+ }
}
if (directoryIds.size() == 0) return null; // Early exit
@@ -89,25 +96,21 @@
for (WikiDocument flatDoc : flatDocs) {
Long directoryId = flatDoc.getParent().getId();
- NestedSetNodeWrapper<WikiDirectory> dirWrapper;
- if (prefs.getShowRootDocuments() != null && prefs.getShowRootDocuments()
- && directoryId.equals(tocRoot.getWrappedNode().getId())) {
- dirWrapper = tocRoot;
- } else {
- dirWrapper = tocRoot.getFlatTree().get(directoryId);
+ for (WikiTreeNode<WikiDirectory> treeNode : tree) {
+ if (treeNode.getNode().getId().equals(directoryId)) {
+ if (treeNode.getPayload() == null)
+ treeNode.setPayload(new ArrayList());
+
+ ((Collection)treeNode.getPayload()).add(flatDoc);
+ }
}
-
- if (dirWrapper.getPayload() == null)
- dirWrapper.setPayload(new ArrayList<WikiDocument>());
-
- ((Collection)dirWrapper.getPayload()).add(flatDoc);
}
- macro.getAttributes().put(MACRO_ATTR_TOCROOT, tocRoot);
+ macro.getAttributes().put(MACRO_ATTR_TOCTREE, tree);
}
- return tocRoot;
+ return (List<WikiTreeNode<WikiDirectory>>)macro.getAttributes().get(MACRO_ATTR_TOCTREE);
}
public boolean expandTocTree(UITree tree) {
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/dirMenu.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/dirMenu.xhtml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/dirMenu.xhtml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -36,9 +36,15 @@
<s:cache region="#{currentMacro.getCacheRegion('DirMenuList')}"
key="#{currentMacro.cacheKey}">
- <ui:include src="dirMenuItem.xhtml">
- <ui:param name="node" value="#{dirMenu.getRoot(currentMacro)}"/>
- </ui:include>
+ <c:forEach items="#{dirMenu.getTree(currentMacro)}" var="tn">
+ <s:div styleClass="level#{tn.level}">
+ <h:outputText styleClass="level#{tn.level}Marker level#{tn.level}MarkerDot" value="·"/>
+ <h:outputText styleClass="level#{tn.level}Marker level#{tn.level}MarkerGreaterThan" value=">"/>
+ <h:outputText styleClass="level#{tn.level}Marker level#{tn.level}MarkerSlash" value="/"/>
+ <h:outputText styleClass="level#{tn.level}Marker level#{tn.level}MarkerSpace" value=" "/>
+ <h:outputLink styleClass="level#{tn.level}Link" value="#{wikiURLRenderer.renderURL(tn.node)}">#{tn.node.name}</h:outputLink>
+ </s:div>
+ </c:forEach>
</s:cache>
</div>
Deleted: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/dirMenuItem.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/dirMenuItem.xhtml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/dirMenuItem.xhtml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,35 +0,0 @@
-<ui:composition
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:wiki="http://jboss.com/products/seam/wiki"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:s="http://jboss.com/products/seam/taglib">
-
-<c:forEach var="childWrapper" items="#{node.wrappedChildren}">
- <s:div styleClass="level#{childWrapper.level}">
- <s:div styleClass="level#{childWrapper.level}Body">
- <h:panelGrid columns="3"
- columnClasses="level#{childWrapper.level}Marker, level#{childWrapper.level}Icon, level#{childWrapper.level}LinkColumn">
-
- <h:outputText value="·"/>
-
- <s:span>
- <h:graphicImage value="#{imagePath}/icon.dir.gif" width="18" height="20"/>
- </s:span>
-
- <h:outputLink styleClass="level#{childWrapper.level}Link" target="_top"
- value="#{wikiURLRenderer.renderURL(childWrapper.wrappedNode)}">#{wiki:truncateString(childWrapper.wrappedNode.name, 40, '...')}</h:outputLink>
-
- </h:panelGrid>
- </s:div>
- <s:div styleClass="level#{childWrapper.level}Children" style="padding-left: #{childWrapper.level*7}px;">
- <ui:include src="dirMenuItem.xhtml">
- <ui:param name="node" value="#{childWrapper}"/>
- </ui:include>
- </s:div>
- </s:div>
-</c:forEach>
-
-</ui:composition>
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/dirToc.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/dirToc.xhtml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/templates/dirToc.xhtml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -8,71 +8,42 @@
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:s="http://jboss.com/products/seam/taglib">
+
<s:cache region="#{currentMacro.getCacheRegion('DirectoryToc')}"
key="#{currentMacro.cacheKey}">
- <rich:tree switchType="client" styleClass="dirToc"
- adviseNodeOpened="#{dirTocQuery.expandTocTree}">
+ <h:dataTable var="n" value="#{dirTocQuery.getToc(currentMacro)}" cellpadding="0" cellspacing="0" border="0">
+ <h:column>
+ <s:div rendered="#{not empty n.payload}" styleClass="tocLevel#{n.level-1}">
+ <h:panelGrid columns="2" styleClass="category" cellpadding="0" cellspacing="0" border="0">
+ <h:graphicImage value="#{imagePath}/icon.dir.gif" width="18" height="20"/>
+ <h:outputText styleClass="tocCategory" value="#{wiki:truncateString(n.node.name, 100, '...')}" />
+ </h:panelGrid>
+ <ui:repeat var="doc" value="#{n.payload}">
+ <s:fragment rendered="#{doc.id != n.node.defaultFile.id or
+ preferences.get('DirToc', currentMacro).showDefaultDocuments}">
+ <h:panelGrid columns="4" styleClass="children" cellpadding="0" cellspacing="0" border="0">
+ <h:graphicImage value="#{imagePath}/icon.doc.gif" width="18" height="20"/>
+ <h:outputLink value="#{wikiURLRenderer.renderURL(doc)}">
+ <h:outputText styleClass="tocDocumentLabel" value="#{doc.name}"/>
+ </h:outputLink>
+ <s:span styleClass="lastUpdatedLabel smallFont"
+ rendered="#{preferences.get('DirToc', currentMacro).showLastUpdatedTimestamp and not empty doc.lastModifiedOn}">
+ <h:outputText value=" (#{messages['basic.dirToc.label.LastUpdated']}: "/>
+ <h:outputText value="#{doc.lastModifiedOn}">
+ <f:convertDateTime pattern="dd. MMM yyyy, HH:mm" timeZone="#{preferences.get('Wiki').timeZone}"/>
+ </h:outputText>
+ <h:outputText value=" #{preferences.get('Wiki').timeZone}"/>
+ <h:outputText value=")"/>
+ </s:span>
+ </h:panelGrid>
+ </s:fragment>
+ </ui:repeat>
- <rich:treeNodesAdaptor
- var="rootDoc"
- nodes="#{dirTocQuery.getTocRoot(currentMacro).payload}"
- includedNode="#{rootDoc.id != dirTocQuery.getTocRoot(currentMacro).wrappedNode.defaultFile.id or
- preferences.get('DirToc', currentMacro).showDefaultDocuments}">
- <rich:treeNode>
- <f:facet name="iconLeaf">
- <h:graphicImage value="#{imagePath}/icon.doc.gif" width="18" height="20"/>
- </f:facet>
- <h:outputLink value="#{wikiURLRenderer.renderURL(doc)}">
- <h:outputText styleClass="tocDocumentLabel" value="#{doc.name}"/>
- </h:outputLink>
- </rich:treeNode>
- </rich:treeNodesAdaptor>
+ </s:div>
+ </h:column>
+ </h:dataTable>
- <rich:recursiveTreeNodesAdaptor
- var="tocDir"
- roots="#{dirTocQuery.getTocRoot(currentMacro).wrappedChildren}"
- nodes="#{tocDir.wrappedChildren}">
-
- <rich:treeNode>
- <f:facet name="icon">
- <h:graphicImage value="#{imagePath}/icon.dir.gif" width="18" height="20"/>
- </f:facet>
- <f:facet name="iconLeaf">
- <h:graphicImage value="#{imagePath}/icon.dir.gif" width="18" height="20"/>
- </f:facet>
- <s:span styleClass="undecoratedLink">
- <h:outputLink value="#{wikiURLRenderer.renderURL(tocDir.wrappedNode)}">
- <h:outputText styleClass="tocDirectoryLabel" value="#{tocDir.wrappedNode.name}"/>
- </h:outputLink>
- </s:span>
- </rich:treeNode>
-
- <rich:treeNodesAdaptor var="doc" nodes="#{tocDir.payload}"
- includedNode="#{doc.id != tocDir.wrappedNode.defaultFile.id or
- preferences.get('DirToc', currentMacro).showDefaultDocuments}">
- <rich:treeNode>
- <f:facet name="iconLeaf">
- <h:graphicImage value="#{imagePath}/icon.doc.gif" width="18" height="20"/>
- </f:facet>
- <h:outputLink value="#{wikiURLRenderer.renderURL(doc)}">
- <h:outputText styleClass="tocDocumentLabel" value="#{doc.name}"/>
- </h:outputLink>
- <s:span styleClass="tocLastUpdatedLabel"
- rendered="#{preferences.get('DirToc', currentMacro).showLastUpdatedTimestamp and not empty doc.lastModifiedOn}">
- <h:outputText value=" (#{messages['basic.dirToc.label.LastUpdated']}: "/>
- <h:outputText value="#{doc.lastModifiedOn}">
- <f:convertDateTime pattern="dd. MMM yyyy, HH:mm" timeZone="#{preferences.get('Wiki').timeZone}"/>
- </h:outputText>
- <h:outputText value=" #{preferences.get('Wiki').timeZone}"/>
- <h:outputText value=")"/>
- </s:span>
- </rich:treeNode>
- </rich:treeNodesAdaptor>
-
- </rich:recursiveTreeNodesAdaptor>
- </rich:tree>
-
</s:cache>
</wiki:plugin>
\ No newline at end of file
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/default/css/dirMenu.css
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/default/css/dirMenu.css 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/default/css/dirMenu.css 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,10 +1,8 @@
.dirMenu .level1 {
+ margin-top: 2px;
+ margin-bottom: 2px;
}
-.dirMenu .level1Body {
- background-color: white;
-}
-
.dirMenu .level1Marker {
display: none;
}
@@ -13,26 +11,34 @@
color: #962325;
font-size: 95%;
text-decoration: none;
+ font-weight: bold;
}
.dirMenu .level1Link:hover {color: #666}
-.dirMenu .level1Children {
- background-color: white;
-}
-
.dirMenu .level2 {
+ margin-left: 10px;
+ margin-top: 2px;
+ margin-bottom: 2px;
}
.dirMenu .level2Marker {
padding-left: 2px;
padding-right: 2px;
- font-size: 80%;
+ font-size: 95%;
color: #962325;
}
+.dirMenu .level2MarkerGreaterThan,
+.dirMenu .level2MarkerSlash,
+.dirMenu .level3MarkerSlash,
+.dirMenu .level3MarkerDot
+{
+ display: none;
+}
+
.dirMenu .level2Link {
- font-size: 80%;
+ font-size: 95%;
color: #962325;
text-decoration: none;
white-space: nowrap;
@@ -40,7 +46,9 @@
.dirMenu .level2Link:hover {color: #666}
-.dirMenu .level3 {}
+.dirMenu .level3 {
+ margin-left: 20px;
+}
.dirMenu .level3Marker {
padding-left: 2px;
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/default/css/dirToc.css
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/default/css/dirToc.css 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/default/css/dirToc.css 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,20 +1,38 @@
-.dirToc {
+.tocLevel1,
+ .tocLevel2,
+ .tocLevel3,
+ .tocLevel4
+{
+ margin-bottom: 6px;
}
-.tocDirectoryLabel {
- font-weight: bold;
+.tocLevel2 {
+ margin-left: 18px;
}
-.tocDirectoryLabel {
- cursor: pointer;
+
+.tocLevel3 {
+ margin-left: 36px;
}
-.tocDocumentLabel {
- margin-left: 5px;
- cursor: pointer;
+.tocLevel4 {
+ margin-left: 54px;
}
-.rich-tree-node-highlighted .tocDirectoryLabel,
-.rich-tree-node-highlighted .tocDocumentLabel {
- color: black;
+.tocLevel1 .children,
+ .tocLevel2 .children,
+ .tocLevel3 .children,
+ .tocLevel4 .children
+{
+ margin-left: 18px;
+ margin-top: 4px;
+
}
+
+.tocLevel1 .category,
+ .tocLevel2 .category,
+ .tocLevel3 .category,
+ .tocLevel4 .category
+{
+ font-weight: bold;
+}
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/inrelationto/css/dirMenu.css
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/inrelationto/css/dirMenu.css 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/inrelationto/css/dirMenu.css 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,8 +1,10 @@
-.dirMenu .level1 {
+.dirMenu .boxContent {
+ padding: 5px;
}
-.dirMenu .level1Body {
- background-color: white;
+.dirMenu .level1 {
+ margin-top: 2px;
+ margin-bottom: 2px;
}
.dirMenu .level1Marker {
@@ -10,50 +12,49 @@
}
.dirMenu .level1Link {
- color: #d75525;
font-size: 95%;
text-decoration: none;
+ font-weight: bold;
}
-.dirMenu .level1Link:hover {color: #666}
-
-.dirMenu .level1Children {
- background-color: white;
-}
-
.dirMenu .level2 {
+ margin-left: 10px;
+ margin-top: 2px;
+ margin-bottom: 2px;
}
.dirMenu .level2Marker {
- color: #d75525;
padding-left: 2px;
padding-right: 2px;
- font-size: 80%;
+ font-size: 95%;
}
+.dirMenu .level2MarkerGreaterThan,
+.dirMenu .level2MarkerSlash,
+.dirMenu .level3MarkerSlash,
+.dirMenu .level3MarkerDot
+{
+ display: none;
+}
+
.dirMenu .level2Link {
- color: #d75525;
- font-size: 80%;
+ font-size: 95%;
text-decoration: none;
white-space: nowrap;
}
-.dirMenu .level2Link:hover {color: #666}
+.dirMenu .level3 {
+ margin-left: 20px;
+}
-.dirMenu .level3 {}
-
.dirMenu .level3Marker {
- color: #d75525;
padding-left: 2px;
padding-right: 2px;
font-size: 80%;
}
.dirMenu .level3Link {
- color: #d75525;
font-size: 80%;
text-decoration: none;
white-space: nowrap;
}
-
-.dirMenu .level3Link:hover {color: #666}
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/inrelationto/css/dirToc.css
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/inrelationto/css/dirToc.css 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/inrelationto/css/dirToc.css 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,20 +1,38 @@
-.dirToc {
+.tocLevel1,
+ .tocLevel2,
+ .tocLevel3,
+ .tocLevel4
+{
+ margin-bottom: 6px;
}
-.tocDirectoryLabel {
- font-weight: bold;
+.tocLevel2 {
+ margin-left: 18px;
}
-.tocDirectoryLabel {
- cursor: pointer;
+
+.tocLevel3 {
+ margin-left: 36px;
}
-.tocDocumentLabel {
- margin-left: 5px;
- cursor: pointer;
+.tocLevel4 {
+ margin-left: 54px;
}
-.rich-tree-node-highlighted .tocDirectoryLabel,
-.rich-tree-node-highlighted .tocDocumentLabel {
- color: black;
+.tocLevel1 .children,
+ .tocLevel2 .children,
+ .tocLevel3 .children,
+ .tocLevel4 .children
+{
+ margin-left: 18px;
+ margin-top: 4px;
+
}
+
+.tocLevel1 .category,
+ .tocLevel2 .category,
+ .tocLevel3 .category,
+ .tocLevel4 .category
+{
+ font-weight: bold;
+}
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/sfwkorg/css/dirMenu.css
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/sfwkorg/css/dirMenu.css 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/sfwkorg/css/dirMenu.css 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,8 +1,10 @@
-.dirMenu .level1 {
+.dirMenu .boxContent {
+ padding: 5px;
}
-.dirMenu .level1Body {
- background-color: white;
+.dirMenu .level1 {
+ margin-top: 2px;
+ margin-bottom: 2px;
}
.dirMenu .level1Marker {
@@ -10,33 +12,49 @@
}
.dirMenu .level1Link {
+ font-size: 95%;
+ text-decoration: none;
+ font-weight: bold;
}
-
-.dirMenu .level1Children {
- background-color: white;
-}
-
.dirMenu .level2 {
+ margin-left: 10px;
+ margin-top: 2px;
+ margin-bottom: 2px;
}
.dirMenu .level2Marker {
padding-left: 2px;
padding-right: 2px;
+ font-size: 95%;
}
+.dirMenu .level2MarkerGreaterThan,
+.dirMenu .level2MarkerSlash,
+.dirMenu .level3MarkerSlash,
+.dirMenu .level3MarkerDot
+{
+ display: none;
+}
+
.dirMenu .level2Link {
+ font-size: 95%;
+ text-decoration: none;
white-space: nowrap;
}
-.dirMenu .level3 {}
+.dirMenu .level3 {
+ margin-left: 20px;
+}
.dirMenu .level3Marker {
padding-left: 2px;
padding-right: 2px;
+ font-size: 80%;
}
.dirMenu .level3Link {
+ font-size: 80%;
+ text-decoration: none;
white-space: nowrap;
}
-
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/sfwkorg/css/dirToc.css
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/sfwkorg/css/dirToc.css 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/basic/themes/sfwkorg/css/dirToc.css 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,21 +1,38 @@
-.dirToc {
+.tocLevel1,
+ .tocLevel2,
+ .tocLevel3,
+ .tocLevel4
+{
+ margin-bottom: 6px;
}
-.tocDirectoryPanel {
- margin-top: 5px;
+.tocLevel2 {
+ margin-left: 18px;
}
-.tocDirectoryLabel {
- font-weight: bold;
- cursor: pointer;
+
+.tocLevel3 {
+ margin-left: 36px;
}
-.tocDocumentLabel {
- margin-left: 5px;
- cursor: pointer;
+.tocLevel4 {
+ margin-left: 54px;
}
-.rich-tree-node-highlighted .tocDirectoryLabel,
-.rich-tree-node-highlighted .tocDocumentLabel {
- color: black;
+.tocLevel1 .children,
+ .tocLevel2 .children,
+ .tocLevel3 .children,
+ .tocLevel4 .children
+{
+ margin-left: 18px;
+ margin-top: 4px;
+
}
+
+.tocLevel1 .category,
+ .tocLevel2 .category,
+ .tocLevel3 .category,
+ .tocLevel4 .category
+{
+ font-weight: bold;
+}
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/BlogDAO.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/BlogDAO.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/blog/BlogDAO.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -7,9 +7,9 @@
package org.jboss.seam.wiki.plugin.blog;
import org.hibernate.Hibernate;
-import org.hibernate.Query;
import org.hibernate.SQLQuery;
import org.hibernate.Session;
+import org.hibernate.Query;
import org.hibernate.transform.ResultTransformer;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
@@ -17,7 +17,9 @@
import org.jboss.seam.annotations.AutoCreate;
import org.jboss.seam.wiki.core.model.WikiDirectory;
import org.jboss.seam.wiki.core.model.WikiDocument;
+import org.jboss.seam.wiki.core.model.WikiNode;
import org.jboss.seam.wiki.core.action.Pager;
+import org.jboss.seam.wiki.core.dao.WikiNodeDAO;
import org.jboss.seam.ScopeType;
import javax.persistence.EntityManager;
@@ -29,7 +31,7 @@
/**
* Queries and database operations related to blog entries (mostly aggregation queries).
- *
+ * <p/>
* TODO: The queries (especially since they are all SQL) should be externalized to a hbm.xml file. However,
* building them dynamically here is less duplication for now.
*
@@ -44,6 +46,9 @@
EntityManager restrictedEntityManager;
@In
+ WikiNodeDAO wikiNodeDAO;
+
+ @In
Integer currentAccessLevel;
// Too bad, but we really need a SQL query here... better use SQL queries for ALL queries in this DAO and generalize things
@@ -70,12 +75,7 @@
private String getBlogEntryWhereClause(WikiDocument ignoreDoc, Integer year, Integer month, Integer day, String tag) {
StringBuilder clause = new StringBuilder();
- clause.append("where doc2.PARENT_NODE_ID in").append(" (");
- clause.append("select distinct dir1.NODE_ID from WIKI_DIRECTORY dir1, WIKI_DIRECTORY dir2").append(" ");
- clause.append("where dir1.NS_THREAD = dir2.NS_THREAD").append(" ");
- clause.append("and dir1.NS_LEFT between dir2.NS_LEFT and dir2.NS_RIGHT").append(" ");
- clause.append("and dir2.NS_THREAD=:nsThread and dir2.NS_LEFT>=:nsLeft and dir2.NS_RIGHT<=:nsRight");
- clause.append(") ");
+ clause.append("where doc2.PARENT_NODE_ID in (:directoryIDs)").append(" ");
clause.append("and doc.HEADER_MACROS like '%blogEntry%'").append(" ");
clause.append("and doc2.READ_ACCESS_LEVEL <= :currentAccessLevel").append(" ");
if (ignoreDoc != null && ignoreDoc.getId() != null) clause.append("and doc.NODE_ID<>:ignoreDoc").append(" ");
@@ -88,9 +88,7 @@
private void bindBlogEntryWhereClause(Query query, WikiDirectory startDir, WikiDocument ignoreDoc,
Integer year, Integer month, Integer day, String tag) {
- query.setParameter("nsThread", startDir.getNodeInfo().getNsThread());
- query.setParameter("nsLeft", startDir.getNodeInfo().getNsLeft());
- query.setParameter("nsRight", startDir.getNodeInfo().getNsRight());
+ query.setParameterList("directoryIDs", wikiNodeDAO.findWikiDirectoryTreeIDs(startDir));
query.setParameter("currentAccessLevel", currentAccessLevel);
if (ignoreDoc != null && ignoreDoc.getId() != null) query.setParameter("ignoreDoc", ignoreDoc);
@@ -151,11 +149,9 @@
if (countComments && result.size() > 0) {
// The risk here is that pager.getQueryMaxResults() is too large for the IN() operator of some DBs...
StringBuilder commentQueryString = new StringBuilder();
- commentQueryString.append("select doc.NODE_ID as DOC_ID, count(c3.NODE_ID) as COMMENT_COUNT").append(" ");
+ commentQueryString.append("select doc.NODE_ID as DOC_ID, count(c1.NODE_ID) as COMMENT_COUNT").append(" ");
commentQueryString.append("from WIKI_DOCUMENT doc").append(" ");
commentQueryString.append("left outer join WIKI_NODE c1 on doc.NODE_ID = c1.PARENT_NODE_ID").append(" ");
- commentQueryString.append("left outer join WIKI_COMMENT c2 on c1.NODE_ID = c2.NODE_ID").append(" ");
- commentQueryString.append("left outer join WIKI_COMMENT c3 on c2.NS_THREAD = c3.NS_THREAD").append(" ");
commentQueryString.append("where doc.NODE_ID in (:blogEntriesIds)").append(" ");
commentQueryString.append("group by doc.NODE_ID");
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/FaqBrowser.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/FaqBrowser.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/FaqBrowser.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -13,7 +13,7 @@
import org.jboss.seam.wiki.core.model.WikiDirectory;
import org.jboss.seam.wiki.core.model.WikiDocument;
import org.jboss.seam.wiki.core.model.WikiNode;
-import org.jboss.seam.wiki.core.nestedset.query.NestedSetNodeWrapper;
+import org.jboss.seam.wiki.core.model.WikiTreeNode;
import java.util.List;
import java.io.Serializable;
@@ -40,8 +40,8 @@
@In(required = false)
String requestedCategory;
- NestedSetNodeWrapper<WikiDirectory> tree;
- NestedSetNodeWrapper<WikiDirectory> selectedDir;
+ List<WikiTreeNode<WikiDirectory>> tree;
+ WikiTreeNode<WikiDirectory> selectedDir;
boolean directorySelected = false;
public void loadTree() {
@@ -49,7 +49,7 @@
WikiDirectory faqRoot = faqBrowserDAO.findFaqRootDir(currentDirectory);
if (faqRoot != null) {
log.debug("found faq root: " + faqRoot);
- tree = wikiNodeDAO.findWikiDirectoryTree(faqRoot, 99l, 1l, false);
+ tree = wikiNodeDAO.findWikiDirectoryTree(faqRoot, WikiNode.SortableProperty.createdOn, true);
} else {
log.warn("did not find faq root, started search in: " + currentDirectory);
}
@@ -65,31 +65,28 @@
WikiDirectory dir = wikiNodeDAO.findWikiDirectoryInArea(currentDirectory.getAreaNumber(), requestedCategory);
if (dir != null) {
log.debug("found requested category, setting selected directory: " + dir);
- selectedDir = new NestedSetNodeWrapper<WikiDirectory>(dir);
+ selectedDir = new WikiTreeNode(0, dir);
showQuestions();
}
}
if (selectedDir == null) {
log.debug("setting selected directory to current directory");
- selectedDir =
- new NestedSetNodeWrapper<WikiDirectory>(
- wikiNodeDAO.findWikiDirectory(currentDirectory.getId())
- );
+ selectedDir = new WikiTreeNode(0, wikiNodeDAO.findWikiDirectory(currentDirectory.getId()));
}
}
- public NestedSetNodeWrapper<WikiDirectory> getTree() {
+ public List<WikiTreeNode<WikiDirectory>> getTree() {
log.debug("getting faq tree");
if (tree == null) loadTree();
return tree;
}
- public NestedSetNodeWrapper<WikiDirectory> getSelectedDir() {
+ public WikiTreeNode<WikiDirectory> getSelectedDir() {
log.debug("getting selected directory : " + selectedDir);
return selectedDir;
}
- public void setSelectedDir(NestedSetNodeWrapper<WikiDirectory> selectedDir) {
+ public void setSelectedDir(WikiTreeNode<WikiDirectory> selectedDir) {
log.debug("setting selected directory: " + selectedDir);
this.selectedDir = selectedDir;
}
@@ -100,9 +97,9 @@
@Observer("FaqBrowser.questionListRefresh")
public void showQuestions() {
- log.debug("showing questions of currently selected directory: " + selectedDir.getWrappedNode());
+ log.debug("showing questions of currently selected: " + selectedDir);
directorySelected = true;
- questions = wikiNodeDAO.findWikiDocuments(selectedDir.getWrappedNode(), WikiNode.SortableProperty.createdOn, true);
+ questions = wikiNodeDAO.findWikiDocuments(selectedDir.getNode(), WikiNode.SortableProperty.createdOn, true);
}
public void hideQuestions() {
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/FaqBrowserDAO.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/FaqBrowserDAO.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/FaqBrowserDAO.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -7,13 +7,16 @@
package org.jboss.seam.wiki.plugin.faqBrowser;
import org.jboss.seam.ScopeType;
-import org.jboss.seam.annotations.*;
+import org.jboss.seam.annotations.In;
+import org.jboss.seam.annotations.Name;
+import org.jboss.seam.annotations.Scope;
import org.jboss.seam.wiki.core.model.WikiDirectory;
+import org.jboss.seam.wiki.core.model.WikiDocument;
import javax.persistence.EntityManager;
-import javax.persistence.Query;
import java.io.Serializable;
import java.util.List;
+import java.util.ArrayList;
/**
* @author Christian Bauer
@@ -27,31 +30,20 @@
public WikiDirectory findFaqRootDir(WikiDirectory startDir) {
- StringBuilder queryString = new StringBuilder();
- queryString.append("select dir from WikiDirectory dir join dir.defaultFile f, WikiDocument doc");
- queryString.append(" where dir.nodeInfo.nsThread = :nsThread and");
- queryString.append(" dir.nodeInfo.nsLeft <= :nsLeft and dir.nodeInfo.nsRight >= :nsRight");
- queryString.append(" and f = doc and doc.headerMacrosString like '%faqBrowser%'");
-
- Query query = restrictedEntityManager.createQuery(queryString.toString())
- .setParameter("nsThread", startDir.getNodeInfo().getNsThread())
- .setParameter("nsLeft", startDir.getNodeInfo().getNsLeft())
- .setParameter("nsRight", startDir.getNodeInfo().getNsRight());
-
- List<WikiDirectory> result = query.getResultList();
-
- if (result.size() == 0) return null;
-
- // We need to iterate through all found directories, these directories are all the "parents" in the
- // tree which might have a default document with "faqBrowser" macro. We assume that the "highest level"
- // directory is the root of the FAQ tree - luckily we have the nested set values to find that one.
- WikiDirectory highestLevelDirectory = result.get(0);
- for (WikiDirectory wikiDirectory : result) {
- if (wikiDirectory.getNodeInfo().getNsLeft() < highestLevelDirectory.getNodeInfo().getNsLeft()) {
- highestLevelDirectory = wikiDirectory;
+ // This was a database query once... now it's in-memory iteration
+ List<WikiDirectory> parents = new ArrayList();
+ parents.add(startDir);
+ parents.addAll(startDir.getParentsRecursive());
+ WikiDirectory faqRootDir = null;
+ // We need the highest level directory that has a document with a "faqBrowser" macro
+ for (WikiDirectory parent : parents) {
+ if (parent.getDefaultFile() == null) continue;
+ if (((WikiDocument)parent.getDefaultFile()).getHeaderMacrosString().contains("faqBrowser")) {
+ faqRootDir = parent;
+ // Continue iterating, maybe we find a higher level directory with the macro
}
}
- return highestLevelDirectory;
+ return faqRootDir;
}
}
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/FaqQuestionHome.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/FaqQuestionHome.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/FaqQuestionHome.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -35,7 +35,7 @@
@Override
public void create() {
super.create();
- setParentNodeId(faqBrowser.getSelectedDir().getWrappedNode().getId());
+ setParentNodeId(faqBrowser.getSelectedDir().getNode().getId());
}
@Override
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/templates/faqControls.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/templates/faqControls.xhtml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/faqBrowser/templates/faqControls.xhtml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -23,38 +23,37 @@
<s:span>
<h:selectOneMenu value="#{faqBrowser.selectedDir}"
- rendered="#{not empty faqBrowser.tree and faqBrowser.tree.wrappedChildren.size() > 0}"
- converter="#{nestedSetNodeWrapperRestrictedEntityConverter}"
+ rendered="#{not empty faqBrowser.tree}"
+ converter="#{wikiTreeNodeRestrictedEntityConverter}"
styleClass="ajaxSupport" tabindex="1">
- <s:selectItems value="#{faqBrowser.tree.wrappedChildren}"
+ <s:selectItems value="#{faqBrowser.tree}"
var="faqsDir"
- label="#{wiki:repeatString(' · ',faqsDir.level-1)}#{wiki:truncateString(faqsDir.wrappedNode.name, 40, '...')}"/>
+ label="#{wiki:repeatString(' ',faqsDir.level-1)}· #{wiki:truncateString(faqsDir.node.name, 40, '...')}"/>
<a:support event="onchange" status="globalStatus"
action="#{faqBrowser.showQuestions}"
reRender="faqQuestions, faqQuestionsControl, faqCategoryLink, messageBoxContainer"/>
</h:selectOneMenu>
<h:outputText value="#{messages['fb.faqBrowser.msg.TreeNotFound']}" rendered="#{empty faqBrowser.tree}"/>
- <h:outputText value="#{messages['fb.faqBrowser.msg.TreeEmpty']}" rendered="#{faqBrowser.tree.wrappedChildren.size() == 0}"/>
</s:span>
<s:span id="faqQuestionsControl">
<a:commandLink action="#{faqBrowser.showQuestions}" tabindex="1"
reRender="faqQuestions, faqQuestionsControl, faqCategoryLink, messageBoxContainer"
status="globalStatus"
- rendered="#{not faqBrowser.directorySelected and not empty faqBrowser.tree and faqBrowser.tree.wrappedChildren.size() > 0}">
+ rendered="#{not faqBrowser.directorySelected and not empty faqBrowser.tree}">
<h:graphicImage value="#{imagePath}/menu_down.gif" width="18" height="18"/>
</a:commandLink>
<a:commandLink action="#{faqBrowser.hideQuestions}" tabindex="1"
reRender="faqQuestions, faqQuestionsControl, faqCategoryLink, messageBoxContainer"
status="globalStatus"
- rendered="#{faqBrowser.directorySelected and not empty faqBrowser.tree and faqBrowser.tree.wrappedChildren.size() > 0}">
+ rendered="#{faqBrowser.directorySelected and not empty faqBrowser.tree}">
<h:graphicImage value="#{imagePath}/menu_up.gif" width="18" height="18"/>
</a:commandLink>
</s:span>
<s:span id="faqCategoryLink" styleClass="undecoratedLink">
<s:fragment rendered="#{faqBrowser.directorySelected}">
- <h:outputLink value="#{wikiURLRenderer.renderWikiURL(currentDocument)}/Category/#{faqBrowser.selectedDir.wrappedNode.wikiname}">
+ <h:outputLink value="#{wikiURLRenderer.renderWikiURL(currentDocument)}/Category/#{faqBrowser.selectedDir.node.wikiname}">
<h:outputText value="Link"/>
</h:outputLink>
</s:fragment>
@@ -69,9 +68,9 @@
<h:panelGrid columns="2" styleClass="header" columnClasses="categoryDescription, newQuestionButton"
cellpadding="0" cellspacing="0" border="0">
- <h:outputText value="#{faqBrowser.selectedDir.wrappedNode.description}"/>
+ <h:outputText value="#{faqBrowser.selectedDir.node.description}"/>
- <s:fragment rendered="#{s:hasPermission('Node', 'create', faqBrowser.selectedDir.wrappedNode)}">
+ <s:fragment rendered="#{s:hasPermission('Node', 'create', faqBrowser.selectedDir.node)}">
<a:commandLink action="#{faqQuestionHome.newQuestion()}"
reRender="faqBrowserPluginContainer, messageBoxContainer"
status="globalStatus"
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumDAO.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumDAO.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumDAO.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -275,7 +275,7 @@
)
.list();
- if (topicInfoMap.keySet().size() == 0) return topicInfoMap; // Early exist possible
+ if (topicInfoMap.keySet().size() == 0) return topicInfoMap; // Early exit possible
// Retrieve the topic entity instances and shove them into the map
getSession(true).getNamedQuery("forumTopics")
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumQueries.hbm.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumQueries.hbm.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumQueries.hbm.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -76,25 +76,28 @@
order by m.displayPosition asc
</query>
+ <!--
+ This query should take 200-400 ms with about 50.000 postings on the forum.
+ (No, querying per-forum instead of querying all forums at once is not (much) faster.)
+ -->
<sql-query name="forumTopicReplyCount">
<return-scalar column="FORUM_ID" type="long"/>
<return-scalar column="TOPIC_COUNT" type="long"/>
<return-scalar column="REPLY_COUNT" type="long"/>
select
dir0.NODE_ID as FORUM_ID,
- count(doc0.NODE_ID) as TOPIC_COUNT,
- sum(dc.COMMENT_COUNT) as REPLY_COUNT
+ count(distinct doc0.NODE_ID) as TOPIC_COUNT,
+ count(distinct c0.NODE_ID) as REPLY_COUNT
from
WIKI_NODE dir0
- inner join WIKI_NODE doc1 on doc1.PARENT_NODE_ID = dir0.NODE_ID
- and doc1.READ_ACCESS_LEVEL <= :readAccessLevel
- inner join WIKI_DOCUMENT doc0 on doc0.NODE_ID=doc1.NODE_ID
- and (doc0.HEADER_MACROS like '%forumPosting%' or doc0.HEADER_MACROS like '%forumStickyPosting%')
- left outer join WIKI_DOCUMENT_COUNT_COMMENT dc on dc.WIKI_DOCUMENT_ID = doc0.NODE_ID
+ left outer join WIKI_NODE doc1 on doc1.PARENT_NODE_ID = dir0.NODE_ID
+ and doc1.READ_ACCESS_LEVEL <= :readAccessLevel
+ inner join WIKI_DOCUMENT doc0 on doc0.NODE_ID=doc1.NODE_ID
+ and (doc0.HEADER_MACROS like '%forumPosting%' or doc0.HEADER_MACROS like '%forumStickyPosting%')
+ left outer join WIKI_NODE c0 on c0.PARENT_NODE_ID = doc0.NODE_ID
where
dir0.READ_ACCESS_LEVEL <= :readAccessLevel and dir0.PARENT_NODE_ID = :parentDirId
- group by
- dir0.NODE_ID
+ group by dir0.NODE_ID
</sql-query>
<sql-query name="forumLastTopic">
@@ -142,26 +145,27 @@
c0.FROM_USER_NAME as FROM_USER_NAME,
c0.FROM_USER_EMAIL as FROM_USER_EMAIL,
c0.FROM_USER_HOMEPAGE as FROM_USER_HOMEPAGE,
- c0.USE_WIKI_TEXT as USE_WIKI_TEXT,
- c0.NS_LEFT as NS_LEFT,
- c0.NS_RIGHT as NS_RIGHT,
- c0.NS_THREAD as NS_THREAD
+ c0.USE_WIKI_TEXT as USE_WIKI_TEXT
+ from
+ WIKI_NODE c1 inner join WIKI_COMMENT c0 on c1.NODE_ID = c0.NODE_ID
+ where
+ c1.NODE_ID in
+ (
+ select
+ c2.NODE_ID
from
- WIKI_NODE doc0
- inner join WIKI_DOCUMENT doc1 on doc0.NODE_ID = doc1.NODE_ID
- and (doc1.HEADER_MACROS like '%forumPosting%' or doc1.HEADER_MACROS like '%forumStickyPosting%')
- inner join WIKI_DOCUMENT_LAST_COMMENT lc on lc.WIKI_DOCUMENT_ID = doc1.NODE_ID,
- WIKI_NODE c1
- inner join WIKI_COMMENT c0 on c0.NODE_ID = c1.NODE_ID
+ WIKI_NODE doc0
+ inner join WIKI_DOCUMENT doc1 on doc0.NODE_ID = doc1.NODE_ID
+ and (doc1.HEADER_MACROS like '%forumPosting%' or doc1.HEADER_MACROS like '%forumStickyPosting%')
+ left outer join WIKI_NODE c2 on c2.PARENT_NODE_ID = doc1.NODE_ID
where
doc0.PARENT_NODE_ID = :parentDirId
- and
+ and
doc0.READ_ACCESS_LEVEL <= :readAccessLevel
- and
- c0.NODE_ID = lc.LAST_COMMENT_ID
- order by
- lc.LAST_COMMENT_CREATED_ON desc
- limit 1
+ )
+ order by
+ c1.CREATED_ON desc
+ limit 1
</sql-query>
<query name="forumUnreadTopics"><![CDATA[
@@ -181,25 +185,20 @@
<return-scalar column="FORUM_ID" type="long"/>
<![CDATA[
select
- distinct doc0.NODE_ID as UNREAD_TOPIC_ID, doc1.PARENT_NODE_ID as FORUM_ID
+ distinct doc0.NODE_ID as UNREAD_TOPIC_ID,
+ doc1.PARENT_NODE_ID as FORUM_ID
from
- WIKI_DIRECTORY dir0
- inner join WIKI_NODE dir1 on dir0.NODE_ID=dir1.NODE_ID,
- WIKI_DOCUMENT doc0
- inner join WIKI_NODE doc1 on doc0.NODE_ID=doc1.NODE_ID
- inner join WIKI_NODE ct0 on ct0.PARENT_NODE_ID = doc1.NODE_ID
- inner join WIKI_COMMENT ct1 on ct0.NODE_ID = ct1.NODE_ID,
- WIKI_COMMENT c0
- inner join WIKI_NODE c1 on c0.NODE_ID=c1.NODE_ID
+ WIKI_NODE dir1
+ inner join WIKI_NODE doc1 on doc1.PARENT_NODE_ID = dir1.NODE_ID
+ and doc1.READ_ACCESS_LEVEL <= :readAccessLevel
+ inner join WIKI_DOCUMENT doc0 on doc0.NODE_ID=doc1.NODE_ID
+ and (doc0.HEADER_MACROS like '%forumPosting%' or doc0.HEADER_MACROS like '%forumStickyPosting%')
+ inner join WIKI_NODE c0 on c0.PARENT_NODE_ID = doc0.NODE_ID
+ and c0.CREATED_ON > :lastLoginDate
where
dir1.READ_ACCESS_LEVEL <= :readAccessLevel
- and doc1.READ_ACCESS_LEVEL <= :readAccessLevel
- and c1.READ_ACCESS_LEVEL <= :readAccessLevel
- and dir1.PARENT_NODE_ID= :parentDirId
- and doc1.PARENT_NODE_ID=dir1.NODE_ID
- and (doc0.HEADER_MACROS like '%forumPosting%' or doc0.HEADER_MACROS like '%forumStickyPosting%')
- and c0.NS_THREAD in (ct1.NS_THREAD)
- and c1.CREATED_ON > :lastLoginDate
+ and
+ dir1.PARENT_NODE_ID= :parentDirId
]]>
</sql-query>
@@ -219,21 +218,18 @@
<return-scalar column="FORUM_ID" type="long"/>
<![CDATA[
select
- distinct doc0.NODE_ID as UNREAD_TOPIC_ID, doc1.PARENT_NODE_ID as FORUM_ID
+ distinct doc0.NODE_ID as UNREAD_TOPIC_ID,
+ doc1.PARENT_NODE_ID as FORUM_ID
from
- WIKI_DOCUMENT doc0
- inner join WIKI_NODE doc1 on doc0.NODE_ID=doc1.NODE_ID
- inner join WIKI_NODE ct0 on ct0.PARENT_NODE_ID = doc1.NODE_ID
- inner join WIKI_COMMENT ct1 on ct0.NODE_ID = ct1.NODE_ID,
- WIKI_COMMENT c0
- inner join WIKI_NODE c1 on c0.NODE_ID=c1.NODE_ID
+ WIKI_NODE doc1
+ inner join WIKI_DOCUMENT doc0 on doc0.NODE_ID=doc1.NODE_ID
+ and (doc0.HEADER_MACROS like '%forumPosting%' or doc0.HEADER_MACROS like '%forumStickyPosting%')
+ inner join WIKI_NODE c0 on c0.PARENT_NODE_ID = doc0.NODE_ID
+ and c0.CREATED_ON > :lastLoginDate
where
doc1.READ_ACCESS_LEVEL <= :readAccessLevel
- and c1.READ_ACCESS_LEVEL <= :readAccessLevel
- and doc1.PARENT_NODE_ID= :parentDirId
- and (doc0.HEADER_MACROS like '%forumPosting%' or doc0.HEADER_MACROS like '%forumStickyPosting%')
- and c0.NS_THREAD in (ct1.NS_THREAD)
- and c1.CREATED_ON > :lastLoginDate
+ and
+ doc1.PARENT_NODE_ID= :parentDirId
]]>
</sql-query>
@@ -243,29 +239,38 @@
and (t.headerMacrosString like '%forumPosting%' or t.headerMacrosString like '%forumStickyPosting%')
</query>
+ <!--
+ Although we do not read the LAST_POST column, we need to project it so we can order by date. Note
+ that this is probably the most problematic of all the queries here, it is quite slow. I don't see
+ any way how to optimize this further without denormalization/data quality degradation. Also note
+ that the nested select is using a max(CREATED_ON) date comparison. This is the (much slower!)
+ alternative:
+
+ cl0.NODE_ID = (
+ select lc.NODE_ID from WIKI_NODE lc where lc.PARENT_NODE_ID = doc0.NODE_ID order by lc.CREATED_ON desc limit 1
+ )
+ -->
<sql-query name="forumTopicsList">
<return-scalar column="NODE_ID" type="long"/>
<return-scalar column="STICKY" type="integer"/>
<return-scalar column="HAS_REPLIES" type="boolean"/>
<return-scalar column="LAST_POST" type="timestamp"/>
<![CDATA[
- select distinct
- d0.NODE_ID as NODE_ID,
- case when (d2.HEADER_MACROS like '%forumStickyPosting%') then 1 else 0 end as STICKY,
- case when c0.CREATED_ON is null then false else true end as HAS_REPLIES,
- case when c0.CREATED_ON is null then d0.CREATED_ON else c0.CREATED_ON end as LAST_POST
- from
- WIKI_NODE d0
- inner join WIKI_DOCUMENT d2 on d0.NODE_ID = d2.NODE_ID and (d2.HEADER_MACROS like '%forumPosting%' or d2.HEADER_MACROS like '%forumStickyPosting%')
- left outer join WIKI_NODE c0
- on c0.NODE_ID = (
- select lc.LAST_COMMENT_ID from WIKI_DOCUMENT_LAST_COMMENT lc
- where lc.WIKI_DOCUMENT_ID = d2.NODE_ID
- )
- where
- d0.READ_ACCESS_LEVEL <= :readAccessLevel and d0.PARENT_NODE_ID = :parentNodeId
- order
- by STICKY desc, LAST_POST desc
+ select distinct
+ d0.NODE_ID as NODE_ID,
+ case when (d2.HEADER_MACROS like '%forumStickyPosting%') then 1 else 0 end as STICKY,
+ case when c0.CREATED_ON is null then false else true end as HAS_REPLIES,
+ case when c0.CREATED_ON is null then d0.CREATED_ON else c0.CREATED_ON end as LAST_POST
+ from
+ WIKI_NODE d0
+ inner join WIKI_DOCUMENT d2 on d0.NODE_ID = d2.NODE_ID
+ and (d2.HEADER_MACROS like '%forumPosting%' or d2.HEADER_MACROS like '%forumStickyPosting%')
+ left outer join WIKI_NODE c0 on c0.CREATED_ON =
+ (select max(lc.CREATED_ON) from WIKI_NODE lc where lc.PARENT_NODE_ID = d2.NODE_ID)
+ where
+ d0.READ_ACCESS_LEVEL <= :readAccessLevel and d0.PARENT_NODE_ID = :parentNodeId
+ order
+ by STICKY desc, LAST_POST desc
]]>
</sql-query>
@@ -320,64 +325,52 @@
<return-scalar column="TOPIC_ID" type="long"/>
<return-scalar column="NUM_OF_REPLIES" type="long"/>
<![CDATA[
- select
- cl1.NODE_ID as NODE_ID,
- cl1.OBJ_VERSION as OBJ_VERSION,
- cl1.RATING as RATING,
- cl1.AREA_NR as AREA_NR,
- cl1.NAME as NAME,
- cl1.WIKINAME as WIKINAME,
- cl1.MESSAGE_ID as MESSAGE_ID,
- cl1.CREATED_ON as CREATED_ON,
- cl1.CREATED_BY_USER_ID as CREATED_BY_USER_ID,
- cl1.LAST_MODIFIED_ON as LAST_MODIFIED_ON,
- cl1.LAST_MODIFIED_BY_USER_ID as LAST_MODIFIED_BY_USER_ID,
- cl1.WRITE_ACCESS_LEVEL as WRITE_ACCESS_LEVEL,
- cl1.READ_ACCESS_LEVEL as READ_ACCESS_LEVEL,
- cl1.WRITE_PROTECTED as WRITE_PROTECTED,
- cl1.PARENT_NODE_ID as PARENT_NODE_ID,
+ select
+ cl1.NODE_ID as NODE_ID,
+ cl1.OBJ_VERSION as OBJ_VERSION,
+ cl1.RATING as RATING,
+ cl1.AREA_NR as AREA_NR,
+ cl1.NAME as NAME,
+ cl1.WIKINAME as WIKINAME,
+ cl1.MESSAGE_ID as MESSAGE_ID,
+ cl1.CREATED_ON as CREATED_ON,
+ cl1.CREATED_BY_USER_ID as CREATED_BY_USER_ID,
+ cl1.LAST_MODIFIED_ON as LAST_MODIFIED_ON,
+ cl1.LAST_MODIFIED_BY_USER_ID as LAST_MODIFIED_BY_USER_ID,
+ cl1.WRITE_ACCESS_LEVEL as WRITE_ACCESS_LEVEL,
+ cl1.READ_ACCESS_LEVEL as READ_ACCESS_LEVEL,
+ cl1.WRITE_PROTECTED as WRITE_PROTECTED,
+ cl1.PARENT_NODE_ID as PARENT_NODE_ID,
+ cl0.SUBJECT as SUBJECT,
+ cl0.FROM_USER_NAME as FROM_USER_NAME,
+ cl0.FROM_USER_EMAIL as FROM_USER_EMAIL,
+ cl0.FROM_USER_HOMEPAGE as FROM_USER_HOMEPAGE,
+ cl0.USE_WIKI_TEXT as USE_WIKI_TEXT,
+ u.USER_ID, u.ACTIVATED, u.ACTIVATION_CODE, u.CREATED_ON, u.EMAIL, u.FIRSTNAME, u.LAST_LOGIN_ON,
+ u.LASTNAME, u.MEMBER_HOME_WIKI_DIRECTORY_ID, u.PASSWORDHASH, u.USER_PROFILE_ID, u.USERNAME, u.OBJ_VERSION,
+ doc0.NODE_ID as TOPIC_ID,
+ count(distinct c0.NODE_ID) as NUM_OF_REPLIES
+ from
+ WIKI_DOCUMENT doc0
+ left outer join WIKI_NODE c0 on c0.PARENT_NODE_ID = doc0.NODE_ID,
+ WIKI_COMMENT cl0
+ inner join WIKI_NODE cl1 on cl0.NODE_ID = cl1.NODE_ID
+ inner join USERS u on cl1.CREATED_BY_USER_ID = u.USER_ID
+ where
+ doc0.NODE_ID in (:topicIds)
+ and cl0.NODE_ID = (
+ select lc.NODE_ID from WIKI_NODE lc where lc.PARENT_NODE_ID = doc0.NODE_ID order by lc.CREATED_ON desc limit 1
+ )
+ group by
+ cl1.NODE_ID, cl1.OBJ_VERSION, cl1.RATING, cl1.AREA_NR, cl1.NAME, cl1.WIKINAME, cl1.MESSAGE_ID, cl1.CREATED_ON, cl1.CREATED_BY_USER_ID, cl1.LAST_MODIFIED_ON,
+ cl1.LAST_MODIFIED_BY_USER_ID, cl1.WRITE_ACCESS_LEVEL, cl1.READ_ACCESS_LEVEL, cl1.WRITE_PROTECTED, cl1.PARENT_NODE_ID,
+ cl0.SUBJECT, cl0.FROM_USER_NAME, cl0.FROM_USER_EMAIL, cl0.FROM_USER_HOMEPAGE, cl0.USE_WIKI_TEXT,
+ u.USER_ID, u.ACTIVATED, u.ACTIVATION_CODE, u.CREATED_ON, u.EMAIL, u.FIRSTNAME, u.LAST_LOGIN_ON,
+ u.LASTNAME, u.MEMBER_HOME_WIKI_DIRECTORY_ID, u.PASSWORDHASH, u.USER_PROFILE_ID, u.USERNAME, u.OBJ_VERSION,
+ doc0.NODE_ID
+ ]]>
+ </sql-query>
- cl0.SUBJECT as SUBJECT,
- cl0.FROM_USER_NAME as FROM_USER_NAME,
- cl0.FROM_USER_EMAIL as FROM_USER_EMAIL,
- cl0.FROM_USER_HOMEPAGE as FROM_USER_HOMEPAGE,
- cl0.USE_WIKI_TEXT as USE_WIKI_TEXT,
- cl0.NS_LEFT as NS_LEFT,
- cl0.NS_RIGHT as NS_RIGHT,
- cl0.NS_THREAD as NS_THREAD,
-
- u.USER_ID, u.ACTIVATED, u.ACTIVATION_CODE, u.CREATED_ON, u.EMAIL, u.FIRSTNAME, u.LAST_LOGIN_ON,
- u.LASTNAME, u.MEMBER_HOME_WIKI_DIRECTORY_ID, u.PASSWORDHASH, u.USER_PROFILE_ID, u.USERNAME, u.OBJ_VERSION,
-
- doc0.NODE_ID as TOPIC_ID,
- count(c0.NODE_ID) as NUM_OF_REPLIES
- from
- WIKI_DOCUMENT doc0
- inner join WIKI_NODE ct0 on ct0.PARENT_NODE_ID = doc0.NODE_ID
- inner join WIKI_COMMENT ct1 on ct0.NODE_ID = ct1.NODE_ID,
- WIKI_COMMENT c0,
- WIKI_COMMENT cl0
- inner join WIKI_NODE cl1 on cl0.NODE_ID = cl1.NODE_ID
- inner join USERS u on cl1.CREATED_BY_USER_ID = u.USER_ID
- where
- doc0.NODE_ID in (:topicIds)
- and c0.NS_THREAD in (ct1.NS_THREAD)
- and cl0.NODE_ID = (
- select lc.LAST_COMMENT_ID
- from WIKI_DOCUMENT_LAST_COMMENT lc
- where lc.WIKI_DOCUMENT_ID = doc0.NODE_ID
- )
- group by
- cl1.NODE_ID, cl1.OBJ_VERSION, cl1.RATING, cl1.AREA_NR, cl1.NAME, cl1.WIKINAME, cl1.MESSAGE_ID, cl1.CREATED_ON, cl1.CREATED_BY_USER_ID, cl1.LAST_MODIFIED_ON,
- cl1.LAST_MODIFIED_BY_USER_ID, cl1.WRITE_ACCESS_LEVEL, cl1.READ_ACCESS_LEVEL, cl1.WRITE_PROTECTED, cl1.PARENT_NODE_ID,
- cl0.SUBJECT, cl0.FROM_USER_NAME, cl0.FROM_USER_EMAIL, cl0.FROM_USER_HOMEPAGE, cl0.USE_WIKI_TEXT, cl0.NS_LEFT, cl0.NS_RIGHT, cl0.NS_THREAD,
-
- u.USER_ID, u.ACTIVATED, u.ACTIVATION_CODE, u.CREATED_ON, u.EMAIL, u.FIRSTNAME, u.LAST_LOGIN_ON,
- u.LASTNAME, u.MEMBER_HOME_WIKI_DIRECTORY_ID, u.PASSWORDHASH, u.USER_PROFILE_ID, u.USERNAME, u.OBJ_VERSION,
-
- doc0.NODE_ID
- ]]></sql-query>
-
<sql-query name="forumPostersAndRatingPoints">
<return class="org.jboss.seam.wiki.core.model.User"/>
<return-scalar column="RATING_POINTS" type="long"/>
@@ -388,30 +381,26 @@
sum(ur.RATING) as RATING_POINTS
from
(select distinct
- user2.*,
- com2.NODE_ID,
- com2.RATING
+ u0.*,
+ c0.NODE_ID,
+ c0.RATING
from
- WIKI_DOCUMENT doc0
- inner join WIKI_NODE doc1 on doc0.NODE_ID=doc1.NODE_ID
- inner join WIKI_NODE ct0 on ct0.PARENT_NODE_ID = doc1.NODE_ID
- inner join WIKI_COMMENT ct1 on ct0.NODE_ID = ct1.NODE_ID,
- WIKI_COMMENT com1
- inner join WIKI_NODE com2 on com1.NODE_ID=com2.NODE_ID
- inner join USERS user2 on com2.CREATED_BY_USER_ID=user2.USER_ID
- inner join USER_ROLE roles1 on user2.USER_ID=roles1.USER_ID
- inner join ROLES roles2 on roles1.ROLE_ID=roles2.ROLE_ID
+ WIKI_NODE doc0
+ inner join WIKI_NODE c0 on c0.PARENT_NODE_ID = doc0.NODE_ID
+ inner join USERS u0 on c0.CREATED_BY_USER_ID = u0.USER_ID
+ inner join USER_ROLE r0 on u0.USER_ID = r0.USER_ID
+ inner join ROLES r1 on r0.ROLE_ID = r1.ROLE_ID
where
- doc1.PARENT_NODE_ID=:parentDirId
- and com1.NS_THREAD in (ct1.NS_THREAD)
- and (roles2.NAME not in (:ignoreUserInRoles))
- and com2.RATING<>0
+ doc0.PARENT_NODE_ID = :parentDirId
+ and (r1.NAME not in (:ignoreUserInRoles))
+ and c0.RATING<>0
) as ur
group by
ur.USER_ID, ur.ACTIVATED, ur.ACTIVATION_CODE, ur.CREATED_ON, ur.EMAIL, ur.FIRSTNAME, ur.LAST_LOGIN_ON,
ur.LASTNAME, ur.MEMBER_HOME_WIKI_DIRECTORY_ID, ur.PASSWORDHASH, ur.USER_PROFILE_ID, ur.USERNAME,
ur.OBJ_VERSION
order by sum(ur.RATING) desc
- ]]></sql-query>
+ ]]>
+ </sql-query>
</hibernate-mapping>
\ No newline at end of file
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumReplyFeedEntryManager.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumReplyFeedEntryManager.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ForumReplyFeedEntryManager.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -8,7 +8,7 @@
public class ForumReplyFeedEntryManager extends WikiCommentFeedEntryManager {
public String getFeedEntryTitle(WikiComment comment) {
- return "[" + comment.getParentDocument().getParent().getName() + "] " + comment.getSubject();
+ return "[" + comment.getParent().getParent().getName() + "] " + comment.getSubject();
}
}
Modified: branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ReplyHome.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ReplyHome.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/plugin/org/jboss/seam/wiki/plugin/forum/ReplyHome.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -63,7 +63,7 @@
// Find all posters of the thread
Set<User> notifyPosters = new HashSet();
getLog().debug("finding all posters of current topic thread");
- List<WikiComment> comments = getWikiNodeDAO().findWikiCommentsFlat(documentHome.getInstance(), true);
+ List<WikiComment> comments = getWikiNodeDAO().findWikiComments(documentHome.getInstance(), true);
for (WikiComment comment : comments) {
Long commentPosterId = comment.getCreatedBy().getId();
Modified: branches/community/Seam_2_2/examples/wiki/src/test/AllTests.tng.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/AllTests.tng.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/AllTests.tng.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -5,7 +5,7 @@
<parameter name="database" value="HSQL"/>
<!-- MySQL also requires changes to persistence-test.xml and wiki-test-ds.xml
- <parameter name="database" value="mysql"/>
+ <parameter name="database" value="MYSQL"/>
-->
<parameter name="datasourceJndiName" value="java:/wikiTestDatasource"/>
@@ -47,12 +47,6 @@
</packages>
</test>
- <test name="NestedSet">
- <packages>
- <package name="org.jboss.seam.wiki.test.nestedset"/>
- </packages>
- </test>
-
<test name="User">
<packages>
<package name="org.jboss.seam.wiki.test.user"/>
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/DocumentFeedEntries.dbunit.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/DocumentFeedEntries.dbunit.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/DocumentFeedEntries.dbunit.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -2,6 +2,7 @@
<dataset>
+ <!-- These PUBLISED_ON/UPDATED_ON dates are a timebomb because we expire old stuff, but I'm too lazy to fix it now... -->
<FEEDENTRY
FEEDENTRY_TYPE="WIKI_DOCUMENT" WIKI_COMMENT_ID="[NULL]" WIKI_DOCUMENT_ID="9"
FEEDENTRY_ID="1" AUTHOR="System Administrator"
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/FAQData.dbunit.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/FAQData.dbunit.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/FAQData.dbunit.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -9,8 +9,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="1000" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="300" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="301"
- NS_LEFT="300" NS_RIGHT="311" NS_THREAD="1"/>
+ NODE_ID="300" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="301"/>
<WIKI_MENU_ITEM DIRECTORY_ID="300" DISPLAY_POSITION="4"/>
<!-- FAQs directory start page, faq browser plugin -->
@@ -39,8 +38,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="302" DESCRIPTION="Questions for new users and evaluators of Seam." DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="301" NS_RIGHT="304" NS_THREAD="1"/>
+ NODE_ID="302" DESCRIPTION="Questions for new users and evaluators of Seam." DEFAULT_FILE_ID="[NULL]"/>
<!-- Second FAQ category -->
<WIKI_NODE
@@ -49,8 +47,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="303" DESCRIPTION="Questions about Seams distribution and usage license." DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="302" NS_RIGHT="303" NS_THREAD="1"/>
+ NODE_ID="303" DESCRIPTION="Questions about Seams distribution and usage license." DEFAULT_FILE_ID="[NULL]"/>
<!-- Third FAQ category -->
<WIKI_NODE
@@ -59,8 +56,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="304" DESCRIPTION="Seam core technology questions." DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="305" NS_RIGHT="310" NS_THREAD="1"/>
+ NODE_ID="304" DESCRIPTION="Seam core technology questions." DEFAULT_FILE_ID="[NULL]"/>
<!-- Fourth FAQ category -->
<WIKI_NODE
@@ -69,8 +65,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="305" DESCRIPTION="Questions about the JSP-, JSF-, and Unified-EL." DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="306" NS_RIGHT="307" NS_THREAD="1"/>
+ NODE_ID="305" DESCRIPTION="Questions about the JSP-, JSF-, and Unified-EL." DEFAULT_FILE_ID="[NULL]"/>
<!-- Fifth FAQ category -->
<WIKI_NODE
@@ -79,8 +74,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="306" DESCRIPTION="Tips and tricks about creating Seam components." DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="308" NS_RIGHT="309" NS_THREAD="1"/>
+ NODE_ID="306" DESCRIPTION="Tips and tricks about creating Seam components." DEFAULT_FILE_ID="[NULL]"/>
<!-- FAQ questions -->
@@ -131,16 +125,6 @@
NODE_ID="309"
SUBJECT="No, you don't."
CONTENT="But you can send us as much money as you want. Or, if you are not happy with our free software and support, we can send you some money to reimburse your download expenses and the time it took you to read this." USE_WIKI_TEXT="true"
- FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"
- NS_LEFT="1" NS_RIGHT="2" NS_THREAD="309"/>
+ FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"/>
- <WIKI_DOCUMENT_LAST_COMMENT
- WIKI_DOCUMENT_ID="308"
- LAST_COMMENT_CREATED_ON="2006-09-23 13:45:00"
- LAST_COMMENT_ID="309"/>
-
- <WIKI_DOCUMENT_COUNT_COMMENT
- WIKI_DOCUMENT_ID="308"
- COMMENT_COUNT="1"/>
-
</dataset>
\ No newline at end of file
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/ForumData.dbunit.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/ForumData.dbunit.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/ForumData.dbunit.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -9,8 +9,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="1000" WRITE_PROTECTED="true"/>
<WIKI_DIRECTORY
- NODE_ID="100" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="101"
- NS_LEFT="100" NS_RIGHT="105" NS_THREAD="1"/>
+ NODE_ID="100" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="101"/>
<FEED
FEED_ID = "100"
FEED_TYPE="INTERNAL"
@@ -47,8 +46,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="true"/>
<WIKI_DIRECTORY
- NODE_ID="102" DESCRIPTION="Seam usage discussions go here." DEFAULT_FILE_ID="103"
- NS_LEFT="101" NS_RIGHT="102" NS_THREAD="1"/>
+ NODE_ID="102" DESCRIPTION="Seam usage discussions go here." DEFAULT_FILE_ID="103"/>
<FEED
FEED_ID = "101"
FEED_TYPE="INTERNAL"
@@ -76,8 +74,8 @@
CONTENT_MACROS="forumTopics"
FOOTER_MACROS="[NULL]"
NAME_AS_TITLE="true" ENABLE_COMMENTS="false" ENABLE_COMMENT_FORM="false" ENABLE_COMMENTS_ON_FEEDS="false"/>
-
+
<!-- First posting -->
<WIKI_NODE
NODE_ID="104" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="102"
@@ -107,12 +105,11 @@
SUBJECT="This is a first test comment"
CONTENT="Collaboration-oriented websites require a human-friendly markup language for easy entry of formatted text in forum posts, wiki pages, blogs, comments, etc. Seam provides the |<s:formattedText/>| control for display of formatted text that conforms to the Seam Text language. Seam Text is implemented using an ANTLR-based parser. You do not need to know anything about ANTLR to use it, however."
USE_WIKI_TEXT="true"
- FROM_USER_NAME="Regular Member" FROM_USER_EMAIL="[NULL]" FROM_USER_HOMEPAGE="[NULL]"
- NS_LEFT="1" NS_RIGHT="4" NS_THREAD="105"/>
+ FROM_USER_NAME="Regular Member" FROM_USER_EMAIL="[NULL]" FROM_USER_HOMEPAGE="[NULL]"/>
<!-- Reply to first posting -->
<WIKI_NODE
- NODE_ID="106" OBJ_VERSION="0" RATING="5" PARENT_NODE_ID="105"
+ NODE_ID="106" OBJ_VERSION="0" RATING="5" PARENT_NODE_ID="104"
AREA_NR="100" NAME="The First Posting.Comment119672933218233" WIKINAME="TheFirstPostingComment119672933218233"
CREATED_ON="2007-04-10 10:00:00" CREATED_BY_USER_ID="3" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="1000" WRITE_PROTECTED="false"/>
@@ -121,18 +118,8 @@
SUBJECT="The first posting"
CONTENT="Collaboration-oriented websites require a human-friendly markup language for easy entry of formatted text in forum posts, wiki pages, blogs, comments, etc. Seam provides the |<s:formattedText/>| control for display of formatted text that conforms to the Seam Text language. 

Seam Text is implemented using an ANTLR-based parser. You do not need to know anything about ANTLR to use it, however."
USE_WIKI_TEXT="true"
- FROM_USER_NAME="Regular Member" FROM_USER_EMAIL="[NULL]" FROM_USER_HOMEPAGE="[NULL]"
- NS_LEFT="2" NS_RIGHT="3" NS_THREAD="105"/>
+ FROM_USER_NAME="Regular Member" FROM_USER_EMAIL="[NULL]" FROM_USER_HOMEPAGE="[NULL]"/>
- <WIKI_DOCUMENT_LAST_COMMENT
- WIKI_DOCUMENT_ID="104"
- LAST_COMMENT_CREATED_ON="2007-04-10 10:00:00"
- LAST_COMMENT_ID="106"/>
-
- <WIKI_DOCUMENT_COUNT_COMMENT
- WIKI_DOCUMENT_ID="104"
- COMMENT_COUNT="2"/>
-
<!-- Second (sticky) posting -->
<WIKI_NODE
NODE_ID="107" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="102"
@@ -162,18 +149,8 @@
SUBJECT="This is a third test comment"
CONTENT="Collaboration-oriented websites require a human-friendly markup language for easy entry of formatted text in forum posts, wiki pages, blogs, comments, etc. Seam provides the |<s:formattedText/>| control for display of formatted text that conforms to the Seam Text language. Seam Text is implemented using an ANTLR-based parser. You do not need to know anything about ANTLR to use it, however."
USE_WIKI_TEXT="true"
- FROM_USER_NAME="Regular Member" FROM_USER_EMAIL="[NULL]" FROM_USER_HOMEPAGE="[NULL]"
- NS_LEFT="1" NS_RIGHT="2" NS_THREAD="108"/>
+ FROM_USER_NAME="Regular Member" FROM_USER_EMAIL="[NULL]" FROM_USER_HOMEPAGE="[NULL]"/>
- <WIKI_DOCUMENT_LAST_COMMENT
- WIKI_DOCUMENT_ID="107"
- LAST_COMMENT_CREATED_ON="2007-04-04 08:01:00"
- LAST_COMMENT_ID="108"/>
-
- <WIKI_DOCUMENT_COUNT_COMMENT
- WIKI_DOCUMENT_ID="107"
- COMMENT_COUNT="1"/>
-
<!-- Third posting
<WIKI_NODE
NODE_ID="112" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="102"
@@ -201,8 +178,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="1" WRITE_ACCESS_LEVEL="1" WRITE_PROTECTED="true"/>
<WIKI_DIRECTORY
- NODE_ID="109" DESCRIPTION="Only for Seam developers or people interested in Seam development." DEFAULT_FILE_ID="110"
- NS_LEFT="103" NS_RIGHT="104" NS_THREAD="1"/>
+ NODE_ID="109" DESCRIPTION="Only for Seam developers or people interested in Seam development." DEFAULT_FILE_ID="110"/>
<WIKI_MENU_ITEM DIRECTORY_ID="109" DISPLAY_POSITION="1"/>
<FEED
FEED_ID = "102"
@@ -249,7 +225,7 @@
FOOTER_MACROS="forumReplies"
NAME_AS_TITLE="false" ENABLE_COMMENTS="true" ENABLE_COMMENT_FORM="true" ENABLE_COMMENTS_ON_FEEDS="true"/>
-
+
</dataset>
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/HelpDocuments.dbunit.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/HelpDocuments.dbunit.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/HelpDocuments.dbunit.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -8,8 +8,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="1000" WRITE_PROTECTED="true"/>
<WIKI_DIRECTORY
- NODE_ID="20" DESCRIPTION="Help documents" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="20" NS_RIGHT="29" NS_THREAD="1"/>
+ NODE_ID="20" DESCRIPTION="Help documents" DEFAULT_FILE_ID="[NULL]"/>
<WIKI_NODE
NODE_ID="21" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="20"
@@ -17,8 +16,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="1000" WRITE_PROTECTED="true"/>
<WIKI_DIRECTORY
- NODE_ID="21" DESCRIPTION="Creating and editing wiki documents" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="21" NS_RIGHT="22" NS_THREAD="1"/>
+ NODE_ID="21" DESCRIPTION="Creating and editing wiki documents" DEFAULT_FILE_ID="[NULL]"/>
<WIKI_NODE
@@ -42,8 +40,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="1000" WRITE_PROTECTED="true"/>
<WIKI_DIRECTORY
- NODE_ID="23" DESCRIPTION="The plugin system" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="23" NS_RIGHT="28" NS_THREAD="1"/>
+ NODE_ID="23" DESCRIPTION="The plugin system" DEFAULT_FILE_ID="[NULL]"/>
<WIKI_NODE
NODE_ID="24" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="23"
@@ -51,8 +48,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="1000" WRITE_PROTECTED="true"/>
<WIKI_DIRECTORY
- NODE_ID="24" DESCRIPTION="How to use plugins" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="24" NS_RIGHT="25" NS_THREAD="1"/>
+ NODE_ID="24" DESCRIPTION="How to use plugins" DEFAULT_FILE_ID="[NULL]"/>
<WIKI_NODE
NODE_ID="25" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="23"
@@ -60,8 +56,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="1000" WRITE_PROTECTED="true"/>
<WIKI_DIRECTORY
- NODE_ID="25" DESCRIPTION="How to write plugins" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="26" NS_RIGHT="27" NS_THREAD="1"/>
+ NODE_ID="25" DESCRIPTION="How to write plugins" DEFAULT_FILE_ID="[NULL]"/>
</dataset>
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/KnowledgeBase.dbunit.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/KnowledgeBase.dbunit.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/KnowledgeBase.dbunit.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -8,8 +8,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="200" DESCRIPTION="Seam Documentation" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="200" NS_RIGHT="211" NS_THREAD="1"/>
+ NODE_ID="200" DESCRIPTION="Seam Documentation" DEFAULT_FILE_ID="[NULL]"/>
<WIKI_MENU_ITEM DIRECTORY_ID="200" DISPLAY_POSITION="3"/>
<WIKI_NODE
@@ -18,8 +17,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="201" DESCRIPTION="Seam Knowledge Base" DEFAULT_FILE_ID="202"
- NS_LEFT="201" NS_RIGHT="210" NS_THREAD="1"/>
+ NODE_ID="201" DESCRIPTION="Seam Knowledge Base" DEFAULT_FILE_ID="202"/>
<WIKI_MENU_ITEM DIRECTORY_ID="201" DISPLAY_POSITION="0"/>
<WIKI_NODE
@@ -39,12 +37,11 @@
<WIKI_NODE
NODE_ID="203" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="201"
- AREA_NR="200" NAME="FAQs" WIKINAME="FAQs"
+ AREA_NR="200" NAME="Some Stuff" WIKINAME="SomeStuff"
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="203" DESCRIPTION="Seam frequently asked questions" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="202" NS_RIGHT="203" NS_THREAD="1"/>
+ NODE_ID="203" DESCRIPTION="Some Random Stuff" DEFAULT_FILE_ID="[NULL]"/>
<WIKI_MENU_ITEM DIRECTORY_ID="203" DISPLAY_POSITION="0"/>
<WIKI_NODE
@@ -53,8 +50,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="204" DESCRIPTION="Installing Seam and setting up Seam projects" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="204" NS_RIGHT="205" NS_THREAD="1"/>
+ NODE_ID="204" DESCRIPTION="Installing Seam and setting up Seam projects" DEFAULT_FILE_ID="[NULL]"/>
<WIKI_MENU_ITEM DIRECTORY_ID="204" DISPLAY_POSITION="1"/>
<WIKI_NODE
@@ -63,8 +59,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="205" DESCRIPTION="Designing and creating Seam components and services" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="206" NS_RIGHT="207" NS_THREAD="1"/>
+ NODE_ID="205" DESCRIPTION="Designing and creating Seam components and services" DEFAULT_FILE_ID="[NULL]"/>
<WIKI_MENU_ITEM DIRECTORY_ID="205" DISPLAY_POSITION="2"/>
<WIKI_NODE
@@ -73,8 +68,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="206" DESCRIPTION="User interfaces and presentation layer" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="208" NS_RIGHT="209" NS_THREAD="1"/>
+ NODE_ID="206" DESCRIPTION="User interfaces and presentation layer" DEFAULT_FILE_ID="[NULL]"/>
<WIKI_MENU_ITEM DIRECTORY_ID="206" DISPLAY_POSITION="3"/>
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -34,9 +34,8 @@
<PREFERENCE PREF_ID = "64" OBJ_VERSION = "0" USER_ID = "[NULL]" ENTITY_NAME = "UserManagement" PROPERTY_NAME = "createHomeAfterUserActivation" STRING_VALUE = "[NULL]" LONG_VALUE = "[NULL]" BOOLEAN_VALUE = "false"/>
<PREFERENCE PREF_ID = "65" OBJ_VERSION = "0" USER_ID = "[NULL]" ENTITY_NAME = "UserManagement" PROPERTY_NAME = "homepageDefaultContent" STRING_VALUE = "This is your homepage, login to edit it." LONG_VALUE = "[NULL]" BOOLEAN_VALUE = "[NULL]"/>
- <PREFERENCE PREF_ID = "70" OBJ_VERSION = "0" USER_ID = "[NULL]" ENTITY_NAME = "Comments" PROPERTY_NAME = "listAscending" STRING_VALUE = "[NULL]" LONG_VALUE = "[NULL]" BOOLEAN_VALUE = "false"/>
+ <PREFERENCE PREF_ID = "70" OBJ_VERSION = "0" USER_ID = "[NULL]" ENTITY_NAME = "Comments" PROPERTY_NAME = "listAscending" STRING_VALUE = "[NULL]" LONG_VALUE = "[NULL]" BOOLEAN_VALUE = "true"/>
<PREFERENCE PREF_ID = "71" OBJ_VERSION = "0" USER_ID = "[NULL]" ENTITY_NAME = "Comments" PROPERTY_NAME = "enableByDefault" STRING_VALUE = "[NULL]" LONG_VALUE = "[NULL]" BOOLEAN_VALUE = "true"/>
- <PREFERENCE PREF_ID = "72" OBJ_VERSION = "0" USER_ID = "[NULL]" ENTITY_NAME = "Comments" PROPERTY_NAME = "threaded" STRING_VALUE = "[NULL]" LONG_VALUE = "[NULL]" BOOLEAN_VALUE = "true"/>
<!-- PLUGINS -->
@@ -185,8 +184,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="true"/>
<WIKI_DIRECTORY
- NODE_ID="1" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="1" NS_RIGHT="999" NS_THREAD="1"/>
+ NODE_ID="1" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="[NULL]"/>
<WIKI_NODE
NODE_ID="2" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="1"
@@ -194,8 +192,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="2" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="2" NS_RIGHT="3" NS_THREAD="1"/>
+ NODE_ID="2" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="[NULL]"/>
<WIKI_NODE
NODE_ID="3" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="1"
@@ -203,8 +200,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="3" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="6"
- NS_LEFT="4" NS_RIGHT="9" NS_THREAD="1"/>
+ NODE_ID="3" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="6"/>
<WIKI_NODE
NODE_ID="4" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="3"
@@ -212,8 +208,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="4" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="5" NS_RIGHT="6" NS_THREAD="1"/>
+ NODE_ID="4" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="[NULL]"/>
<WIKI_NODE
NODE_ID="5" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="3"
@@ -221,8 +216,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_DIRECTORY
- NODE_ID="5" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="7" NS_RIGHT="8" NS_THREAD="1"/>
+ NODE_ID="5" DESCRIPTION="[NULL]" DEFAULT_FILE_ID="[NULL]"/>
<WIKI_MENU_ITEM DIRECTORY_ID="2" DISPLAY_POSITION="0"/>
@@ -301,41 +295,37 @@
NODE_ID="10"
SUBJECT="This is the first comment with a very long title so we can test the layout on different browsers"
CONTENT="Comment One

[=>BBB|Test Image]

[=>BBB|Test Upload]" USE_WIKI_TEXT="true"
- FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"
- NS_LEFT="1" NS_RIGHT="8" NS_THREAD="10"/>
+ FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"/>
<WIKI_NODE
- NODE_ID="11" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="10"
+ NODE_ID="11" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="6"
AREA_NR="3" NAME="One.Comment1196729823870" WIKINAME="OneComment1196729823870"
CREATED_ON="2006-09-24 13:45:00" CREATED_BY_USER_ID="3" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_COMMENT
NODE_ID="11"
SUBJECT="Two" CONTENT="Comment Two" USE_WIKI_TEXT="true"
- FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"
- NS_LEFT="2" NS_RIGHT="3" NS_THREAD="10"/>
+ FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"/>
<WIKI_NODE
- NODE_ID="12" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="10"
+ NODE_ID="12" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="6"
AREA_NR="3" NAME="One.Comment1196729874870" WIKINAME="OneComment.1196729874870"
CREATED_ON="2006-09-25 13:46:00" CREATED_BY_USER_ID="2" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_COMMENT
NODE_ID="12"
SUBJECT="Three" CONTENT="Comment Three" USE_WIKI_TEXT="true"
- FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"
- NS_LEFT="4" NS_RIGHT="7" NS_THREAD="10"/>
+ FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"/>
<WIKI_NODE
- NODE_ID="13" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="12"
+ NODE_ID="13" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="6"
AREA_NR="3" NAME="One.Comment11967293211870" WIKINAME="OneComment11967293211870"
CREATED_ON="2006-09-26 13:47:00" CREATED_BY_USER_ID="2" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_COMMENT
NODE_ID="13"
SUBJECT="Four" CONTENT="Comment Four" USE_WIKI_TEXT="true"
- FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"
- NS_LEFT="5" NS_RIGHT="6" NS_THREAD="10"/>
+ FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"/>
<WIKI_NODE
NODE_ID="14" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="6"
@@ -345,29 +335,18 @@
<WIKI_COMMENT
NODE_ID="14"
SUBJECT="Five" CONTENT="Comment Five" USE_WIKI_TEXT="true"
- FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"
- NS_LEFT="1" NS_RIGHT="4" NS_THREAD="14"/>
+ FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"/>
<WIKI_NODE
- NODE_ID="15" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="14"
+ NODE_ID="15" OBJ_VERSION="0" RATING="0" PARENT_NODE_ID="6"
AREA_NR="3" NAME="One.Comment119672932118230" WIKINAME="OneComment119672932118230"
CREATED_ON="2006-09-28 13:49:00" CREATED_BY_USER_ID="2" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="false"/>
<WIKI_COMMENT
NODE_ID="15"
SUBJECT="Six" CONTENT="Comment Six" USE_WIKI_TEXT="true"
- FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"
- NS_LEFT="2" NS_RIGHT="3" NS_THREAD="14"/>
+ FROM_USER_NAME="My Anonymous Name" FROM_USER_EMAIL="foo(a)bar.baz.somemoretext.tld" FROM_USER_HOMEPAGE="http://foo.bar.baz/foo/bar?foo=123"/>
- <WIKI_DOCUMENT_LAST_COMMENT
- WIKI_DOCUMENT_ID="6"
- LAST_COMMENT_CREATED_ON="2006-09-28 13:49:00"
- LAST_COMMENT_ID="15"/>
-
- <WIKI_DOCUMENT_COUNT_COMMENT
- WIKI_DOCUMENT_ID="6"
- COMMENT_COUNT="6"/>
-
<WIKI_DOCUMENT_HISTORY
FILE_HISTORY_ID="1" FILE_ID="6" FILE_REVISION="0"
NAME="One" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USERNAME="admin" content="Original text of Testdocument One"/>
@@ -408,8 +387,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="1000" WRITE_PROTECTED="true"/>
<WIKI_DIRECTORY
- NODE_ID="16" DESCRIPTION="Default member area" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="10" NS_RIGHT="11" NS_THREAD="1"/>
+ NODE_ID="16" DESCRIPTION="Default member area" DEFAULT_FILE_ID="[NULL]"/>
<!-- Trash Area -->
@@ -419,8 +397,7 @@
CREATED_ON="2006-09-23 13:45:00" CREATED_BY_USER_ID="1" LAST_MODIFIED_ON="[NULL]" LAST_MODIFIED_BY_USER_ID="[NULL]"
READ_ACCESS_LEVEL="0" WRITE_ACCESS_LEVEL="0" WRITE_PROTECTED="true"/>
<WIKI_DIRECTORY
- NODE_ID="17" DESCRIPTION="Trash area" DEFAULT_FILE_ID="[NULL]"
- NS_LEFT="12" NS_RIGHT="13" NS_THREAD="1"/>
+ NODE_ID="17" DESCRIPTION="Trash area" DEFAULT_FILE_ID="[NULL]"/>
<!-- Clean these tables -->
<FEEDENTRY/>
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/browse/DisplayComments.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/browse/DisplayComments.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/browse/DisplayComments.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -35,7 +35,6 @@
assert doc != null;
assert doc.getId().equals(6l);
-
CommentQuery commentQuery = (CommentQuery)getInstance(CommentQuery.class);
assert commentQuery.getComments().size() == 6;
Deleted: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/browse/DisplayMenu.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/browse/DisplayMenu.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/browse/DisplayMenu.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,62 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.seam.wiki.test.browse;
-
-import org.dbunit.operation.DatabaseOperation;
-import org.jboss.seam.wiki.core.action.Menu;
-import org.jboss.seam.wiki.core.nestedset.query.NestedSetNodeWrapper;
-import org.jboss.seam.wiki.core.model.WikiDirectory;
-import org.jboss.seam.mock.DBUnitSeamTest;
-import org.testng.annotations.Test;
-
-public class DisplayMenu extends DBUnitSeamTest {
-
-
- protected void prepareDBUnitOperations() {
- beforeTestOperations.add(
- new DataSetOperation("org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml", DatabaseOperation.CLEAN_INSERT)
- );
- }
-
- @Test
- public void allMenuItems() throws Exception {
-
- new NonFacesRequest("/wiki.xhtml") {
-
- protected void renderResponse() throws Exception {
-
- Menu menu = (Menu)getValue("#{menu}");
-
- assert menu.getRoot().getAdditionalProjections().get("displayPosition") == null;
- assert menu.getRoot().getWrappedNode().getId().equals(1l);
- assert menu.getRoot().getLevel().equals(0l);
- assert menu.getRoot().getWrappedChildren().size() == 2;
- for (NestedSetNodeWrapper<WikiDirectory> child : menu.getRoot().getWrappedChildrenSorted()) {
- assert child.getLevel().equals(1l);
- }
-
- }
-
- }.run();
- }
-
-
- /*
- System.out.println("#### GOT MENU ROOT DISPLAY POSITION: " + menu.getRoot().getAdditionalProjections().get("displayPosition") + ": " + menu.getRoot());
- System.out.println("############## ROOT HAS CHILDREN: " + menu.getRoot().getWrappedChildren().size());
-
- for (NestedSetNodeWrapper<WikiDirectory> child : menu.getRoot().getWrappedChildrenSorted()) {
-
- System.out.println("#### CHILD DISPLAY POSITION: " + child.getAdditionalProjections().get("displayPosition") + ": " + child);
-
- for (NestedSetNodeWrapper<WikiDirectory> child2 : child.getWrappedChildrenSorted()) {
- System.out.println("####### CHILD2 DISPLAY POSITION: " + child.getAdditionalProjections().get("displayPosition") + ": " + child2);
-
- }
- }
- */
-}
\ No newline at end of file
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/dao/TagDAOTests.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/dao/TagDAOTests.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/dao/TagDAOTests.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -11,8 +11,11 @@
import org.jboss.seam.wiki.core.dao.WikiNodeDAO;
import org.jboss.seam.wiki.core.model.WikiDirectory;
import org.jboss.seam.wiki.core.model.DisplayTagCount;
+import org.jboss.seam.wiki.core.model.WikiFile;
+import org.jboss.seam.wiki.core.model.WikiNode;
import org.jboss.seam.mock.DBUnitSeamTest;
import org.testng.annotations.Test;
+import org.testng.Assert;
import java.util.List;
@@ -65,4 +68,23 @@
}.run();
}
+ @Test
+ public void findTaggedFiles() throws Exception {
+ new FacesRequest() {
+
+ protected void invokeApplication() throws Exception {
+ WikiDirectory startDir = ((WikiNodeDAO)getInstance(WikiNodeDAO.class)).findWikiDirectory(3l);
+
+ TagDAO dao = (TagDAO)getInstance(TagDAO.class);
+ List<WikiFile> taggedFiles = dao.findWikFiles(startDir, null, "Tag One", WikiNode.SortableProperty.name, true);
+
+ Assert.assertEquals(taggedFiles.size(), 3);
+
+ Assert.assertEquals(taggedFiles.get(0).getName(), "One");
+ Assert.assertEquals(taggedFiles.get(1).getName(), "Three");
+ Assert.assertEquals(taggedFiles.get(2).getName(), "Two");
+ }
+ }.run();
+ }
+
}
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/dao/WikiNodeDAOTests.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/dao/WikiNodeDAOTests.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/dao/WikiNodeDAOTests.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -11,6 +11,7 @@
import org.jboss.seam.wiki.core.model.*;
import org.jboss.seam.mock.DBUnitSeamTest;
import org.testng.annotations.Test;
+import org.testng.Assert;
import java.util.List;
@@ -192,7 +193,7 @@
}
@Test
- public void findCommentThreads() throws Exception {
+ public void findComments() throws Exception {
new FacesRequest() {
protected void invokeApplication() throws Exception {
@@ -200,64 +201,122 @@
WikiDocument d = dao.findWikiDocument(6l);
assert d.getName().equals("One");
- List<WikiComment> comments = dao.findWikiCommentsThreaded(d);
+ List<WikiComment> comments = dao.findWikiComments(d, true);
assert comments.size() == 6;
- assert comments.get(0).getLevel().equals(1l);
assert comments.get(0).getId().equals(10l);
- assert comments.get(1).getLevel().equals(2l);
assert comments.get(1).getId().equals(11l);
- assert comments.get(2).getLevel().equals(2l);
assert comments.get(2).getId().equals(12l);
- assert comments.get(3).getLevel().equals(3l);
assert comments.get(3).getId().equals(13l);
- assert comments.get(4).getLevel().equals(1l);
assert comments.get(4).getId().equals(14l);
- assert comments.get(5).getLevel().equals(2l);
assert comments.get(5).getId().equals(15l);
}
}.run();
}
@Test
- public void findCommentSubthreads() throws Exception {
+ public void findSiblings() throws Exception {
new FacesRequest() {
protected void invokeApplication() throws Exception {
WikiNodeDAO dao = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
+ WikiDocument d = dao.findWikiDocument(6l);
+ assert d.getName().equals("One");
- WikiComment rootOne = dao.findWikiComment(10l);
- List<WikiComment> commentsOne = dao.findWikiCommentSubtree(rootOne);
- assert commentsOne.size() == 3;
- assert commentsOne.get(0).getLevel().equals(1l);
- assert commentsOne.get(0).getId().equals(11l);
- assert commentsOne.get(1).getLevel().equals(1l);
- assert commentsOne.get(1).getId().equals(12l);
- assert commentsOne.get(2).getLevel().equals(2l);
- assert commentsOne.get(2).getId().equals(13l);
+ assert dao.findSiblingWikiDocumentInDirectory(d, WikiNode.SortableProperty.createdOn, true) == null;
+ assert dao.findSiblingWikiDocumentInDirectory(d, WikiNode.SortableProperty.createdOn, false).getId().equals(7l);
+ }
+ }.run();
+ }
- WikiComment rootTwo = dao.findWikiComment(14l);
- List<WikiComment> commentsTwo = dao.findWikiCommentSubtree(rootTwo);
- assert commentsTwo.size() == 1;
- assert commentsTwo.get(0).getLevel().equals(1l);
- assert commentsTwo.get(0).getId().equals(15l);
+ @Test
+ public void findWikiDirectoryTree() throws Exception {
+ new FacesRequest() {
+ protected void invokeApplication() throws Exception {
+ WikiNodeDAO dao = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
+
+ WikiDirectory root = dao.findWikiDirectory(1l);
+ List<WikiTreeNode<WikiDirectory>> tree = dao.findWikiDirectoryTree(root, WikiNode.SortableProperty.name, true);
+
+ Assert.assertEquals(tree.size(), 7);
+
+ Assert.assertEquals(tree.get(0).getLevel(), 1);
+ Assert.assertEquals(tree.get(0).getNode().getName(), "AAA");
+ Assert.assertEquals(tree.get(1).getLevel(), 2);
+ Assert.assertEquals(tree.get(1).getNode().getName(), "BBB");
+ Assert.assertEquals(tree.get(2).getLevel(), 2);
+ Assert.assertEquals(tree.get(2).getNode().getName(), "CCC");
+ Assert.assertEquals(tree.get(3).getLevel(), 3);
+ Assert.assertEquals(tree.get(3).getNode().getName(), "DDD");
+ Assert.assertEquals(tree.get(4).getLevel(), 3);
+ Assert.assertEquals(tree.get(4).getNode().getName(), "EEE");
+ Assert.assertEquals(tree.get(5).getLevel(), 2);
+ Assert.assertEquals(tree.get(5).getNode().getName(), "Members");
+ Assert.assertEquals(tree.get(6).getLevel(), 2);
+ Assert.assertEquals(tree.get(6).getNode().getName(), "Trash");
+
}
}.run();
}
+ @Test
+ public void findWikiDirectorySubtree() throws Exception {
+ new FacesRequest() {
+ protected void invokeApplication() throws Exception {
+ WikiNodeDAO dao = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
+
+ WikiDirectory root = dao.findWikiDirectory(3l);
+ List<WikiTreeNode<WikiDirectory>> tree = dao.findWikiDirectoryTree(root, WikiNode.SortableProperty.name, false);
+
+ Assert.assertEquals(tree.size(), 3);
+
+ Assert.assertEquals(tree.get(0).getLevel(), 1);
+ Assert.assertEquals(tree.get(0).getNode().getName(), "CCC");
+ Assert.assertEquals(tree.get(1).getLevel(), 2);
+ Assert.assertEquals(tree.get(1).getNode().getName(), "EEE");
+ Assert.assertEquals(tree.get(2).getLevel(), 2);
+ Assert.assertEquals(tree.get(2).getNode().getName(), "DDD");
+
+ }
+ }.run();
+ }
+
@Test
- public void findSiblings() throws Exception {
+ public void findMenuItems() throws Exception {
new FacesRequest() {
protected void invokeApplication() throws Exception {
WikiNodeDAO dao = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
- WikiDocument d = dao.findWikiDocument(6l);
- assert d.getName().equals("One");
- assert dao.findSiblingWikiDocumentInDirectory(d, WikiNode.SortableProperty.createdOn, true) == null;
- assert dao.findSiblingWikiDocumentInDirectory(d, WikiNode.SortableProperty.createdOn, false).getId().equals(7l);
+ WikiDirectory root = dao.findWikiDirectory(1l);
+
+ List<WikiTreeNode<WikiDirectory>> tree = dao.findMenuItemTree(root, 3l, 3l, false);
+ Assert.assertEquals(tree.size(), 3);
+ Assert.assertEquals(tree.get(0).getLevel(), 1);
+ Assert.assertEquals(tree.get(0).getNode().getName(), "BBB");
+ Assert.assertEquals(tree.get(1).getLevel(), 1);
+ Assert.assertEquals(tree.get(1).getNode().getName(), "CCC");
+ Assert.assertEquals(tree.get(2).getLevel(), 2);
+ Assert.assertEquals(tree.get(2).getNode().getName(), "DDD");
+
+ tree = dao.findMenuItemTree(root, 3l, 1l, false);
+ Assert.assertEquals(tree.size(), 3);
+ Assert.assertEquals(tree.get(0).getLevel(), 1);
+ Assert.assertEquals(tree.get(0).getNode().getName(), "BBB");
+ Assert.assertEquals(tree.get(1).getLevel(), 1);
+ Assert.assertEquals(tree.get(1).getNode().getName(), "CCC");
+ Assert.assertEquals(tree.get(2).getLevel(), 1);
+ Assert.assertEquals(tree.get(2).getNode().getName(), "DDD");
+
+ tree = dao.findMenuItemTree(root, 1l, 3l, false);
+ Assert.assertEquals(tree.size(), 2);
+ Assert.assertEquals(tree.get(0).getLevel(), 1);
+ Assert.assertEquals(tree.get(0).getNode().getName(), "BBB");
+ Assert.assertEquals(tree.get(1).getLevel(), 1);
+ Assert.assertEquals(tree.get(1).getNode().getName(), "CCC");
+
}
}.run();
}
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/BasicNodeOperations.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/BasicNodeOperations.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/BasicNodeOperations.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -84,7 +84,6 @@
Redirect.instance().setViewId("/dirDisplay.xhtml");
Redirect.instance().execute();
- assert checkNestedSetNodeInDatabase(1l, 1, 997);
assert !checkDirectoryInDatabase(5l);
}
@@ -119,7 +118,6 @@
protected void renderResponse() throws Exception {
WikiDocument newNode = (WikiDocument)getValue("#{documentHome.instance}");
- assert checkNestedSetNodeInDatabase(3l, 4, 9);
assert newNode.getAreaNumber().equals(3l);
assert newNode.getCreatedBy().getId().equals(2l);
assert newNode.getParent().getId().equals(3l);
@@ -245,13 +243,6 @@
}.run();
}
- private boolean checkNestedSetNodeInDatabase(long nodeId, long left, long right) throws Exception {
- Session s = getHibernateSession();
- WikiDirectory dir = (WikiDirectory)s.createQuery("select d from WikiDirectory d left join fetch d.parent where d.id = :id").setParameter("id", nodeId).uniqueResult();
- s.close();
- return dir.getNodeInfo().getNsLeft() == left && dir.getNodeInfo().getNsRight() == right;
- }
-
private boolean checkDirectoryInDatabase(long nodeId) throws Exception {
Session s = getHibernateSession();
WikiDirectory dir = (WikiDirectory ) s.createQuery("select d from WikiDirectory d left join fetch d.parent where d.id = :id").setParameter("id", nodeId).uniqueResult();
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/ClipboardTests.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/ClipboardTests.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/ClipboardTests.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -761,7 +761,7 @@
assert doc.getAreaNumber().equals(2l);
assert doc.getParent().getId().equals(2l);
- List<WikiComment> comments = browser.getWikiNodeDAO().findWikiCommentsFlat(doc, false);
+ List<WikiComment> comments = browser.getWikiNodeDAO().findWikiComments(doc, false);
for (WikiComment comment : comments) {
assert comment.getAreaNumber().equals(2l);
}
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/Commenting.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/Commenting.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/editing/Commenting.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -12,12 +12,9 @@
import org.jboss.seam.wiki.core.action.CommentQuery;
import org.jboss.seam.wiki.core.dao.WikiNodeDAO;
import org.jboss.seam.wiki.core.model.User;
-import org.jboss.seam.wiki.core.model.WikiDocumentCountComment;
-import org.jboss.seam.wiki.core.model.WikiDocumentLastComment;
import org.testng.annotations.Test;
+import static org.testng.Assert.assertEquals;
-import javax.persistence.EntityManager;
-
public class Commenting extends DBUnitSeamTest {
protected void prepareDBUnitOperations() {
@@ -49,12 +46,10 @@
commentHome.getInstance().setFromUserHomepage("http://foo.bar");
commentHome.getInstance().setFromUserEmail("foo(a)bar.tld");
commentHome.getInstance().setSubject("Some Subject");
- commentHome.getInstance().setContent("Some Content");
+ commentHome.getTextEditor().setValue("Some Content");
invokeMethod("#{commentHome.persist}");
- }
- protected void renderResponse() throws Exception {
CommentQuery commentQuery = (CommentQuery)getInstance(CommentQuery.class);
assert commentQuery.getComments().size() == 7;
@@ -70,19 +65,10 @@
assert commentQuery.getComments().get(6).getFromUserHomepage().equals("http://foo.bar");
assert commentQuery.getComments().get(6).getFromUserEmail().equals("foo(a)bar.tld");
assert commentQuery.getComments().get(6).getSubject().equals("Some Subject");
- assert commentQuery.getComments().get(6).getContent().equals("Some Content");
+ assertEquals(commentQuery.getComments().get(6).getContent(), "Some Content");
assert commentQuery.getComments().get(6).getName().matches("One\\.Comment[0-9]+");
assert !commentQuery.getComments().get(6).getWikiname().contains(" ");
-
- EntityManager em = (EntityManager)getInstance("entityManager");
- WikiDocumentLastComment lastComment = em.find(WikiDocumentLastComment.class, 6l);
- assert lastComment != null;
- assert lastComment.getLastCommentId().equals(commentQuery.getComments().get(6).getId());
-
- WikiDocumentCountComment countComment = em.find(WikiDocumentCountComment.class, 6l);
- assert countComment != null;
- assert countComment.getCommentCount() == 8;
}
}.run();
@@ -112,12 +98,10 @@
commentHome.getInstance().setFromUserHomepage("http://foo.bar");
commentHome.getInstance().setFromUserEmail("foo(a)bar.tld");
commentHome.getInstance().setSubject("Some Subject");
- commentHome.getInstance().setContent("Some Content");
+ commentHome.getTextEditor().setValue("Some Content");
invokeMethod("#{commentHome.persist}");
- }
- protected void renderResponse() throws Exception {
CommentQuery commentQuery = (CommentQuery)getInstance(CommentQuery.class);
assert commentQuery.getComments().size() == 7;
@@ -132,23 +116,14 @@
assert commentQuery.getComments().get(6).getFromUserName().equals("Foo");
assert commentQuery.getComments().get(6).getFromUserHomepage().equals("http://foo.bar");
assert commentQuery.getComments().get(6).getFromUserEmail().equals("foo(a)bar.tld");
- assert commentQuery.getComments().get(6).getSubject().equals("Some Subject");
- assert commentQuery.getComments().get(6).getContent().equals("Some Content");
- assert commentQuery.getComments().get(6).getParent().getId().equals(15l);
+ assertEquals(commentQuery.getComments().get(6).getSubject(), "Some Subject");
+ assertEquals(commentQuery.getComments().get(6).getContent(), "Some Content");
+ assertEquals(commentQuery.getComments().get(6).getParent().getId(), new Long(6));
assert commentQuery.getComments().get(6).getName().matches("One\\.Comment[0-9]+");
assert !commentQuery.getComments().get(6).getWikiname().contains(" ");
-
- EntityManager em = (EntityManager)getInstance("entityManager");
- WikiDocumentLastComment lastComment = em.find(WikiDocumentLastComment.class, 6l);
- assert lastComment != null;
- assert lastComment.getLastCommentId().equals(commentQuery.getComments().get(6).getId());
-
- WikiDocumentCountComment countComment = em.find(WikiDocumentCountComment.class, 6l);
- assert countComment != null;
- assert countComment.getCommentCount() == 7;
}
-
+
}.run();
}
@@ -169,28 +144,14 @@
protected void invokeApplication() throws Exception {
invokeMethod("#{commentHome.remove(14)}");
- }
- protected void renderResponse() throws Exception {
CommentQuery commentQuery = (CommentQuery)getInstance(CommentQuery.class);
- assert commentQuery.getComments().size() == 4;
+ assert commentQuery.getComments().size() == 5;
assert commentQuery.getComments().get(0).getId().equals(10l);
- assert commentQuery.getComments().get(0).getLevel().equals(1l);
assert commentQuery.getComments().get(1).getId().equals(11l);
- assert commentQuery.getComments().get(1).getLevel().equals(2l);
assert commentQuery.getComments().get(2).getId().equals(12l);
- assert commentQuery.getComments().get(2).getLevel().equals(2l);
assert commentQuery.getComments().get(3).getId().equals(13l);
- assert commentQuery.getComments().get(3).getLevel().equals(3l);
-
- EntityManager em = (EntityManager)getInstance("entityManager");
- WikiDocumentLastComment lastComment = em.find(WikiDocumentLastComment.class, 6l);
- assert lastComment != null;
- assert lastComment.getLastCommentId().equals(13l);
-
- WikiDocumentCountComment countComment = em.find(WikiDocumentCountComment.class, 6l);
- assert countComment != null;
- assert countComment.getCommentCount() == 4;
+ assert commentQuery.getComments().get(4).getId().equals(15l);
}
}.run();
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/model/CommentTests.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/model/CommentTests.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/model/CommentTests.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -13,10 +13,10 @@
import org.jboss.seam.wiki.util.WikiUtil;
import org.dbunit.operation.DatabaseOperation;
import org.testng.annotations.Test;
+import static org.testng.Assert.assertEquals;
import javax.persistence.EntityManager;
import java.util.List;
-import java.util.Date;
public class CommentTests extends DBUnitSeamTest {
@@ -27,7 +27,7 @@
}
@Test
- public void findAllCommentsFlat() throws Exception {
+ public void findAllComments() throws Exception {
new FacesRequest() {
protected void invokeApplication() throws Exception {
@@ -43,77 +43,19 @@
.setParameter("doc", d)
.getResultList();
- assert comments.size() == 2;
+ assert comments.size() == 6;
assert comments.get(0).getName().equals("One.Comment11967298211870");
- assert comments.get(1).getSubject().equals("Five");
+ assert comments.get(1).getSubject().equals("Two");
+ assert comments.get(2).getSubject().equals("Three");
+ assert comments.get(3).getSubject().equals("Four");
+ assert comments.get(4).getSubject().equals("Five");
+ assert comments.get(5).getSubject().equals("Six");
}
}.run();
}
@Test
- public void findAllCommentsHierachical() throws Exception {
- new FacesRequest() {
-
- protected void invokeApplication() throws Exception {
- EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
- WikiDocument d = (WikiDocument)
- em.createQuery("select d from WikiDocument d where d.id = :id")
- .setParameter("id", 6l)
- .getSingleResult();
- assert d.getName().equals("One");
-
- List<Object[]> result = queryComments(d, em);
-
- assert result.size() == 6;
-
- Object[] one = result.get(0);
- assert one[0].equals(1l);
- assert one[1].equals(10l);
- assert one[2].equals(1l);
- assert one[3].equals(8l);
- assert one[4].equals(10l);
-
- Object[] two = result.get(1);
- assert two[0].equals(2l);
- assert two[1].equals(11l);
- assert two[2].equals(2l);
- assert two[3].equals(3l);
- assert two[4].equals(10l);
-
- Object[] three = result.get(2);
- assert three[0].equals(2l);
- assert three[1].equals(12l);
- assert three[2].equals(4l);
- assert three[3].equals(7l);
- assert three[4].equals(10l);
-
- Object[] four = result.get(3);
- assert four[0].equals(3l);
- assert four[1].equals(13l);
- assert four[2].equals(5l);
- assert four[3].equals(6l);
- assert four[4].equals(10l);
-
- Object[] five = result.get(4);
- assert five[0].equals(1l);
- assert five[1].equals(14l);
- assert five[2].equals(1l);
- assert five[3].equals(4l);
- assert five[4].equals(14l);
-
- Object[] six = result.get(5);
- assert six[0].equals(2l);
- assert six[1].equals(15l);
- assert six[2].equals(2l);
- assert six[3].equals(3l);
- assert six[4].equals(14l);
- }
- }.run();
- }
-
-
- @Test
public void insertCommentNewThread() throws Exception {
new FacesRequest() {
@@ -143,59 +85,22 @@
em.flush();
em.clear();
- List<Object[]> result = queryComments(d, em);
+ List<WikiComment> comments =
+ em.createQuery("select c from WikiComment c where c.parent = :doc order by c.createdOn asc")
+ .setParameter("doc", d)
+ .getResultList();
- assert result.size() == 7;
+ assert comments.size() == 7;
- Object[] one = result.get(0);
- assert one[0].equals(1l);
- assert one[1].equals(10l);
- assert one[2].equals(1l);
- assert one[3].equals(8l);
- assert one[4].equals(10l);
+ assert comments.get(0).getName().equals("One.Comment11967298211870");
+ assert comments.get(1).getSubject().equals("Two");
+ assert comments.get(2).getSubject().equals("Three");
+ assert comments.get(3).getSubject().equals("Four");
+ assert comments.get(4).getSubject().equals("Five");
+ assert comments.get(5).getSubject().equals("Six");
+ assert comments.get(6).getSubject().equals("Seven");
+ assert comments.get(6).getId().equals(newComment.getId());
- Object[] two = result.get(1);
- assert two[0].equals(2l);
- assert two[1].equals(11l);
- assert two[2].equals(2l);
- assert two[3].equals(3l);
- assert two[4].equals(10l);
-
- Object[] three = result.get(2);
- assert three[0].equals(2l);
- assert three[1].equals(12l);
- assert three[2].equals(4l);
- assert three[3].equals(7l);
- assert three[4].equals(10l);
-
- Object[] four = result.get(3);
- assert four[0].equals(3l);
- assert four[1].equals(13l);
- assert four[2].equals(5l);
- assert four[3].equals(6l);
- assert four[4].equals(10l);
-
- Object[] five = result.get(4);
- assert five[0].equals(1l);
- assert five[1].equals(14l);
- assert five[2].equals(1l);
- assert five[3].equals(4l);
- assert five[4].equals(14l);
-
- Object[] six = result.get(5);
- assert six[0].equals(2l);
- assert six[1].equals(15l);
- assert six[2].equals(2l);
- assert six[3].equals(3l);
- assert six[4].equals(14l);
-
- Object[] seven = result.get(6);
- assert seven[0].equals(1l);
- assert seven[1].equals(newComment.getId());
- assert seven[2].equals(1l);
- assert seven[3].equals(2l);
- assert seven[4].equals(newComment.getId());
-
}
}.run();
}
@@ -212,23 +117,12 @@
.setParameter("id", 13l)
.getSingleResult();
assert comment.getSubject().equals("Four");
- assert comment.getParentDocument().getId().equals(6l);
+ assert comment.getParent().getId().equals(6l);
+ assertEquals(comment.getPermURL(".lace"), "6.lace#comment13");
+ assertEquals(comment.getWikiURL(), "CCC/One#comment13");
}
}.run();
}
- private List<Object[]> queryComments(WikiDocument doc, EntityManager em) {
- String query =
- "select count(c1.id) as nslevel, c1.id, c1.nodeInfo.nsLeft, c1.nodeInfo.nsRight, c1.nodeInfo.nsThread " +
- " from WikiComment c1, WikiComment c2 " +
- " where c1.nodeInfo.nsThread = c2.nodeInfo.nsThread" +
- " and c2.nodeInfo.nsThread in (select c3.nodeInfo.nsThread from WikiComment c3 where c3.parent = :doc)" +
- " and c1.nodeInfo.nsLeft between c2.nodeInfo.nsLeft and c2.nodeInfo.nsRight" +
- " group by c1.id, c1.nodeInfo.nsLeft, c1.nodeInfo.nsRight, c1.nodeInfo.nsThread" +
- " order by c1.nodeInfo.nsThread asc, c1.nodeInfo.nsLeft asc";
- return em.createQuery(query)
- .setParameter("doc", doc)
- .getResultList();
- }
}
\ No newline at end of file
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/model/DirectoryTests.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/model/DirectoryTests.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/model/DirectoryTests.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -11,8 +11,10 @@
import org.jboss.seam.wiki.core.model.WikiDirectory;
import org.jboss.seam.mock.DBUnitSeamTest;
import org.testng.annotations.Test;
+import org.testng.Assert;
import javax.persistence.EntityManager;
+import java.util.List;
public class DirectoryTests extends DBUnitSeamTest {
@@ -33,8 +35,6 @@
.setParameter("id", 1l)
.getSingleResult();
assert d.getName().equals("AAA");
- assert d.getNodeInfo().getNsLeft().equals(1l);
- assert d.getNodeInfo().getNsRight().equals(999l);
}
}.run();
}
@@ -77,8 +77,6 @@
.setParameter("id", 1l)
.getSingleResult();
assert d.getName().equals("AAA2");
- assert d.getNodeInfo().getNsLeft().equals(1l);
- assert d.getNodeInfo().getNsRight().equals(999l);
}
}.run();
}
@@ -222,8 +220,6 @@
.setParameter("id", 1l)
.getSingleResult();
assert d.getName().equals("AAA");
- assert d.getNodeInfo().getNsLeft().equals(1l);
- assert d.getNodeInfo().getNsRight().equals(1001l);
em.clear();
d = (WikiDirectory)
@@ -231,8 +227,6 @@
.setParameter("id", 3l)
.getSingleResult();
assert d.getName().equals("CCC");
- assert d.getNodeInfo().getNsLeft().equals(4l);
- assert d.getNodeInfo().getNsRight().equals(11l);
em.clear();
d = (WikiDirectory)
@@ -240,12 +234,45 @@
.setParameter("id", newDir.getId())
.getSingleResult();
assert d.getName().equals("FFF");
- assert d.getNodeInfo().getNsLeft().equals(9l);
- assert d.getNodeInfo().getNsRight().equals(10l);
}
}.run();
}
+ @Test
+ public void findParents() throws Exception {
+ new FacesRequest() {
+ protected void invokeApplication() throws Exception {
+ EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
+ WikiDirectory d = (WikiDirectory)
+ em.createQuery("select d from WikiDirectory d where d.id = :id")
+ .setParameter("id", 4l)
+ .getSingleResult();
+ List<WikiDirectory> parents = d.getParentsRecursive();
+
+ Assert.assertEquals(parents.size(), 2);
+ Assert.assertEquals(parents.get(0).getId(), new Long(3));
+ Assert.assertEquals(parents.get(1).getId(), new Long(1));
+ }
+ }.run();
+
+ new FacesRequest() {
+
+ protected void invokeApplication() throws Exception {
+ EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
+ WikiDirectory d = (WikiDirectory)
+ em.createQuery("select d from WikiDirectory d where d.id = :id")
+ .setParameter("id", 3l)
+ .getSingleResult();
+
+ List<WikiDirectory> parents = d.getParentsRecursive();
+
+ Assert.assertEquals(parents.size(), 1);
+ Assert.assertEquals(parents.get(0).getId(), new Long(1));
+ }
+ }.run();
+ }
+
+
}
Deleted: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/model/MenuTests.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/model/MenuTests.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/model/MenuTests.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,192 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- *
- * Distributable under LGPL license.
- * See terms of license at gnu.org.
- */
-package org.jboss.seam.wiki.test.model;
-
-import org.dbunit.operation.DatabaseOperation;
-import org.jboss.seam.wiki.core.model.WikiDirectory;
-import org.jboss.seam.wiki.core.model.WikiMenuItem;
-import org.jboss.seam.mock.DBUnitSeamTest;
-import org.testng.annotations.Test;
-
-import javax.persistence.EntityManager;
-import java.util.List;
-
-public class MenuTests extends DBUnitSeamTest {
-
- protected void prepareDBUnitOperations() {
- beforeTestOperations.add(
- new DataSetOperation("org/jboss/seam/wiki/test/WikiBaseData.dbunit.xml", DatabaseOperation.CLEAN_INSERT)
- );
- }
-
- @Test
- public void findAllMenuItems() throws Exception {
- new FacesRequest() {
-
- protected void invokeApplication() throws Exception {
-
- EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
-
- WikiDirectory root = (WikiDirectory)
- em.createQuery("select d from WikiDirectory d where d.id = :id")
- .setParameter("id", 1l)
- .getSingleResult();
-
- List<Object[]> result = queryMenuItems(root, em);
-
- assert result.size() == 3;
-
- Object[] one = result.get(0);
- assert one[0].equals(2l);
- assert one[1].equals(2l);
- assert one[2].equals(0l);
-
- Object[] two = result.get(1);
- assert two[0].equals(2l);
- assert two[1].equals(3l);
- assert two[2].equals(1l);
-
- Object[] three = result.get(2);
- assert three[0].equals(3l);
- assert three[1].equals(4l);
- assert three[2].equals(0l);
-
- }
- }.run();
- }
-
-
- @Test
- public void removeMenuItem() throws Exception {
- new FacesRequest() {
-
- protected void invokeApplication() throws Exception {
-
- EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
-
- WikiDirectory d = (WikiDirectory)
- em.createQuery("select d from WikiDirectory d where d.id = :id")
- .setParameter("id", 1l)
- .getSingleResult();
-
- List<WikiMenuItem> menuItems =
- em.createQuery("select m from WikiMenuItem m where m.id in (select d.id from WikiDirectory d where d.parent = :parent)")
- .setParameter("parent", d).getResultList();
-
- assert menuItems.size() == 2;
-
- WikiMenuItem removedItem = menuItems.remove(0);
- em.remove(removedItem);
- for (int i = 0; i<menuItems.size(); i++) {
- WikiMenuItem itm = menuItems.get(i);
- itm.setDisplayPosition(i);
- }
-
- em.flush();
- em.clear();
-
- List<Object[]> result = queryMenuItems(d, em);
-
- assert result.size() == 2;
-
- Object[] one = result.get(0);
- assert one[0].equals(2l);
- assert one[1].equals(3l);
- assert one[2].equals(0l);
-
- Object[] two = result.get(1);
- assert two[0].equals(3l);
- assert two[1].equals(4l);
- assert two[2].equals(0l);
-
- }
- }.run();
- }
-
-
- @Test
- public void addMenuItem() throws Exception {
- new FacesRequest() {
-
- protected void invokeApplication() throws Exception {
-
- EntityManager em = (EntityManager) getInstance("restrictedEntityManager");
-
- WikiDirectory root = (WikiDirectory)
- em.createQuery("select d from WikiDirectory d where d.id = :id")
- .setParameter("id", 1l)
- .getSingleResult();
-
- WikiDirectory d = (WikiDirectory)
- em.createQuery("select d from WikiDirectory d where d.id = :id")
- .setParameter("id", 5l)
- .getSingleResult();
-
- List<WikiMenuItem> menuItems =
- em.createQuery("select m from WikiMenuItem m where m.id in (select d.id from WikiDirectory d where d.parent = :parent)")
- .setParameter("parent", d.getParent()).getResultList();
-
- WikiMenuItem newMenuItem = new WikiMenuItem(d);
- menuItems.add(newMenuItem);
-
- assert menuItems.size() == 2;
-
- for (int i = 0; i<menuItems.size(); i++) {
- WikiMenuItem itm = menuItems.get(i);
- itm.setDisplayPosition(i);
- }
-
- em.persist(newMenuItem);
-
- em.flush();
- em.clear();
-
- List<Object[]> result = queryMenuItems(root, em);
-
- assert result.size() == 4;
-
- Object[] one = result.get(0);
- assert one[0].equals(2l);
- assert one[1].equals(2l);
- assert one[2].equals(0l);
-
- Object[] two = result.get(1);
- assert two[0].equals(2l);
- assert two[1].equals(3l);
- assert two[2].equals(1l);
-
- Object[] three = result.get(2);
- assert three[0].equals(3l);
- assert three[1].equals(4l);
- assert three[2].equals(0l);
-
- Object[] four = result.get(3);
- assert four[0].equals(3l);
- assert four[1].equals(5l);
- assert four[2].equals(1l);
-
- }
- }.run();
- }
-
- private List<Object[]> queryMenuItems(WikiDirectory start, EntityManager em) {
- String query =
- "select count(d1.id), d1.id, m.displayPosition" +
- " from WikiDirectory d1, WikiDirectory d2, WikiMenuItem m" +
- " where d1.nodeInfo.nsThread = :thread and d2.nodeInfo.nsThread = d1.nodeInfo.nsThread" +
- " and d1.nodeInfo.nsLeft between d2.nodeInfo.nsLeft and d2.nodeInfo.nsRight" +
- " and d2.nodeInfo.nsLeft >= :left and d2.nodeInfo.nsRight <= :right" +
- " and m.id = d1.id" +
- " group by d1.id, m.displayPosition";
- return em.createQuery(query)
- .setParameter("thread", start.getNodeInfo().getNsThread())
- .setParameter("left", start.getNodeInfo().getNsLeft())
- .setParameter("right", start.getNodeInfo().getNsRight())
- .getResultList();
- }
-
-}
Modified: branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/plugin/TopicHomeTests.java
===================================================================
--- branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/plugin/TopicHomeTests.java 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/src/test/org/jboss/seam/wiki/test/plugin/TopicHomeTests.java 2010-01-27 17:13:25 UTC (rev 11995)
@@ -67,9 +67,7 @@
home.getTextEditor().setValue("This is a new topic.");
assert invokeMethod("#{topicHome.persist}") == null;
- }
- protected void renderResponse() throws Exception {
Long newId = (Long)getValue("#{topicHome.instance.id}");
WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
@@ -135,9 +133,7 @@
home.setSticky(true);
assert invokeMethod("#{topicHome.persist}") == null;
- }
-
- protected void renderResponse() throws Exception {
+
Long newId = (Long)getValue("#{topicHome.instance.id}");
WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
@@ -201,9 +197,7 @@
home.getInstance().setEnableComments(false);
assert invokeMethod("#{topicHome.persist}") == null;
- }
- protected void renderResponse() throws Exception {
Long newId = (Long)getValue("#{topicHome.instance.id}");
WikiNodeDAO nodeDAO = (WikiNodeDAO)getInstance(WikiNodeDAO.class);
Modified: branches/community/Seam_2_2/examples/wiki/view/dirDisplay_d.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/view/dirDisplay_d.xhtml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/view/dirDisplay_d.xhtml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -43,6 +43,7 @@
<h:outputText escape="false" value="#{messages['lacewiki.label.template.RegularWikiDocument']}"/>
<f:param name="documentId" value=""/>
<f:param name="parentDirectoryId" value="#{directoryBrowser.instance.id}"/>
+ <f:param name="templateType" value=""/>
</s:link>
</li>
<ui:repeat var="templateType" value="#{templateRegistry.templateTypes}">
@@ -101,11 +102,18 @@
<s:div styleClass="box directoryBrowser" id="directoryBrowser">
+<!--
<ui:include src="includes/directoryBrowserPath.xhtml">
<ui:param name="renderOnSelect" value="control, directoryBrowser, messageBoxContainer"/>
</ui:include>
+-->
<h:panelGrid id="directoryBrowserMainPanel" styleClass="directoryBrowserMainPanel"
+ columnClasses="directoryBrowserContentPanel"
+ columns="2" cellpadding="0" cellspacing="0" border="0">
+
+<!--
+ <h:panelGrid id="directoryBrowserMainPanel" styleClass="directoryBrowserMainPanel"
columnClasses="directoryBrowserTreePanel #{directoryBrowserSettings.treeVisible ? 'open':'closed'}, directoryBrowserContentPanel"
columns="2" cellpadding="0" cellspacing="0" border="0">
@@ -114,6 +122,7 @@
<ui:param name="renderOnSelect" value="control, directoryBrowser, messageBoxContainer"/>
</ui:include>
</s:fragment>
+-->
<s:div id="directoryBrowserContentPanel">
<h:form>
@@ -260,6 +269,8 @@
<li>
<s:link view="/docEdit_#{skin}.xhtml" propagation="none">
<f:param name="documentId" value="#{node.id}"/>
+ <f:param name="parentDirectoryId" value="#{directoryBrowser.instance.id}"/>
+ <f:param name="templateType" value=""/>
<h:outputText value="#{messages['lacewiki.button.dirDisplay.Edit']}"/>
</s:link>
</li>
Modified: branches/community/Seam_2_2/examples/wiki/view/docDisplay_d.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/view/docDisplay_d.xhtml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/view/docDisplay_d.xhtml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -42,6 +42,7 @@
<h:outputText escape="false" value="#{messages['lacewiki.label.template.RegularWikiDocument']}"/>
<f:param name="documentId" value=""/>
<f:param name="parentDirectoryId" value="#{documentHome.instance.parent.id}"/>
+ <f:param name="templateType" value=""/>
</s:link>
</li>
<ui:repeat var="templateType" value="#{templateRegistry.templateTypes}">
Modified: branches/community/Seam_2_2/examples/wiki/view/includes/commentsDisplay.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/view/includes/commentsDisplay.xhtml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/view/includes/commentsDisplay.xhtml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -38,9 +38,13 @@
</f:facet>
<c:forEach var="c" items="#{commentQuery.comments}">
+<!--
<s:div style="margin-left:#{c.level > 1 ? c.level : ''}0px;"
styleClass="commentBox #{c.level > 1 ? 'commentLevel' : 'commentFirstLevel'}">
+-->
+ <s:div styleClass="commentBox commentFirstLevel">
+
<h:panelGrid columns="3" styleClass="commentHeader"
columnClasses="commentSubject, commentAuthorInfo smallFont, commentAuthorPortrait"
cellpadding="0" cellspacing="0" border="0">
Modified: branches/community/Seam_2_2/examples/wiki/view/includes/directoryBrowserPath.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/view/includes/directoryBrowserPath.xhtml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/view/includes/directoryBrowserPath.xhtml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -10,6 +10,12 @@
<h:form id="directoryBrowserPathForm" style="margin:0;padding:0;border:0">
<h:panelGrid columns="2"
styleClass="directoryBrowserPathPanel"
+ columnClasses="path"
+ cellpadding="0" cellspacing="0" border="0">
+
+<!--
+ <h:panelGrid columns="2"
+ styleClass="directoryBrowserPathPanel"
columnClasses="#{directoryBrowserSettings.treeVisible ? 'treeSwitchOpen':'treeSwitchClosed'}, path"
cellpadding="0" cellspacing="0" border="0">
@@ -29,6 +35,7 @@
</a:commandLink>
</s:fragment>
+-->
<s:fragment>
<h:panelGroup>
Modified: branches/community/Seam_2_2/examples/wiki/view/includes/directoryBrowserTree.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/view/includes/directoryBrowserTree.xhtml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/view/includes/directoryBrowserTree.xhtml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -9,6 +9,8 @@
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:s="http://jboss.com/products/seam/taglib">
+ <!-- Outdated, we do not have nested sets anymore and this needs to be completely rewritten... -->
+
<h:form id="directoryTreeForm" rendered="#{directoryBrowserSettings.treeVisible}">
<rich:tree switchType="ajax"
ajaxSubmitSelection="true"
Modified: branches/community/Seam_2_2/examples/wiki/view/includes/mainMenu.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/view/includes/mainMenu.xhtml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/view/includes/mainMenu.xhtml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -3,6 +3,7 @@
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:c="http://java.sun.com/jstl/core"
xmlns:wiki="http://jboss.com/products/seam/wiki"
xmlns:rich="http://richfaces.ajax4jsf.org/rich"
xmlns:s="http://jboss.com/products/seam/taglib">
@@ -11,11 +12,19 @@
<div class="mainMenuHeader"><ui:insert name="mainMenuHeader"> </ui:insert></div>
- <s:cache region="#{menu.cacheRegion}" key="#{menu.cacheKey}">
- <ui:include src="mainMenuItem.xhtml">
- <ui:param name="node" value="#{menu.root}"/>
- </ui:include>
- </s:cache>
+ <div class="mainMenuBody">
+ <s:cache region="#{menu.cacheRegion}" key="#{menu.cacheKey}">
+ <c:forEach items="#{menu.tree}" var="tn">
+ <s:div styleClass="level#{tn.level}">
+ <h:outputText styleClass="level#{tn.level}Marker level#{tn.level}MarkerDot" value="·"/>
+ <h:outputText styleClass="level#{tn.level}Marker level#{tn.level}MarkerGreaterThan" value=">"/>
+ <h:outputText styleClass="level#{tn.level}Marker level#{tn.level}MarkerSlash" value="/"/>
+ <h:outputText styleClass="level#{tn.level}Marker level#{tn.level}MarkerSpace" value=" "/>
+ <h:outputLink styleClass="level#{tn.level}Link" value="#{wikiURLRenderer.renderURL(tn.node)}">#{tn.node.name}</h:outputLink>
+ </s:div>
+ </c:forEach>
+ </s:cache>
+ </div>
<div class="mainMenuFooter"><ui:insert name="mainMenuFooter"> </ui:insert></div>
Deleted: branches/community/Seam_2_2/examples/wiki/view/includes/mainMenuItem.xhtml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/view/includes/mainMenuItem.xhtml 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/view/includes/mainMenuItem.xhtml 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,28 +0,0 @@
-<ui:composition
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:ui="http://java.sun.com/jsf/facelets"
- xmlns:h="http://java.sun.com/jsf/html"
- xmlns:f="http://java.sun.com/jsf/core"
- xmlns:wiki="http://jboss.com/products/seam/wiki"
- xmlns:c="http://java.sun.com/jstl/core"
- xmlns:s="http://jboss.com/products/seam/taglib">
-
-<c:forEach var="childWrapper" items="#{node.wrappedChildrenSorted}">
- <s:div styleClass="level#{childWrapper.level}">
- <s:div styleClass="level#{childWrapper.level}Body">
- <h:outputText styleClass="level#{childWrapper.level}Marker level#{childWrapper.level}MarkerDot" value="·"/>
- <h:outputText styleClass="level#{childWrapper.level}Marker level#{childWrapper.level}MarkerGreaterThan" value=">"/>
- <h:outputText styleClass="level#{childWrapper.level}Marker level#{childWrapper.level}MarkerSlash" value="/"/>
- <h:outputText styleClass="level#{childWrapper.level}Marker level#{childWrapper.level}MarkerSpace" value=" "/>
- <h:outputLink styleClass="level#{childWrapper.level}Link"
- value="#{wikiURLRenderer.renderURL(childWrapper.wrappedNode)}">#{childWrapper.wrappedNode.name}</h:outputLink>
- </s:div>
- <s:div styleClass="level#{childWrapper.level}Children" style="padding-left: #{childWrapper.level*7}px;">
- <ui:include src="mainMenuItem.xhtml">
- <ui:param name="node" value="#{childWrapper}"/>
- </ui:include>
- </s:div>
- </s:div>
-</c:forEach>
-
-</ui:composition>
Modified: branches/community/Seam_2_2/examples/wiki/view/themes/default/css/mainMenu.css
===================================================================
--- branches/community/Seam_2_2/examples/wiki/view/themes/default/css/mainMenu.css 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/view/themes/default/css/mainMenu.css 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1,10 +1,11 @@
+.mainMenuBody {
+ background-color: #3e3532;
+}
+
#mainMenu .level1 {
background: #3e3532 url(../img/menu.bg.gif) 0 0 repeat-x;
-}
-
-#mainMenu .level1Body {
padding-top: 3px;
- padding-bottom: 3px;
+ padding-bottom: 5px;
}
#mainMenu .level1Marker {
@@ -16,18 +17,13 @@
font-size: 100%;
color: #fff;
text-decoration: none;
- margin-left: 10px;
+ margin-left: 7px;
}
#mainMenu .level1Link:hover {color: #ccc}
-#mainMenu .level1Children {
- background-color: #3e3532;
+#mainMenu .level2 {
border-style: none;
- margin-left: 10px;
-}
-
-#mainMenu .level2 {
padding-top: 2px;
padding-bottom: 2px;
}
@@ -42,11 +38,16 @@
color: #fff;
text-decoration: none;
white-space: nowrap;
+ margin-left: 14px;
}
#mainMenu .level2Link:hover {color: #ccc}
-#mainMenu .level3 {}
+#mainMenu .level3 {
+ border-style: none;
+ padding-top: 2px;
+ padding-bottom: 2px;
+}
#mainMenu .level3Marker {
display: none;
@@ -64,6 +65,7 @@
color: #fff;
text-decoration: none;
white-space: nowrap;
+ margin-left: 21px;
}
#mainMenu .level3Link:hover {color: #ccc}
Modified: branches/community/Seam_2_2/examples/wiki/view/themes/inrelationto/css/inrelationto.css
===================================================================
--- branches/community/Seam_2_2/examples/wiki/view/themes/inrelationto/css/inrelationto.css 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/view/themes/inrelationto/css/inrelationto.css 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1847,16 +1847,12 @@
.mainMenuFooter {
background: #d6d5c8 url(../img/th.bg.gif) 0 0 repeat-x;
height: 35px;
- margin-top: 5px;
}
#mainMenu .level1 {
-}
-
-#mainMenu .level1Body {
+ padding-left: 9px;
padding-top: 3px;
padding-bottom: 3px;
- padding-left: 10px;
}
#mainMenu .level1Marker {
@@ -1872,13 +1868,10 @@
#mainMenu .level1Link:hover {color: #666}
-#mainMenu .level1Children {
- margin-left: 10px;
-}
-
#mainMenu .level2 {
- padding-top: 2px;
- padding-bottom: 2px;
+ padding-top: 1px;
+ padding-bottom: 1px;
+ padding-left: 18px;
}
#mainMenu .level2Marker {
Modified: branches/community/Seam_2_2/examples/wiki/view/themes/sfwkorg/css/sfwk.css
===================================================================
--- branches/community/Seam_2_2/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2010-01-27 16:30:34 UTC (rev 11994)
+++ branches/community/Seam_2_2/examples/wiki/view/themes/sfwkorg/css/sfwk.css 2010-01-27 17:13:25 UTC (rev 11995)
@@ -1804,18 +1804,15 @@
}
#mainMenu .mainMenuHeader {
- border-bottom: 1px solid #433930;
}
#mainMenu .level1 {
+ background-color:#32332B;
+ border-top:1px solid #433930;
+ padding-bottom:3px;
+ padding-top:3px;
}
-#mainMenu .level1Body {
- padding-top: 3px;
- padding-bottom: 3px;
- background-color:#32332b;
-}
-
#mainMenu .level1Marker {
display: none;
}
@@ -1828,13 +1825,8 @@
#mainMenu .level1Link:hover { color: #ffaf64; }
-#mainMenu .level1Children {
- background-color:#2A2B24;
- border-bottom: 1px solid #433930;
-}
-
#mainMenu .level2 {
- padding-left: 10px;
+ padding-left: 15px;
background-color:#2A2B24;
padding-top: 3px;
padding-bottom: 3px;
@@ -1859,10 +1851,6 @@
#mainMenu .level2Link:hover {color: #ffaf64}
-#mainMenu .level2Children {
- background-color: #2A2B24;
-}
-
#mainMenu .level3 {
padding-top: 2px;
padding-bottom: 2px;
14 years, 10 months
Seam SVN: r11994 - branches/community/Seam_2_2/examples/wiki.
by seam-commits@lists.jboss.org
Author: christian.bauer(a)jboss.com
Date: 2010-01-27 11:30:34 -0500 (Wed, 27 Jan 2010)
New Revision: 11994
Modified:
branches/community/Seam_2_2/examples/wiki/build.xml
Log:
JBSEAM-4498, wiki hibernate upgrade final
Modified: branches/community/Seam_2_2/examples/wiki/build.xml
===================================================================
--- branches/community/Seam_2_2/examples/wiki/build.xml 2010-01-26 15:56:44 UTC (rev 11993)
+++ branches/community/Seam_2_2/examples/wiki/build.xml 2010-01-27 16:30:34 UTC (rev 11994)
@@ -88,6 +88,8 @@
<include name="commons-logging*.jar"/>
<include name="dom4j*.jar"/>
<include name="javassist*.jar"/>
+ <include name="slf4j*.jar"/>
+ <include name="log4j*.jar"/>
</fileset>
<fileset dir="${local.lib.dir}"/>
</path>
14 years, 10 months
Seam SVN: r11993 - in branches/community/Seam_2_2/src/test/ftest/examples: dvdstore and 1 other directory.
by seam-commits@lists.jboss.org
Author: jharting
Date: 2010-01-26 10:56:44 -0500 (Tue, 26 Jan 2010)
New Revision: 11993
Modified:
branches/community/Seam_2_2/src/test/ftest/examples/build.xml
branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/build.xml
Log:
minor
Modified: branches/community/Seam_2_2/src/test/ftest/examples/build.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/build.xml 2010-01-26 13:48:08 UTC (rev 11992)
+++ branches/community/Seam_2_2/src/test/ftest/examples/build.xml 2010-01-26 15:56:44 UTC (rev 11993)
@@ -186,7 +186,7 @@
</target>
<target name="deploy.example" depends="container.properties">
- <property name="absolute.wait.url" value="${selenium.browser.url}${wait.url}" />
+ <property name="absolute.wait.url" value="${selenium.browser.url}${wait.url}${example.homepage}" />
<echo>Deploying ${example.name} example to ${container} using ${deploy.target} target</echo>
<ant antfile="${seam.dir}/examples/${example.name}/build.xml" target="${deploy.target}" inheritall="false" dir="${seam.dir}/examples/${example.name}">
<property name="jboss.home" value="${container.home}" />
@@ -196,7 +196,7 @@
<!-- wait for the application to be active -->
<!-- TODO is there a better way? -->
<echo>Waiting ${wait.time} seconds for ${absolute.wait.url}</echo>
- <waitfor maxwait="${wait.time}" maxwaitunit="second">
+ <waitfor maxwait="${wait.time}" maxwaitunit="second" timeoutproperty="timeout">
<and>
<!-- wait for the application to not throw 404 -->
<http url="${absolute.wait.url}" errorsBeginAt="404" />
Modified: branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/build.xml
===================================================================
--- branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/build.xml 2010-01-26 13:48:08 UTC (rev 11992)
+++ branches/community/Seam_2_2/src/test/ftest/examples/dvdstore/build.xml 2010-01-26 15:56:44 UTC (rev 11993)
@@ -22,6 +22,7 @@
-->
<project name="dvdstore.ftest.build" basedir="." default="build">
<property name="example.name" value="dvdstore" />
+ <property name="example.homepage" value="/home" />
<import file="../build.xml" />
14 years, 10 months
Seam SVN: r11992 - in branches/community/Seam_2_2/src: main/org/jboss/seam/contexts and 3 other directories.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-01-26 08:48:08 -0500 (Tue, 26 Jan 2010)
New Revision: 11992
Modified:
branches/community/Seam_2_2/src/main/org/jboss/seam/captcha/CaptchaImage.java
branches/community/Seam_2_2/src/main/org/jboss/seam/contexts/ServletLifecycle.java
branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/AbstractScanner.java
branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/ClassDescriptor.java
branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/DeploymentStrategy.java
branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/FileDescriptor.java
branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/ForwardingAbstractScanner.java
branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/ForwardingDeploymentStrategy.java
branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/GroovyHotDeploymentStrategy.java
branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/HotDeploymentStrategy.java
branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/StandardDeploymentStrategy.java
branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/TimestampCheckForwardingDeploymentStrategy.java
branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/TimestampScanner.java
branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java
branches/community/Seam_2_2/src/main/org/jboss/seam/init/Initialization.java
branches/community/Seam_2_2/src/remoting/org/jboss/seam/remoting/Remoting.java
Log:
JBSEAM-4316
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/captcha/CaptchaImage.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/captcha/CaptchaImage.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/captcha/CaptchaImage.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -50,7 +50,7 @@
{
ByteArrayOutputStream out = new ByteArrayOutputStream();
- ServletLifecycle.beginRequest(request);
+ ServletLifecycle.beginRequest(request,getServletContext());
try
{
ImageIO.write( Captcha.instance().renderChallenge(), "jpeg", out );
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/contexts/ServletLifecycle.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/contexts/ServletLifecycle.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/contexts/ServletLifecycle.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -46,10 +46,32 @@
public static void beginRequest(HttpServletRequest request)
{
+ beginRequest(request,null);
+ }
+
+ public static void beginRequest(HttpServletRequest request,ServletContext context)
+ {
+
+ ServletContext ctx = context;
+ if(ctx == null)
+ {
+ //try and figure out which servlet context to use
+ //from the request.
+ HttpSession session = request.getSession(false);
+ if(session == null)
+ {
+ ctx = servletContext;
+ }
+ else
+ {
+ ctx = session.getServletContext();
+ }
+ }
+
log.debug( ">>> Begin web request" );
Contexts.eventContext.set( new EventContext( new ServletRequestMap(request) ) );
Contexts.sessionContext.set( new SessionContext( new ServletRequestSessionMap(request) ) );
- Contexts.applicationContext.set(new ApplicationContext( Lifecycle.getApplication() ) );
+ Contexts.applicationContext.set(new ApplicationContext( new ServletApplicationMap(ctx) ) );
Contexts.conversationContext.set(null); //in case endRequest() was never called
}
@@ -76,11 +98,16 @@
log.debug( "<<< End web request" );
}
}
-
+ @Deprecated
public static void beginReinitialization(HttpServletRequest request)
{
+ beginReinitialization(request, servletContext);
+ }
+
+ public static void beginReinitialization(HttpServletRequest request,ServletContext servletContext)
+ {
log.debug(">>> Begin re-initialization");
- Contexts.applicationContext.set( new ApplicationContext( Lifecycle.getApplication() ) );
+ Contexts.applicationContext.set( new ApplicationContext( new ServletApplicationMap(servletContext) ) );
Contexts.eventContext.set( new BasicContext(ScopeType.EVENT) );
Contexts.sessionContext.set( new SessionContext( new ServletRequestSessionMap(request) ) );
Contexts.conversationContext.set( new BasicContext(ScopeType.CONVERSATION) );
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/AbstractScanner.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/AbstractScanner.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/AbstractScanner.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -11,6 +11,9 @@
import javassist.bytecode.AnnotationsAttribute;
import javassist.bytecode.ClassFile;
+import javax.servlet.ServletContext;
+
+import org.jboss.seam.contexts.ServletLifecycle;
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
@@ -25,6 +28,8 @@
public abstract class AbstractScanner implements Scanner
{
+ protected ServletContext servletContext;
+
private static class Handler
{
@@ -36,12 +41,14 @@
private Set<Entry<String, DeploymentHandler>> deploymentHandlers;
private ClassLoader classLoader;
private String name;
+ private ServletContext servletContext;
- public Handler(String name, Set<Entry<String, DeploymentHandler>> deploymentHandlers, ClassLoader classLoader)
+ public Handler(String name, Set<Entry<String, DeploymentHandler>> deploymentHandlers, ClassLoader classLoader,ServletContext servletContext)
{
this.deploymentHandlers = deploymentHandlers;
this.name = name;
this.classLoader = classLoader;
+ this.servletContext=servletContext;
}
/**
@@ -115,7 +122,7 @@
{
if (classDescriptor == null)
{
- classDescriptor = new ClassDescriptor(name, classLoader);
+ classDescriptor = new ClassDescriptor(name, classLoader,servletContext);
}
return classDescriptor;
}
@@ -124,7 +131,7 @@
{
if (fileDescriptor == null)
{
- fileDescriptor = new FileDescriptor(name, classLoader);
+ fileDescriptor = new FileDescriptor(name, classLoader,servletContext);
}
return fileDescriptor;
}
@@ -137,14 +144,20 @@
public AbstractScanner(DeploymentStrategy deploymentStrategy)
{
this.deploymentStrategy = deploymentStrategy;
+ this.servletContext=deploymentStrategy.getServletContext();
ClassFile.class.getPackage(); //to force loading of javassist, throwing an exception if it is missing
}
-
+ @Deprecated
protected AbstractScanner()
{
-
+ this.servletContext=ServletLifecycle.getCurrentServletContext();
}
+ protected AbstractScanner(ServletContext servletContext)
+ {
+ this.servletContext=servletContext;
+ }
+
protected static boolean hasAnnotations(ClassFile classFile, Set<Class<? extends Annotation>> annotationTypes)
{
if (annotationTypes.size() > 0)
@@ -209,7 +222,7 @@
protected boolean handle(String name)
{
- return new Handler(name, deploymentStrategy.getDeploymentHandlers().entrySet(), deploymentStrategy.getClassLoader()).handle();
+ return new Handler(name, deploymentStrategy.getDeploymentHandlers().entrySet(), deploymentStrategy.getClassLoader(),servletContext).handle();
}
public void scanDirectories(File[] directories, File[] excludedDirectories)
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/ClassDescriptor.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/ClassDescriptor.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/ClassDescriptor.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -2,6 +2,8 @@
import java.net.URL;
+import javax.servlet.ServletContext;
+
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
@@ -18,9 +20,9 @@
this.clazz = clazz;
}
- public ClassDescriptor(String name, ClassLoader classLoader)
+ public ClassDescriptor(String name, ClassLoader classLoader,ServletContext servletContext)
{
- super(name, classLoader);
+ super(name, classLoader,servletContext);
String classname = filenameToClassname(name);
log.trace("Trying to load class " + classname);
try
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/DeploymentStrategy.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/DeploymentStrategy.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/DeploymentStrategy.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -9,6 +9,8 @@
import java.util.Map;
import java.util.Map.Entry;
+import javax.servlet.ServletContext;
+
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
@@ -65,6 +67,11 @@
* Get the classloader to use
*/
public abstract ClassLoader getClassLoader();
+
+ /**
+ * Get the ServletContext to use
+ */
+ public abstract ServletContext getServletContext();
/**
* Get (or modify) any registered {@link DeploymentHandler}s
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/FileDescriptor.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/FileDescriptor.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/FileDescriptor.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -2,6 +2,8 @@
import java.net.URL;
+import javax.servlet.ServletContext;
+
import org.jboss.seam.contexts.ServletLifecycle;
import org.jboss.seam.util.Resources;
@@ -17,18 +19,26 @@
this.url = url;
}
- public FileDescriptor(String name, ClassLoader classLoader)
+ public FileDescriptor(String name, ClassLoader classLoader,ServletContext servletContext)
{
+ ServletContext ctx = servletContext;
+ if(ctx == null)
+ {
+ //this should not happen but it could if people have created custom scanners
+ ctx = ServletLifecycle.getCurrentServletContext();
+ }
this.name = name;
if (name == null)
{
throw new NullPointerException("Name cannot be null, loading from " + classLoader);
}
- this.url = classLoader.getResource(name);
+ this.url = Resources.getResource(name, ctx);
+
if (url == null)
{
- this.url = Resources.getResource(name, ServletLifecycle.getServletContext());
+ this.url = classLoader.getResource(name);
}
+
if (this.url == null)
{
throw new NullPointerException("Cannot find URL from classLoader for " + name + ", loading from " + classLoader);
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/ForwardingAbstractScanner.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/ForwardingAbstractScanner.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/ForwardingAbstractScanner.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -2,7 +2,9 @@
import java.io.File;
+import javax.servlet.ServletContext;
+
public abstract class ForwardingAbstractScanner extends AbstractScanner
{
@@ -54,4 +56,16 @@
protected abstract AbstractScanner delegate();
+ @Deprecated
+ public ForwardingAbstractScanner()
+ {
+
+ }
+
+
+ public ForwardingAbstractScanner(ServletContext servletContext)
+ {
+ super(servletContext);
+ }
+
}
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/ForwardingDeploymentStrategy.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/ForwardingDeploymentStrategy.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/ForwardingDeploymentStrategy.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -4,6 +4,8 @@
import java.util.List;
import java.util.Map;
+import javax.servlet.ServletContext;
+
/**
* A decorator for DeploymentStrategy
*
@@ -18,6 +20,12 @@
{
return delegate().getClassLoader();
}
+
+ @Override
+ public ServletContext getServletContext()
+ {
+ return delegate().getServletContext();
+ }
@Override
protected String getDeploymentHandlersKey()
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/GroovyHotDeploymentStrategy.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/GroovyHotDeploymentStrategy.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/GroovyHotDeploymentStrategy.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -7,6 +7,8 @@
import java.util.HashSet;
import java.util.Set;
+import javax.servlet.ServletContext;
+
import org.codehaus.groovy.control.CompilerConfiguration;
@@ -31,9 +33,9 @@
* groovy Seam components are placed
*
*/
- public GroovyHotDeploymentStrategy(ClassLoader classLoader, File hotDeployDirectory, boolean enabled)
+ public GroovyHotDeploymentStrategy(ClassLoader classLoader, File hotDeployDirectory, ServletContext servletContext, boolean enabled)
{
- super(classLoader, hotDeployDirectory, enabled);
+ super(classLoader, hotDeployDirectory,servletContext, enabled);
if (enabled)
{
groovyDeploymentHandler = new GroovyDeploymentHandler(DEFAULT_SCRIPT_EXTENSION);
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/HotDeploymentStrategy.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/HotDeploymentStrategy.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/HotDeploymentStrategy.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -9,6 +9,8 @@
import java.util.Map;
import java.util.Set;
+import javax.servlet.ServletContext;
+
import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.util.Reflections;
@@ -54,15 +56,18 @@
private ClassLoader classLoader;
+ private ServletContext servletContext;
+
/**
* @param classLoader The parent classloader of the hot deployment classloader
* @param hotDeployDirectory The directory in which hot deployable Seam
* components are placed
*/
- public HotDeploymentStrategy(ClassLoader classLoader, File hotDeployDirectory, boolean enabled)
+ public HotDeploymentStrategy(ClassLoader classLoader, File hotDeployDirectory, ServletContext servletContext, boolean enabled)
{
if (enabled)
{
+ this.servletContext=servletContext;
this.classLoader = Thread.currentThread().getContextClassLoader();
if (hotDeployDirectory != null && hotDeployDirectory.exists())
{
@@ -140,13 +145,13 @@
* @param hotDeployDirectory The directory which contains hot deployable
* Seam components
*/
- public static HotDeploymentStrategy createInstance(String className, ClassLoader classLoader, File hotDeployDirectory, boolean enabled)
+ public static HotDeploymentStrategy createInstance(String className, ClassLoader classLoader, File hotDeployDirectory, ServletContext servletContext, boolean enabled)
{
try
{
Class initializer = Reflections.classForName(className);
- Constructor ctr = initializer.getConstructor(ClassLoader.class, File.class, boolean.class);
- return (HotDeploymentStrategy) ctr.newInstance(classLoader, hotDeployDirectory, enabled);
+ Constructor ctr = initializer.getConstructor(ClassLoader.class, File.class, ServletContext.class, boolean.class);
+ return (HotDeploymentStrategy) ctr.newInstance(classLoader, hotDeployDirectory, servletContext, enabled);
}
catch (Exception e)
{
@@ -188,5 +193,11 @@
}
return null;
}
+
+ @Override
+ public ServletContext getServletContext()
+ {
+ return servletContext;
+ }
}
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/StandardDeploymentStrategy.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/StandardDeploymentStrategy.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/StandardDeploymentStrategy.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -6,6 +6,8 @@
import java.util.Map;
import java.util.Set;
+import javax.servlet.ServletContext;
+
import org.jboss.seam.contexts.Contexts;
/**
@@ -20,6 +22,8 @@
private ClassLoader classLoader;
+ private ServletContext servletContext;
+
/**
* The files used to identify a Seam archive
*/
@@ -45,12 +49,14 @@
private AnnotationDeploymentHandler annotationDeploymentHandler;
private DotComponentDotXmlDeploymentHandler dotComponentDotXmlDeploymentHandler;
+
/**
* @param classLoader The classloader used to load and handle resources
*/
- public StandardDeploymentStrategy(ClassLoader classLoader)
+ public StandardDeploymentStrategy(ClassLoader classLoader,ServletContext servletContext)
{
this.classLoader = Thread.currentThread().getContextClassLoader();
+ this.servletContext=servletContext;
componentDeploymentHandler = new ComponentDeploymentHandler();
getDeploymentHandlers().put(ComponentDeploymentHandler.NAME, componentDeploymentHandler);
componentsXmlDeploymentHandler = new ComponentsXmlDeploymentHandler();
@@ -123,4 +129,10 @@
}
return null;
}
+
+ @Override
+ public ServletContext getServletContext()
+ {
+ return servletContext;
+ }
}
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/TimestampCheckForwardingDeploymentStrategy.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/TimestampCheckForwardingDeploymentStrategy.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/TimestampCheckForwardingDeploymentStrategy.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -22,7 +22,7 @@
if (getScanner() instanceof AbstractScanner)
{
final AbstractScanner delegate = (AbstractScanner) getScanner();
- this.scanner = new TimestampScanner()
+ this.scanner = new TimestampScanner(getServletContext())
{
@Override
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/TimestampScanner.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/TimestampScanner.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/TimestampScanner.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -1,5 +1,7 @@
package org.jboss.seam.deployment;
+import javax.servlet.ServletContext;
+
/**
* A no-op version of the URLScanner that merely returns whether the deployment
* handler would in fact handle this file. It does not process the file
@@ -32,5 +34,17 @@
}
return false;
}
+
+ @Deprecated
+ public TimestampScanner()
+ {
+
+ }
+
+
+ public TimestampScanner(ServletContext servletContext)
+ {
+ super(servletContext);
+ }
}
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/deployment/WarRootDeploymentStrategy.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -3,6 +3,8 @@
import java.io.File;
import java.util.Set;
+import javax.servlet.ServletContext;
+
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
@@ -20,6 +22,8 @@
private ClassLoader classLoader;
+ private ServletContext servletContext;
+
private File[] warRoot;
private File[] excludedDirectories;
@@ -32,14 +36,15 @@
private PagesDotXmlDeploymentHandler pagesDotXmlDeploymentHandler;
- public WarRootDeploymentStrategy(ClassLoader classLoader, File warRoot)
+ public WarRootDeploymentStrategy(ClassLoader classLoader, File warRoot,ServletContext servletContext)
{
- this(classLoader, warRoot, new File[0]);
+ this(classLoader, warRoot,servletContext, new File[0]);
}
- public WarRootDeploymentStrategy(ClassLoader classLoader, File warRoot, File[] excludedDirectories)
+ public WarRootDeploymentStrategy(ClassLoader classLoader, File warRoot,ServletContext servletContext, File[] excludedDirectories)
{
this.classLoader = classLoader;
+ this.servletContext = servletContext;
this.warRoot = new File[1];
this.excludedDirectories = excludedDirectories;
if (warRoot != null)
@@ -88,4 +93,10 @@
return dotPageDotXmlDeploymentHandler.getResources();
}
+ @Override
+ public ServletContext getServletContext()
+ {
+ return servletContext;
+ }
+
}
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/init/Initialization.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/init/Initialization.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -61,6 +61,7 @@
import org.jboss.seam.log.LogProvider;
import org.jboss.seam.log.Logging;
import org.jboss.seam.navigation.Pages;
+import org.jboss.seam.servlet.ServletApplicationMap;
import org.jboss.seam.util.Conversions;
import org.jboss.seam.util.Naming;
import org.jboss.seam.util.Reflections;
@@ -128,7 +129,7 @@
public Initialization create()
{
- standardDeploymentStrategy = new StandardDeploymentStrategy(Thread.currentThread().getContextClassLoader());
+ standardDeploymentStrategy = new StandardDeploymentStrategy(Thread.currentThread().getContextClassLoader(),servletContext);
standardDeploymentStrategy.scan();
addNamespaces();
initComponentsFromXmlDocument("/WEB-INF/components.xml");
@@ -715,7 +716,7 @@
// Add the war root deployment
warRootDeploymentStrategy = new WarRootDeploymentStrategy(
- Thread.currentThread().getContextClassLoader(), warRoot, new File[] { warClassesDirectory, warLibDirectory, hotDeployDirectory });
+ Thread.currentThread().getContextClassLoader(), warRoot,servletContext, new File[] { warClassesDirectory, warLibDirectory, hotDeployDirectory });
Contexts.getEventContext().set(WarRootDeploymentStrategy.NAME, warRootDeploymentStrategy);
warRootDeploymentStrategy.scan();
init.setWarTimestamp(System.currentTimeMillis());
@@ -744,7 +745,7 @@
public void redeploy(HttpServletRequest request) throws InterruptedException
{
- redeploy(request, (Init) ServletLifecycle.getServletContext().getAttribute( Seam.getComponentName(Init.class) ));
+ redeploy(request, (Init) servletContext.getAttribute( Seam.getComponentName(Init.class) ));
}
public void redeploy(HttpServletRequest request, Init init) throws InterruptedException
@@ -805,7 +806,7 @@
ServletLifecycle.endReinitialization();
}
- final WarRootDeploymentStrategy warRootDeploymentStrategy = new WarRootDeploymentStrategy(Thread.currentThread().getContextClassLoader(), warRoot, new File[] { warClassesDirectory, warLibDirectory, hotDeployDirectory });
+ final WarRootDeploymentStrategy warRootDeploymentStrategy = new WarRootDeploymentStrategy(Thread.currentThread().getContextClassLoader(), warRoot, servletContext, new File[] { warClassesDirectory, warLibDirectory, hotDeployDirectory });
changed = new TimestampCheckForwardingDeploymentStrategy()
{
@Override
@@ -854,12 +855,12 @@
if (isGroovyPresent())
{
log.debug("Using Java + Groovy hot deploy");
- return HotDeploymentStrategy.createInstance("org.jboss.seam.deployment.GroovyHotDeploymentStrategy", classLoader, hotDeployDirectory, hotDeployEnabled);
+ return HotDeploymentStrategy.createInstance("org.jboss.seam.deployment.GroovyHotDeploymentStrategy", classLoader, hotDeployDirectory, servletContext, hotDeployEnabled);
}
else
{
log.debug("Using Java hot deploy");
- return new HotDeploymentStrategy(classLoader, hotDeployDirectory, hotDeployEnabled);
+ return new HotDeploymentStrategy(classLoader, hotDeployDirectory, servletContext, hotDeployEnabled);
}
}
Modified: branches/community/Seam_2_2/src/remoting/org/jboss/seam/remoting/Remoting.java
===================================================================
--- branches/community/Seam_2_2/src/remoting/org/jboss/seam/remoting/Remoting.java 2010-01-26 12:11:29 UTC (rev 11991)
+++ branches/community/Seam_2_2/src/remoting/org/jboss/seam/remoting/Remoting.java 2010-01-26 13:48:08 UTC (rev 11992)
@@ -68,7 +68,7 @@
{
try
{
- ServletLifecycle.beginRequest(request);
+ ServletLifecycle.beginRequest(request,getServletContext());
StringBuilder sb = new StringBuilder();
sb.append("\nSeam.Remoting.resourcePath = \"");
14 years, 10 months
Seam SVN: r11991 - branches/community/Seam_2_2/src/main/org/jboss/seam/init.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-01-26 07:11:29 -0500 (Tue, 26 Jan 2010)
New Revision: 11991
Modified:
branches/community/Seam_2_2/src/main/org/jboss/seam/init/Initialization.java
Log:
JBSEAM-4334
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/init/Initialization.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/init/Initialization.java 2010-01-25 23:55:21 UTC (rev 11990)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/init/Initialization.java 2010-01-26 12:11:29 UTC (rev 11991)
@@ -755,93 +755,89 @@
return;
}
- ReentrantLock lock = new ReentrantLock();
- if (lock.tryLock(500, TimeUnit.MILLISECONDS))
+ try
{
- try
+ hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader(), isHotDeployEnabled(init));
+
+ boolean changed = new TimestampCheckForwardingDeploymentStrategy()
{
- hotDeploymentStrategy = createHotDeployment(Thread.currentThread().getContextClassLoader(), isHotDeployEnabled(init));
-
- boolean changed = new TimestampCheckForwardingDeploymentStrategy()
+ @Override
+ protected DeploymentStrategy delegate()
{
- @Override
- protected DeploymentStrategy delegate()
- {
- return hotDeploymentStrategy;
- }
-
- }.changedSince(init.getTimestamp());
+ return hotDeploymentStrategy;
+ }
- if (hotDeploymentStrategy.available() && changed)
+ }.changedSince(init.getTimestamp());
+
+ if (hotDeploymentStrategy.available() && changed)
+ {
+ ServletLifecycle.beginReinitialization(request);
+ Contexts.getEventContext().set(HotDeploymentStrategy.NAME, hotDeploymentStrategy);
+ hotDeploymentStrategy.scan();
+
+ if (hotDeploymentStrategy.getTimestamp() > init.getTimestamp())
{
- ServletLifecycle.beginReinitialization(request);
- Contexts.getEventContext().set(HotDeploymentStrategy.NAME, hotDeploymentStrategy);
- hotDeploymentStrategy.scan();
-
- if (hotDeploymentStrategy.getTimestamp() > init.getTimestamp())
+ log.debug("redeploying components");
+ Seam.clearComponentNameCache();
+ for ( String name: init.getHotDeployableComponents() )
{
- log.debug("redeploying components");
- Seam.clearComponentNameCache();
- for ( String name: init.getHotDeployableComponents() )
+ Component component = Component.forName(name);
+ if (component!=null)
{
- Component component = Component.forName(name);
- if (component!=null)
+ ScopeType scope = component.getScope();
+ if ( scope!=ScopeType.STATELESS && scope.isContextActive() )
{
- ScopeType scope = component.getScope();
- if ( scope!=ScopeType.STATELESS && scope.isContextActive() )
- {
- scope.getContext().remove(name);
- }
- init.removeObserverMethods(component);
+ scope.getContext().remove(name);
}
- Contexts.getApplicationContext().remove(name + COMPONENT_SUFFIX);
+ init.removeObserverMethods(component);
}
-
- init.getHotDeployableComponents().clear();
- installHotDeployableComponents();
- installComponents(init);
- log.debug("done redeploying components");
+ Contexts.getApplicationContext().remove(name + COMPONENT_SUFFIX);
}
- // update the timestamp outside of the second timestamp check to be sure we don't cause an unnecessary scan
- // the second scan checks annotations (the slow part) which might happen to exclude the most recent file
- init.setTimestamp(System.currentTimeMillis());
- ServletLifecycle.endReinitialization();
+
+ init.getHotDeployableComponents().clear();
+ installHotDeployableComponents();
+ installComponents(init);
+ log.debug("done redeploying components");
}
-
- final WarRootDeploymentStrategy warRootDeploymentStrategy = new WarRootDeploymentStrategy(Thread.currentThread().getContextClassLoader(), warRoot, new File[] { warClassesDirectory, warLibDirectory, hotDeployDirectory });
- changed = new TimestampCheckForwardingDeploymentStrategy()
+ // update the timestamp outside of the second timestamp check to be sure we don't cause an unnecessary scan
+ // the second scan checks annotations (the slow part) which might happen to exclude the most recent file
+ init.setTimestamp(System.currentTimeMillis());
+ ServletLifecycle.endReinitialization();
+ }
+
+ final WarRootDeploymentStrategy warRootDeploymentStrategy = new WarRootDeploymentStrategy(Thread.currentThread().getContextClassLoader(), warRoot, new File[] { warClassesDirectory, warLibDirectory, hotDeployDirectory });
+ changed = new TimestampCheckForwardingDeploymentStrategy()
+ {
+ @Override
+ protected DeploymentStrategy delegate()
{
- @Override
- protected DeploymentStrategy delegate()
- {
- return warRootDeploymentStrategy;
- }
-
- }.changedSince(init.getWarTimestamp());
- if (changed)
+ return warRootDeploymentStrategy;
+ }
+
+ }.changedSince(init.getWarTimestamp());
+ if (changed)
+ {
+ warRootDeploymentStrategy.scan();
+ if (warRootDeploymentStrategy.getTimestamp() > init.getWarTimestamp())
{
- warRootDeploymentStrategy.scan();
- if (warRootDeploymentStrategy.getTimestamp() > init.getWarTimestamp())
- {
- log.debug("redeploying page descriptors...");
- Pages pages = (Pages) ServletLifecycle.getServletContext().getAttribute(Seam.getComponentName(Pages.class));
- if (pages != null) {
- // application context is needed for creating expressions
- Lifecycle.setupApplication();
- pages.initialize(warRootDeploymentStrategy.getDotPageDotXmlFileNames());
- Lifecycle.cleanupApplication();
- }
- ServletLifecycle.getServletContext().removeAttribute(Seam.getComponentName(Exceptions.class));
- init.setWarTimestamp(warRootDeploymentStrategy.getTimestamp());
- log.debug ("done redeploying page descriptors");
+ log.debug("redeploying page descriptors...");
+ Pages pages = (Pages) ServletLifecycle.getServletContext().getAttribute(Seam.getComponentName(Pages.class));
+ if (pages != null) {
+ // application context is needed for creating expressions
+ Lifecycle.setupApplication();
+ pages.initialize(warRootDeploymentStrategy.getDotPageDotXmlFileNames());
+ Lifecycle.cleanupApplication();
}
+ ServletLifecycle.getServletContext().removeAttribute(Seam.getComponentName(Exceptions.class));
+ init.setWarTimestamp(warRootDeploymentStrategy.getTimestamp());
+ log.debug ("done redeploying page descriptors");
}
}
- finally
- {
- lock.unlock();
- }
}
+ finally
+ {
+
+ }
}
private void installHotDeployableComponents()
14 years, 10 months
Seam SVN: r11990 - branches/community/Seam_2_2/src/main/org/jboss/seam/persistence.
by seam-commits@lists.jboss.org
Author: manaRH
Date: 2010-01-25 18:55:21 -0500 (Mon, 25 Jan 2010)
New Revision: 11990
Modified:
branches/community/Seam_2_2/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java
Log:
JBSEAM-3778
Modified: branches/community/Seam_2_2/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java
===================================================================
--- branches/community/Seam_2_2/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java 2010-01-25 16:31:18 UTC (rev 11989)
+++ branches/community/Seam_2_2/src/main/org/jboss/seam/persistence/ManagedPersistenceContext.java 2010-01-25 23:55:21 UTC (rev 11990)
@@ -22,6 +22,7 @@
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.annotations.Unwrap;
import org.jboss.seam.annotations.intercept.BypassInterceptors;
+import org.jboss.seam.contexts.Contexts;
import org.jboss.seam.contexts.Lifecycle;
import org.jboss.seam.core.Mutable;
import org.jboss.seam.core.Expressions.ValueExpression;
@@ -199,32 +200,36 @@
private void close()
{
- boolean transactionActive = false;
-
- try
+ if (Contexts.isEventContextActive())
{
- UserTransaction tx = Transaction.instance();
- try
+
+ boolean transactionActive = false;
+
+ try
{
- transactionActive = tx.isActive();
+ UserTransaction tx = Transaction.instance();
+ try
+ {
+ transactionActive = tx.isActive();
+ }
+ catch (SystemException se)
+ {
+ log.debug("could not get transaction status while destroying persistence context");
+ }
}
- catch (SystemException se)
+ catch (Exception e)
{
- log.debug("could not get transaction status while destroying persistence context");
+ // WebSphere throws a javax.naming.ConfigurationException when Transaction.instance() is called during HTTP Session expiration
+ // and there is no JNDI lookup possible. See details there: JBSEAM-4332
+ log.warn("could not get transaction while destroying persistence context. (called during session expiration ?)");
}
+
+ if ( transactionActive )
+ {
+ throw new IllegalStateException("attempting to destroy the persistence context while an active transaction exists (try installing <transaction:ejb-transaction/>)");
+ }
}
- catch (Exception e)
- {
- // WebSphere throws a javax.naming.ConfigurationException when Transaction.instance() is called during HTTP Session expiration
- // and there is no JNDI lookup possible. See details there: JBSEAM-4332
- log.warn("could not get transaction while destroying persistence context. (called during session expiration ?)");
- }
- if ( transactionActive )
- {
- throw new IllegalStateException("attempting to destroy the persistence context while an active transaction exists (try installing <transaction:ejb-transaction/>)");
- }
-
if ( log.isDebugEnabled() )
{
log.debug("destroying seam managed persistence context for persistence unit: " + persistenceUnitJndiName);
14 years, 10 months