Release Notes for XWiki 7.2 Milestone 1
- New and Noteworthy (since XWiki 7.1)
- For Developers
- Nested Spaces
- New Reference-related APIs
- Complete References Providers
- org.xwiki.model.reference.EntityReferenceProvider
- Properly support any kind of References in getDocument and getURL
- New helpers in EntityReference
- New helpers in LocalDocumentReference
- org.xwiki.model.reference.SpaceReferenceResolver
- New model Script Service helpers
- New components to generate REST URLs
- New readonly XWikiContext provider
- Upgrades
- Miscellaneous
- Translations
- Known issues
- Backward Compatibility and Migration Notes
This is the release notes for XWiki Commons, XWiki Rendering, XWiki Platform and XWiki Enterprise. They share the same release notes as they are released together and have the same version.
The main focus of this milestone is the introduction of support for Nested Documents in XWiki's UI together with an important amount of changes in the platform and default extensions to better support this.
New and Noteworthy (since XWiki 7.1)
Full list of issues fixed and Dashboard for 7.2.
Nested Documents
It's now possible to create wiki pages inside other wiki pages. More specifically we've decided to drop the concept of Space in the UI (it's still there at the API/platform level) and instead to replace it with the concept of Nested Documents (a.k.a. Nested Pages).
We've also decided to drop the concept of Parent/Child relationship since it was too complex for end users to have 2 hierarchies: the Space/Page hierarchy and the Parent/Child hierarchy. The Parent/Child hierarchy also had limitations: you could inherit page permissions for example. Thus the idea is to have a single hierarchy based on Nested Documents.
Current status:
- In this milestone the UI has not been updated yet but a lot of the required changes have been done in the backend code to support Nested Documents.
- What you can try today:
- Typing URLs with Nested Documents. For example typing http://localhost:8080/xwiki/bin/view/A/B/C and then clicking Edit will allow you to create a Page C inside pages A and B (which don't need to exist).
- Creating Nested Documents with Add > Page should also work even though the UI will be improved in the next version.
- Moving/Deleting Nested Documents work at the script level but not at the UI level yet, see below for examples you can try out.
Script right
Miscellaneous
- The list of available template providers is now sorted by document full name.
See the full list of JIRA issues fixed in this release.
For Developers
Nested Spaces
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.
Space Reference instead of Space name
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:
- "." (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.
- 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...
- Various APIs are also affected by this Space name to Space Reference input change:
- XWiki#getSpaceDocsName methods (both in the public and private XWiki API)
- 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:private EntityReferenceResolver<String> relativeEntityReferenceResolver =
Utils.getComponent(EntityReferenceResolver.TYPE_STRING, "relative");
...
or
...
@Inject
@Named("relative")
private EntityReferenceResolver<String> relativeEntityReferenceResolver;
...
private List<String> extractSpaceNames(String spaces)
{
List<String> spaceNames = new ArrayList<>();
// Parse the spaces list into Space References
EntityReference spaceReference = this.relativeEntityReferenceResolver.resolve(spaces, EntityType.SPACE);
for (EntityReference reference : spaceReference.getReversedReferenceChain()) {
spaceNames.add(reference.getName());
}
return spaceNames;
} - Extensions/code implementing ExportURLFactoryActionHandler will also need to be modified to handle nested Spaces passed in the space parameter.
- 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).
Space separator properly taken into account
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.
New XAR format
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).
Two new attributes has been added to the <xwikidoc> root XML element
- 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).
- 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.
REST module
- 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.
URL modules
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.
New Rename/Delete Jobs
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. However the Rename/Delete feature in the UI do not yet call this new code (this is planned for 7.2M2 and after).
However you can start to test this by using the following Script Services APIs:
- Copy a Space#set ($source = $services.model.resolveSpace('Path.To.Source'))
#set ($destination = $services.model.resolveSpace('Path.To.New.Parent'))
$services.refactoring.copy($source, $destination).join() - Copy a Space As#set ($source = $services.model.resolveSpace('Path.To.Source'))
#set ($destination = $services.model.resolveSpace('Path.To.New.Name'))
$services.refactoring.copyAs($source, $destination).join() - Move a Space#set ($source = $services.model.resolveSpace('Path.To.Source'))
#set ($destination = $services.model.resolveSpace('Path.To.New.Parent'))
$services.refactoring.move($source, $destination).join() - Move a Document#set ($source = $services.model.resolveDocument('Path.To.Source.WebHome'))
#set ($destination = $services.model.resolveSpace('Path.To.New.Parent'))
$services.refactoring.move($source, $destination).join() - Rename a Space#set ($source = $services.model.resolveSpace('Path.To.Source'))
$services.refactoring.rename($source, 'NewName').join() - Rename a Document#set ($source = $services.model.resolveDocument('Path.To.Source.WebHome'))
$services.refactoring.rename($source, 'NewName').join() - Delete a Document#set ($source = $services.model.resolveDocument('Path.To.Source.WebHome'))
$services.refactoring.delete($source).join() - Delete a Space#set ($source = $services.model.resolveSpace('Path.To.Source'))
$services.refactoring.delete($source).join() - Convert a Terminal Document to a Nested Document#set ($source = $services.model.resolveDocument('Path.To.Page'))
$services.refactoring.convertToNestedDocument($source).join() - Convert a Nested Document to a Terminal Document#set ($source = $services.model.resolveDocument('Path.To.Source.WebHome'))
$services.refactoring.convertToTerminalDocument($source).join()
New Reference-related APIs
Various new API around References has been introduced while adding support for nested spaces.
Complete References Providers
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)
Provider<DocumentReference> defaultDocumentReference;
@Inject
@Named("current")
Provider<DocumentReference> currentDocumentReference;
org.xwiki.model.reference.EntityReferenceProvider
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.
EntityReferenceProvider provider;
Properly support any kind of References in getDocument and getURL
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).
Same for com.xpn.xwiki.XWiki#getURL(EntityReference) and com.xpn.xwiki.api.XWiki#getURL(EntityReference).
New helpers in EntityReference
- boolean equals(EntityReference otherReference, EntityType to): same as equals but only take into account Reference parts up to the passed entity type (included)
- boolean equals(EntityReference otherReference, EntityType from, EntityType to): same as equals but only take into account Reference parts between passed entity types (included)
- boolean equalsNonRecursive(EntityReference otherReference): same as equals but does not take into account the parent
New helpers in LocalDocumentReference
- LocalDocumentReference(String pageName, EntityReference spaceReference): allowed created a LocalDocumentReference from a Space Reference instead of just the space name
org.xwiki.model.reference.SpaceReferenceResolver
New default String and EntityReference based SpaceReferenceResolver has been added. It's the same behavior then DocumentReferenceBehavior but for spaces.
SpaceReferenceResolver<String> stringResolver;
@Inject
SpaceReferenceResolver<EntityReference> referenceResolver;
New model Script Service helpers
- new help to escape an entity name according to default Reference syntax as in:$services.model.escape('some.space:with\specialchars', 'SPACE')
will print
some\.space\:with\\specialchars
New components to generate REST URLs
- 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.
- The corresponding script service has been added: $services.rest with the method $services.rest.url($entityReference).
New readonly XWikiContext provider
You can inject a new "readonly" XWikiContext the following way:
@Named("readonly")
Provider<XWikiContext> roXWikiContextProvider;
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.
Upgrades
The following dependencies have been upgraded:
- httpclient 4.5
- cssparser 0.9.16
- less4j 1.12.0
- Joda-Time 2.8.1
- Bootstrap 3.3.5
- Infinispan 7.2.3
- HSQLDB 2.3.3
- JGroups 3.6.4
- Jackson 2.5.4
Miscellaneous
- 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.
- custom Maven properties which have a special meaning (like xwiki.extension.features) are not duplicated in Extension custom properties anymore
- standard fields names have been added to org.xwiki.extension.rating.RatingExtension
- 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
- 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).
- 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.
- A new DocumentModelBridge.getContentAuthorReference() method has been added to allow accessing the content author of a document without depending on oldcore.
- 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.
Translations
The following translations have been updated:
Known issues
Backward Compatibility and Migration Notes
General Notes
When upgrading make sure you compare your xwiki.cfg, xwiki.properties and web.xml files with the newest version since some configuration parameters may have been modified or added. Note that you should add xwiki.store.migration=1 so that XWiki will attempt to automatically migrate your current database to the new schema. Make sure you backup your Database before doing anything.
Issues specific to XWiki 7.2M1
Nested spaces
See previous Nested spaces section for details on what changes in the way some API and the database are dealing with the Document Space.
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":
- before 7.2M1: the Extension would create/display a Space named "my.space"
- after 7.2M1: the Extension will create/display a Space named "my\.space"
URLs
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[...].
Templates
All the templates specific to 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.
API Breakages
The following APIs were modified since XWiki 7.1.1:
- AbstractWrappingObject, AbstractSafeObject and ScriptSafeProvider have been moved to xwiki-commons-scriptorg.xwiki.extension.wrap.WrappingIterableResult: Removed org.xwiki.extension.internal.safe.AbstractSafeObject from the list of superclasses
org.xwiki.extension.wrap.WrappingIterableResult: Removed org.xwiki.extension.wrap.AbstractWrappingObject from the list of superclasses
org.xwiki.extension.wrap.WrappingIterableResult: Parameter 2 of 'public WrappingIterableResult(org.xwiki.extension.repository.result.IterableResult, org.xwiki.extension.internal.safe.ScriptSafeProvider)' has changed its type to org.xwiki.script.internal.safe.ScriptSafeProvider
org.xwiki.filter.script.AbstractFilterScriptService: Changed type of field scriptProvider from org.xwiki.extension.internal.safe.ScriptSafeProvider to org.xwiki.script.internal.safe.ScriptSafeProvider
org.xwiki.extension.script.AbstractExtensionScriptService: Changed type of field scriptProvider from org.xwiki.extension.internal.safe.ScriptSafeProvider to org.xwiki.script.internal.safe.ScriptSafeProvider
- Added missing methods to the DocumentModelBridge which are already implemented by XWikiDocument.org.xwiki.bridge.DocumentModelBridge: Method 'public org.xwiki.model.reference.DocumentReference getContentAuthorReference()' has been added to an interface
- com.xpn.xwiki.XWiki#localStringEntityReferenceSerializer now exists in oldcore, we do not need it in the aspect anymore.com.xpn.xwiki.XWikiCompatibilityAspect: Method 'public org.xwiki.model.reference.EntityReferenceSerializer ajc$interFieldGetDispatch$com_xpn_xwiki_XWikiCompatibilityAspect$com_xpn_xwiki_XWiki$localStringEntityReferenceSerializer(com.xpn.xwiki.XWiki)' has been removed
com.xpn.xwiki.XWikiCompatibilityAspect: Method 'public void ajc$interFieldInit$com_xpn_xwiki_XWikiCompatibilityAspect$com_xpn_xwiki_XWiki$localStringEntityReferenceSerializer(com.xpn.xwiki.XWiki)' has been removed
com.xpn.xwiki.XWikiCompatibilityAspect: Method 'public void ajc$interFieldSetDispatch$com_xpn_xwiki_XWikiCompatibilityAspect$com_xpn_xwiki_XWiki$localStringEntityReferenceSerializer(com.xpn.xwiki.XWiki, org.xwiki.model.reference.EntityReferenceSerializer)' has been removed
- Young API. ExportURLFactoryContext been renamed to FilesystemExportContext and moved to the Filesystem URL scheme module.com.xpn.xwiki.web.ExportURLFactory: Method 'public com.xpn.xwiki.web.ExportURLFactoryContext getExportURLFactoryContext()' has been removed
com.xpn.xwiki.web.ExportURLFactoryActionHandler: Parameter 7 of 'public java.net.URL createURL(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, com.xpn.xwiki.XWikiContext, com.xpn.xwiki.web.ExportURLFactoryContext)' has changed its type to org.xwiki.url.filesystem.FilesystemExportContext
com.xpn.xwiki.web.ExportURLFactory: class removed
- This API has been changed to support nested spaces.org.xwiki.rest.resources.spaces.SpaceResource: Method argument count changed for method 'org.xwiki.rest.model.jaxb.Space getSpace(java.lang.String, java.lang.String)'