--- En date de : Lun 9.2.15, Clemens Klein-Robbenhaar <c.robbenhaar(a)espresto.com> a
écrit :
De: Clemens Klein-Robbenhaar
<c.robbenhaar(a)espresto.com>
Objet: Re: [xwiki-users] Need doc about access object in a page (and use doc)
À: users(a)xwiki.org
Date: Lundi 9 février 2015, 13h29
On 02/09/2015 10:15 AM,
Pascal BASTIEN wrote:
display all objects ATTACHED to THIS page.
***********
#set($class = $obj.xWikiClass) ## access the class object
representing SomeSpace.SomeClass
#foreach($prop in $class.properties) ## go
through all
properties
> ...
***********
but if I attached some
class to another
page, how can I list properties?
the $xwiki object has a method
to access the class if you know the name
#set( $someClass =
$xwiki.getClass("SomeSpace.SomeClass"))
http://maven.xwiki.org/site/docs/xwiki-javadoc-4.1.x/com/xpn/xwiki/api/XWik…
This code (probably false) doesn't work.
#set( $Class = $xwiki.getClass("MySpace.MyClass"))
#foreach($prop in $class.properties) ## go through all properties
* ${prop.prettyName} : $doc.display($prop.getName())
#end
Another question:
I have a page with 3 same Class, how to
list them (like ?editor=class did)?
you can get a list of of objects of a certain
class via
$doc.getObjects("SomeSpace.SomeClass")
http://maven.xwiki.org/site/docs/xwiki-javadoc-4.1.x/com/xpn/xwiki/api/Docu…
$doc.getObjects("SomeSpace.SomeClass")
I failed to :-(
The thing I don't understand is, my values are stored in a doc with attached class. I
need theses value from another doc but all method have Class name parameter ... Class name
contain only field (properties) name?
(Hope I will understand how find answer in javadoc to avoid disturbed nice people of user
list)
Thxs
An example:
MySpaceMyClass contain this Class properties:
- My Field ID (IdField: String)
- My Lib Field (LibField: String)
I create MySpace.MyNiceDoc and add my
previous Class
MySpace/MyNiceDoc?editor=object
and contain:
Objets
de type MySpace.MyClass (2)
* MyClass
0
- My Field ID
- My Lib Field
*MyClass 1:
- My Field ID
- My Lib Field
With it I like to fill a select list from
this doc (but from another doc to).
How
can I proceed? because on
MySpace.MyNiceDoc I can only
display one/First Lib values with this code:
{{velocity}}
##
Retrieve the first object (index [0]) among all objects
attached to this page and of a certain class
#set($obj =
$doc.getObject('MySpace.MyClass'))
#set($class = $obj.xWikiClass) ## access
the class object representing SomeSpace.SomeClass
#foreach($prop in $class.properties) ## go
through all properties
*
${prop.prettyName} :
$doc.display($prop.getName())
#end
{{/velocity}}
I guess i need a loop but which one?
And the big question
(who I think it will interest everyone), how can I use
documentation
and or
http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/or…
)
to guess xWikiClass (or my loop)
by
example?
A
doc/example to use documentation will be welcome. :-)
thxs for any
help.
Pascal
B
_______________________________________________
mit freundlichen Grüßen
Clemens Klein-Robbenhaar
--
Clemens Klein-Robbenhaar
Software Development
EsPresto
AG
Breite Str. 30-31
10178
Berlin/Germany
Tel: +49.(0)30.90 226.763
Fax: +49.(0)30.90 226.760
robbenhaar(a)espresto.com
HRB 77554 B -
Berlin-Charlottenburg
Vorstand: Maya
Biersack, Peter Biersack
Vorsitzender des
Aufsichtsrats: Dipl.-Wirtsch.-Ing. Winfried Weber
Zertifiziert nach ISO 9001:2008
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users