Hide last authors
Vincent Massol 33.1 1 {{box cssClass="floatinginfobox" title="**Contents**"}}
2 {{toc/}}
3 {{/box}}
4
Jerome 16.1 5 XWiki is not just your average wiki engine; it exposes a flexible data model that can be leveraged at the presentation level. Combined with its powerful presentation level scripting capabilities, XWiki's data model can help you build simple to complex Web applications with little or no need to access the XWiki core. In other words, you can build custom applications through the XWiki web interface without having to compile, package, and deploy software components.
Vincent Massol 1.1 6
Vincent Massol 1.5 7 This area explains XWiki's data model of Classes, Properties, and Objects for those users who want to build applications primarily at the presentation level. It will help you understand how you can achieve significant features by programming at this level alone.
Vincent Massol 1.1 8
Vincent Massol 36.3 9 For information about XWiki's underlying database schema (tables and fields), see: [[XWiki's Database Schema>>platform:DevGuide.DatabaseSchema]].
Vincent Massol 1.1 10
Silvia Macovei 18.1 11 = XWiki Classes, Objects, and Properties =
Silvia Macovei 17.1 12
MaximeHilaire 1.7 13 If you are familiar with object oriented programming, you understand the concept of classes, properties, and objects. The presentation level data model that XWiki exposes is much the same.
Vincent Massol 1.1 14
Manuel Smeria 29.2 15 ; Classes
Silvia Macovei 18.1 16 : An XWiki class is like a template that defines a unique type of object. It defines what properties an object can have. When you define a custom class, you are saying that your application may need to create one or many objects (instances) of that class. The class itself is like a cookie cutter and the objects are unique instances of that class. So, in this analogy, if the class is the cookie cutter, the objects are the cookies (and we are talking about real edible cookies in this analogy; not Web cookies).
17 : A class is attached to a page. There can be at most one class per page. The class name is the name of the document it is attached to.
Vincent Massol 30.1 18
Manuel Smeria 29.2 19 ; Properties
Marius Dumitru Florea 28.1 20 : Properties are the characteristics that an object can have. In a class definition, the properties define the data fields that each unique instance of the class can have values for. Properties have displayers which control how the property value is displayed in view or edit mode. Some displayers use advanced pickers to help you input a valid property value.
Eduard Moraru 33.2 21 : XWiki currently supports the following kinds of properties (data types):
Ludovic Dubost 32.1 22
Eduard Moraru 33.2 23 (((
Vincent Massol 62.2 24 |= Field Type|= Since Version |= Description |= Screenshots
25 |//String//||Allows to store and display one line texts |
26 |//TextArea//||Allows to store and display large text fields (text and wysiwyg)|
27 |//Number//||Allows to store and display Numbers of type integer,long,float,double|
28 |//Password//||Allows to store password fields which can be encrypted or hashed |
29 |//EMail//|4.2M3 |Allows to store email fields that can be obfuscated at display time |
30 |//Boolean//||Allows to store and display boolean values (yes/no or 1/0) which can be displayed as select or checkbox fields |
31 |[[//Static List//>>.Static List.WebHome]]||Allows to store and display single-select or multi-select fields that can be displayed as select, checkbox, radio or suggests fields. The possible values of static list fields are configured in the field definition.
32 |[[//Database List//>>.DatabaseList.WebHome]]||Allows to store and display single-select or multi-select fields that can be displayed as select, checkbox, radio or suggests fields. The possible values of database list fields are taken from the execution of a query on other XWiki data such as pages or objects. The query is typically expressed in the Hibernate Query Language (see [[XWiki Query Module>>extensions:Extension.Query Module]]) and it can use [[the Velocity script notation>>Documentation.DevGuide.Scripting.WebHome]] (as long as the XWiki class author has [[the required scripting permission>>extensions:Extension.Security Module]]) for including dynamic parameters such as the current page space, the current time, etc.|{{image reference="dbListSuggestInput.png"/}}
33 |//Database Tree List//||Same as a Database List field, with the addition that the data can be displayed as a tree, using the Yahoo Javascript Tree library |
34 |//Page//|4.2M3|Same as a Database List field, but made to store XWiki page names. |(((
Adel Atallah 55.1 35 {{image reference="pageSuggestInput.png"/}}
36 )))
Vincent Massol 62.2 37 |//Date//||Allows to store and display date or datetime values. A date picker is used automatically for this field as shown below. |(((
Marius Dumitru Florea 60.1 38 {{image reference="dateTimePicker.png"/}}
Eduard Moraru 33.2 39 )))
Vincent Massol 62.2 40 |//User List//||Allows to store and display single-select or multi-select users. The field uses a user picker as shown below.|(((
Marius Dumitru Florea 41.1 41 {{image reference="userPicker-singleSelection.png"/}}{{image reference="userPicker-multipleSelection.png"/}}{{image reference="userPicker-view.png"/}}
Eduard Moraru 33.2 42 )))
Vincent Massol 62.2 43 |//Group List//||Allows to store and display single-select or multi-select groups. The field uses a user picker as shown below.|(((
Eduard Moraru 33.2 44 {{image reference="groupPicker-editMultiple.png"/}}
45 )))
Vincent Massol 62.2 46 |//[[Computed Pseudofield]]//|4.2M3|Allows to create a pseudo field for which the display can be configured using a custom displayer and the value retrieved by using a script. It allows to combine other fields together.|
47 |//Time Zone//|7.3M1|Allow to display and edit Time Zones.|
Ludovic Dubost 32.1 48
Vincent Massol 36.3 49 : Starting with version 4.3M2 you can define [[your own property types>>platform:DevGuide.CreatingNewXClassPropertyTypes]].
Marius Dumitru Florea 21.1 50
Manuel Smeria 29.2 51 ; Objects
Silvia Macovei 18.1 52 : Objects are unique instances of a class with unique values defined for each of the properties that make up the class.
53 : An object is attached to a specific page. Each page can have multiple objects.
54 : Using objects, you insert **structured** information in the wiki, while in a traditional wiki you can only enter unstructured information (plain text). This is one of the reasons why XWiki is a second generation wiki.
Vincent Massol 1.1 55
Silvia Macovei 17.1 56 //In summary//:
Vincent Massol 1.1 57
58 * Classes define an object type and the properties that are possible for an object of that type to have.
59 * Properties define the types of data that unique objects can have. The property types (datatypes) are defined for the class, but the actual values for the properties are defined for the objects when the objects are instantiated from the class.
60 * Objects are unique instances of a class with unique values for all of the properties that the class definition allows the objects to have.
Vincent Massol 33.1 61
62 = Suggested Reading =
63
Vincent Massol 36.3 64 * Armed with your knowledge of Classes and Objects you could try creating a small application, such as a FAQ application, by following this [[FAQ Tutorial>>platform:DevGuide.FAQTutorial.WebHome]].
65 * You could also start understanding how to display properties of Objects in wiki pages by using [[platform:DevGuide.Scripting]].
66 * You could also try using the [[App Within Minutes extension>>extensions:Extension.App Within Minutes Application]] which simplifies how to get started developing an application with little required knowledge. After your application is generated, if you wish to go further and develop new features for your app, you'll need to use your knowledge about Classes, Objects and [[platform:DevGuide.Scripting]].
Vincent Massol 35.6 67 * More information on the [[Custom Display field>>xwiki:FAQ.Bindings available inside the Custom Display property]] and an [[example>>snippets:Extension.User Property Custom Display]]
Vincent Massol 36.1 68 )))

Get Connected