OK, $obj.getProperty("prop").getValue() gets the desired values.
$sorttool.sort conforms only to java bean standards.
I'll implement something like
$sorttool.*sort<http://velocity.apache.org/tools/releases/1.4/javadoc/org/apache/velocity/tools/generic/SortTool.html#sort(java.util.Collection,
java.util.List)>*(java.util.Collection collection,
java.util.List properties) that conforms to XWiki Object standards.
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…