[xwiki-devs] [PROPOSAL] Update DocumentAccessBridge
Hi Devs, I'm upgrading office-importer code base to new architecture. For this I suggest following methods to be added to the DocumentAccessBridge: 1. createNewDocument(String documentName, String content) //This method will throw an exception if the document already exists. 2. setDocumentContent(String documentName, String newContent) //For updating an existing document. 3. setDocumentSyntaxId(String documentName, String syntaxId) //For presentation documents the syntax would be 1.0 and for others it would be 2.0 4. addAttachmentToDocument(String documentName, String AttachmentName, byte [] attachmentData) //For making attachments 5. isDocumentEditable(String documentName) //This is following isDocumentViewable() mthod. But we could also have a hasRight() mthod instead. I'm +1 for all. But please let me know if any of above methods are redundant / not required / has wrong signature. Thanks. - Asiri
After few discussions it seems like we need two more methods. 1. createNewDocument(String documentName, String content) //This method will
throw an exception if the document already exists.
2. setDocumentContent(String documentName, String newContent) //For updating an existing document.
3. setDocumentSyntaxId(String documentName, String syntaxId) //For presentation documents the syntax would be 1.0 and for others it would be 2.0
4. addAttachmentToDocument(String documentName, String AttachmentName, byte [] attachmentData) //For making attachments
5. isDocumentEditable(String documentName) //This is following isDocumentViewable() mthod. But we could also have a hasRight() mthod instead.
6. getCurrentUser() // Returns the current user as a string (equivalent to XWikiContext.getUser()) 7. getDefaultEncoding() // Returns the default wiki encoding (equivalent to xwikiContext.getWiki().getEncoding()) Thanks. - Asiri
On Tue, Dec 30, 2008 at 9:54 AM, Asiri Rathnayake <[email protected]> wrote:
After few discussions it seems like we need two more methods.
1. createNewDocument(String documentName, String content) //This method will
throw an exception if the document already exists.
This methods is not needed, 2. already do the job. In wiki concept when you ask for a non existing document you get an empty document, you never need to create one before manipulating it.
2. setDocumentContent(String documentName, String newContent) //For updating an existing document.
3. setDocumentSyntaxId(String documentName, String syntaxId) //For presentation documents the syntax would be 1.0 and for others it would be 2.0
4. addAttachmentToDocument(String documentName, String AttachmentName, byte [] attachmentData) //For making attachments
5. isDocumentEditable(String documentName) //This is following isDocumentViewable() mthod. But we could also have a hasRight() mthod instead.
I prefer isDocumentEditable since it's in a bridge for the same reason I voted for isDocumentViewable().
6. getCurrentUser() // Returns the current user as a string (equivalent to XWikiContext.getUser())
This has nothing to do with documents. It should be stored in ExecutionContext or add another bridge. (+1 for ExecutionContext)
7. getDefaultEncoding() // Returns the default wiki encoding (equivalent to xwikiContext.getWiki().getEncoding())
Same, this is more general that documents. Need another bridge or put it in ExecutionContext. (+1 for ExecutionContext)
Thanks.
- Asiri _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
On Dec 30, 2008, at 10:46 AM, Thomas Mortagne wrote:
On Tue, Dec 30, 2008 at 9:54 AM, Asiri Rathnayake <[email protected]> wrote:
After few discussions it seems like we need two more methods.
1. createNewDocument(String documentName, String content) //This method will
throw an exception if the document already exists.
This methods is not needed, 2. already do the job. In wiki concept when you ask for a non existing document you get an empty document, you never need to create one before manipulating it.
2. setDocumentContent(String documentName, String newContent) //For updating an existing document.
3. setDocumentSyntaxId(String documentName, String syntaxId) //For presentation documents the syntax would be 1.0 and for others it would be 2.0
4. addAttachmentToDocument(String documentName, String AttachmentName, byte [] attachmentData) //For making attachments
5. isDocumentEditable(String documentName) //This is following isDocumentViewable() mthod. But we could also have a hasRight() mthod instead.
I prefer isDocumentEditable since it's in a bridge for the same reason I voted for isDocumentViewable().
6. getCurrentUser() // Returns the current user as a string (equivalent to XWikiContext.getUser())
This has nothing to do with documents. It should be stored in ExecutionContext or add another bridge. (+1 for ExecutionContext)
7. getDefaultEncoding() // Returns the default wiki encoding (equivalent to xwikiContext.getWiki().getEncoding())
Same, this is more general that documents. Need another bridge or put it in ExecutionContext. (+1 for ExecutionContext)
We haven't thought about what we want to put in the execution context yet and in what format so personally I wouldn't mind having a bridge for now till we make a proposal on what we put in the execution context. Thanks -Vincent
participants (3)
-
Asiri Rathnayake -
Thomas Mortagne -
Vincent Massol