Author: jalkanen
Date: Sun Apr 12 12:11:34 2009
New Revision: 764293
URL: http://svn.apache.org/viewvc?rev=764293&view=rev
Log:
Minor refactorings and comments.
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/JCRWikiPage.java
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
Modified: incubator/jspwiki/trunk/src/java/org/apache/wiki/JCRWikiPage.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/JCRWikiPage.java?rev=764293&r1=764292&r2=764293&view=diff
==============================================================================
--- incubator/jspwiki/trunk/src/java/org/apache/wiki/JCRWikiPage.java (original)
+++ incubator/jspwiki/trunk/src/java/org/apache/wiki/JCRWikiPage.java Sun Apr
12 12:11:34 2009
@@ -185,9 +185,13 @@
/* (non-Javadoc)
* @see org.apache.wiki.WikiPage#getAttributes()
*/
+ //
+ // This method will be removed, since it makes no sense to get
+ // all of the attributes, as the end result may be very, very large.
+ //
public Map<String,Serializable> getAttributes()
{
- return null; // FIXME: m_attributes;
+ return null;
}
/* (non-Javadoc)
Modified:
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
URL:
http://svn.apache.org/viewvc/incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java?rev=764293&r1=764292&r2=764293&view=diff
==============================================================================
---
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
(original)
+++
incubator/jspwiki/trunk/src/java/org/apache/wiki/content/ContentManager.java
Sun Apr 12 12:11:34 2009
@@ -426,7 +426,7 @@
public Collection<WikiPage> getAllPages( String space )
throws ProviderException
{
- ArrayList<WikiPage> result = new ArrayList<WikiPage>();
+ Set<WikiPage> result = new TreeSet<WikiPage>();
try
{
Session session = m_sessionManager.getSession();
@@ -442,8 +442,10 @@
Node n = ni.nextNode();
// Hack to make sure we don't add the space root node.
- if( n.getDepth() != 2 )
+ if( !isSpaceRoot(n) )
+ {
result.add( new JCRWikiPage( getEngine(), n ) );
+ }
}
}
catch( RepositoryException e )
@@ -458,6 +460,16 @@
return result;
}
+ /**
+ * Returns true, if this Node is the root node of a space.
+ *
+ * @param nd Node to check
+ * @return true, if this is a root node of a space.
+ */
+ private boolean isSpaceRoot(Node nd) throws RepositoryException
+ {
+ return nd.getPath().startsWith( "/"+JCR_PAGES_NODE ) && nd.getDepth()
== 2;
+ }
/**
* Returns the WikiEngine to which this PageManager belongs to.
@@ -698,9 +710,14 @@
return m_repository.getDescriptor( Repository.REP_NAME_DESC );
}
+ /**
+ * Return the FQN of the class implementing Repository.
+ *
+ * @return A class name.
+ */
public String getProvider()
{
- return m_repository.getDescriptor( Repository.SPEC_NAME_DESC );
+ return m_repository.getClass().getName();
}
/**
@@ -720,6 +737,7 @@
{
return getAllPages(space).size();
}
+
/**
* Returns true, if the page exists (any version).
*
@@ -975,6 +993,10 @@
}
// Stash the page ACL, author, attributes, modified-date, name and
new text as workflow attributes
+
+ // FIXME: This does not work, since the attribute list can be
exceedingly big (in the order of gigabytes).
+ // Alternate method required.
+
workflow.setAttribute( PRESAVE_PAGE_ACL, page.getAcl() );
workflow.setAttribute( PRESAVE_PAGE_AUTHOR, author );
workflow.setAttribute( PRESAVE_PAGE_ATTRIBUTES,
(Serializable)page.getAttributes() );