Hi devs,

I'm still working on the Model Reference domain. We've brainstormed  
with Thomas and we'd like to propose replacing the current  
ModelContext.getCurrentDocumentName() by  
ModelContext.getCurrentEntityReference() (which returns an  
EntityReference).

The idea is that a URL could target a document but also a wiki only  
(e.g the REST API odes that), or a given space only, or even an object  
or a property. This would mean we would need to have  
getCurrentDocumentReference() in addition to all the others:  
getCurrentWikiReference(), getCurrentSpaceReference(). It would also  
mean a lot of them would be set to null. Last it would mean different  
ways to access the same information (e.g.  
getCurrentDocumentReference.getWikiReference() vs  
getCurrentWikiReference()).

We would also add a EntityReference.extractReference(EntityType type)  
method in order to make it easy to extract information from the a  
reference path.

For example to extract the Wiki from an entity reference:

WikiReference wikiRef =  
context.getCurrentEntityReference(EntityType.WIKI);
if (wikiRef != null) ....

WDYT?

Thanks
-Vincent
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to