I read the code, but it doesn't sort by multiple properties.
I'm writing components that help sort by properties.
On Fri, Nov 16, 2012 at 11:04 PM, Eduard Moraru <enygma2002(a)gmail.com>wrote;wrote:
Hi,
I`ve recently published a snippet [1] that provides a macro for sorting
lists of XWiki objects in velocity.
As for platform, we should probably either include such a macro in
macros.vm, or extend SortTool and expose a method for handling XWiki
objects.
Hope this helps,
Eduard
----------
[1]
http://extensions.xwiki.org/xwiki/bin/view/Extension/Sort+a+list+of+XWiki+o…
On Fri, Nov 16, 2012 at 7:40 AM, crocket <crockabiscuit(a)gmail.com> wrote:
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/t…
,
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:
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/docs/xwiki-javadoc-4.2.x/com/xpn/xwiki/objects/…
>>
>> 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<
http://velocity.apache.org/tools/devel/javadoc/org/apache/velocity/tools/ge…
>
>
> > 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/mailman/listinfo/devs>
> >>
>
> >
______________________________**_________________
> > devs mailing list
> > devs(a)xwiki.org
> >
http://lists.xwiki.org/**mailman/listinfo/devs<
>
http://lists.xwiki.org/mailman/listinfo/devs>
>
>
_______________________________________________
> devs mailing list
> devs(a)xwiki.org
>
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs