com.xpn.xwiki.gwt.api.server
Class XWikiServiceImpl

java.lang.Object
  extended by javax.servlet.GenericServlet
      extended by javax.servlet.http.HttpServlet
          extended by com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
              extended by com.google.gwt.user.server.rpc.RemoteServiceServlet
                  extended by com.xpn.xwiki.gwt.api.server.XWikiServiceImpl
All Implemented Interfaces:
com.google.gwt.user.client.rpc.RemoteService, com.google.gwt.user.server.rpc.SerializationPolicyProvider, XWikiService, java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class XWikiServiceImpl
extends com.google.gwt.user.server.rpc.RemoteServiceServlet
implements XWikiService

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.xpn.xwiki.gwt.api.client.XWikiService
XWikiService.App
 
Field Summary
 
Fields inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
perThreadRequest, perThreadResponse
 
Constructor Summary
XWikiServiceImpl()
           
 
Method Summary
 boolean addComment(java.lang.String docname, java.lang.String message)
           
 java.util.List addObject(java.lang.String fullName, java.util.List classesName)
           
 XObject addObject(java.lang.String fullName, java.lang.String className)
           
 boolean addObject(java.lang.String docname, XObject xobject)
           
 XObject addObject(com.xpn.xwiki.doc.XWikiDocument doc, java.lang.String className)
           
protected  void assertEditRight(com.xpn.xwiki.doc.XWikiDocument doc, com.xpn.xwiki.XWikiContext context)
           
protected  void assertViewRight(java.lang.String fullName, com.xpn.xwiki.XWikiContext context)
           
protected  void assertViewRight(com.xpn.xwiki.doc.XWikiDocument doc, com.xpn.xwiki.XWikiContext context)
           
 java.util.List customQuery(java.lang.String queryPage)
           
 java.util.List customQuery(java.lang.String queryPage, int nb, int start)
           
 java.util.List customQuery(java.lang.String queryPage, java.util.Map params)
           
 java.util.List customQuery(java.lang.String queryPage, java.util.Map params, int nb, int start)
           
 java.lang.Boolean deleteDocument(java.lang.String docName)
           
 int deleteDocuments(java.lang.String sql)
           
 java.lang.Boolean deleteObject(java.lang.String docName, java.lang.String className, int number)
           
 java.lang.Boolean deleteObject(XObject object)
           
 Document getDocument(java.lang.String fullName)
           
 Document getDocument(java.lang.String fullName, boolean full, boolean withRenderedContent)
           
 Document getDocument(java.lang.String fullName, boolean full, boolean viewDisplayers, boolean editDisplayers)
           
 Document getDocument(java.lang.String fullName, boolean full, boolean viewDisplayers, boolean editDisplayers, boolean withRenderedContent)
           
 java.lang.String getDocumentContent(java.lang.String fullName)
           
 java.lang.String getDocumentContent(java.lang.String fullName, boolean rendered)
           
 java.lang.String getDocumentContent(java.lang.String fullName, boolean rendered, java.util.Map params)
           
 java.util.List getDocuments(java.lang.String sql, int nb, int start)
           
 java.util.List getDocuments(java.lang.String sql, int nb, int start, boolean full)
           
 java.util.List getDocuments(java.lang.String sql, int nb, int start, boolean full, boolean viewDisplayers, boolean editDisplayers)
           
 java.util.List getDocumentVersions(java.lang.String fullName, int nb, int start)
           
 XObject getFirstObject(java.lang.String sql, java.lang.String className)
           
 java.lang.String getLoginURL()
           
 java.util.List getObjects(java.lang.String sql, java.lang.String className, int nb, int start)
           
 Dictionary getTranslation(java.lang.String translationPage, java.lang.String locale)
           
 Document getUniqueDocument(java.lang.String space)
           
 Document getUniqueDocument(java.lang.String space, java.lang.String pageName)
           
 java.lang.String getUniquePageName(java.lang.String space)
           
 java.lang.String getUniquePageName(java.lang.String space, java.lang.String pageName)
           
 User getUser()
           
 User getUser(java.lang.String fullName)
           
 User[] getUserList(int nb, int start)
           
protected  com.xpn.xwiki.XWikiContext getXWikiContext()
          Helper method to retrieve the XWikiContext from the Execution context.
protected  XWikiGWTException getXWikiGWTException(java.lang.Exception e)
           
 java.lang.Boolean hasAccessLevel(java.lang.String level, java.lang.String docName)
          Checks the access level for the current user on the specified document.
 java.lang.Boolean hasAccessLevel(java.lang.String level, java.lang.String username, java.lang.String docName)
          Checks the access level for the user given by username on the specified document.
 boolean hasAccessLevel(java.lang.String level, java.lang.String fullName, com.xpn.xwiki.XWikiContext context)
           
 java.lang.Boolean isLastDocumentVersion(java.lang.String fullName, java.lang.String version)
           
 java.lang.Boolean lockDocument(java.lang.String fullName, boolean force)
          return true if can be locked return null in case of an error return false in all the other cases
 java.lang.String login(java.lang.String username, java.lang.String password, boolean rememberme)
           
 void logJSError(java.util.Map infos)
           
protected  void mergeObject(XObject xobject, com.xpn.xwiki.objects.BaseObject baseObject, com.xpn.xwiki.XWikiContext context)
           
protected  Attachment newAttachment(Attachment att, com.xpn.xwiki.doc.XWikiAttachment xAtt, com.xpn.xwiki.XWikiContext context)
           
protected  com.xpn.xwiki.objects.BaseObject newBaseObject(com.xpn.xwiki.objects.BaseObject baseObject, XObject xObject, com.xpn.xwiki.XWikiContext context)
           
protected  Document newDocument(Document doc, com.xpn.xwiki.doc.XWikiDocument xdoc, boolean withObjects, boolean withViewDisplayers, boolean withEditDisplayers, boolean withRenderedContent, com.xpn.xwiki.XWikiContext context)
           
protected  Document newDocument(Document doc, com.xpn.xwiki.doc.XWikiDocument xdoc, boolean withObjects, com.xpn.xwiki.XWikiContext context)
           
protected  Document newDocument(Document doc, com.xpn.xwiki.doc.XWikiDocument xdoc, com.xpn.xwiki.XWikiContext context)
           
protected  XObject newObject(XObject xObject, com.xpn.xwiki.objects.BaseObject baseObject, boolean withViewDisplayers, boolean withEditDisplayers, com.xpn.xwiki.XWikiContext context)
           
protected  User newUser(User user, com.xpn.xwiki.doc.XWikiDocument xdoc, com.xpn.xwiki.XWikiContext context)
           
 java.lang.String processCall(java.lang.String payload)
          We override the default processCall method in order to provide XWiki initialization before we handle the request.
protected  void raiseRightException(com.xpn.xwiki.XWikiContext context)
           
 java.lang.Boolean saveDocumentContent(java.lang.String fullName, java.lang.String content)
          save only the content of a document TODO manage translations
 java.lang.Boolean saveDocumentContent(java.lang.String fullName, java.lang.String content, java.lang.String comment)
          save only the content of a document TODO manage translations
 java.lang.Boolean saveObject(XObject object)
           
 java.lang.Boolean saveObjects(java.util.List objects)
           
 java.util.List searchDocuments(java.lang.String sql, int nb, int start)
           
 void unlockDocument(java.lang.String fullName)
           
 boolean updateProperty(java.lang.String docname, java.lang.String className, java.lang.String propertyname, int value)
           
 boolean updateProperty(java.lang.String docname, java.lang.String className, java.lang.String propertyname, java.util.List value)
           
 boolean updateProperty(java.lang.String docname, java.lang.String className, java.lang.String propertyname, java.lang.String value)
           
 
Methods inherited from class com.google.gwt.user.server.rpc.RemoteServiceServlet
doGetSerializationPolicy, getSerializationPolicy, onAfterResponseSerialized, onBeforeRequestDeserialized, processPost, shouldCompressResponse
 
Methods inherited from class com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet
doPost, doUnexpectedFailure, getPermutationStrongName, getThreadLocalRequest, getThreadLocalResponse, onAfterRequestDeserialized, readContent
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPut, doTrace, getLastModified, service, service
 
Methods inherited from class javax.servlet.GenericServlet
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XWikiServiceImpl

public XWikiServiceImpl()
Method Detail

processCall

public java.lang.String processCall(java.lang.String payload)
                             throws com.google.gwt.user.client.rpc.SerializationException
We override the default processCall method in order to provide XWiki initialization before we handle the request. This allows us to initialize the XWiki Context and the new Container Objects (which are using ThreadLocal variables).

Overrides:
processCall in class com.google.gwt.user.server.rpc.RemoteServiceServlet
Throws:
com.google.gwt.user.client.rpc.SerializationException
See Also:
RemoteServiceServlet.processCall(String)

getXWikiContext

protected com.xpn.xwiki.XWikiContext getXWikiContext()
Helper method to retrieve the XWikiContext from the Execution context.

Returns:
this execution's XWikiContext, set upon initialization

getXWikiGWTException

protected XWikiGWTException getXWikiGWTException(java.lang.Exception e)

getDocument

public Document getDocument(java.lang.String fullName)
                     throws XWikiGWTException
Specified by:
getDocument in interface XWikiService
Throws:
XWikiGWTException

getDocument

public Document getDocument(java.lang.String fullName,
                            boolean full,
                            boolean withRenderedContent)
                     throws XWikiGWTException
Specified by:
getDocument in interface XWikiService
Throws:
XWikiGWTException

getUniquePageName

public java.lang.String getUniquePageName(java.lang.String space)
                                   throws XWikiGWTException
Specified by:
getUniquePageName in interface XWikiService
Throws:
XWikiGWTException

getUniquePageName

public java.lang.String getUniquePageName(java.lang.String space,
                                          java.lang.String pageName)
                                   throws XWikiGWTException
Specified by:
getUniquePageName in interface XWikiService
Throws:
XWikiGWTException

getUniqueDocument

public Document getUniqueDocument(java.lang.String space,
                                  java.lang.String pageName)
                           throws XWikiGWTException
Specified by:
getUniqueDocument in interface XWikiService
Throws:
XWikiGWTException

getUniqueDocument

public Document getUniqueDocument(java.lang.String space)
                           throws XWikiGWTException
Specified by:
getUniqueDocument in interface XWikiService
Throws:
XWikiGWTException

getDocument

public Document getDocument(java.lang.String fullName,
                            boolean full,
                            boolean viewDisplayers,
                            boolean editDisplayers)
                     throws XWikiGWTException
Specified by:
getDocument in interface XWikiService
Throws:
XWikiGWTException

getDocument

public Document getDocument(java.lang.String fullName,
                            boolean full,
                            boolean viewDisplayers,
                            boolean editDisplayers,
                            boolean withRenderedContent)
                     throws XWikiGWTException
Specified by:
getDocument in interface XWikiService
Throws:
XWikiGWTException

deleteDocument

public java.lang.Boolean deleteDocument(java.lang.String docName)
                                 throws XWikiGWTException
Specified by:
deleteDocument in interface XWikiService
Throws:
XWikiGWTException

deleteDocuments

public int deleteDocuments(java.lang.String sql)
                    throws XWikiGWTException
Specified by:
deleteDocuments in interface XWikiService
Throws:
XWikiGWTException

getUser

public User getUser()
             throws XWikiGWTException
Specified by:
getUser in interface XWikiService
Throws:
XWikiGWTException

getUser

public User getUser(java.lang.String fullName)
             throws XWikiGWTException
Specified by:
getUser in interface XWikiService
Throws:
XWikiGWTException

getUserList

public User[] getUserList(int nb,
                          int start)
                   throws XWikiGWTException
Specified by:
getUserList in interface XWikiService
Throws:
XWikiGWTException

searchDocuments

public java.util.List searchDocuments(java.lang.String sql,
                                      int nb,
                                      int start)
                               throws XWikiGWTException
Specified by:
searchDocuments in interface XWikiService
Throws:
XWikiGWTException

getDocuments

public java.util.List getDocuments(java.lang.String sql,
                                   int nb,
                                   int start)
                            throws XWikiGWTException
Specified by:
getDocuments in interface XWikiService
Throws:
XWikiGWTException

getDocuments

public java.util.List getDocuments(java.lang.String sql,
                                   int nb,
                                   int start,
                                   boolean full)
                            throws XWikiGWTException
Specified by:
getDocuments in interface XWikiService
Throws:
XWikiGWTException

getDocuments

public java.util.List getDocuments(java.lang.String sql,
                                   int nb,
                                   int start,
                                   boolean full,
                                   boolean viewDisplayers,
                                   boolean editDisplayers)
                            throws XWikiGWTException
Specified by:
getDocuments in interface XWikiService
Throws:
XWikiGWTException

updateProperty

public boolean updateProperty(java.lang.String docname,
                              java.lang.String className,
                              java.lang.String propertyname,
                              java.lang.String value)
                       throws XWikiGWTException
Specified by:
updateProperty in interface XWikiService
Throws:
XWikiGWTException

updateProperty

public boolean updateProperty(java.lang.String docname,
                              java.lang.String className,
                              java.lang.String propertyname,
                              int value)
                       throws XWikiGWTException
Specified by:
updateProperty in interface XWikiService
Throws:
XWikiGWTException

updateProperty

public boolean updateProperty(java.lang.String docname,
                              java.lang.String className,
                              java.lang.String propertyname,
                              java.util.List value)
                       throws XWikiGWTException
Specified by:
updateProperty in interface XWikiService
Throws:
XWikiGWTException

getObjects

public java.util.List getObjects(java.lang.String sql,
                                 java.lang.String className,
                                 int nb,
                                 int start)
                          throws XWikiGWTException
Specified by:
getObjects in interface XWikiService
Throws:
XWikiGWTException

getFirstObject

public XObject getFirstObject(java.lang.String sql,
                              java.lang.String className)
                       throws XWikiGWTException
Specified by:
getFirstObject in interface XWikiService
Throws:
XWikiGWTException

addObject

public XObject addObject(com.xpn.xwiki.doc.XWikiDocument doc,
                         java.lang.String className)
                  throws XWikiGWTException
Throws:
XWikiGWTException

addObject

public XObject addObject(java.lang.String fullName,
                         java.lang.String className)
                  throws XWikiGWTException
Specified by:
addObject in interface XWikiService
Throws:
XWikiGWTException

addObject

public java.util.List addObject(java.lang.String fullName,
                                java.util.List classesName)
                         throws XWikiGWTException
Specified by:
addObject in interface XWikiService
Throws:
XWikiGWTException

addObject

public boolean addObject(java.lang.String docname,
                         XObject xobject)
                  throws XWikiGWTException
Specified by:
addObject in interface XWikiService
Throws:
XWikiGWTException

saveDocumentContent

public java.lang.Boolean saveDocumentContent(java.lang.String fullName,
                                             java.lang.String content)
                                      throws XWikiGWTException
save only the content of a document TODO manage translations

Specified by:
saveDocumentContent in interface XWikiService
Parameters:
fullName -
content -
Returns:
Throws:
XWikiGWTException

saveDocumentContent

public java.lang.Boolean saveDocumentContent(java.lang.String fullName,
                                             java.lang.String content,
                                             java.lang.String comment)
                                      throws XWikiGWTException
save only the content of a document TODO manage translations

Parameters:
fullName -
content -
Returns:
Throws:
XWikiGWTException

saveObject

public java.lang.Boolean saveObject(XObject object)
                             throws XWikiGWTException
Specified by:
saveObject in interface XWikiService
Throws:
XWikiGWTException

deleteObject

public java.lang.Boolean deleteObject(XObject object)
                               throws XWikiGWTException
Specified by:
deleteObject in interface XWikiService
Throws:
XWikiGWTException

deleteObject

public java.lang.Boolean deleteObject(java.lang.String docName,
                                      java.lang.String className,
                                      int number)
                               throws XWikiGWTException
Specified by:
deleteObject in interface XWikiService
Throws:
XWikiGWTException

saveObjects

public java.lang.Boolean saveObjects(java.util.List objects)
                              throws XWikiGWTException
Specified by:
saveObjects in interface XWikiService
Throws:
XWikiGWTException

lockDocument

public java.lang.Boolean lockDocument(java.lang.String fullName,
                                      boolean force)
                               throws XWikiGWTException
return true if can be locked return null in case of an error return false in all the other cases

Specified by:
lockDocument in interface XWikiService
Parameters:
fullName -
force -
Returns:
Throws:
XWikiGWTException

unlockDocument

public void unlockDocument(java.lang.String fullName)
                    throws XWikiGWTException
Specified by:
unlockDocument in interface XWikiService
Throws:
XWikiGWTException

isLastDocumentVersion

public java.lang.Boolean isLastDocumentVersion(java.lang.String fullName,
                                               java.lang.String version)
                                        throws XWikiGWTException
Specified by:
isLastDocumentVersion in interface XWikiService
Throws:
XWikiGWTException

getLoginURL

public java.lang.String getLoginURL()
                             throws XWikiGWTException
Specified by:
getLoginURL in interface XWikiService
Throws:
XWikiGWTException

login

public java.lang.String login(java.lang.String username,
                              java.lang.String password,
                              boolean rememberme)
                       throws XWikiGWTException
Specified by:
login in interface XWikiService
Throws:
XWikiGWTException

addComment

public boolean addComment(java.lang.String docname,
                          java.lang.String message)
                   throws XWikiGWTException
Specified by:
addComment in interface XWikiService
Throws:
XWikiGWTException

customQuery

public java.util.List customQuery(java.lang.String queryPage)
                           throws XWikiGWTException
Specified by:
customQuery in interface XWikiService
Throws:
XWikiGWTException

customQuery

public java.util.List customQuery(java.lang.String queryPage,
                                  java.util.Map params)
                           throws XWikiGWTException
Specified by:
customQuery in interface XWikiService
Throws:
XWikiGWTException

customQuery

public java.util.List customQuery(java.lang.String queryPage,
                                  int nb,
                                  int start)
                           throws XWikiGWTException
Specified by:
customQuery in interface XWikiService
Throws:
XWikiGWTException

customQuery

public java.util.List customQuery(java.lang.String queryPage,
                                  java.util.Map params,
                                  int nb,
                                  int start)
                           throws XWikiGWTException
Specified by:
customQuery in interface XWikiService
Throws:
XWikiGWTException

newUser

protected User newUser(User user,
                       com.xpn.xwiki.doc.XWikiDocument xdoc,
                       com.xpn.xwiki.XWikiContext context)
                throws XWikiGWTException
Throws:
XWikiGWTException

newDocument

protected Document newDocument(Document doc,
                               com.xpn.xwiki.doc.XWikiDocument xdoc,
                               com.xpn.xwiki.XWikiContext context)
                        throws XWikiGWTException
Throws:
XWikiGWTException

newDocument

protected Document newDocument(Document doc,
                               com.xpn.xwiki.doc.XWikiDocument xdoc,
                               boolean withObjects,
                               com.xpn.xwiki.XWikiContext context)
                        throws XWikiGWTException
Throws:
XWikiGWTException

hasAccessLevel

public boolean hasAccessLevel(java.lang.String level,
                              java.lang.String fullName,
                              com.xpn.xwiki.XWikiContext context)
                       throws XWikiGWTException
Throws:
XWikiGWTException

assertEditRight

protected void assertEditRight(com.xpn.xwiki.doc.XWikiDocument doc,
                               com.xpn.xwiki.XWikiContext context)
                        throws XWikiGWTException,
                               com.xpn.xwiki.XWikiException
Throws:
XWikiGWTException
com.xpn.xwiki.XWikiException

assertViewRight

protected void assertViewRight(java.lang.String fullName,
                               com.xpn.xwiki.XWikiContext context)
                        throws XWikiGWTException,
                               com.xpn.xwiki.XWikiException
Throws:
XWikiGWTException
com.xpn.xwiki.XWikiException

raiseRightException

protected void raiseRightException(com.xpn.xwiki.XWikiContext context)
                            throws com.xpn.xwiki.XWikiException
Throws:
com.xpn.xwiki.XWikiException

assertViewRight

protected void assertViewRight(com.xpn.xwiki.doc.XWikiDocument doc,
                               com.xpn.xwiki.XWikiContext context)
                        throws XWikiGWTException,
                               com.xpn.xwiki.XWikiException
Throws:
XWikiGWTException
com.xpn.xwiki.XWikiException

newDocument

protected Document newDocument(Document doc,
                               com.xpn.xwiki.doc.XWikiDocument xdoc,
                               boolean withObjects,
                               boolean withViewDisplayers,
                               boolean withEditDisplayers,
                               boolean withRenderedContent,
                               com.xpn.xwiki.XWikiContext context)
                        throws XWikiGWTException
Throws:
XWikiGWTException

newAttachment

protected Attachment newAttachment(Attachment att,
                                   com.xpn.xwiki.doc.XWikiAttachment xAtt,
                                   com.xpn.xwiki.XWikiContext context)

newObject

protected XObject newObject(XObject xObject,
                            com.xpn.xwiki.objects.BaseObject baseObject,
                            boolean withViewDisplayers,
                            boolean withEditDisplayers,
                            com.xpn.xwiki.XWikiContext context)

mergeObject

protected void mergeObject(XObject xobject,
                           com.xpn.xwiki.objects.BaseObject baseObject,
                           com.xpn.xwiki.XWikiContext context)

getDocumentContent

public java.lang.String getDocumentContent(java.lang.String fullName)
                                    throws XWikiGWTException
Specified by:
getDocumentContent in interface XWikiService
Throws:
XWikiGWTException

newBaseObject

protected com.xpn.xwiki.objects.BaseObject newBaseObject(com.xpn.xwiki.objects.BaseObject baseObject,
                                                         XObject xObject,
                                                         com.xpn.xwiki.XWikiContext context)
                                                  throws com.xpn.xwiki.XWikiException
Throws:
com.xpn.xwiki.XWikiException

getDocumentContent

public java.lang.String getDocumentContent(java.lang.String fullName,
                                           boolean rendered)
                                    throws XWikiGWTException
Specified by:
getDocumentContent in interface XWikiService
Throws:
XWikiGWTException

getDocumentContent

public java.lang.String getDocumentContent(java.lang.String fullName,
                                           boolean rendered,
                                           java.util.Map params)
                                    throws XWikiGWTException
Specified by:
getDocumentContent in interface XWikiService
Throws:
XWikiGWTException

getDocumentVersions

public java.util.List getDocumentVersions(java.lang.String fullName,
                                          int nb,
                                          int start)
                                   throws XWikiGWTException
Specified by:
getDocumentVersions in interface XWikiService
Throws:
XWikiGWTException

logJSError

public void logJSError(java.util.Map infos)
Specified by:
logJSError in interface XWikiService

getTranslation

public Dictionary getTranslation(java.lang.String translationPage,
                                 java.lang.String locale)
                          throws XWikiGWTException
Specified by:
getTranslation in interface XWikiService
Throws:
XWikiGWTException

hasAccessLevel

public java.lang.Boolean hasAccessLevel(java.lang.String level,
                                        java.lang.String docName)
                                 throws XWikiGWTException
Description copied from interface: XWikiService
Checks the access level for the current user on the specified document.

Specified by:
hasAccessLevel in interface XWikiService
Parameters:
level - level to verify access for, e.g.: "view", "edit"
docName - fullname of the document to check access level for, e.g. Main.WebHome
Returns:
true if current user has specified access level on the specified document, false otherwise
Throws:
XWikiGWTException

hasAccessLevel

public java.lang.Boolean hasAccessLevel(java.lang.String level,
                                        java.lang.String username,
                                        java.lang.String docName)
                                 throws XWikiGWTException
Description copied from interface: XWikiService
Checks the access level for the user given by username on the specified document.

Specified by:
hasAccessLevel in interface XWikiService
Parameters:
level - level to verify access for, e.g.: "view", "edit"
username - fullname of the user to check access for, e.g. XWiki.User
docName - fullname of the document to check access level for, e.g. Main.WebHome
Returns:
true if specified user has the access level on the specified document, false otherwise
Throws:
XWikiGWTException


Copyright © 2004-2010 XWiki. All Rights Reserved.