Wiki source code of Database List

Last modified by Vincent Massol on 2020/02/17

Show last authors
1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
5 Note that the following screenshots are taken from using [[AWM>>extensions:Extension.App Within Minutes Application]] but you'll find the same properties when using the [[class editor>>Documentation.UserGuide.Features.PageEditing||anchor="HClasseseditingmode"]].
6
7 = Displaying XWikiDocument properties =
8
9 To display ##XWikiDocument## properties values like ##doc.title##, ##doc.author##, ##doc.fullName## (see full list on the [[Hibernate mapping document>>https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/xwiki.hbm.xml#L39]]) from another application (represented for example by the class ##Domains.Code.DomainClass##)you can use the following fields:
10
11 * ##XWIKI CLASS NAME## (the class for the application you want to pull the data from)
12 * ##ID FIELD NAME## (usually "doc.fullName" to uniquely identify the document(s) selected)
13 * ##VALUE FIELD NAME## (usually ##doc.title## because it represents the pretty name displayed to the user)
14
15 == AWM Example ==
16
17 {{gallery}}
18 image:ClassnameExample.png
19 {{/gallery}}
20
21 = Displaying custom properties =
22
23 When you need to display a certain property value from another application (represented for example by the class ##application.Code.applicationClass##) inside the database list you should use the "Hibernate Query" field. For example, to fill in the list with the values of the property "shortText1" (property name automatically generated by the AWM wizard) for an AWM "application", the "Hibernate Query" field should use the following value (assuming "shortText1" is "Short Text" which means "StringProperty" for the [[Hibernate mapping>>https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/xwiki.hbm.xml#L244]]):
24
25 {{code}}
26 select d.fullName, prop.id.value from XWikiDocument as d, BaseObject as o,
27 StringProperty as prop where o.name = d.fullName and o.className = 'application.Code.applicationClass'
28 and d.fullName <> 'application.Code.applicationTemplate' and o.id=prop.id.id and prop.id.name='shortText1'
29 {{/code}}
30
31 == AWM Example ==
32
33 {{gallery}}
34 image:HQLExample.png
35 {{/gallery}}
36
37 == How it looks in a LiveTable ==
38
39 * The "application list" property is displayed using a "database list" and the "Hibernate Query" above
40 * The "domains" property is displayed using a "database list" and the XWikiDocument properties
41
42 {{gallery}}
43 image:viewmode.png
44
45 image:editmode.png
46 {{/gallery}}
47
48 = Related Reading =
49
50 * [[Master/Details tutorial>>Documentation.DevGuide.Tutorials.MasterDetailTutorial.WebHome]]

Get Connected