com.atlassian.confluence.it.rpc
Class ConfluenceRpc

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

public class ConfluenceRpc
extends Object

A client-side stub of the Confluence remote API.


Nested Class Summary
static class ConfluenceRpc.Version
          Enumeration of all supported versions of the Confluence remote API
 
Method Summary
 boolean addExistingProfilePicture(String username, String filename)
          Attempts to add a existing profile picture to a user's profile.
 boolean addLabel(long labelId, long contentId)
          Adds a label to the content specified by the supplied contentId
 void addLabel(String label, BlogPost blogPost)
           
 boolean addLabel(String label, Page page)
          Adds a label to the specified page
 boolean addLabelByObject(Object remoteLabel, Page page)
          Adds a label to the specified page
 boolean addLabelToSpace(String label, Space space)
          Adds a label to the specified space
 void addMailServer(String serverName, String from, String subjectPrefix, String hostname, int port)
           
 void addMailServer(String serverName, String from, String subjectPrefix, String hostname, int port, String fromName)
           
 boolean addProfilePicture(String username, String filename, String mimeType, byte[] pictureData)
          Attempts to add a profile picture to a user's profile
 boolean addUserToGroup(String username, String groupname)
           
 boolean addUserToGroup(User user, Group group)
           
protected  Vector<Object> args(Object... params)
           
 void buildDidYouMeanIndex()
          Builds the "Did you mean" index via RPC and waits for an event to show that the index build is complete.
 void changeAttachmentCreatedDate(Attachment attachment, Date createdDate)
           
 void changeBlogPostModificationDate(long blogId, Date modificationDate)
           
 boolean changeMyPassword(String oldPassword, String newPassword)
          Attempts to change the current user's old password with the specified new password
 void changePageModificationDate(long pageId, Date modificationDate)
           
 boolean changeUserPassword(String username, String newPassword)
          Attempts to set the specified password for the specified user
 void clearCustomHtml()
           
 void clearSystemProperty(String name)
          Clear the specified System property on the Confluence server.
 String convertWikiMarkupToXhtml(String wikiMarkup, long pageId)
           
 String convertWikiToStorageFormat(String wiki)
           
 String convertXhtmlToWikiMarkup(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(String groupname)
           
 void createJohnsonEvent(String message)
           
 long createPage(Page page)
           
 Map<String,String> createPage(String spaceKey, String title, String content, long parentPageId)
           
 List<Page> createPageHierarchy(Space space, int depth, 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(String key, String name, String description)
           
 boolean createUser(User user)
          Adds the given user
 void createUserMacro(String name, boolean hasBody, String bodyType, String outputType, String template)
           
 void createUserMacro(String name, boolean hasBody, String bodyType, String outputType, String template, String title, String description, String category, String iconUrl, String documentationUrl, boolean hidden)
           
 boolean deactivateUser(String username)
          Deactivates the user matching the specified username
 boolean doesDraftExist(String contentId, String draftCreator, String draftType, String spaceKey)
           
 void editAttachment(Attachment oldAttachment, Attachment newAttachment)
          Edit either the owning page or the filename of the attachment.
 void editPage(Space space, String pageTitle, String newTitle, String newContent)
          Modifies the page with the given details
 boolean editUser(User user)
          Attempts to edit the details of the specified user
 void enableCaptcha(boolean enable)
           
 void enableCaptchaDebugMode(boolean enable)
           
 void enableWebSudo(boolean enabled)
           
 Object execute(String method, Object... args)
          Execute a Confluence rpc method as the currently logged in user.
 Object executeFuncTest(String method, Object... args)
          Instead of using the execute methods directly, consider adding a wrapper method to ConfluenceRpc.
protected  Object executeRpc(String rpcBase, String methodToken, String method, Object... args)
           
 Object executeWithToken(String method, String token, Object... args)
          Execute method with the specified token.
 String exportSite(boolean exportAttachments)
          Returns the URL of the downloadable export.
 String exportSpace(Space space, String exportType)
          Returns the URL of the downloadable export.
 void flushAllCaches()
           
 void flushIndexQueue()
          Triggers an index queue flush and blocks until flush is complete.
 void flushMailQueue()
           
 void follow(User user)
          Follows the given user with the logged in user.
 Object getApplicationConfigProperty(String propertyKey)
           
 long getAttachmentId(long contentId, String fileName)
           
 BlogPost getBlogPost(long pageId)
          Returns the blog post with the specified page ID.
 CacheStatistics getCacheStatistics(CacheKey key)
           
 List<Page> getChildren(long parentPageId)
           
 List<Comment> getComments(Page page)
           
 String getConfiguredBaseUrl()
          Returns the configured base url on the server.
 String getConfiguredThemeForSpace(String spaceKey)
           
 long getContentPermissionId(ContentPermission contentPermission, long pageId)
           
 long getContentPermissionId(long pageId, String permissionType, String username)
           
 Page getExistingPage(long pageId)
          Retrieve the Page object for a page, known to exist in confluence.
 Page getExistingPage(Space space, String pageTitle)
          Retrieve the fully populated Page object for a page, known to exist in confluence.
 String getGlobalConfiguredTheme()
           
 List<Group> getGroups()
          Retrieves existing groups
 List<SearchResult> getLabelContent(long labelId)
           
 List<SearchResult> getLabelContent(String labelName)
           
 List<SearchResult> getLabelContentByObject(Object remoteLabel)
          Returns the content for a given label object
 List<Label> getLabels(long pageId)
          Retrieves the labels for the page matching the specified pageId
 List<Label> getLabels(String labelName, String namespace, String spaceKey, String owner)
          Retrieves the labels matching the given labelName, namespace or owner.
 List<Label> getMostPopularLabels(int maxCount)
          Returns the most popular labels
 List<Label> getMostPopularLabelsInSpace(String spaceKey, int maxCount)
          Returns the most popular labels in the space with the specified key
 int getNumberOfIndexTasksInQueue()
           
 String getPageContent(long pageId)
           
 long getPageId(Page page)
           
 long getPageId(String spaceKey, String title)
           
 List<Long> getPageIdsInSpace(Space space)
           
 Collection<ContentPermissionEntry> getPagePermissions(long pageId)
           
 PluginHelper getPluginHelper()
          Retrieve a PluginHelper that manipulates plugin using this ConfluenceRpc.
 List<Label> getRecentlyUsedLabels(int maxCount)
          Returns the recently used labels for the Confluence instance, with a specified maximum number of results.
 List<Label> getRecentlyUsedLabelsInSpace(String spaceKey, int maxCount)
          Returns the recently used labels in the space with the specified key
 List<Label> getRelatedLabels(String labelName, int maxCount)
          Returns the labels related to the given label name
 List<Label> getRelatedLabelsInSpace(String labelName, String spaceKey, int maxCount)
          Returns the labels related to the given label name in the given space
 Map<String,Object> getServerInfo()
           
 Space getSpace(String spaceKey)
          Returns the space with the specified key.
 List<Space> getSpaces()
          Retrieves spaces visible to the currently logged in rpc user
 List<Space> getSpacesContainingContentWithLabel(String labelName)
           
 List<Space> getSpacesWithLabel(String labelName)
           
 List<Page> getTopLevelPages(String spaceKey)
           
 User getUser(String username)
          Retrieves a user with the given username
 List<Group> getUserGroups(String username)
          Retrieves the groups that a user matching the specified username belongs to
 UserInformation getUserInformation(String username)
           
 UserInformation getUserInformation(User user)
           
 Locale getUserLocale(User user)
           
 List<String> getUsernames(boolean viewAll)
          Retrieves the usernames of the current system users
 String getUserPreference(String userName, String preferenceKey)
           
 String getUserPreference(User user, String preferenceKey)
           
 boolean getUserPreferenceBoolean(String userName, String preferenceKey)
           
 boolean getUserPreferenceBoolean(User user, String preferenceKey)
           
 long getUserPreferenceLong(String userName, String preferenceKey)
           
 long getUserPreferenceLong(User user, String preferenceKey)
           
 void grantAllPermissionsExceptAdmin(Entity entity, Space space)
           
 void grantAnonymousPermission(SpacePermission permission, Space space)
           
 void grantAnonymousUsePermission()
           
 void grantAnonymousViewUserProfilePermission()
           
 void grantContentPermission(ContentPermission contentPermission, ContentEntity contentEntity)
           
 void grantContentPermissions(ContentEntity contentEntity, List<? extends 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)
           
 boolean hasGroup(String groupname)
          Checks whether or not a group matching the specified name exists
 boolean hasUser(String username)
          Checks whether a user with the specified username exists
 void importSpace(File zippedXmlBackup)
           
 boolean isActiveUser(String username)
          Checks whether the user is active
 boolean isClusteredInstance()
           
 void logIn(String token)
           
 void logIn(User user)
          Set the current user logged into this rpc client.
 boolean logMessage(RpcLogDestination destination, String message)
          Logs a message on the server at a specified log level or to sout or syserr.
 void logOut()
           
 void movePage(long sourcePageId, long targetPageId, String position)
           
 void movePage(Page page, Page target, String position)
          Move a page "to" another page.
 void movePageToTopLevel(Page page, Space targetSpace)
          Moves a page to the top of the target space
static ConfluenceRpc newInstance(String baseUrl)
          Create a new RPC stub pointed at the default version of the server-side API.
static ConfluenceRpc newInstance(String baseUrl, ConfluenceRpc.Version version)
          Create a new RPC stub pointed at a specific version of the server-side API.
protected  Hashtable<String,String> object(String... args)
           
 void pauseJob(QuartzJob job)
           
 void pauseJob(String jobName)
           
 void purgeFromTrash(Space space, long pageId)
           
 boolean reactivateUser(String username)
          Reactivates the user matching the specified username
 void removeAllData()
          Removes all the data from the system, including all content and any non-system users and groups.
 void removeAllJohnsonEvents()
           
 void removeAllSpaces()
           
 void removeDrafts(User user)
           
 boolean removeGroup(Group group)
          Removes the group if it exists, otherwise does nothing
 boolean removeGroup(String groupname, String defaultGroupName)
          Removes the group if it exists, otherwise does nothing
 void removeGroupAndUserDependencies()
           
 boolean removeLabel(long labelId, long contentId)
          Removes a label from the specified content
 boolean removeLabel(String label, Page page)
          Removes a label from the specified page
 boolean removeLabelByObject(Object remoteLabel, Page page)
          Removes a label from the specified page
 boolean removeLabelFromSpace(String label, Space space)
          Removes a label from the specified space
 void removeMailServer(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(String spaceKey)
          Removes the space if it exists, otherwise does nothing.
 boolean removeUser(String username)
          Removes the user if it exists, otherwise does nothing.
 void removeUser(User user)
           
 boolean removeUserFromGroup(String username, String groupname)
           
 boolean removeUserFromGroup(User user, Group group)
           
 void removeUserMacro(String name)
           
 void resetGlobalPermissions()
           
 void resumeJob(QuartzJob job)
           
 void resumeJob(String jobName)
           
 boolean revokeAllPermissions(Group group)
          Removes all permissions for the specified group
 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.
 void runJob(QuartzJob job)
          Trigger a quartz job on the server.
 void runJob(String jobName)
           
 long saveBlogPost(BlogPost blogPost)
           
 long saveComment(Comment comment)
           
 long savePage(Page page)
           
 List<Hashtable> search(String queryString, int maxMatches)
          Search for the supplied query String.
 void setApplicationConfigProperty(String propertyKey, String propertyValue)
           
 void setDirectoryPasswordEncoder(String directoryName, String encoder)
           
 void setDraftSaveInterval(int seconds)
           
 void setEnableAnonymousAccess(boolean enable)
           
 void setEnableJavascriptTop(boolean enable)
           
 void setGlobalTheme(String themeKey)
           
 void setKeyboardShortcutPref(User user, boolean enabled)
           
 org.apache.log4j.Level setLogLevel(String logger, org.apache.log4j.Level level)
          Sets the log level of the specified logger, returning the old value.
 String setLogLevel(String logger, String level)
          Deprecated. since 3.3 use setLogLevel(String, Level)
 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(String name, String value)
          Set the specified System property on the Confluence server.
 void setThemeForSpace(Space space, String themeKey)
           
 boolean setUserInformation(UserInformation userInfo)
          Updates a user's information
 void setUserLocale(User user, Locale locale)
           
 void setUserPreference(String userName, String preferenceKey, boolean value)
           
 void setUserPreference(String userName, String preferenceKey, long value)
           
 void setUserPreference(String userName, String preferenceKey, String value)
           
 void setUserPreference(User user, String preferenceKey, boolean value)
           
 void setUserPreference(User user, String preferenceKey, long value)
           
 void setUserPreference(User user, String preferenceKey, String value)
           
 void setUserStatus(String wikiStatus)
          Sets the current user's status.
 void setWatchOwnContent(User user, boolean enabled)
           
 void setWebSudoTimeout(int timeout)
           
 void stopFollowing(User user)
          Stop following the given user.
 void synchroniseUserDirectories()
          Synchronises all the directories which support synchronisation (LDAP, remote Crowd, etc.)
 void unwatchSpace(User user, Space space, ContentTypeEnum contentType)
           
 long updateDraft(Draft draft)
           
 long updatePage(Page page, boolean minorEdit, String versionComment)
          Saves pages, but not blogs, see saveBlogPost(BlogPost).
 void useAnonymously()
          Indicate that further rpc calls should be made anonymously, rather than as a specific user.
 void watchPage(Page page)
          Watch a page as the current user.
 void watchSpace(Space space)
          Watch a space as the current user.
 void watchSpace(User user, Space space, ContentTypeEnum contentType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

newInstance

public static ConfluenceRpc newInstance(String baseUrl,
                                        ConfluenceRpc.Version version)
Create a new RPC stub pointed at a specific version of the server-side API.

Parameters:
baseUrl - the base URL of the server to connect to
version - the version of the API to use
Returns:
an RPC stub object

newInstance

public static ConfluenceRpc newInstance(String baseUrl)
Create a new RPC stub pointed at the default version of the server-side API.

Parameters:
baseUrl - the base URL of the server to connect to
Returns:
an RPC stub object

execute

public Object execute(String method,
                      Object... args)
               throws RpcRuntimeException
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. Longs will be automatically converted to strings to save the hassle of manually converting object IDs
Returns:
whatever object is returned from the rpc method.
Throws:
RpcRuntimeException - wrapping the underlying remote exception
See Also:
logIn(User), useAnonymously()

executeWithToken

public Object executeWithToken(String method,
                               String token,
                               Object... args)
                        throws RpcRuntimeException
Execute method with the specified token.

Parameters:
method - the method to execute
token - the token
args -
Returns:
Throws:
RpcRuntimeException

executeFuncTest

public Object executeFuncTest(String method,
                              Object... args)
                       throws RpcRuntimeException
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. Longs will be automatically converted to strings to save the hassle of manually converting object IDs
Throws:
RpcRuntimeException - wrapping the underlying remote exception

executeRpc

protected Object executeRpc(String rpcBase,
                            String methodToken,
                            String method,
                            Object... args)
                     throws RpcRuntimeException
Throws:
RpcRuntimeException

object

protected Hashtable<String,String> object(String... args)

args

protected Vector<Object> args(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(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(String spaceKey,
                      String title)

getPageIdsInSpace

public List<Long> getPageIdsInSpace(Space space)

getPageContent

public String getPageContent(long pageId)

convertWikiMarkupToXhtml

public String convertWikiMarkupToXhtml(String wikiMarkup,
                                       long pageId)

convertXhtmlToWikiMarkup

public String convertXhtmlToWikiMarkup(String xhtml,
                                       long pageId)

createPage

public Map<String,String> createPage(String spaceKey,
                                     String title,
                                     String content,
                                     long parentPageId)

createPage

public long createPage(Page page)
Parameters:
page - an uncreated page
Returns:
the id of the newly created page

editPage

public void editPage(Space space,
                     String pageTitle,
                     String newTitle,
                     String newContent)
Modifies the page with the given details

Parameters:
space - the space that the page belongs to
pageTitle - the current title of the Page
newTitle - the new title of the Page (null if the same)
newContent - the new content of the Page (null if the same)

removePage

public boolean removePage(Page page)

removePage

public boolean removePage(long pageId)

getExistingPage

public Page getExistingPage(Space space,
                            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.

getBlogPost

public BlogPost getBlogPost(long pageId)
Returns the blog post with the specified page ID. Looks up the space which the blog post belongs to, so this method will execute two RPC calls.


getSpace

public Space getSpace(String spaceKey)
Returns the space with the specified key.


getChildren

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

getTopLevelPages

public List<Page> getTopLevelPages(String spaceKey)

savePage

public long savePage(Page page)

updatePage

public long updatePage(Page page,
                       boolean minorEdit,
                       String versionComment)
Saves pages, but not blogs, see saveBlogPost(BlogPost).


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,
                                   String permissionType,
                                   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)

addProfilePicture

public boolean addProfilePicture(String username,
                                 String filename,
                                 String mimeType,
                                 byte[] pictureData)
Attempts to add a profile picture to a user's profile

Parameters:
username - the user name of the profile
filename - file name of the picture
mimeType - image mime type (must be from image/*)
pictureData - the image data
Returns:
true if the picture is successfully added

addExistingProfilePicture

public boolean addExistingProfilePicture(String username,
                                         String filename)
Attempts to add a existing profile picture to a user's profile.

Parameters:
username - the user name of the profile
filename - file name of the picture
Returns:
true if the picture is successfully added

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,
                            String fileName)

movePage

public void movePage(long sourcePageId,
                     long targetPageId,
                     String position)

movePage

public void movePage(Page page,
                     Page target,
                     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 boolean addLabel(String label,
                        Page page)
Adds a label to the specified page

Parameters:
label - name of the label to add
page - page to add the label to
Returns:
true if the label was successfully added

addLabel

public void addLabel(String label,
                     BlogPost blogPost)

addLabel

public boolean addLabel(long labelId,
                        long contentId)
Adds a label to the content specified by the supplied contentId

Parameters:
labelId - id of the label to add
contentId - id of a page or blogpost to add the label to
Returns:
true if the label is successfully added

addLabelByObject

public boolean addLabelByObject(Object remoteLabel,
                                Page page)
Adds a label to the specified page

Parameters:
remoteLabel - the object retrieved from a direct call to an rpc method that returns a label, i.e. this parameter should be the return value of execute(String, Object...) and not any of wrapper methods that return a Label object
page - page to add the label to
Returns:
true if the label is successfully added

removeLabel

public boolean removeLabel(String label,
                           Page page)
Removes a label from the specified page

Parameters:
label - the name of the label to remove
page - the page to remove the label from
Returns:
true if the label is successfully removed

removeLabel

public boolean removeLabel(long labelId,
                           long contentId)
Removes a label from the specified content

Parameters:
labelId - id of the label to remove
contentId - id of the page or blog to remove the label from
Returns:
true if the label is successfully removed

removeLabelByObject

public boolean removeLabelByObject(Object remoteLabel,
                                   Page page)
Removes a label from the specified page

Parameters:
remoteLabel - the object retrieved from a direct call to an rpc method that returns a label, i.e. this parameter should be the return value of execute(String, Object...) and not any of wrapper methods that return a Label object
page - page to remove the label from
Returns:
true if the label is successfully removed

addLabelToSpace

public boolean addLabelToSpace(String label,
                               Space space)
Adds a label to the specified space

Parameters:
label - the label to add
space - the space to add the label to
Returns:
true if the label is successfully added

removeLabelFromSpace

public boolean removeLabelFromSpace(String label,
                                    Space space)
Removes a label from the specified space

Parameters:
label - the label to remove
space - the space to remove the label from
Returns:
true if the label is successfully removed

getSpacesWithLabel

public List<Space> getSpacesWithLabel(String labelName)

getSpacesContainingContentWithLabel

public List<Space> getSpacesContainingContentWithLabel(String labelName)

getLabelContent

public List<SearchResult> getLabelContent(long labelId)

getLabelContent

public List<SearchResult> getLabelContent(String labelName)

getLabelContentByObject

public List<SearchResult> getLabelContentByObject(Object remoteLabel)
Returns the content for a given label object

Parameters:
remoteLabel - the object retrieved from a direct call to an rpc method that returns a label, i.e. this parameter should be the return value of execute(String, Object...) and not any of wrapper methods that return a Label object
Returns:
content for the given label object

getLabels

public List<Label> getLabels(long pageId)
Retrieves the labels for the page matching the specified pageId

Returns:
labels for the page

getLabels

public List<Label> getLabels(String labelName,
                             String namespace,
                             String spaceKey,
                             String owner)
Retrieves the labels matching the given labelName, namespace or owner. This method can be used to retrieve labels of a specific type, such as personal labels, by setting the namespace. Parameters with empty strings are ignored.

Parameters:
labelName - the name of the label to search for (not parsed for prefixes)
namespace - the namespace to restrict by
spaceKey - the key of the space to restrict by
owner - the owner of the labels
Returns:
labels matching the specified details

getMostPopularLabels

public List<Label> getMostPopularLabels(int maxCount)
Returns the most popular labels

Parameters:
maxCount - the maximum number of labels to return, or no limit if this is 0
Returns:
labels sorted by descending popularity

getMostPopularLabelsInSpace

public List<Label> getMostPopularLabelsInSpace(String spaceKey,
                                               int maxCount)
Returns the most popular labels in the space with the specified key

Parameters:
spaceKey - key for the space
maxCount - the maximum number of labels to return, or no limit if this is 0
Returns:
labels sorted by descending popularity

getRecentlyUsedLabels

public List<Label> getRecentlyUsedLabels(int maxCount)
Returns the recently used labels for the Confluence instance, with a specified maximum number of results.

Parameters:
maxCount - the maximum number of labels to return, or the default if this is 0
Returns:
labels sorted by most recent use

getRecentlyUsedLabelsInSpace

public List<Label> getRecentlyUsedLabelsInSpace(String spaceKey,
                                                int maxCount)
Returns the recently used labels in the space with the specified key

Parameters:
spaceKey - key for the space
maxCount - the maximum number of labels to return, or the default if this is 0
Returns:
labels sorted by most recent use

getRelatedLabels

public List<Label> getRelatedLabels(String labelName,
                                    int maxCount)
Returns the labels related to the given label name

Parameters:
labelName - name of the label to find related labels with
maxCount - the maximum number of labels to return, or the default if this is 0
Returns:

getRelatedLabelsInSpace

public List<Label> getRelatedLabelsInSpace(String labelName,
                                           String spaceKey,
                                           int maxCount)
Returns the labels related to the given label name in the given space

Parameters:
labelName - name of the label to find related labels with
spaceKey - the key of the space to search in
maxCount - the maximum number of labels to return, or the default if this is 0
Returns:

createSpace

public Space createSpace(Space space)

createSpace

public Space createSpace(String key,
                         String name,
                         String description)

createPersonalSpace

public Space createPersonalSpace(User user)

removeSpace

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


getSpaces

public List<Space> getSpaces()
Retrieves spaces visible to the currently logged in rpc user

Returns:
spaces visible spaces

createUser

public boolean createUser(User user)
Adds the given user

Returns:
true if the user was successfully created

getUser

public User getUser(String username)
Retrieves a user with the given username

Returns:
the user matching the given username, without a password

getUserInformation

public UserInformation getUserInformation(User user)

getUserInformation

public UserInformation getUserInformation(String username)

setUserInformation

public boolean setUserInformation(UserInformation userInfo)
Updates a user's information

Returns:
true if the user's information is successfully updated

getUsernames

public List<String> getUsernames(boolean viewAll)
Retrieves the usernames of the current system users

Parameters:
viewAll - If false, all usernames in the confluence-users group will be returned. Otherwise, every registered username is returned.
Returns:
usernames found

changeUserPassword

public boolean changeUserPassword(String username,
                                  String newPassword)
Attempts to set the specified password for the specified user

Returns:
true if the user's password is successfully changed

changeMyPassword

public boolean changeMyPassword(String oldPassword,
                                String newPassword)
Attempts to change the current user's old password with the specified new password

Returns:
true if the current user's password is successfully changed

editUser

public boolean editUser(User user)
Attempts to edit the details of the specified user

Returns:
true if the user's details are successfully edited

removeUser

public void removeUser(User user)

removeUser

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

Returns:
true if the user was removed

hasUser

public boolean hasUser(String username)
Checks whether a user with the specified username exists

Returns:
true if the user exists

deactivateUser

public boolean deactivateUser(String username)
Deactivates the user matching the specified username

Returns:
true if the user is deactivated

reactivateUser

public boolean reactivateUser(String username)
Reactivates the user matching the specified username

Returns:
true if the user is reactivated

isActiveUser

public boolean isActiveUser(String username)
Checks whether the user is active

Parameters:
username - The username of the user whose status to check
Returns:
True if the user is active, false otherwise

createGroup

public void createGroup(String groupname)

createGroup

public void createGroup(Group group)

removeGroup

public boolean removeGroup(Group group)
Removes the group if it exists, otherwise does nothing

Returns:
true if the group was removed

removeGroup

public boolean removeGroup(String groupname,
                           String defaultGroupName)
Removes the group if it exists, otherwise does nothing

Parameters:
groupname - the group to remove
defaultGroupName - another group to put existing members of the group in. Can be an empty string if users should not be added to any other group.
Returns:
true if the group was removed

hasGroup

public boolean hasGroup(String groupname)
Checks whether or not a group matching the specified name exists

Returns:
true if the group exists

getGroups

public List<Group> getGroups()
Retrieves existing groups

Returns:
existing groups

getUserGroups

public List<Group> getUserGroups(String username)
Retrieves the groups that a user matching the specified username belongs to

Returns:
groups that the user belongs to

addUserToGroup

public boolean addUserToGroup(String username,
                              String groupname)

addUserToGroup

public boolean addUserToGroup(User user,
                              Group group)

removeUserFromGroup

public boolean removeUserFromGroup(User user,
                                   Group group)

removeUserFromGroup

public boolean removeUserFromGroup(String username,
                                   String groupname)

exportSpace

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


exportSite

public 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)

grantAllPermissionsExceptAdmin

public void grantAllPermissionsExceptAdmin(Entity entity,
                                           Space space)

grantContentPermission

public void grantContentPermission(ContentPermission contentPermission,
                                   ContentEntity contentEntity)

grantContentPermissions

public void grantContentPermissions(ContentEntity contentEntity,
                                    List<? extends 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)

revokeAllPermissions

public boolean revokeAllPermissions(Group group)
Removes all permissions for the specified group

Returns:
true if all permissions were removed

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.


buildDidYouMeanIndex

public void buildDidYouMeanIndex()
Builds the "Did you mean" index via RPC and waits for an event to show that the index build is complete.

Throws:
RuntimeException - if the index times out.

runJob

public void runJob(QuartzJob job)
Trigger a quartz job on the server. Waits for the job to complete before returning.


runJob

public void runJob(String jobName)

getNumberOfIndexTasksInQueue

public int getNumberOfIndexTasksInQueue()

getUserLocale

public Locale getUserLocale(User user)

setUserLocale

public void setUserLocale(User user,
                          Locale locale)

setKeyboardShortcutPref

public void setKeyboardShortcutPref(User user,
                                    boolean enabled)

setWatchOwnContent

public void setWatchOwnContent(User user,
                               boolean enabled)

watchSpace

public void watchSpace(Space space)
Watch a space as the current user.


watchSpace

public void watchSpace(User user,
                       Space space,
                       ContentTypeEnum contentType)

watchPage

public void watchPage(Page page)
Watch a page as the current user.


unwatchSpace

public void unwatchSpace(User user,
                         Space space,
                         ContentTypeEnum contentType)

removeDrafts

public void removeDrafts(User user)

removeAllData

public void removeAllData()
Removes all the data from the system, including all content and any non-system users and groups. Also restores some administrative settings that occasionally get changed.


removeGroupAndUserDependencies

public void removeGroupAndUserDependencies()

removeAllSpaces

public void removeAllSpaces()

changeBlogPostModificationDate

public void changeBlogPostModificationDate(long blogId,
                                           Date modificationDate)

changePageModificationDate

public void changePageModificationDate(long pageId,
                                       Date modificationDate)

changeAttachmentCreatedDate

public void changeAttachmentCreatedDate(Attachment attachment,
                                        Date createdDate)

pauseJob

public void pauseJob(String jobName)

pauseJob

public void pauseJob(QuartzJob job)

resumeJob

public void resumeJob(String jobName)

resumeJob

public void resumeJob(QuartzJob job)

getGlobalConfiguredTheme

public String getGlobalConfiguredTheme()

getConfiguredThemeForSpace

public String getConfiguredThemeForSpace(String spaceKey)

setGlobalTheme

public void setGlobalTheme(String themeKey)

setThemeForSpace

public void setThemeForSpace(Space space,
                             String themeKey)

clearCustomHtml

public void clearCustomHtml()

createJohnsonEvent

public void createJohnsonEvent(String message)

removeAllJohnsonEvents

public void removeAllJohnsonEvents()

enableCaptcha

public void enableCaptcha(boolean enable)

enableCaptchaDebugMode

public void enableCaptchaDebugMode(boolean enable)

setDraftSaveInterval

public void setDraftSaveInterval(int seconds)

doesDraftExist

public boolean doesDraftExist(String contentId,
                              String draftCreator,
                              String draftType,
                              String spaceKey)

search

public List<Hashtable> search(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(File zippedXmlBackup)
                 throws IOException
Throws:
IOException

getPagePermissions

public Collection<ContentPermissionEntry> getPagePermissions(long pageId)

setSystemProperty

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

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

clearSystemProperty

public void clearSystemProperty(String name)
Clear the specified System property on the Confluence server.

Parameters:
name - the property to set

getPluginHelper

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


createUserMacro

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

createUserMacro

public void createUserMacro(String name,
                            boolean hasBody,
                            String bodyType,
                            String outputType,
                            String template,
                            String title,
                            String description,
                            String category,
                            String iconUrl,
                            String documentationUrl,
                            boolean hidden)

removeUserMacro

public void removeUserMacro(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 String setLogLevel(String logger,
                          String level)
Deprecated. since 3.3 use setLogLevel(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.

setLogLevel

public org.apache.log4j.Level setLogLevel(String logger,
                                          org.apache.log4j.Level 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. Level.ERROR
Returns:
the previous level the logger was set to.

logMessage

public boolean logMessage(RpcLogDestination destination,
                          String message)
Logs a message on the server at a specified log level or to sout or syserr.

Returns:
always true.

setEnableAnonymousAccess

public void setEnableAnonymousAccess(boolean enable)

setEnableJavascriptTop

public void setEnableJavascriptTop(boolean enable)

flushAllCaches

public void flushAllCaches()

getCacheStatistics

public CacheStatistics getCacheStatistics(CacheKey key)

isClusteredInstance

public boolean isClusteredInstance()

createPageHierarchy

public List<Page> createPageHierarchy(Space space,
                                      int depth,
                                      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.


resetGlobalPermissions

public void resetGlobalPermissions()

addMailServer

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

addMailServer

public void addMailServer(String serverName,
                          String from,
                          String subjectPrefix,
                          String hostname,
                          int port,
                          String fromName)

removeMailServer

public void removeMailServer(String serverName)

flushMailQueue

public void flushMailQueue()

setApplicationConfigProperty

public void setApplicationConfigProperty(String propertyKey,
                                         String propertyValue)

getApplicationConfigProperty

public Object getApplicationConfigProperty(String propertyKey)

follow

public void follow(User user)
Follows the given user with the logged in user.

Parameters:
user - the user to follow.
See Also:
stopFollowing(com.atlassian.confluence.it.User)

stopFollowing

public void stopFollowing(User user)
Stop following the given user.

Parameters:
user - the user to follow.
See Also:
follow(com.atlassian.confluence.it.User)

setUserStatus

public void setUserStatus(String wikiStatus)
Sets the current user's status.

Parameters:
wikiStatus - the new status of the user as wiki markup.

getConfiguredBaseUrl

public String getConfiguredBaseUrl()
Returns the configured base url on the server.


getServerInfo

public Map<String,Object> getServerInfo()

setUserPreference

public void setUserPreference(User user,
                              String preferenceKey,
                              boolean value)

setUserPreference

public void setUserPreference(String userName,
                              String preferenceKey,
                              boolean value)

getUserPreferenceBoolean

public boolean getUserPreferenceBoolean(String userName,
                                        String preferenceKey)

getUserPreferenceBoolean

public boolean getUserPreferenceBoolean(User user,
                                        String preferenceKey)

setUserPreference

public void setUserPreference(String userName,
                              String preferenceKey,
                              String value)

setUserPreference

public void setUserPreference(User user,
                              String preferenceKey,
                              String value)

getUserPreference

public String getUserPreference(String userName,
                                String preferenceKey)

getUserPreference

public String getUserPreference(User user,
                                String preferenceKey)

setUserPreference

public void setUserPreference(String userName,
                              String preferenceKey,
                              long value)

setUserPreference

public void setUserPreference(User user,
                              String preferenceKey,
                              long value)

getUserPreferenceLong

public long getUserPreferenceLong(String userName,
                                  String preferenceKey)

getUserPreferenceLong

public long getUserPreferenceLong(User user,
                                  String preferenceKey)

convertWikiToStorageFormat

public String convertWikiToStorageFormat(String wiki)

enableWebSudo

public void enableWebSudo(boolean enabled)

setWebSudoTimeout

public void setWebSudoTimeout(int timeout)

synchroniseUserDirectories

public void synchroniseUserDirectories()
Synchronises all the directories which support synchronisation (LDAP, remote Crowd, etc.)


setDirectoryPasswordEncoder

public void setDirectoryPasswordEncoder(String directoryName,
                                        String encoder)

purgeFromTrash

public void purgeFromTrash(Space space,
                           long pageId)

getComments

public List<Comment> getComments(Page page)


Copyright © 2003-2011 Atlassian. All Rights Reserved.