<
From version < 10.1 >
edited by Guillaume Delhumeau
on 2015/09/23
To version < 12.1 >
edited by Guillaume Delhumeau
on 2015/09/23
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -54,10 +54,248 @@
54 54  
55 55  = For Developers =
56 56  
57 -== <developer feature N> ==
57 +== Nested Spaces ==
58 58  
59 -<description of developer feature N>
59 +Since Nested Spaces were already planned and supported in APIs like ##DocumentReference## there are not too many changes for those who were using recent APIs but there is still some and here are the main ones.
60 60  
61 +=== Space Reference instead of Space name ===
62 +
63 +The heart of the implementation is that the field that used to contain the unique document space now contain the possibly Nested Space Reference. In practice it means that:
64 +
65 +* "##.##" (dot), "##:##" (colon) and "##\##" (baskslash) characters, which are part of a Space name will now be escaped (using the "##\##" character) in the ##space## (##XWD_WEB##) field from the Document's table in the Database. For example a space named ##Space:with.special\char## will be stored as ##{{{Space\:with\.special\\char}}}##.
66 +* Same as for the database, the ##XWikiDocument/Document#getSpace()## methods now return a serialized Reference to the Space instead of what used to be the unique Space name (basically it return what's in the database). Same logic for ##XWikiDocument#setSpace()##. Those field have been deprecated a long time ago but they are still used in lots of places...
67 +* Various APIs are also affected by this Space name to Space Reference input change:
68 +** ##XWiki#getSpaceDocsName## methods (both in the public and private XWiki API)
69 +** All the default ##XWikiURLFactory## implementation methods accepting a Space as parameter have been modified to accept a serialized Space Reference. Extensions/code implementing ##XWikiURLFactory## (or extending classes implementing ##XWikiURLFactory## such as ##XWikiServletURLFactory##) will need to be modified to handle nested spaces passed in the ##space## parameter of the various APIs. Here's how to parse Spaces passed as a String:(((
70 +{{code language="java"}}
71 +private EntityReferenceResolver<String> relativeEntityReferenceResolver =
72 + Utils.getComponent(EntityReferenceResolver.TYPE_STRING, "relative");
73 +...
74 +or
75 +...
76 [email protected]
77 [email protected]("relative")
78 +private EntityReferenceResolver<String> relativeEntityReferenceResolver;
79 +...
80 +private List<String> extractSpaceNames(String spaces)
81 +{
82 + List<String> spaceNames = new ArrayList<>();
83 + // Parse the spaces list into Space References
84 + EntityReference spaceReference = this.relativeEntityReferenceResolver.resolve(spaces, EntityType.SPACE);
85 + for (EntityReference reference : spaceReference.getReversedReferenceChain()) {
86 + spaceNames.add(reference.getName());
87 + }
88 + return spaceNames;
89 +}
90 +{{/code}}
91 +)))
92 +** Extensions/code implementing ##ExportURLFactoryActionHandler## will also need to be modified to handle nested Spaces passed in the ##space## parameter.
93 +* Extensions/code implementing ##EntityReferenceSerializer## or ##DocumentReferenceResolver## must now handle Nested Spaces (in the past they were already supposed to handle Nested Spaces but since it was not used they could take shortcuts and it wasn't visible. It's now going to fail, see [[XWIKI-12191>>http://jira.xwiki.org/browse/XWIKI-12191]]).
94 +
95 +=== Space separator properly taken into account ===
96 +
97 +The Reference syntax specification was already indication that "##.##" was supposed to be escaped in the space part of the Reference but it was not really taken into account so not escaping it was not making any difference. This is now fixed in the various standard String Reference resolvers so a Reference that don't follow the specification and did not escaped the "##.##" in the space part will be cut is several nested spaces. Anything that was serialized with one of the standard serializers was properly escaped so not worry here, the issue will be more for hand written or hardcoded String References.
98 +
99 +=== New XAR format ===
100 +
101 +To support exporting/importing nested spaces some changes has been made to the XAR format. The format remain upward and downward compatible (except that you won't get nested spaces in your < 7.2 instance obviously).
102 +
103 +Two new attributes has been added to the ##<xwikidoc>## root XML element
104 +
105 +* ##reference##: the complete local Reference of the document in standard Reference format. ##<web>## and ##<name>## are deprecated (but still set). ##<web>## keep containing the (unescaped) space name when there is only one space and will contain the space Reference when there is several (when imported in a < 7.2 instance a document exported from a nested space will end up in a space having as name the space reference).
106 +* ##locale##: the locale of the document. ##<language>## is deprecated. It was not technically needed in the context of nested spaces but it makes having the Reference as attribute more consistent. It also make getting all the entries from a new format XAR easier and faster since document space and name would be placed anywhere in the document.
107 +
108 +=== REST module ===
109 +
110 +* The REST module now supports Nested Spaces. Example of url to access the page ##A.B.C.MyPage##: ##/xwiki/rest/wikis/xwiki/spaces/A/spaces/B/spaces/C/pages/MyPage##.
111 +
112 +=== URL modules ===
113 +
114 +The URL modules have been modified to support Nested Spaces. As a consequence the [[URL formats supported by the ##standard## URL scheme have been modified>>extensions:Extension.Standard URL API]].
115 +
116 +=== New Rename/Delete Jobs ===
117 +
118 +New code has been developed to support Nested Documents/Nested Spaces and Script Services have been provided and they now run inside Jobs to better handle the fact that they are long-running operations.
119 +
120 +However you can start to test this by using the following Script Services APIs:
121 +
122 +* Copy a Space(((
123 +{{code language="none"}}
124 +#set ($source = $services.model.resolveSpace('Path.To.Source'))
125 +#set ($destination = $services.model.resolveSpace('Path.To.New.Parent'))
126 +$services.refactoring.copy($source, $destination).join()
127 +{{/code}}
128 +)))
129 +* Copy a Space As(((
130 +{{code language="none"}}
131 +#set ($source = $services.model.resolveSpace('Path.To.Source'))
132 +#set ($destination = $services.model.resolveSpace('Path.To.New.Name'))
133 +$services.refactoring.copyAs($source, $destination).join()
134 +{{/code}}
135 +)))
136 +* Move a Space(((
137 +{{code language="none"}}
138 +#set ($source = $services.model.resolveSpace('Path.To.Source'))
139 +#set ($destination = $services.model.resolveSpace('Path.To.New.Parent'))
140 +$services.refactoring.move($source, $destination).join()
141 +{{/code}}
142 +)))
143 +* Move a Document(((
144 +{{code language="none"}}
145 +#set ($source = $services.model.resolveDocument('Path.To.Source.WebHome'))
146 +#set ($destination = $services.model.resolveSpace('Path.To.New.Parent'))
147 +$services.refactoring.move($source, $destination).join()
148 +{{/code}}
149 +)))
150 +* Rename a Space(((
151 +{{code language="none"}}
152 +#set ($source = $services.model.resolveSpace('Path.To.Source'))
153 +$services.refactoring.rename($source, 'NewName').join()
154 +{{/code}}
155 +)))
156 +* Rename a Document(((
157 +{{code language="none"}}
158 +#set ($source = $services.model.resolveDocument('Path.To.Source.WebHome'))
159 +$services.refactoring.rename($source, 'NewName').join()
160 +{{/code}}
161 +)))
162 +* Delete a Document(((
163 +{{code language="none"}}
164 +#set ($source = $services.model.resolveDocument('Path.To.Source.WebHome'))
165 +$services.refactoring.delete($source).join()
166 +{{/code}}
167 +)))
168 +* Delete a Space(((
169 +{{code language="none"}}
170 +#set ($source = $services.model.resolveSpace('Path.To.Source'))
171 +$services.refactoring.delete($source).join()
172 +{{/code}}
173 +)))
174 +* Convert a Terminal Document to a Nested Document(((
175 +{{code language="none"}}
176 +#set ($source = $services.model.resolveDocument('Path.To.Page'))
177 +$services.refactoring.convertToNestedDocument($source).join()
178 +{{/code}}
179 +)))
180 +* Convert a Nested Document to a Terminal Document(((
181 +{{code language="none"}}
182 +#set ($source = $services.model.resolveDocument('Path.To.Source.WebHome'))
183 +$services.refactoring.convertToTerminalDocument($source).join()
184 +{{/code}}
185 +)))
186 +
187 +=== New create action parameters and logic ===
188 +
189 +The create action now accepts a ##spaceReference## parameter and a ##name## parameter, together with an optional ##tocreate=terminal## parameter (usable on non-terinal documents). The previous space parameters was not scalable in the context of Nested Spaces since it was just a top-level space name so it did not allow the creation of deeper space levels. More details are available in the [[create action's documentation>>platform:DevGuide.Standard URL Format||anchor="HAction:create"]].
190 +
191 +These logic is now also available in the improved create UI, with the terminal pages option appearing only for advanced users and being checked or unchecked by default, depending on the type of the current document:
192 +{{image reference="[email protected]"/}}
193 +
194 +== New Reference-related APIs ==
195 +
196 +Various new API around References has been introduced while adding support for nested spaces.
197 +
198 +=== Complete References Providers ===
199 +
200 +Complete References Providers (for DocumentReference, SpaceReference and WikiReference) with default or ##current## hints. They allow getting complete Reference created from each default or current part of those references (for example in SpaceReference you end up with the space of the XWikiContext document and the XWikiContext wiki)
201 +
202 +{{code language="java"}}
203 [email protected]
204 +Provider<DocumentReference> defaultDocumentReference;
205 +
206 [email protected]
207 [email protected]("current")
208 +Provider<DocumentReference> currentDocumentReference;
209 +{{/code}}
210 +
211 +=== org.xwiki.model.reference.EntityReferenceProvider ===
212 +
213 +##org.xwiki.model.reference.EntityReferenceProvider## replaces ##org.xwiki.model.reference.EntityReferenceValueProvider##. It's essentially the same thing but with ##EntityReference## instead of string which allow getting multiple spaces when you ask for the current ##EntityType.SPACE## for example.
214 +
215 +{{code language="java"}}
216 [email protected]
217 +EntityReferenceProvider provider;
218 +{{/code}}
219 +
220 +=== Properly support any kind of References in getDocument and getURL ===
221 +
222 +##com.xpn.xwiki.XWiki#getDocument(EntityReference)## and ##com.xpn.xwiki.api.XWiki#getDocument(EntityReference)## support any kind of Reference properly (e.g. a Space Reference will return the space home page, an Object Reference will return the Object Document Reference, etc).
223 +
224 +Same for ##com.xpn.xwiki.XWiki#getURL(EntityReference)## and ##com.xpn.xwiki.api.XWiki#getURL(EntityReference)##.
225 +
226 +=== New helpers in EntityReference ===
227 +
228 +* ##boolean equals(EntityReference otherReference, EntityType to)##: same as equals but only take into account Reference parts up to the passed entity type (included)
229 +* ##boolean equals(EntityReference otherReference, EntityType from, EntityType to)##: same as equals but only take into account Reference parts between passed entity types (included)
230 +* ##boolean equalsNonRecursive(EntityReference otherReference)##: same as equals but does not take into account the parent
231 +
232 +=== New helpers in LocalDocumentReference ===
233 +
234 +* ##LocalDocumentReference(String pageName, EntityReference spaceReference)##: allowed created a LocalDocumentReference from a Space Reference instead of just the space name
235 +
236 +=== org.xwiki.model.reference.SpaceReferenceResolver ===
237 +
238 +New default ##String## and ##EntityReference## based SpaceReferenceResolver has been added. It's the same behavior then ##DocumentReferenceBehavior## but for spaces.
239 +
240 +{{code language="java"}}
241 [email protected]
242 +SpaceReferenceResolver<String> stringResolver;
243 +
244 [email protected]
245 +SpaceReferenceResolver<EntityReference> referenceResolver;
246 +{{/code}}
247 +
248 +=== New model Script Service helpers ===
249 +
250 +* new help to escape an entity name according to default Reference syntax as in:(((
251 +{{code language="velocity"}}
252 +$services.model.escape('some.space:with\specialchars', 'SPACE')
253 +{{/code}}
254 +
255 +will print
256 +
257 +{{code language="nonde"}}
258 +some\.space\:with\\specialchars
259 +{{/code}}
260 +)))
261 +* you can retrieve a node from an ##EntityReferenceTree## using its reference:(((
262 +{{code language="velocity"}}
263 +#set ($alice = $services.model.resolveDocument('wiki:Users.Alice.WebHome'))
264 +#set ($bob = $services.model.resolveDocument('wiki:Users.Directory'))
265 +#set ($tree = $services.model.toTree($alice, $bob))
266 +#set ($usersNode = $tree.get($bob.lastSpaceReference))
267 +{{/code}}
268 +)))
269 +
270 +=== New components to generate REST URLs ===
271 +
272 +* The component ##RestURLGenerator## has been added. Its role, in the long terme, is to generate a REST URL for any kind of EntityReference. It currently handles ##DocumentReference## and ##SpaceReference##.
273 +* The corresponding script service has been added: ##$services.rest## with the method ##$services.rest.url($entityReference)##.
274 +
275 +=== Resolve nested spaces in JavaScript ===
276 +
277 +{{code language="js"}}
278 +var spaceReference = XWiki.Model.resolve('A.B.C', XWiki.EntityType.SPACE);
279 +spaceReference.getReversedReferenceChain().map(function(entityReference) {
280 + return entityReference.name;
281 +}).join(' > ');
282 +// Produces: A > B > C
283 +{{/code}}
284 +
285 +See the [[JavaScript API documentation>>platform:DevGuide.JavaScriptAPI||anchor="HWorkwithEntityReferences"]] for more details.
286 +
287 +== New readonly XWikiContext provider ==
288 +
289 +You can inject a new "readonly" XWikiContext the following way:
290 +
291 +{{code language="java"}}
292 [email protected]
293 [email protected]("readonly")
294 +Provider<XWikiContext> roXWikiContextProvider;
295 +{{/code}}
296 +
297 +The difference with default provider is that the readonly one won't try to create a new XWikiContext and will return null if it can't find any. It's been introduce for some low level components that were used during XWikiContext creation but in general it should be used by any component that only search for some XWikiContext property that might be null even in a valid XWikiContext.
298 +
61 61  == Deprecated and Retired projects ==
62 62  
63 63  <description of deprecated and retired projects>
... ... @@ -66,11 +66,27 @@
66 66  
67 67  The following dependencies have been upgraded:
68 68  
69 -* <list libraries that have been upgraded>
307 +* [[httpclient 4.5>>http://jira.xwiki.org/browse/XCOMMONS-815]]
308 +* [[cssparser 0.9.16>>http://jira.xwiki.org/browse/XCOMMONS-817]]
309 +* [[less4j 1.12.0>>http://jira.xwiki.org/browse/XWIKI-12161]]
310 +* [[Joda-Time 2.8.1>>http://jira.xwiki.org/browse/XWIKI-12159]]
311 +* [[Bootstrap 3.3.5>>http://jira.xwiki.org/browse/XWIKI-12211]]
312 +* [[Infinispan 7.2.3>>http://jira.xwiki.org/browse/XWIKI-12227]]
313 +* [[HSQLDB 2.3.3>>http://jira.xwiki.org/browse/XE-1491]]
314 +* [[JGroups 3.6.4>>http://jira.xwiki.org/browse/XWIKI-12215]]
315 +* [[Jackson 2.5.4>>http://jira.xwiki.org/browse/XCOMMONS-828]]
70 70  
71 71  == Miscellaneous ==
72 72  
73 -<other dev stuff to add and link to JIRA for all issues fixed>
319 +* Objects, attachments and the document's class are now clearly not considered content, but metadata. Thus, any change in these will set the document's (XWikiDocument) metadataDirty flag to true and not touch the document's contentDirty flag unless there is an actual change in the document's content or title fields. This is also in line with the original intent of the contentAuthor document field. The direct impact of this is that the contentAuthor field will be updated only when the content is changed and thus the programming/script rights of a document will be changed much less often than before and much less by accident.
320 +* custom Maven properties which have a special meaning (like ##xwiki.extension.features##) are not ##duplicated## in Extension custom properties anymore
321 +* standard fields names have been added to ##org.xwiki.extension.rating.RatingExtension##
322 +* URL configuration now use default ConfigurationSource provider instead of only ##xwiki.properties## one which means it's possible to overwrite properties for each wiki among other things
323 +* Added ability to set and change the URL scheme to use in the Execution Context. This allows code to dynamically change the generated URLs when Rendering a document (useful when performing an Export for example).
324 +* Started a new ##filesystem## URL Scheme for exporting Resources to the filesystem and generating URLs to them (useful for the HTML Export for example). At the moment, only the ##webjars## Resource Type is using it and all other Resource Types are using the old ##XWikiURLFactory## class.
325 +* A new DocumentModelBridge.getContentAuthorReference() method has been added to allow accessing the content author of a document without depending on oldcore.
326 +* Deprecate XWiki.parseContent(...) since it is was misleading and outdated. Its documentation mentioned that the passed content is parsed as velocity code, but it was actually doing much more than that and had some unwanted side-effect. Instead, use the parse/renderer that is specific to the type of content you have. See more details in [[XWIKI-12299>>http://jira.xwiki.org/browse/XWIKI-12299]].
327 +* A new script service is available to retrieve the status of a specified job or the status of the currently running job from a specified group. See the [[Job Module>>extensions:Extension.Job Module||anchor="HScriptService"]] documentation for details.
74 74  
75 75  = Translations =
76 76  
... ... @@ -102,8 +102,23 @@
102 102  
103 103  == Issues specific to XWiki 7.2 ==
104 104  
105 -<issues specific to the project>
359 +=== Nested spaces ===
106 106  
361 +See [[previous Nested spaces section>>||anchor="HNestedSpaces"]] for details on what changes in the way some API and the database are dealing with the Document Space.
362 +
363 +Note that some existing Extensions are impacted and may break slightly: Extensions taking some user input and creating Spaces based on that will most likely display {{{"\."}}}, {{{"\:"}}} and {{{"\\"}}} in the UI. Unless they already clean the user input and remove ".", ":" and "\" characters. So for example if a user enter a Space name of "my.space":
364 +
365 +* before 7.2: the Extension would create/display a Space named "my.space"
366 +* after 7.2: the Extension will create/display a Space named "my\.space"
367 +
368 +=== URLs ===
369 +
370 +In order to support Nested Documents and have the ability that typing a URL such as ##/A## will lead to ##A.WebHome## we have stopped supporting URLs that don't specify the ##view## action (when ##xwiki.showviewaction=1##). Thus URLs such as ##/xwiki/bin/Something## now need to be written as ##/xwiki/bin/view/Something##. If ##xwiki.showviewaction=0## then you can still write ##/xwiki/bin/<something>## provided that ##<something>## isn't equal to ##view##. If it is (you have a space named ##view##) then you need to use ##/xwiki/bin/view/view[...]##.
371 +
372 +=== Templates ===
373 +
374 +All the templates specific to [[extensions:Extension.Colibri Skin]] had been moved to it. If your skin depends on some of these templates, you should set Colibri as parent of your skin.
375 +
107 107  == API Breakages ==
108 108  
109 109  The following APIs were modified since XWiki 7.1:

Get Connected