--- En date de : Lun 9.2.15, Clemens Klein-Robbenhaar
c.robbenh...@espresto.com a écrit :
De: Clemens Klein-Robbenhaar c.robbenh...@espresto.com
Objet: Re: [xwiki-users] Need doc about access object in a page (and use doc)
À: users@xwiki.org
Date: Lundi 9 février 2015, 13h29
On 02/09/2015 10:15 AM,
Pascal BASTIEN wrote:
Hello,
I read/apply this doc with succcess:
http://platform.xwiki.org/xwiki/bin/view/DevGuide/APIGuide#HAccessobjectsinapage
With this code I can
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/XWiki.html#getClass%28java.lang.String%29
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/Document.html#getObjects%28java.lang.String%29
$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
( http://platform.xwiki.org/xwiki/bin/view/SRD/Navigation?xpage=embed
and or
http://nexus.xwiki.org/nexus/service/local/repositories/releases/archive/org/xwiki/platform/xwiki-platform-oldcore/6.4/xwiki-platform-oldcore-6.4-javadoc.jar/!/index.html
)
to guess xWikiClass (or my loop)
by example?
A
doc/example to use documentation will be welcome. :-)
thxs for any
help.
Pascal
B
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
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
robbenh...@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@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
___
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users