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.

DO NOT add methods to this class! Per the manifesto in AdminRpc, we should be trying to split this class into smaller RPC clients that are accessed directly from tests. Deprecate and replace uses of methods in this class whenever possible.


Nested Class Summary
static class ConfluenceRpc.Version
          Enumeration of all supported versions of the Confluence remote API
 
Field Summary
 AdminRpc admin
           
 AttachmentRpc attachments
           
 AuthenticatedWebResourceProvider baseResourceProvider
           
 ContentRpc content
           
 DarkFeaturesHelper darkFeatures
           
 LabelsRpc labels
           
 LikesRpc likes
           
 MailRpc mail
           
 NotificationsRpc notifications
           
 SpaceRpc spaces
           
 UserPreferencesRpc userPreferences
           
 
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
 boolean addLabel(String label, AbstractContentEntity target)
           
 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)
          Deprecated. since 5.0. Use addSmtpServer(String, String, String, String, int) instead.
 void addMailServer(String serverName, String from, String subjectPrefix, String hostname, int port, String fromName)
          Deprecated. since 5.0. Use addSmtpServer(String, String, String, String, int, String) instead.
 boolean addProfilePicture(String username, String filename, String mimeType, byte[] pictureData)
          Attempts to add a profile picture to a user's profile
 boolean addSidebarQuickLink(String spaceKey, long pageId, String title, String customClass)
          Deprecated. since 5.2 use executeAuthPluginXmlRpc(String, String, Object...)
 void addSmtpServer(String serverName, String from, String subjectPrefix, String hostname, int port)
           
 void addSmtpServer(String serverName, String from, String subjectPrefix, String hostname, int port, String fromName)
           
 boolean addUserToGroup(String username, String groupname)
           
 boolean addUserToGroup(User user, Group group)
           
 void archiveSpace(Space space)
           
protected  Vector<Object> args(Object... params)
           
 void assertThatMostRecentIndexEntriesHaveBeenProcessed(ContentEntity... entities)
           
 void changeAttachmentCreatedDate(Attachment attachment, Date createdDate)
           
 void changeBlogPostModificationDate(long blogId, Date modificationDate)
           
 void changeCommentCreatedDate(Comment comment, Date newCreationDate)
           
 boolean changeMyPassword(String oldPassword, String newPassword)
          Attempts to change the current user's old password with the specified new password
 void changePageCreatedDate(long id, Date newDate)
           
 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 clearIndex()
           
 boolean clearIndexQueue()
           
 void clearMailQueue()
           
 void clearQueue(String queueName)
           
 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)
           
 int countDrafts(User user)
           
 long createAttachment(Attachment attachment)
           
 long createAttachment(ContentEntity page, Attachment attachment)
           
 long createAttachment(long contentId, Attachment attachment)
           
 long createAttachmentOnDraft(Attachment attachment)
           
 long createBlogPost(BlogPost blogPost)
           
 long createComment(Comment comment)
           
 long createComment(Comment comment, long parentCommentId)
          Deprecated. Since 5.5. Just call createComment(Comment) with a Comment that has a parentId set.
 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)
          Deprecated. Since 5.4. Use createPage(Page).
 List<Page> createPageHierarchy(Space space, int depth, String pageTitlePrefix)
          Create a simple hierarchy of pages where each page is the parent of the next.
 List<Page> createPagesFromPrototype(Page pageTemplate, int count)
           
 Space createPersonalSpace(User user)
           
 Space createSpace(Space space)
           
 Space createSpace(String key, String name, String description)
          Deprecated. Since 5.5. Create a Space and call createSpace(Space).
 Iterable<String> createSpaces(int i)
          Creates a bunch of spaces.
 long createTemplate(String templateName, String content, Space space)
           
 long createTemplateWithStorageFormat(String templateName, String storageFormat, Space space)
           
 int createTestUsers(int count)
           
 boolean createUser(User user)
          Adds the given user
 boolean createUser(User user, boolean notifyUser)
          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)
           
 long createWikiMarkupPage(Page page)
          Deprecated. Since 5.4. Use XHTML markup in your tests, and call createPage(Page)
 boolean deactivateUser(String username)
          Deactivates the user matching the specified username
 void disableAnonymousAccess()
           
 boolean doesDraftExist(String contentId, String draftCreator, String draftType, String spaceKey)
           
 void editAttachment(Attachment updatedAttachment)
          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 enableAnonymousAccess()
           
 void enableCaptcha(boolean enable)
           
 void enableCaptchaDebugMode(boolean enable)
           
 boolean enableDailyReportNotification(User user, boolean dailyReportEnabled)
           
 void enableElevatedSecurityCheck(boolean enabled)
           
 void enableNewUserEmailNotifications()
           
 void enablePublicSignUp(boolean enabled)
           
 void enableWebSudo(boolean enabled)
           
 Object execute(String method, Object... args)
          Deprecated. Since 5.6. Use the less ambiguous executeOnCurrentNode(String, Object...)
 Object executeAuthPluginXmlRpc(String servicePath, String method, Object... args)
          Deprecated. Since 5.6. Use the less ambiguous executeAuthPluginXmlRpcOnCurrentNode(String, String, Object...)
<T> T
executeAuthPluginXmlRpcOnCurrentNode(String servicePath, String method, Object... args)
           
 Object executeFuncTest(String method, Object... args)
          Deprecated. Since 5.6. Use the less ambiguous executeFuncTestOnCurrentNode(String, Object...)
<T> T
executeFuncTestOnCurrentNode(String method, Object... args)
          Instead of using the execute methods directly, consider adding a wrapper method to ConfluenceRpc.
protected  Object executeFuncTestWithToken(String method, String token, Object... args)
          Deprecated. 
<T> T
executeOnCurrentNode(String method, Object... args)
           
 Object executePluginXmlRpc(String servicePath, String method, Object... args)
          Execute a Confluence plugin rpc method as anonymous user.
protected  Object executeRpc(String rpcBase, String methodToken, String method, Object... args)
          Deprecated. 
 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 flushEdgeIndexQueue()
           
 boolean flushIndexQueue()
          Triggers an index queue flush and blocks until flush is complete.
 boolean flushIndexQueue(long time, TimeUnit unit)
           
 void flushIndexQueueAndVerify(ContentEntity... contentEntities)
          Flush the entire index queue, and explicitly assert that the given content entities had their most recent index queue journal entries processed.
 void flushMailQueue()
          waits for all async events to be processed and flushes mail queue waiting is needed because otherwise there's a chance that mail won't be in queue at time of flushing
 void follow(User user)
          Follows the given user with the logged in user.
 void followUsers(User follower, Iterable<User> followees)
           
 List<Map> getAliveThreads()
           
 List<Page> getAncestors(Page homePage)
           
 String getAnonymoizedCurrentClusterNodeIdentifier()
           
 Object getApplicationConfigProperty(String propertyKey)
           
 Attachment getAttachment(long contentId, String fileName)
           
 byte[] getAttachmentData(Attachment attachment, String version)
           
 byte[] getAttachmentData(long contentId, String fileName, String version)
           
 long getAttachmentId(long contentId, String fileName)
           
 List<Attachment> getAttachments(Page homePage)
           
 Object getBandanaValue(String context, String key)
           
 String getBaseUrl()
           
 BlogPost getBlogPost(long pageId)
          Returns the blog post with the specified page ID.
 Integer getCacheMaximumNumberOfElements(String cacheName)
          Deprecated. since 5.6. Use CacheRpc.getCacheMaxEntries(String) directly.
 CacheStatistics getCacheStatistics(CacheKey key)
           
 Set<CacheStatistics.Capability> getCacheStatisticsCapabilities()
           
 List<Page> getChildren(long parentPageId)
           
 Map<String,Object> getClusterInformation()
           
 Comment getComment(AbstractPageEntity pageEntity, long commentId)
           
 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)
           
 List<Map<String,String>> getContentPermissions(long contentId, ContentPermissionType permissionType)
           
 Map<String,Object> getContentPermissionSet(long contentId, ContentPermissionType permissionType)
           
 String getContentPropertiesString(long contentId, String key)
          Uses ContentProperties.
 String getContentPropertiesStringForSpace(String spaceKey, String key)
          Uses ContentProperties associated with the SpaceDescription.
 String getContentProperty(long contentId, String key)
          Uses ContentPropertyManager.
 List<String> getContentPropertyKeys(long contentId)
          Uses ContentPropertyManager.
 Vector<Hashtable> getCusterNodeStatuses()
           
 DarkFeaturesHelper getDarkFeaturesHelper()
           
 String getDatabaseStatistics()
           
 List<Page> getDescendents(Page homePage)
           
 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 getExportBuildNumber()
           
 String getFriendlyRelativeDate(Date now, Date date, TimeZone timeZone)
          Use the FriendlyDateFormatter to format the date relative to the "now" time.
 String getGlobalConfiguredTheme()
           
 List<GlobalPermission> getGlobalPermissions(Group group)
           
 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.
 String getLocalisedText(String messageKey)
          Returns the localised message text for the given key, retrieved from the application via RPC.
 String getLoggedInUser()
           
 int getMailQueueSize()
           
 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 getNumberOfActiveUsers()
           
 int getNumberOfIndexTasksInQueue()
           
 String getOldestSpaceImportAllowed()
           
 String getPageContent(long pageId)
           
 List<Map<String,String>> getPageHistory(Page homePage)
           
 long getPageId(Page page)
           
 long getPageId(String spaceKey, String title)
           
 List<Long> getPageIdsInSpace(Space space)
           
 Collection<ContentPermissionEntry> getPagePermissions(long pageId)
           
 List<Page> getPagesInSpace(Space space)
           
 Page getPageWithDetails(long pageId)
          A heavier version of getExistingPage(long), that makes several calls to the server to flesh out the space and the last modifier.
 long getParentId(long pageId)
           
 List<String> getPermissionsForUser(Space space, User user)
           
 List<String> getPermissionsForUser(String spaceKey, String username)
           
 long getPersonalInformationId(String username)
           
 String getPluginExportCompatibility(String pluginKey)
           
 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)
           
 String getSystemProperty(String name)
          Retrieve the value of the specified System property on the Confluence server.
 List<Page> getTopLevelPages(String spaceKey)
           
 UserWithKey getUser(String username)
          Retrieves a user with the given username
 UserWithKey getUser(String username, String password)
           
 UserWithKey getUser(User user)
           
 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
 void grantAllPermissions(Entity entity, Space space)
           
 void grantAllPermissionsExceptAdmin(Entity entity, Space space)
           
 void grantAnonymousPermission(SpacePermission permission, Space space)
           
 void grantAnonymousUsePermission()
           
 boolean grantAnonymousViewUserProfilePermission()
           
 void grantContentPermission(ContentEntity contentEntity, Entity entity, ContentPermissionType permissionType)
           
 void grantContentPermission(ContentPermission contentPermission, ContentEntity contentEntity)
           
 void grantContentPermissions(ContentEntity contentEntity, List<? extends Entity> entities, ContentPermissionType permissionType)
           
 void grantPermission(GlobalPermission permission, Entity entity)
           
 void grantPermission(SpacePermission permission, Space space, Entity entity)
           
 void grantPermission(SpacePermission permission, String spaceKey, 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(byte[] zippedXmlBackup)
           
 void importSpace(File zippedXmlBackup)
           
 boolean isActiveUser(String username)
          Checks whether the user is active
 boolean isClusteredInstance()
           
 boolean isDarkFeatureEnabled(String key)
           
 boolean isImportTaskRunning()
           
 boolean isPluginUpgradeTasksComplete()
           
 boolean isSpringComponentPresent(String componentName)
           
 boolean isUnlimitedUserLicense()
           
 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 moveBlogPost(BlogPost blogPost, Space targetSpace)
           
 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(BaseUrlSelector baseUrlSelector)
          Create a new RPC stub pointed at the default version of the server-side API.
static ConfluenceRpc newInstance(BaseUrlSelector baseUrlSelector, com.sun.jersey.api.client.Client restClient)
           
static ConfluenceRpc newInstance(BaseUrlSelector baseUrlSelector, ConfluenceRpc.Version version)
          Create a new RPC stub pointed at a specific version of the server-side API.
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, com.sun.jersey.api.client.Client restClient)
          Deprecated. 
static ConfluenceRpc newInstance(String baseUrl, ConfluenceRpc.Version version)
          Create a new RPC stub pointed at a specific version of the server-side API.
static ConfluenceRpc newInstanceForSetup(String baseUrl, ConfluenceRpc.Version version)
          Create a new RPC stub pointed at a specific version of the server-side API, for use with Setup acceptance tests.
protected  Hashtable<String,String> object(String... args)
           
 void pauseAllJobs()
           
 void pauseJob(QuartzJob job)
           
 void pauseJob(String jobName)
          Deprecated. Since 5.6. Use SchedulerRpc.pauseJob(QuartzJob)
 void pauseJobGroup(String jobGroupName)
           
 String performBackup(boolean exportAttachments)
           
 void purgeFromTrash(Space space, long pageId)
          Deprecated. Since 5.6. Just call ContentRpc.purge(ContentId) directly.
 void putStringMappingInCache(String cacheName, String entryKey, String value)
           
 boolean reactivateUser(String username)
          Reactivates the user matching the specified username
 void removeAllJohnsonEvents()
           
 void removeAllSpaces()
           
 void removeAttachment(long pageId, String fileName)
           
 void removeAttachmentUncleanly(long pageId, String fileName)
           
 void removeBandanaKey(String context, String key)
           
 void removeComment(Comment comment)
           
 void removeComment(long commentId)
          Remove a comment, identified by its id.
 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
 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)
           
 boolean removePageVersion(long historicalPageId)
           
 boolean removePageVersion(long pageId, int version)
           
 void removePersonalInformation(User user)
          PersonalInformation gets created automatically by the rpc create user method.
 void removeSidebarQuickLink(String spaceKey, long pageId)
          Deprecated. since 5.2 use executeAuthPluginXmlRpc(String, String, Object...)
 void removeSidebarQuickLinks(String spaceKey)
          Deprecated. since 5.2 use executeAuthPluginXmlRpc(String, String, Object...)
 boolean removeSpace(String spaceKey)
          Removes the space if it exists, otherwise does nothing.
 void removeTestData(Set<User> usersToKeep, Set<Group> groupsToKeep, Map<Group,HashSet<User>> userGroupMembershipsToKeep)
          Perform all test-data reset tasks.
 void removeTestDataAfterExternalUserManagement()
          Called on an instance that manages User/Group data externally, this will: 1.
 boolean removeUser(String username)
          Removes the user if it exists, otherwise does nothing.
 void removeUser(User user)
           
 boolean removeUserDirectory(long directoryId)
           
 boolean removeUserFromGroup(String username, String groupname)
           
 boolean removeUserFromGroup(User user, Group group)
           
 void removeUserMacro(String name)
           
 boolean renameUser(String oldUsername, String newUsername)
           
 void resetDatabaseStatistics()
           
 boolean resetWelcomeMessage()
           
 void restoreAbstractPage(long id)
           
 void resumeJob(QuartzJob job)
           
 void resumeJob(String jobName)
          Deprecated. Since 5.6. Use SchedulerRpc.resumeJob(QuartzJob)
 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, Entity entity)
           
 void revokePermission(SpacePermission permission, Space space, Entity entity)
           
 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 runGarbageCollection()
           
 void runJob(QuartzJob job)
          Trigger a quartz job on the server.
 void runJob(String jobName)
          Deprecated. Since 5.6. Use SchedulerRpc.triggerJob(QuartzJob, boolean).
 long saveBlogPost(BlogPost blogPost)
           
 long saveComment(Comment comment)
           
 void saveDateFormat(String pattern)
           
 long savePage(Page page)
           
 List<Hashtable<String,String>> search(String queryString, Hashtable<String,String> params, int maxMatches)
           
 List<Hashtable<String,String>> search(String queryString, int maxMatches)
          Search for the supplied query String.
 void setApplicationConfigProperty(String propertyKey, String propertyValue)
           
 void setBandanaKey(String context, String key, boolean value)
           
 void setBandanaKey(String context, String key, int value)
           
 void setBandanaKey(String context, String key, List<String> value)
           
 void setBandanaKey(String context, String key, Set<String> value)
           
 void setBandanaKey(String context, String key, String value)
           
 void setBlogRestriction(ContentPermission contentPermission, BlogPost blogPost)
          Restricts blog post to single given user or group, wiping out any other existing restrictions.
 void setCacheMaximumNumberOfElements(String cacheName, int maxNumElements)
          Deprecated. since 5.6. Use CacheRpc.setCacheMaxEntries(String, int) directly.
 void setContentPropertiesString(long contentId, String key, String value)
          Uses ContentProperties.
 void setContentPropertiesStringForSpace(String spaceKey, String key, String value)
          Uses ContentProperties associated with the SpaceDescription.
 void setContentRestriction(ContentPermission contentPermission, AbstractPageEntity abstractPage)
          Restricts page or blog post to single given user or group, wiping out any other existing restrictions.
 void setContentTextProperty(long contentId, String key, String value)
          Uses ContentPropertyManager.
 void setDirectoryPasswordEncoder(String directoryName, String encoder)
           
 void setDraftRestriction(ContentPermission contentPermission, Draft draft)
          Restricts blog post to single given user or group, wiping out any other existing restrictions.
 void setDraftSaveInterval(int seconds)
           
 void setEnableAnonymousAccess(boolean enable)
           
 void setEnableAnonymousRpc(boolean enable)
           
 void setGlobalLanguage(String locale)
           
 void setGlobalTheme(BundledTheme theme)
           
 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 levelStr)
          Deprecated. since 3.3 use setLogLevel(String, Level)
 void setPageRestriction(ContentPermission contentPermission, Page page)
          Restricts page to a single given user or group, wiping out any other existing restrictions.
 void setPageRestriction(Page page, Entity entity, ContentPermissionType contentPermissionType)
          Restrict page to single given user or group.
 void setSmtpServer(String serverName, String from, String subjectPrefix, String hostname, int port)
           
 void setSmtpServer(String serverName, String from, String subjectPrefix, String hostname, int port, String fromName)
           
 void setSystemProperty(String name, String value)
          Set the specified System property on the Confluence server.
 void setThemeForSpace(Space space, BundledTheme theme)
           
 boolean setUserDetailProperty(User user, String key, String value)
          Update a UserDetail property via the UserDetailsManager.
 boolean setUserInformation(UserInformation userInfo)
          Updates a user's information
 void setUserLocale(User user, Locale language)
           
 boolean setUserPreference(User user, String key, boolean value)
           
 boolean setUserPreference(User user, String key, String value)
           
 long setUserStatus(String wikiStatus)
          Sets the current user's status.
 UserStatus setUserStatus(UserStatus status)
           
 void setWatchOwnContent(User user, boolean enabled)
           
 void setWebSudoTimeout(int timeout)
           
 boolean setWelcomeMessage(String welcomeMessage)
           
 void stopFollowing(User user)
          Stop following the given user.
 void synchroniseUserDirectories()
          Synchronises all the directories which support synchronisation (LDAP, remote Crowd, etc.)
 com.atlassian.fugue.Option<Object> tryGetApplicationConfigProperty(String propertyKey)
           
 void unarchiveSpace(Space space)
           
 long updateDraft(Draft draft)
           
 boolean updateGlobalSetting(String name, boolean value)
           
 String updateGlobalSetting(String name, String value)
           
 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 waitForEventQueue()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

notifications

public final NotificationsRpc notifications

userPreferences

public final UserPreferencesRpc userPreferences

likes

public final LikesRpc likes

mail

public final MailRpc mail

darkFeatures

public final DarkFeaturesHelper darkFeatures

content

public final ContentRpc content

spaces

public final SpaceRpc spaces

attachments

public final AttachmentRpc attachments

labels

public final LabelsRpc labels

admin

public final AdminRpc admin

baseResourceProvider

public final AuthenticatedWebResourceProvider baseResourceProvider
Method Detail

getFriendlyRelativeDate

public String getFriendlyRelativeDate(Date now,
                                      Date date,
                                      TimeZone timeZone)
Use the FriendlyDateFormatter to format the date relative to the "now" time. Note that the output format varies greatly even from second to second -- see FriendlyDateFormatter.

Parameters:
now - the date which the relative time is calculated in relation to
date - the date of some event which is to be formatted
timeZone - the current time zone
Returns:
a formatted relative date-time
See Also:
FriendlyDateFormatter

flushIndexQueueAndVerify

public void flushIndexQueueAndVerify(ContentEntity... contentEntities)
Flush the entire index queue, and explicitly assert that the given content entities had their most recent index queue journal entries processed.


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(BaseUrlSelector baseUrlSelector,
                                        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

newInstanceForSetup

public static ConfluenceRpc newInstanceForSetup(String baseUrl,
                                                ConfluenceRpc.Version version)
Create a new RPC stub pointed at a specific version of the server-side API, for use with Setup acceptance tests.

This method should only be called by Setup tests where the ConfluenceRpc instance is created *before* the plugin system is started. Other tests should call newInstance(String).

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

newInstance

public static ConfluenceRpc newInstance(BaseUrlSelector baseUrlSelector)
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

newInstance

@Deprecated
public static ConfluenceRpc newInstance(String baseUrl,
                                                   com.sun.jersey.api.client.Client restClient)
Deprecated. 

Create a new RPC stub pointed at the default version using the preconfigured Jersey client

Parameters:
baseUrl - the base URL of the server to connect to
restClient - the jersey client to use when create WebResources
Returns:
an RPC stub object

newInstance

public static ConfluenceRpc newInstance(BaseUrlSelector baseUrlSelector,
                                        com.sun.jersey.api.client.Client restClient)

execute

@Deprecated
public Object execute(String method,
                                 Object... args)
               throws RpcRuntimeException
Deprecated. Since 5.6. Use the less ambiguous executeOnCurrentNode(String, Object...)

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

executeOnCurrentNode

public <T> T executeOnCurrentNode(String method,
                                  Object... args)

executeWithToken

public Object executeWithToken(String method,
                               @Nullable
                               String token,
                               Object... args)
                        throws RpcRuntimeException
Execute method with the specified token. Avoid using this method in favour of logging in as another user and using execute(String, Object...) as them instead. There only time when you should use this is when testing something related to the tokens themselves (e.g. authentication tests)

Parameters:
method - the method to execute
token - the token
args - arguments to pass to the XML RPC method
Returns:
the object returned by the server
Throws:
RpcRuntimeException - If the server throws an exception

executePluginXmlRpc

public Object executePluginXmlRpc(String servicePath,
                                  String method,
                                  Object... args)
                           throws RpcRuntimeException
Execute a Confluence plugin rpc method as anonymous user.

Parameters:
servicePath - service path of the plugin xmlrpc module
method - the name of the rpc method to call
args - the arguments to be passed to the method. 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

executeAuthPluginXmlRpc

@Deprecated
public Object executeAuthPluginXmlRpc(String servicePath,
                                                 String method,
                                                 Object... args)
                               throws RpcRuntimeException
Deprecated. Since 5.6. Use the less ambiguous executeAuthPluginXmlRpcOnCurrentNode(String, String, Object...)

Execute a Confluence plugin rpc method as the currently logged in user.

Parameters:
servicePath - service path of the plugin xmlrpc module
method - the name of the rpc method to call
args - the arguments to be passed to the method. 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

executeAuthPluginXmlRpcOnCurrentNode

public <T> T executeAuthPluginXmlRpcOnCurrentNode(String servicePath,
                                                  String method,
                                                  Object... args)

executeFuncTest

@Deprecated
public Object executeFuncTest(String method,
                                         Object... args)
                       throws RpcRuntimeException
Deprecated. Since 5.6. Use the less ambiguous executeFuncTestOnCurrentNode(String, Object...)

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

executeFuncTestOnCurrentNode

public <T> T executeFuncTestOnCurrentNode(String method,
                                          Object... args)
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

executeFuncTestWithToken

@Deprecated
protected Object executeFuncTestWithToken(String method,
                                                     String token,
                                                     Object... args)
                                   throws RpcRuntimeException
Deprecated. 

Execute a functest method with the specified token.

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

executeRpc

@Deprecated
protected Object executeRpc(String rpcBase,
                                       String methodToken,
                                       String method,
                                       Object... args)
                     throws RpcRuntimeException
Deprecated. 

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.


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)

getPagesInSpace

public List<Page> getPagesInSpace(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

@Deprecated
public Map<String,String> createPage(String spaceKey,
                                                String title,
                                                String content,
                                                long parentPageId)
Deprecated. Since 5.4. Use createPage(Page).

TODO make this private, and make all callers use returned Page objects instead


createPage

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

createWikiMarkupPage

@Deprecated
public long createWikiMarkupPage(Page page)
Deprecated. Since 5.4. Use XHTML markup in your tests, and call createPage(Page)

Certain tests may use wiki-markup as the page content for convenience. These tests can be refactored in the future by breakpointing to see their XHTML version and then using that instead.

Parameters:
page - an uncreated page with wiki markup content
Returns:
the id of the newly created page

createPagesFromPrototype

public List<Page> createPagesFromPrototype(Page pageTemplate,
                                           int count)

createTemplate

public long createTemplate(String templateName,
                           String content,
                           Space space)

createTemplateWithStorageFormat

public long createTemplateWithStorageFormat(String templateName,
                                            String storageFormat,
                                            Space space)

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)

removePageVersion

public boolean removePageVersion(long historicalPageId)

removePageVersion

public boolean removePageVersion(long pageId,
                                 int version)

restoreAbstractPage

public void restoreAbstractPage(long id)

changePageCreatedDate

public void changePageCreatedDate(long id,
                                  Date newDate)

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.

getPageWithDetails

public Page getPageWithDetails(long pageId)
A heavier version of getExistingPage(long), that makes several calls to the server to flesh out the space and the last modifier.


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.

getParentId

public long getParentId(long pageId)
Returns:
the parent id of the specified page or -1 if it doesn't have one.

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)
Restricts page to a single given user or group, wiping out any other existing restrictions. setContentRestriction(com.atlassian.confluence.it.content.security.ContentPermission, com.atlassian.confluence.it.AbstractPageEntity) should be used instead.


setBlogRestriction

public void setBlogRestriction(ContentPermission contentPermission,
                               BlogPost blogPost)
Restricts blog post to single given user or group, wiping out any other existing restrictions. setContentRestriction(com.atlassian.confluence.it.content.security.ContentPermission, com.atlassian.confluence.it.AbstractPageEntity) should be used instead.


setDraftRestriction

public void setDraftRestriction(ContentPermission contentPermission,
                                Draft draft)
Restricts blog post to single given user or group, wiping out any other existing restrictions. setContentRestriction(com.atlassian.confluence.it.content.security.ContentPermission, com.atlassian.confluence.it.AbstractPageEntity) should be used instead.


setContentRestriction

public void setContentRestriction(ContentPermission contentPermission,
                                  AbstractPageEntity abstractPage)
Restricts page or blog post to single given user or group, wiping out any other existing 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

@Deprecated
public long createComment(Comment comment,
                                     long parentCommentId)
Deprecated. Since 5.5. Just call createComment(Comment) with a Comment that has a parentId set.


saveComment

public long saveComment(Comment comment)

removeComment

public void removeComment(long commentId)
Remove a comment, identified by its id.

Parameters:
commentId - the id of the comment to remove

removeComment

public void removeComment(Comment comment)

changeCommentCreatedDate

public void changeCommentCreatedDate(Comment comment,
                                     Date newCreationDate)

createAttachment

public long createAttachment(long contentId,
                             Attachment attachment)

createAttachment

public long createAttachment(ContentEntity page,
                             Attachment attachment)

createAttachment

public long createAttachment(Attachment attachment)

createAttachmentOnDraft

public long createAttachmentOnDraft(Attachment attachment)

removeAttachment

public void removeAttachment(long pageId,
                             String fileName)

removeAttachmentUncleanly

public void removeAttachmentUncleanly(long pageId,
                                      String fileName)

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

enableDailyReportNotification

public boolean enableDailyReportNotification(User user,
                                             boolean dailyReportEnabled)

editAttachment

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


getAttachment

public Attachment getAttachment(long contentId,
                                String fileName)

getAttachmentId

public long getAttachmentId(long contentId,
                            String fileName)

getAttachments

public List<Attachment> getAttachments(Page homePage)

getAttachmentData

public byte[] getAttachmentData(long contentId,
                                String fileName,
                                String version)

getAttachmentData

public byte[] getAttachmentData(Attachment attachment,
                                String version)

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

moveBlogPost

public void moveBlogPost(BlogPost blogPost,
                         Space targetSpace)

addLabel

public boolean addLabel(String label,
                        AbstractContentEntity target)

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

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

createSpace

public Space createSpace(Space space)

createSpace

@Deprecated
public Space createSpace(String key,
                                    String name,
                                    String description)
Deprecated. Since 5.5. Create a Space and call createSpace(Space).

This method will be made private in a future version of Confluence.


createPersonalSpace

public Space createPersonalSpace(User user)

removeSpace

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

createUser

public boolean createUser(User user,
                          boolean notifyUser)
Adds the given user

Returns:
true if the user was successfully created

createTestUsers

public int createTestUsers(int count)

getUser

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

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

getUser

public UserWithKey getUser(User user)

getUser

public UserWithKey getUser(String username,
                           String 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

setUserDetailProperty

public boolean setUserDetailProperty(User user,
                                     String key,
                                     String value)
Update a UserDetail property via the UserDetailsManager.


setUserPreference

public boolean setUserPreference(User user,
                                 String key,
                                 String value)

setUserPreference

public boolean setUserPreference(User user,
                                 String key,
                                 boolean value)

getUsernames

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

Parameters:
viewAll - If false, all usernames in the default 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

renameUser

public boolean renameUser(String oldUsername,
                          String newUsername)

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.


performBackup

public String performBackup(boolean exportAttachments)

getContentPermissionSet

public Map<String,Object> getContentPermissionSet(long contentId,
                                                  ContentPermissionType permissionType)

getContentPermissions

public List<Map<String,String>> getContentPermissions(long contentId,
                                                      ContentPermissionType permissionType)

getPermissionsForUser

public List<String> getPermissionsForUser(String spaceKey,
                                          String username)

getPermissionsForUser

public List<String> getPermissionsForUser(Space space,
                                          User user)

grantPermission

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

grantPermission

public void grantPermission(SpacePermission permission,
                            String spaceKey,
                            Entity entity)

grantPermissions

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

grantAllPermissionsExceptAdmin

public void grantAllPermissionsExceptAdmin(Entity entity,
                                           Space space)

grantAllPermissions

public void grantAllPermissions(Entity entity,
                                Space space)

grantContentPermission

public void grantContentPermission(ContentPermission contentPermission,
                                   ContentEntity contentEntity)

grantContentPermission

public void grantContentPermission(ContentEntity contentEntity,
                                   Entity entity,
                                   ContentPermissionType permissionType)

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.


revokeAnonymousPermission

public void revokeAnonymousPermission(SpacePermission permission,
                                      Space space)

grantPermission

public void grantPermission(GlobalPermission permission,
                            Entity entity)

revokePermission

public void revokePermission(GlobalPermission permission,
                             Entity entity)

getGlobalPermissions

public List<GlobalPermission> getGlobalPermissions(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 boolean grantAnonymousViewUserProfilePermission()

revokeAnonymousViewUserProfilePermission

public void revokeAnonymousViewUserProfilePermission()

setContentTextProperty

public void setContentTextProperty(long contentId,
                                   String key,
                                   String value)
Uses ContentPropertyManager.


setContentPropertiesString

public void setContentPropertiesString(long contentId,
                                       String key,
                                       String value)
Uses ContentProperties.


setContentPropertiesStringForSpace

public void setContentPropertiesStringForSpace(String spaceKey,
                                               String key,
                                               String value)
Uses ContentProperties associated with the SpaceDescription.


getContentPropertyKeys

public List<String> getContentPropertyKeys(long contentId)
Uses ContentPropertyManager.


getContentProperty

public String getContentProperty(long contentId,
                                 String key)
Uses ContentPropertyManager.


getContentPropertiesString

public String getContentPropertiesString(long contentId,
                                         String key)
Uses ContentProperties.


getContentPropertiesStringForSpace

public String getContentPropertiesStringForSpace(String spaceKey,
                                                 String key)
Uses ContentProperties associated with the SpaceDescription.


flushIndexQueue

public boolean flushIndexQueue()
Triggers an index queue flush and blocks until flush is complete.


flushIndexQueue

public boolean flushIndexQueue(long time,
                               TimeUnit unit)

assertThatMostRecentIndexEntriesHaveBeenProcessed

public void assertThatMostRecentIndexEntriesHaveBeenProcessed(ContentEntity... entities)

clearIndex

public void clearIndex()

clearIndexQueue

public boolean clearIndexQueue()

runJob

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


runJob

@Deprecated
public void runJob(String jobName)
Deprecated. Since 5.6. Use SchedulerRpc.triggerJob(QuartzJob, boolean).


getLocalisedText

public String getLocalisedText(String messageKey)
Returns the localised message text for the given key, retrieved from the application via RPC. The message will be localised to the administrator's locale.

If the key is not found, the key itself will be returned, as per ConfluenceActionSupport.getText(String).

Parameters:
messageKey - the message key to internationalise.
Returns:
a localised message in the administrator's locale
See Also:
FuncTestRpcHandler.getLocalisedText(String, String), ConfluenceActionSupport.getText(String)

getMailQueueSize

public int getMailQueueSize()

clearMailQueue

public void clearMailQueue()

clearQueue

public void clearQueue(String queueName)

getNumberOfIndexTasksInQueue

public int getNumberOfIndexTasksInQueue()

flushEdgeIndexQueue

public void flushEdgeIndexQueue()

getUserLocale

public Locale getUserLocale(User user)

setUserLocale

public void setUserLocale(User user,
                          Locale language)

setGlobalLanguage

public void setGlobalLanguage(String locale)
                       throws org.apache.xmlrpc.XmlRpcException,
                              IOException
Throws:
org.apache.xmlrpc.XmlRpcException
IOException

setKeyboardShortcutPref

public void setKeyboardShortcutPref(User user,
                                    boolean enabled)

setWatchOwnContent

public void setWatchOwnContent(User user,
                               boolean enabled)

removeDrafts

public void removeDrafts(User user)

removeTestData

public void removeTestData(Set<User> usersToKeep,
                           Set<Group> groupsToKeep,
                           Map<Group,HashSet<User>> userGroupMembershipsToKeep)
Perform all test-data reset tasks.


removeTestDataAfterExternalUserManagement

public void removeTestDataAfterExternalUserManagement()
Called on an instance that manages User/Group data externally, this will: 1. Remove any data that should be removed *before* the Users/Groups are reset 2. Synchronize with the remote User/Group directory 3. Remove remaining data


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)

pauseAllJobs

public void pauseAllJobs()

pauseJobGroup

public void pauseJobGroup(String jobGroupName)

pauseJob

@Deprecated
public void pauseJob(String jobName)
Deprecated. Since 5.6. Use SchedulerRpc.pauseJob(QuartzJob)

Parameters:
jobName -

pauseJob

public void pauseJob(QuartzJob job)

resumeJob

@Deprecated
public void resumeJob(String jobName)
Deprecated. Since 5.6. Use SchedulerRpc.resumeJob(QuartzJob)

Parameters:
jobName -

resumeJob

public void resumeJob(QuartzJob job)

getGlobalConfiguredTheme

public String getGlobalConfiguredTheme()

getConfiguredThemeForSpace

public String getConfiguredThemeForSpace(String spaceKey)

setGlobalTheme

public void setGlobalTheme(BundledTheme theme)

setThemeForSpace

public void setThemeForSpace(Space space,
                             BundledTheme theme)

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)

countDrafts

public int countDrafts(User user)

search

public List<Hashtable<String,String>> 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.

search

public List<Hashtable<String,String>> search(String queryString,
                                             Hashtable<String,String> params,
                                             int maxMatches)

importSpace

public void importSpace(File zippedXmlBackup)
                 throws IOException
Throws:
IOException

importSpace

public void importSpace(byte[] zippedXmlBackup)
                 throws IOException
Throws:
IOException

getPagePermissions

public Collection<ContentPermissionEntry> getPagePermissions(long pageId)

getSystemProperty

public String getSystemProperty(String name)
Retrieve the value of the specified System property on the Confluence server.

Parameters:
name - the property to retrieve
Returns:
the value of the system property on the server, or null if it is not set

setSystemProperty

public void setSystemProperty(String name,
                              String value)
Set the specified System property on the Confluence server. If the value is null, the system property will be removed instead.

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.


getDarkFeaturesHelper

public DarkFeaturesHelper getDarkFeaturesHelper()

getBaseUrl

public String getBaseUrl()

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)

getPersonalInformationId

public long getPersonalInformationId(String username)

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

@Deprecated
public String setLogLevel(String logger,
                                     String levelStr)
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
levelStr - 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)

setEnableAnonymousRpc

public void setEnableAnonymousRpc(boolean enable)

flushAllCaches

public void flushAllCaches()

getCacheStatistics

public CacheStatistics getCacheStatistics(CacheKey key)

getCacheStatisticsCapabilities

public Set<CacheStatistics.Capability> getCacheStatisticsCapabilities()

getCacheMaximumNumberOfElements

@Deprecated
public Integer getCacheMaximumNumberOfElements(String cacheName)
Deprecated. since 5.6. Use CacheRpc.getCacheMaxEntries(String) directly.


setCacheMaximumNumberOfElements

@Deprecated
public void setCacheMaximumNumberOfElements(String cacheName,
                                                       int maxNumElements)
Deprecated. since 5.6. Use CacheRpc.setCacheMaxEntries(String, int) directly.


putStringMappingInCache

public void putStringMappingInCache(String cacheName,
                                    String entryKey,
                                    String value)
                             throws org.apache.xmlrpc.XmlRpcException,
                                    IOException
Throws:
org.apache.xmlrpc.XmlRpcException
IOException

getClusterInformation

public Map<String,Object> getClusterInformation()

getAnonymoizedCurrentClusterNodeIdentifier

public String getAnonymoizedCurrentClusterNodeIdentifier()

isClusteredInstance

public boolean isClusteredInstance()

getCusterNodeStatuses

public Vector<Hashtable> getCusterNodeStatuses()

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.


addMailServer

@Deprecated
public void addMailServer(String serverName,
                                     String from,
                                     String subjectPrefix,
                                     String hostname,
                                     int port)
Deprecated. since 5.0. Use addSmtpServer(String, String, String, String, int) instead.


addMailServer

@Deprecated
public void addMailServer(String serverName,
                                     String from,
                                     String subjectPrefix,
                                     String hostname,
                                     int port,
                                     String fromName)
Deprecated. since 5.0. Use addSmtpServer(String, String, String, String, int, String) instead.


addSmtpServer

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

addSmtpServer

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

setSmtpServer

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

setSmtpServer

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

removeMailServer

public void removeMailServer(String serverName)

flushMailQueue

public void flushMailQueue()
waits for all async events to be processed and flushes mail queue waiting is needed because otherwise there's a chance that mail won't be in queue at time of flushing


waitForEventQueue

public void waitForEventQueue()

setApplicationConfigProperty

public void setApplicationConfigProperty(String propertyKey,
                                         String propertyValue)

getApplicationConfigProperty

public Object getApplicationConfigProperty(String propertyKey)

tryGetApplicationConfigProperty

public com.atlassian.fugue.Option<Object> tryGetApplicationConfigProperty(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)

followUsers

public void followUsers(User follower,
                        Iterable<User> followees)
Since:
5.7

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 long setUserStatus(String wikiStatus)
Sets the current user's status.

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

setUserStatus

public UserStatus setUserStatus(UserStatus status)

getConfiguredBaseUrl

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


getServerInfo

public Map<String,Object> getServerInfo()

convertWikiToStorageFormat

public String convertWikiToStorageFormat(String wiki)

enableWebSudo

public void enableWebSudo(boolean enabled)

setWebSudoTimeout

public void setWebSudoTimeout(int timeout)

enableElevatedSecurityCheck

public void enableElevatedSecurityCheck(boolean enabled)

enablePublicSignUp

public void enablePublicSignUp(boolean enabled)

synchroniseUserDirectories

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


setDirectoryPasswordEncoder

public void setDirectoryPasswordEncoder(String directoryName,
                                        String encoder)

removeUserDirectory

public boolean removeUserDirectory(long directoryId)

purgeFromTrash

@Deprecated
public void purgeFromTrash(Space space,
                                      long pageId)
Deprecated. Since 5.6. Just call ContentRpc.purge(ContentId) directly.


getComments

public List<Comment> getComments(Page page)

getComment

public Comment getComment(AbstractPageEntity pageEntity,
                          long commentId)

isSpringComponentPresent

public boolean isSpringComponentPresent(String componentName)

removeBandanaKey

public void removeBandanaKey(String context,
                             String key)

setBandanaKey

public void setBandanaKey(String context,
                          String key,
                          Set<String> value)

setBandanaKey

public void setBandanaKey(String context,
                          String key,
                          List<String> value)

setBandanaKey

public void setBandanaKey(String context,
                          String key,
                          String value)

setBandanaKey

public void setBandanaKey(String context,
                          String key,
                          boolean value)

setBandanaKey

public void setBandanaKey(String context,
                          String key,
                          int value)

getBandanaValue

public Object getBandanaValue(String context,
                              String key)

updateGlobalSetting

public boolean updateGlobalSetting(String name,
                                   boolean value)

updateGlobalSetting

public String updateGlobalSetting(String name,
                                  String value)

saveDateFormat

public void saveDateFormat(String pattern)

getAncestors

public List<Page> getAncestors(Page homePage)

getDescendents

public List<Page> getDescendents(Page homePage)

getPageHistory

public List<Map<String,String>> getPageHistory(Page homePage)

getLoggedInUser

public String getLoggedInUser()

createSpaces

public Iterable<String> createSpaces(int i)
Creates a bunch of spaces.

Parameters:
i - the number of spaces to create
Returns:
an iterable of the keys of the spaces created

archiveSpace

public void archiveSpace(Space space)

unarchiveSpace

public void unarchiveSpace(Space space)

isDarkFeatureEnabled

public boolean isDarkFeatureEnabled(String key)

getNumberOfActiveUsers

public int getNumberOfActiveUsers()

isUnlimitedUserLicense

public boolean isUnlimitedUserLicense()

getAliveThreads

public List<Map> getAliveThreads()

setWelcomeMessage

public boolean setWelcomeMessage(String welcomeMessage)

resetWelcomeMessage

public boolean resetWelcomeMessage()

enableAnonymousAccess

public void enableAnonymousAccess()

disableAnonymousAccess

public void disableAnonymousAccess()

addSidebarQuickLink

@Deprecated
public boolean addSidebarQuickLink(String spaceKey,
                                              long pageId,
                                              String title,
                                              String customClass)
Deprecated. since 5.2 use executeAuthPluginXmlRpc(String, String, Object...)


removeSidebarQuickLink

@Deprecated
public void removeSidebarQuickLink(String spaceKey,
                                              long pageId)
Deprecated. since 5.2 use executeAuthPluginXmlRpc(String, String, Object...)


removeSidebarQuickLinks

@Deprecated
public void removeSidebarQuickLinks(String spaceKey)
Deprecated. since 5.2 use executeAuthPluginXmlRpc(String, String, Object...)


getExportBuildNumber

public String getExportBuildNumber()

getOldestSpaceImportAllowed

public String getOldestSpaceImportAllowed()

getPluginExportCompatibility

public String getPluginExportCompatibility(String pluginKey)

isPluginUpgradeTasksComplete

public boolean isPluginUpgradeTasksComplete()

resetDatabaseStatistics

public void resetDatabaseStatistics()

getDatabaseStatistics

public String getDatabaseStatistics()

runGarbageCollection

public void runGarbageCollection()

enableNewUserEmailNotifications

public void enableNewUserEmailNotifications()

isImportTaskRunning

public boolean isImportTaskRunning()


Copyright © 2003–2015 Atlassian. All rights reserved.