,
I saw
"The sort method takes two parameters a collection and a property name or
an array of property names. The property names and corresponding methods
must conform to java bean standards since commons-beanutils is used to
extract the property values."
XWiki Objects don't support java bean standards.
I guess they could be extracted by
$obj.getProperty("prop").getProperty().getValue()
The problem now is to figure out the right sort algorithms for sorting
based on multiple properties.
On Fri, Nov 16, 2012 at 3:06 AM, Jerome Velociter <jerome(a)velociter.fr>wrote;wrote:
Hi,
On 11/15/2012 03:00 PM, crocket wrote:
Ouch, there is a typo. $xwiki -> $doc
#set($services=$xwiki.**getDocument("Private.Snowberry Network
Services").getObjects("**Private.NetworkServices"))
#foreach($prop in $services[0].getProperties())
$services[0].getProperty($**prop.getName()).getName() =
$services[0].getProperty($**prop.getName()).getProperty().**
getClassType()
#end
The velocity snippet above produced an output.
port = com.xpn.xwiki.objects.**LongProperty
protocol = com.xpn.xwiki.objects.**StringListProperty
application = com.xpn.xwiki.objects.**StringProperty
description = com.xpn.xwiki.objects.**StringProperty
service = com.xpn.xwiki.objects.**StringProperty
firewalled = com.xpn.xwiki.objects.**IntegerProperty
It appears that objects returned from $doc.getObjects("Class") have
properties that belong to com.xpn.xwiki.objects package.
I perused the package on
http://maven.xwiki.org/site/**docs/xwiki-javadoc-4.2.x/com/**
xpn/xwiki/objects/package-**summary.html<http://maven.xwiki.org/site/doc…
I guess I will have to implement a Comparator that compares each of the
following properties in the com.xpn.xwiki.objects package.
BaseStringProperty
DateProperty
DoubleProperty
FloatProperty
IntegerProperty
LongProperty
NumberProperty
Am I doing it right? or is it a bad idea to make separate comparison codes
for each of those properties?
You might be interested by
http://velocity.apache.org/**
tools/devel/javadoc/org/**apache/velocity/tools/generic/**SortTool.html<…
Hope this helps,
Jerome
On Thu, Nov 15, 2012 at 9:57 PM, crocket
<crockabiscuit(a)gmail.com> wrote:
I want to make such a Comparator so that I can sort objects retrieved by
$xwiki.getObjects("Class")
If I had the Comparator, I'd be able to pass it to a collection sort
method and sort objects.
I'm planning to make that Comparator in a groovy snippet.
I may be able to make a Component for that even.
Is it possible?
If it was possible, would you give me some hints?
______________________________**_________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/**mailman/listinfo/devs<http://lists.xwiki.org/ma…
______________________________**_________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/**mailman/listinfo/devs<http://lists.xwiki.org/ma…