Re: [xwiki-devs] [xwiki-notifications] r25770 - contrib/sandbox/xwiki-model/src/main/java/org/xwiki/model
On Dec 13, 2009, at 9:11 AM, vmassol (SVN) wrote:
Author: vmassol Date: 2009-12-13 09:11:05 +0100 (Sun, 13 Dec 2009) New Revision: 25770
Modified: contrib/sandbox/xwiki-model/src/main/java/org/xwiki/model/ Document.java contrib/sandbox/xwiki-model/src/main/java/org/xwiki/model/Space.java Log: Made the model more scaleable (ability to have lots of spaces, lots of objects, lots of object definitions)
Modified: contrib/sandbox/xwiki-model/src/main/java/org/xwiki/model/ Document.java =================================================================== --- contrib/sandbox/xwiki-model/src/main/java/org/xwiki/model/ Document.java 2009-12-12 15:37:00 UTC (rev 25769) +++ contrib/sandbox/xwiki-model/src/main/java/org/xwiki/model/ Document.java 2009-12-13 08:11:05 UTC (rev 25770) @@ -11,10 +11,14 @@ /** * @return the list of object definitions defined inside this document */ - List<ObjectDefinition> getObjectDefinitions(); + List<String> getObjectDefinitionNames();
- List<Object> getObjects(); + ObjectDefinition getObjectDefinition(String objectDefinitionName);
+ List<String> getObjectNames(); + + Object getObject(String objectName); +
Another solution would be to use iterators with this API: Iterator<Object> getObjects(); instead of List<String> getObjectNames(); Object getObject(String objectName); I think it could allow more fine-tuning on the requests we send to the DB (ie we can fetch elements N elements by N elements instead of 1 by 1). Thanks -Vincent
List<Attachment> getAttachments();
void setParent(Document document);
Modified: contrib/sandbox/xwiki-model/src/main/java/org/xwiki/model/ Space.java =================================================================== --- contrib/sandbox/xwiki-model/src/main/java/org/xwiki/model/ Space.java 2009-12-12 15:37:00 UTC (rev 25769) +++ contrib/sandbox/xwiki-model/src/main/java/org/xwiki/model/ Space.java 2009-12-13 08:11:05 UTC (rev 25770) @@ -11,9 +11,9 @@ String getDescription();
/** - * @return the full list of all nested spaces + * @return the names of all nested spaces */ - List<Space> getSpaces(); + List<String> getSpaceNames();
/** * @param spaceName the name of the nested space to look for @@ -36,7 +36,7 @@ */ void removeSpace(String spaceName);
- List<Document> getDocuments(); + List<String> getDocumentNames();
boolean hasSpace(String spaceName);
On Dec 13, 2009, at 9:19 AM, Vincent Massol wrote:
On Dec 13, 2009, at 9:11 AM, vmassol (SVN) wrote:
- List<ObjectDefinition> getObjectDefinitions(); + List<String> getObjectDefinitionNames();
- List<Object> getObjects(); + ObjectDefinition getObjectDefinition(String objectDefinitionName);
+ List<String> getObjectNames(); + + Object getObject(String objectName); +
Another solution would be to use iterators with this API:
Iterator<Object> getObjects();
instead of
List<String> getObjectNames(); Object getObject(String objectName);
I think it could allow more fine-tuning on the requests we send to the DB (ie we can fetch elements N elements by N elements instead of 1 by 1).
I think Iterator is better since it allows for lazy retrieval. I have some questions... 1) Don't we need to expose parameters to allow paging? 2) Why is the save() method in the model? -Fabio
I like the idea of lazy loading objects because documents with lots of objects (eg: forum applications) would not clobber the database on page load. This however would require changes to Hibernate.getXWikiDoc Caleb James DeLisle Fabio Mancinelli wrote:
On Dec 13, 2009, at 9:19 AM, Vincent Massol wrote:
On Dec 13, 2009, at 9:11 AM, vmassol (SVN) wrote:
- List<ObjectDefinition> getObjectDefinitions(); + List<String> getObjectDefinitionNames();
- List<Object> getObjects(); + ObjectDefinition getObjectDefinition(String objectDefinitionName);
+ List<String> getObjectNames(); + + Object getObject(String objectName); + Another solution would be to use iterators with this API:
Iterator<Object> getObjects();
instead of
List<String> getObjectNames(); Object getObject(String objectName);
I think it could allow more fine-tuning on the requests we send to the DB (ie we can fetch elements N elements by N elements instead of 1 by 1).
I think Iterator is better since it allows for lazy retrieval.
I have some questions...
1) Don't we need to expose parameters to allow paging? 2) Why is the save() method in the model?
-Fabio _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
participants (3)
-
Caleb James DeLisle -
Fabio Mancinelli -
Vincent Massol