Is there a way to get the most recently created page in the repository? I am
currently using this to get a particular page ("/index" in this case):
WebContext webContext = (WebContext)
FactoryUtil.newInstance(WebContext.class);
webContext.init(request , response ,
request.getSession().getServletContext());
MgnlContext.setInstance(webContext);
// now you should be able to access HierarchyManager on this
context
HierarchyManager websiteHierarchy =
webContext.getHierarchyManager("website");
Content contentIndex =
websiteHierarchy.getContent("/index");
System.out.println("title [" + contentIndex.getTitle()
+"]");
Collection children =
contentIndex.getChildren(ItemType.CONTENTNODE);
System.out.println("children size [" + children.size()
+"]");
Iterator childrenIterator = children.iterator();
while (childrenIterator.hasNext()) {
Content child = (Content) childrenIterator.next();
Iterator paraIterator =
child.getChildren(ItemType.CONTENTNODE).iterator();
while (paraIterator.hasNext()) {
Content para = (Content) paraIterator.next();
contentString +=
para.getNodeData("text").getString();
}
}
and am not sure if it can be modified to to get the most recently created
page.
--
View this message in context:
http://www.nabble.com/Is-it-possible-to-get-the-most-recently-created-page-tp24597556p24597556.html
Sent from the Magnolia - User mailing list archive at Nabble.com.
----------------------------------------------------------------
For list details see
http://www.magnolia-cms.com/home/community/mailing-lists.html
To unsubscribe, E-mail to: <[email protected]>
----------------------------------------------------------------