Class XWiki


  • public class XWiki
    extends Object
    Version:
    $Revision$ $Date$
    • Field Detail

      • sendRawData

        protected boolean sendRawData
    • Method Detail

      • getServicePrefix

        protected String getServicePrefix()
      • willSendRawData

        public boolean willSendRawData()
      • sendRawData

        public void sendRawData​(boolean sendRawData)
      • logout

        public boolean logout()
                       throws Exception
        remove this token from the list of logged in tokens. Returns true if the user was logged out, false if they were not logged in in the first place (we don't really need this return, but void seems to kill XML-RPC for me)
        Throws:
        Exception
      • exportSite

        public String exportSite​(boolean exportAttachments)
                          throws Exception
        exports a Confluence instance and returns a String holding the URL for the download. The boolean argument indicates whether or not attachments ought to be included in the export.
        Throws:
        Exception
      • getServerInfo

        public ServerInfo getServerInfo()
                                 throws Exception
        retrieve some basic information about the server being connected to. Useful for clients that need to turn certain features on or off depending on the version of the server. (Since 1.0.3)
        Throws:
        Exception
      • exportSpace

        public String exportSpace​(String spaceKey,
                                  String exportType)
                           throws Exception
        exports a space and returns a String holding the URL for the download. The export type argument indicates whether or not to export in XML, PDF, or HTML format - use "TYPE_XML", "TYPE_PDF", or "TYPE_HTML" respectively. Also, using "all" will select TYPE_XML.
        Throws:
        Exception
      • addSpace

        public Space addSpace​(Space space)
                       throws Exception
        create a new space, passing in name, key and description.
        Throws:
        Exception
      • getPages

        public List<Object> getPages​(String spaceKey)
                              throws Exception
        returns all the PageSummary instances in the space. Doesn't include pages which are in the Trash. Equivalent to calling {{Space.getCurrentPages()}}.
        Throws:
        Exception
      • getPage

        public org.bsc.confluence.xmlrpc.Page getPage​(org.bsc.confluence.xmlrpc.PageSummary summary)
                                               throws Exception
        returns a single Page
        Throws:
        Exception
      • getPage

        public org.bsc.confluence.xmlrpc.Page getPage​(String spaceKey,
                                                      String pageTitle)
                                               throws Exception
        returns a single Page
        Throws:
        Exception
      • getAttachments

        public List<Object> getAttachments​(String pageId)
                                    throws Exception
        returns all the Attachments for this page (useful to point users to download them with the full file download URL returned).
        Throws:
        Exception
      • getAncestors

        public List<Object> getAncestors​(String pageId)
                                  throws Exception
        returns all the ancestors (as PageSummary instances) of this page (parent, parent's parent etc).
        Throws:
        Exception
      • getChildren

        public <T> List<T> getChildren​(String pageId)
                                throws Exception
        returns all the direct children (as PageSummary instances) of this page.
        Throws:
        Exception
      • getDescendents

        public <T> List<T> getDescendents​(String pageId)
                                   throws Exception
        returns all the descendents (as PageSummary instances) of this page (children, children's children etc).
        Throws:
        Exception
      • removeComment

        public boolean removeComment​(String commentId)
                              throws Exception
        removes a comment from the page.
        Throws:
        Exception
      • storePage

        public org.bsc.confluence.xmlrpc.Page storePage​(org.bsc.confluence.xmlrpc.Page page)
                                                 throws Exception
        add or update a page. For adding, the Page given as an argument should have space, title and content fields at a minimum. For updating, the Page given should have id, space, title, content and version fields at a minimum. The parentId field is always optional. All other fields will be ignored.
        Throws:
        Exception
      • renderContent

        public String renderContent​(String spaceKey,
                                    String pageId,
                                    String content)
                             throws Exception
        returns the HTML rendered content for this page. If 'content' is provided, then that is rendered as if it were the body of the page (useful for a 'preview page' function). If it's not provided, then the existing content of the page is used instead (ie useful for 'view page' function).
        Throws:
        Exception
      • renderContent

        public String renderContent​(org.bsc.confluence.xmlrpc.PageSummary page)
                             throws Exception
        Throws:
        Exception
      • renderContent

        public String renderContent​(String spaceKey,
                                    String pageId,
                                    String content,
                                    Map<?,​?> parameters)
                             throws Exception
        Like the above renderContent(), but you can supply an optional hash (map, dictionary, etc) containing additional instructions for the renderer. Currently, only one such parameter is supported:
        Throws:
        Exception
      • getAttachment

        public org.bsc.confluence.xmlrpc.Attachment getAttachment​(String pageId,
                                                                  String fileName,
                                                                  String versionNumber)
                                                           throws Exception
        get information about an attachment.
        Throws:
        Exception
      • getAttachmentData

        public byte[] getAttachmentData​(String pageId,
                                        String fileName,
                                        String versionNumber)
                                 throws Exception
        get the contents of an attachment.
        Throws:
        Exception
      • addAttachment

        public org.bsc.confluence.xmlrpc.Attachment addAttachment​(long contentId,
                                                                  org.bsc.confluence.xmlrpc.Attachment attachment,
                                                                  byte[] attachmentData)
                                                           throws Exception
        add a new attachment to a content entity object. *Note that this uses a lot of memory -- about 4 times the size of the attachment.*
        Throws:
        Exception
      • removeAttachment

        public boolean removeAttachment​(String contentId,
                                        String fileName)
                                 throws Exception
        remove an attachment from a content entity object.
        Throws:
        Exception
      • moveAttachment

        public boolean moveAttachment​(String originalContentId,
                                      String originalName,
                                      String newContentEntityId,
                                      String newName)
                               throws Exception
        move an attachment to a different content entity object and/or give it a new name.
        Throws:
        Exception
      • storeBlogEntry

        public BlogEntry storeBlogEntry​(BlogEntry entry)
                                 throws Exception
        add or update a blog entry. For adding, the BlogEntry given as an argument should have space, title and content fields at a minimum. For updating, the BlogEntry given should have id, space, title, content and version fields at a minimum. All other fields will be ignored.
        Throws:
        Exception
      • getBlogEntryByDayAndTitle

        public BlogEntry getBlogEntryByDayAndTitle​(String spaceKey,
                                                   int dayOfMonth,
                                                   String postTitle)
                                            throws Exception
        Retrieves a blog post in the Space with the given spaceKey, with the title 'postTitle' and posted on the day 'dayOfMonth'.
        Throws:
        Exception
      • search

        public List<Object> search​(String query,
                                   int maxResults)
                            throws Exception
        return a list of SearchResults which match a given search query (including pages and other content types). This is the same as a performing a parameterised search (see below) with an empty parameter map.
        Throws:
        Exception
      • search

        public List<Object> search​(String query,
                                   Map<?,​?> parameters,
                                   int maxResults)
                            throws Exception
        Returns a list of SearchResults like the previous search, but you can optionally limit your search by adding parameters to the parameter map. If you do not include a parameter, the default is used instead.
        Throws:
        Exception
      • getPermissions

        public List<Object> getPermissions​(String spaceKey)
                                    throws Exception
        Returns a List of Permissions representing the permissions the current user has for this space (a list of "view", "modify", "comment" and / or "admin").
        Throws:
        Exception
      • getSpaceLevelPermissions

        public List<Object> getSpaceLevelPermissions()
                                              throws Exception
        returns List of the space level Permissions which may be granted. This is a list of possible permissions to use with {{addPermissionToSpace}}, below, not a list of current permissions on a Space.
        Throws:
        Exception
      • addPermissionToSpace

        public boolean addPermissionToSpace​(String permission,
                                            String remoteEntityName,
                                            String spaceKey)
                                     throws Exception
        Give the entity named {{remoteEntityName}} (either a group or a user) the permission {{permission}} on the space with the key {{spaceKey}}.
        Throws:
        Exception
      • addPermissionsToSpace

        public boolean addPermissionsToSpace​(List<Object> permissions,
                                             String remoteEntityName,
                                             String spaceKey)
                                      throws Exception
        Give the entity named {{remoteEntityName}} (either a group or a user) the permissions {{permissions}} on the space with the key {{spaceKey}}.
        Throws:
        Exception
      • removePermissionFromSpace

        public boolean removePermissionFromSpace​(String permission,
                                                 String remoteEntityName,
                                                 String spaceKey)
                                          throws Exception
        Remove the permission {{permission} from the entity named {{remoteEntityName}} (either a group or a user) on the space with the key {{spaceKey}}.
        Throws:
        Exception
      • addAnonymousPermissionToSpace

        public boolean addAnonymousPermissionToSpace​(String permission,
                                                     String spaceKey)
                                              throws Exception
        Give anonymous users the permission {{permission}} on the space with the key {{spaceKey}}. (since 2.0)
        Throws:
        Exception
      • addAnonymousPermissionsToSpace

        public boolean addAnonymousPermissionsToSpace​(List<Object> permissions,
                                                      String spaceKey)
                                               throws Exception
        Give anonymous users the permissions {{permissions}} on the space with the key {{spaceKey}}. (since 2.0)
        Throws:
        Exception
      • removeAnonymousPermissionFromSpace

        public boolean removeAnonymousPermissionFromSpace​(String permission,
                                                          String spaceKey)
                                                   throws Exception
        Remove the permission {{permission} from anonymous users on the space with the key {{spaceKey}}. (since 2.0)
        Throws:
        Exception
      • removeAllPermissionsForGroup

        public boolean removeAllPermissionsForGroup​(String groupname)
                                             throws Exception
        Remove all the global and space level permissions for {{groupname}}.
        Throws:
        Exception
      • addUserToGroup

        public void addUserToGroup​(String username,
                                   String groupname)
                            throws Exception
        add a user to a particular group
        Throws:
        Exception
      • removeUserFromGroup

        public boolean removeUserFromGroup​(String username,
                                           String groupname)
                                    throws Exception
        remove a user from a group.
        Throws:
        Exception
      • removeGroup

        public boolean removeGroup​(String groupname,
                                   String defaultGroupName)
                            throws Exception
        remove a group. If {{defaultGroupName}} is specified, users belonging to {{groupname}} will be added to {{defaultGroupName}}.
        Throws:
        Exception
      • editUser

        public boolean editUser​(User remoteUser)
                         throws Exception
        edits the details of a user
        Throws:
        Exception
      • deactivateUser

        public boolean deactivateUser​(String username)
                               throws Exception
        deactivates the specified user
        Throws:
        Exception
      • reactivateUser

        public boolean reactivateUser​(String username)
                               throws Exception
        reactivates the specified user
        Throws:
        Exception
      • getActiveUsers

        public List<Object> getActiveUsers​(boolean viewAll)
                                    throws Exception
        returns all registered users as Strings
        Throws:
        Exception
      • changeMyPassword

        public boolean changeMyPassword​(String oldPass,
                                        String newPass)
                                 throws Exception
        changes the current user's password
        Throws:
        Exception
      • changeUserPassword

        public boolean changeUserPassword​(String username,
                                          String newPass)
                                   throws Exception
        changes the specified user's password
        Throws:
        Exception
      • getMostPopularLabels

        public List<Object> getMostPopularLabels​(int maxCount)
                                          throws Exception
        Returns the most popular Labels for the Confluence instance, with a specified maximum number.
        Throws:
        Exception
      • getMostPopularLabelsInSpace

        public List<Object> getMostPopularLabelsInSpace​(String spaceKey,
                                                        int maxCount)
                                                 throws Exception
        Returns the most popular Labels for the given {{spaceKey}}, with a specified maximum number of results.
        Throws:
        Exception
      • getRecentlyUsedLabels

        public List<Object> getRecentlyUsedLabels​(int maxResults)
                                           throws Exception
        Returns the recently used Labels for the Confluence instance, with a specified maximum number of results.
        Throws:
        Exception
      • getRecentlyUsedLabelsInSpace

        public List<Object> getRecentlyUsedLabelsInSpace​(String spaceKey,
                                                         int maxResults)
                                                  throws Exception
        Returns the recently used Labels for the given {{spaceKey}}, with a specified maximum number of results.
        Throws:
        Exception
      • getRelatedLabels

        public List<Object> getRelatedLabels​(String labelName,
                                             int maxResults)
                                      throws Exception
        Returns the Labels related to the given label name, with a specified maximum number of results.
        Throws:
        Exception
      • getRelatedLabelsInSpace

        public List<Object> getRelatedLabelsInSpace​(String labelName,
                                                    String spaceKey,
                                                    int maxResults)
                                             throws Exception
        Returns the Labels related to the given label name for the given {{spaceKey}}, with a specified maximum number of results.
        Throws:
        Exception
      • getLabelContentById

        public List<Object> getLabelContentById​(long labelId)
                                         throws Exception
        Returns the content for a given label ID
        Throws:
        Exception
      • getLabelContentByObject

        public List<Object> getLabelContentByObject​(Label labelObject)
                                             throws Exception
        Returns the content for a given Label object.
        Throws:
        Exception
      • getSpacesContainingContentWithLabel

        public List<Object> getSpacesContainingContentWithLabel​(String labelName)
                                                         throws Exception
        Returns all Spaces that have content labelled with {{labelName}}.
        Throws:
        Exception
      • addLabelByName

        public boolean addLabelByName​(String labelName,
                                      long objectId)
                               throws Exception
        Adds a label to the object with the given ContentEntityObject ID.
        Throws:
        Exception
      • addLabelById

        public boolean addLabelById​(long labelId,
                                    long objectId)
                             throws Exception
        Adds a label with the given ID to the object with the given ContentEntityObject ID.
        Throws:
        Exception
      • addLabelByObject

        public boolean addLabelByObject​(Label labelObject,
                                        long objectId)
                                 throws Exception
        Adds the given label object to the object with the given ContentEntityObject ID.
        Throws:
        Exception
      • addLabelByNameToSpace

        public boolean addLabelByNameToSpace​(String labelName,
                                             String spaceKey)
                                      throws Exception
        Adds a label to the object with the given ContentEntityObject ID.
        Throws:
        Exception
      • removeLabelByName

        public boolean removeLabelByName​(String labelName,
                                         long objectId)
                                  throws Exception
        Removes the given label from the object with the given ContentEntityObject ID.
        Throws:
        Exception
      • removeLabelById

        public boolean removeLabelById​(long labelId,
                                       long objectId)
                                throws Exception
        Removes the label with the given ID from the object with the given ContentEntityObject ID.
        Throws:
        Exception
      • removeLabelByObject

        public boolean removeLabelByObject​(Label labelObject,
                                           long objectId)
                                    throws Exception
        Removes the given label object from the object with the given ContentEntityObject ID.
        Throws:
        Exception
      • removeLabelByNameFromSpace

        public boolean removeLabelByNameFromSpace​(String labelName,
                                                  String spaceKey)
                                           throws Exception
        Removes the given label from the given {{spaceKey}}.
        Throws:
        Exception