com.atlassian.confluence.it.rpc
Class ConfluenceRpc

java.lang.Object
  extended by com.atlassian.confluence.it.rpc.ConfluenceRpc

public class ConfluenceRpc
extends java.lang.Object


Constructor Summary
ConfluenceRpc(java.lang.String baseUrl)
           
 
Method Summary
 void addLabel(java.lang.String label, BlogPost blogPost)
           
 void addLabel(java.lang.String label, Page page)
           
 void addLabelToSpace(java.lang.String label, Space space)
           
 void addMailServer(java.lang.String serverName, java.lang.String from, java.lang.String subjectPrefix, java.lang.String hostname, int port)
           
 void addUserToGroup(User user, Group group)
           
protected  java.util.Vector<java.lang.Object> args(java.lang.Object... params)
           
 void changeAttachmentCreatedDate(Attachment attachment, java.util.Date createdDate)
           
 void changePageModificationDate(long pageId, java.util.Date modificationDate)
           
 java.lang.String convertWikiMarkupToXhtml(java.lang.String wikiMarkup, long pageId)
           
 java.lang.String convertXhtmlToWikiMarkup(java.lang.String xhtml, long pageId)
           
 long createAttachment(Attachment attachment)
           
 long createAttachment(long contentId, Attachment attachment)
           
 long createBlogPost(BlogPost blogPost)
           
 long createComment(Comment comment)
           
 long createComment(Comment comment, long parentCommentId)
           
 long createDraft(Draft draft)
           
 void createGroup(Group group)
           
 void createGroup(java.lang.String groupname)
           
 void createJohnsonEvent(java.lang.String message)
           
 long createPage(Page page)
           
 java.util.Map<java.lang.String,java.lang.String> createPage(java.lang.String spaceKey, java.lang.String title, java.lang.String content, long parentPageId)
           
 java.util.List<Page> createPageHierarchy(Space space, int depth, java.lang.String pageTitlePrefix)
          Create a simple hierarchy of pages where each page is the parent of the next.
 Space createPersonalSpace(User user)
           
 Space createSpace(Space space)
           
 Space createSpace(java.lang.String key, java.lang.String name, java.lang.String description)
           
 void createUser(User user)
           
 void createUserMacro(java.lang.String name, boolean hasBody, java.lang.String bodyType, java.lang.String outputType, java.lang.String template)
           
 void editAttachment(Attachment oldAttachment, Attachment newAttachment)
          Edit either the owning page or the filename of the attachment.
 java.lang.Object execute(java.lang.String method, java.lang.Object... args)
          Execute a Confluence rpc method as the currently logged in user.
 java.lang.Object executeFuncTest(java.lang.String method, java.lang.Object... args)
          Instead of using the execute methods directly, consider adding a wrapper method to ConfluenceRpc
protected  java.lang.Object executeRpc(java.lang.String rpcBase, java.lang.String method, java.lang.Object... args)
           
 java.lang.String exportSite(boolean exportAttachments)
          Returns the URL of the downloadable export.
 java.lang.String exportSpace(Space space, java.lang.String exportType)
          Returns the URL of the downloadable export.
 void flushAllCaches()
           
 void flushIndexQueue()
          Triggers an index queue flush and blocks until flush is complete or up to ms before timing out and throwing a runtime exception.
 long getAttachmentId(long contentId, java.lang.String fileName)
           
 java.util.List<Page> getChildren(long parentPageId)
           
 java.lang.String getConfiguredThemeForSpace(java.lang.String spaceKey)
           
 long getContentPermissionId(ContentPermission contentPermission, long pageId)
           
 long getContentPermissionId(long pageId, java.lang.String permissionType, java.lang.String username)
           
 Page getExistingPage(long pageId)
          Retrieve the Page object for a page, known to exist in confluence.
 Page getExistingPage(Space space, java.lang.String pageTitle)
          Retrieve the fully populated Page object for a page, known to exist in confluence.
 java.lang.String getGlobalConfiguredTheme()
           
 java.lang.String getPageContent(long pageId)
           
 long getPageId(Page page)
           
 long getPageId(java.lang.String spaceKey, java.lang.String title)
           
 java.util.List<java.lang.Long> getPageIdsInSpace(Space space)
           
 java.util.Collection<ContentPermissionEntry> getPagePermissions(long pageId)
           
 PluginHelper getPluginHelper()
          Retrieve a PluginHelper that manipulates plugin using this ConfluenceRpc.
 java.util.List<Page> getTopLevelPages(java.lang.String spaceKey)
           
 java.util.Locale getUserLocale(User user)
           
 void grantAnonymousPermission(SpacePermission permission, Space space)
           
 void grantAnonymousUsePermission()
           
 void grantAnonymousViewUserProfilePermission()
           
 void grantContentPermission(ContentPermission contentPermission, ContentEntity contentEntity)
           
 void grantContentPermissions(ContentEntity contentEntity, java.util.List<Entity> entities, ContentPermissionType permissionType)
           
 void grantPermission(GlobalPermission permission, Group group)
           
 void grantPermission(GlobalPermission permission, User user)
           
 void grantPermission(SpacePermission permission, Space space, Entity entity)
           
 void grantPermissions(Space space, Entity entity, SpacePermission... permissions)
           
 void importSpace(java.io.File zippedXmlBackup)
           
 boolean isClusteredInstance()
           
 void logIn(java.lang.String token)
           
 void logIn(User user)
          Set the current user logged into this rpc client.
 void logOut()
           
 void movePage(long sourcePageId, long targetPageId, java.lang.String position)
           
 void movePage(Page page, Page target, java.lang.String position)
          Move a page "to" another page.
 void movePageToTopLevel(Page page, Space targetSpace)
          Moves a page to the top of the target space
protected  java.util.Hashtable<java.lang.String,java.lang.String> object(java.lang.String... args)
           
 void pauseJob(java.lang.String jobName)
           
 void removeAllJohnsonEvents()
           
 void removeAllSpaces()
           
 void removeDrafts(User user)
           
 void removeGroup(java.lang.String groupname, java.lang.String defaultGroupName)
           
 void removeGroupAndUserDependencies()
           
 void removeMailServer(java.lang.String serverName)
           
 boolean removePage(long pageId)
           
 boolean removePage(Page page)
           
 void removePersonalInformation(User user)
          PersonalInformation gets created automatically by the rpc create user method.
 void removeSpace(java.lang.String spaceKey)
          Removes the space if it exists, otherwise does nothing.
 void removeUser(java.lang.String username)
          Removes the user if it exists, otherwise does nothing.
 void removeUser(User user)
           
 void removeUserFromGroup(User user, Group group)
           
 void removeUserMacro(java.lang.String name)
           
 void resumeJob(java.lang.String jobName)
           
 void revokeAnonymousPermission(SpacePermission permission, Space space)
           
 void revokeAnonymousUsePermission()
           
 void revokeAnonymousViewUserProfilePermission()
           
 void revokeContentPermission(ContentPermission contentPermission, ContentEntity contentEntity)
           
 void revokePermission(GlobalPermission permission, Group group)
           
 void revokePermission(GlobalPermission permission, User user)
           
 void revokePermission(SpacePermission permission, Space space, Entity entity)
           
 void revokePermission(SpacePermission permission, Space space, Group group)
           
 void revokePermission(SpacePermission permission, Space space, User user)
           
 void revokePermissions(Space space, Entity entity, SpacePermission... permissions)
          Unfortunately there is no revokePermissions method on the API, so this just calls the singular method repeatedly.
 long saveBlogPost(BlogPost blogPost)
           
 long saveComment(Comment comment)
           
 long savePage(Page page)
           
 java.util.List<java.util.Hashtable> search(java.lang.String queryString, int maxMatches)
          Search for the supplied query String.
 void setCaptchaDebugMode(boolean enable)
           
 void setCaptchaMode(boolean enable)
           
 void setEnableAnonymousAccess(boolean enable)
           
 void setEnableJavascriptTop(boolean enable)
           
 void setEnableWysiwyg(boolean enable)
           
 void setGlobalTheme(java.lang.String themeKey)
           
 java.lang.String setLogLevel(java.lang.String logger, java.lang.String level)
          Sets the log level of the specified logger, returning the old value.
 void setPageRestriction(ContentPermission contentPermission, Page page)
          Restrict page to single given user or group.
 void setPageRestriction(Page page, Entity entity, ContentPermissionType contentPermissionType)
          Restrict page to single given user or group.
 void setSystemProperty(java.lang.String name, java.lang.String value)
          Set the specified System property on the Confluence server.
 void setThemeForSpace(Space space, java.lang.String themeKey)
           
 void setUserLocale(User user, java.util.Locale locale)
           
 long updateDraft(Draft draft)
           
 long updatePage(Page page, boolean minorEdit, java.lang.String versionComment)
           
 void useAnonymously()
          Indicate that further rpc calls should be made anonymously, rather than as a specific user.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConfluenceRpc

public ConfluenceRpc(java.lang.String baseUrl)
Method Detail

execute

public java.lang.Object execute(java.lang.String method,
                                java.lang.Object... args)
Execute a Confluence rpc method as the currently logged in user. Should only be called when token is not null. Instead of using the execute methods directly, consider adding a wrapper method to ConfluenceRpc

Parameters:
method - the name of the rpc method to call
args - the arguments to be passed to the method. Token will automatically be included first. The rest should be strings or HashTables or Vectors. (I think)
Returns:
whatever object is returned from the rpc method.
See Also:
logIn(User), useAnonymously()

executeFuncTest

public java.lang.Object executeFuncTest(java.lang.String method,
                                        java.lang.Object... args)
Instead of using the execute methods directly, consider adding a wrapper method to ConfluenceRpc


executeRpc

protected java.lang.Object executeRpc(java.lang.String rpcBase,
                                      java.lang.String method,
                                      java.lang.Object... args)

object

protected java.util.Hashtable<java.lang.String,java.lang.String> object(java.lang.String... args)

args

protected java.util.Vector<java.lang.Object> args(java.lang.Object... params)

logIn

public void logIn(User user)
Set the current user logged into this rpc client. Creates a user token for the given user by calling the remote login method. All further methods called on the client will be performed using this token until logOut() or useAnonymously() are called.


logIn

public void logIn(java.lang.String token)

useAnonymously

public void useAnonymously()
Indicate that further rpc calls should be made anonymously, rather than as a specific user. This will last until logIn(com.atlassian.confluence.it.User) or logOut() are called.


logOut

public void logOut()

getPageId

public long getPageId(Page page)

getPageId

public long getPageId(java.lang.String spaceKey,
                      java.lang.String title)

getPageIdsInSpace

public java.util.List<java.lang.Long> getPageIdsInSpace(Space space)

getPageContent

public java.lang.String getPageContent(long pageId)

convertWikiMarkupToXhtml

public java.lang.String convertWikiMarkupToXhtml(java.lang.String wikiMarkup,
                                                 long pageId)

convertXhtmlToWikiMarkup

public java.lang.String convertXhtmlToWikiMarkup(java.lang.String xhtml,
                                                 long pageId)

createPage

public java.util.Map<java.lang.String,java.lang.String> createPage(java.lang.String spaceKey,
                                                                   java.lang.String title,
                                                                   java.lang.String content,
                                                                   long parentPageId)

createPage

public long createPage(Page page)

removePage

public boolean removePage(Page page)

removePage

public boolean removePage(long pageId)

getExistingPage

public Page getExistingPage(Space space,
                            java.lang.String pageTitle)
Retrieve the fully populated Page object for a page, known to exist in confluence.


getExistingPage

public Page getExistingPage(long pageId)
Retrieve the Page object for a page, known to exist in confluence.

Returns:
a Page but with no Space information included.

getChildren

public java.util.List<Page> getChildren(long parentPageId)
Returns:
the children of the specified parent page, in order.

getTopLevelPages

public java.util.List<Page> getTopLevelPages(java.lang.String spaceKey)

savePage

public long savePage(Page page)

updatePage

public long updatePage(Page page,
                       boolean minorEdit,
                       java.lang.String versionComment)

createDraft

public long createDraft(Draft draft)

updateDraft

public long updateDraft(Draft draft)

setPageRestriction

public void setPageRestriction(ContentPermission contentPermission,
                               Page page)
Restrict page to single given user or group. This will wipe any other restrictions.


setPageRestriction

public void setPageRestriction(Page page,
                               Entity entity,
                               ContentPermissionType contentPermissionType)
Restrict page to single given user or group. This will wipe any other restrictions.


getContentPermissionId

public long getContentPermissionId(ContentPermission contentPermission,
                                   long pageId)

getContentPermissionId

public long getContentPermissionId(long pageId,
                                   java.lang.String permissionType,
                                   java.lang.String username)

createBlogPost

public long createBlogPost(BlogPost blogPost)

saveBlogPost

public long saveBlogPost(BlogPost blogPost)

createComment

public long createComment(Comment comment)

createComment

public long createComment(Comment comment,
                          long parentCommentId)

saveComment

public long saveComment(Comment comment)

createAttachment

public long createAttachment(long contentId,
                             Attachment attachment)

createAttachment

public long createAttachment(Attachment attachment)

editAttachment

public void editAttachment(Attachment oldAttachment,
                           Attachment newAttachment)
Edit either the owning page or the filename of the attachment.


getAttachmentId

public long getAttachmentId(long contentId,
                            java.lang.String fileName)

movePage

public void movePage(long sourcePageId,
                     long targetPageId,
                     java.lang.String position)

movePage

public void movePage(Page page,
                     Page target,
                     java.lang.String position)
Move a page "to" another page.

Parameters:
position - see com.atlassian.confluence.content.service.page.MovePageCommand

movePageToTopLevel

public void movePageToTopLevel(Page page,
                               Space targetSpace)
Moves a page to the top of the target space

Parameters:
page - page to move
targetSpace - the target space

addLabel

public void addLabel(java.lang.String label,
                     Page page)

addLabel

public void addLabel(java.lang.String label,
                     BlogPost blogPost)

addLabelToSpace

public void addLabelToSpace(java.lang.String label,
                            Space space)

createSpace

public Space createSpace(Space space)

createSpace

public Space createSpace(java.lang.String key,
                         java.lang.String name,
                         java.lang.String description)

createPersonalSpace

public Space createPersonalSpace(User user)

removeSpace

public void removeSpace(java.lang.String spaceKey)
Removes the space if it exists, otherwise does nothing.


createUser

public void createUser(User user)

removeUser

public void removeUser(User user)

removeUser

public void removeUser(java.lang.String username)
Removes the user if it exists, otherwise does nothing.


createGroup

public void createGroup(java.lang.String groupname)

createGroup

public void createGroup(Group group)

removeGroup

public void removeGroup(java.lang.String groupname,
                        java.lang.String defaultGroupName)

addUserToGroup

public void addUserToGroup(User user,
                           Group group)

removeUserFromGroup

public void removeUserFromGroup(User user,
                                Group group)

exportSpace

public java.lang.String exportSpace(Space space,
                                    java.lang.String exportType)
Returns the URL of the downloadable export.


exportSite

public java.lang.String exportSite(boolean exportAttachments)
Returns the URL of the downloadable export.


grantPermission

public void grantPermission(SpacePermission permission,
                            Space space,
                            Entity entity)

grantPermissions

public void grantPermissions(Space space,
                             Entity entity,
                             SpacePermission... permissions)

grantContentPermission

public void grantContentPermission(ContentPermission contentPermission,
                                   ContentEntity contentEntity)

grantContentPermissions

public void grantContentPermissions(ContentEntity contentEntity,
                                    java.util.List<Entity> entities,
                                    ContentPermissionType permissionType)

revokeContentPermission

public void revokeContentPermission(ContentPermission contentPermission,
                                    ContentEntity contentEntity)

grantAnonymousPermission

public void grantAnonymousPermission(SpacePermission permission,
                                     Space space)

revokePermission

public void revokePermission(SpacePermission permission,
                             Space space,
                             Entity entity)

revokePermissions

public void revokePermissions(Space space,
                              Entity entity,
                              SpacePermission... permissions)
Unfortunately there is no revokePermissions method on the API, so this just calls the singular method repeatedly.


revokePermission

public void revokePermission(SpacePermission permission,
                             Space space,
                             User user)

revokePermission

public void revokePermission(SpacePermission permission,
                             Space space,
                             Group group)

revokeAnonymousPermission

public void revokeAnonymousPermission(SpacePermission permission,
                                      Space space)

grantPermission

public void grantPermission(GlobalPermission permission,
                            User user)

revokePermission

public void revokePermission(GlobalPermission permission,
                             User user)

grantPermission

public void grantPermission(GlobalPermission permission,
                            Group group)

revokePermission

public void revokePermission(GlobalPermission permission,
                             Group group)

grantAnonymousUsePermission

public void grantAnonymousUsePermission()

revokeAnonymousUsePermission

public void revokeAnonymousUsePermission()

grantAnonymousViewUserProfilePermission

public void grantAnonymousViewUserProfilePermission()

revokeAnonymousViewUserProfilePermission

public void revokeAnonymousViewUserProfilePermission()

flushIndexQueue

public void flushIndexQueue()
Triggers an index queue flush and blocks until flush is complete or up to ms before timing out and throwing a runtime exception.


setEnableWysiwyg

public void setEnableWysiwyg(boolean enable)

getUserLocale

public java.util.Locale getUserLocale(User user)

setUserLocale

public void setUserLocale(User user,
                          java.util.Locale locale)

removeDrafts

public void removeDrafts(User user)

removeGroupAndUserDependencies

public void removeGroupAndUserDependencies()

removeAllSpaces

public void removeAllSpaces()

changePageModificationDate

public void changePageModificationDate(long pageId,
                                       java.util.Date modificationDate)

changeAttachmentCreatedDate

public void changeAttachmentCreatedDate(Attachment attachment,
                                        java.util.Date createdDate)

pauseJob

public void pauseJob(java.lang.String jobName)

resumeJob

public void resumeJob(java.lang.String jobName)

getGlobalConfiguredTheme

public java.lang.String getGlobalConfiguredTheme()

getConfiguredThemeForSpace

public java.lang.String getConfiguredThemeForSpace(java.lang.String spaceKey)

setGlobalTheme

public void setGlobalTheme(java.lang.String themeKey)

setThemeForSpace

public void setThemeForSpace(Space space,
                             java.lang.String themeKey)

createJohnsonEvent

public void createJohnsonEvent(java.lang.String message)

removeAllJohnsonEvents

public void removeAllJohnsonEvents()

setCaptchaMode

public void setCaptchaMode(boolean enable)

setCaptchaDebugMode

public void setCaptchaDebugMode(boolean enable)

search

public java.util.List<java.util.Hashtable> search(java.lang.String queryString,
                                                  int maxMatches)
Search for the supplied query String.

Parameters:
queryString - the query
maxMatches - the maximum number of matches to be returned
Returns:
a List of Hashtables representing SearchResults or the empty list if there are no matches.

importSpace

public void importSpace(java.io.File zippedXmlBackup)
                 throws java.io.IOException
Throws:
java.io.IOException

getPagePermissions

public java.util.Collection<ContentPermissionEntry> getPagePermissions(long pageId)

setSystemProperty

public void setSystemProperty(java.lang.String name,
                              java.lang.String value)
Set the specified System property on the Confluence server.

Parameters:
name - the property to set
value - the value to set

getPluginHelper

public PluginHelper getPluginHelper()
Retrieve a PluginHelper that manipulates plugin using this ConfluenceRpc.


createUserMacro

public void createUserMacro(java.lang.String name,
                            boolean hasBody,
                            java.lang.String bodyType,
                            java.lang.String outputType,
                            java.lang.String template)

removeUserMacro

public void removeUserMacro(java.lang.String name)

removePersonalInformation

public void removePersonalInformation(User user)
PersonalInformation gets created automatically by the rpc create user method. This method exists to allow testing that the PersonalInformation will get created appropriately when it doesn't exist (eg for LDAP users).

Parameters:
user - whose personalInformation will be removed

setLogLevel

public java.lang.String setLogLevel(java.lang.String logger,
                                    java.lang.String level)
Sets the log level of the specified logger, returning the old value.

Parameters:
logger - the logger to change the logging for, e.g. com.atlassian.confluence.core.ConfluenceActionSupport
level - the level to set the logger to, e.g. ERROR
Returns:
the previous level the logger was set to.

setEnableAnonymousAccess

public void setEnableAnonymousAccess(boolean enable)

setEnableJavascriptTop

public void setEnableJavascriptTop(boolean enable)

flushAllCaches

public void flushAllCaches()

isClusteredInstance

public boolean isClusteredInstance()

createPageHierarchy

public java.util.List<Page> createPageHierarchy(Space space,
                                                int depth,
                                                java.lang.String pageTitlePrefix)
Create a simple hierarchy of pages where each page is the parent of the next. Returns the pages created with the top-most first in the list.


addMailServer

public void addMailServer(java.lang.String serverName,
                          java.lang.String from,
                          java.lang.String subjectPrefix,
                          java.lang.String hostname,
                          int port)

removeMailServer

public void removeMailServer(java.lang.String serverName)


Copyright © 2003-2010 Atlassian. All Rights Reserved.