Changes for page XML-RPC Java Examples

Last modified by Thomas Mortagne on 2023/10/10 14:31

From version 14.2
edited by mawoki
on 2010/11/25 08:30
Change comment: Removed tag [associate]
To version 15.1
edited by Eduard Moraru
on 2011/06/17 11:47
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.mawoki
1 +xwiki:XWiki.enygma
Content
... ... @@ -537,6 +537,7 @@
537 537  = Page: Add Tags =
538 538  
539 539  Adding tags is a similar procedure to listening them. There are two starting points: a) retrieve current tags and a new one or b) set entirely new ones at once. Most often, you want to add tags, so this is one way to do it ...
540 +
540 540  {{code language="java"}}import java.net.MalformedURLException;
541 541  import java.util.List;
542 542  
... ... @@ -755,6 +755,7 @@
755 755  
756 756   XWikiObject xobj = new XWikiObject();
757 757   xobj.setClassName("XWiki.XWikiUsers");
759 + xobj.setId(-1);
758 758   xobj.setPageId("XWiki.testuser");
759 759   xobj.setProperty("first_name", "Test");
760 760   xobj.setProperty("last_name", "User");
... ... @@ -767,6 +767,7 @@
767 767  
768 768   XWikiObject xobjgrp = new XWikiObject();
769 769   xobjgrp.setClassName("XWiki.XWikiGroups");
772 + xobjgrp.setId(-1);
770 770   xobjgrp.setPageId("XWiki.XWikiAllGroup");
771 771   xobjgrp.setProperty("member","XWiki.testuser");
772 772   rpc.storeObject(xobjgrp);
... ... @@ -794,10 +794,10 @@
794 794  import org.xwiki.xmlrpc.XWikiXmlRpcClient;
795 795  import org.xwiki.xmlrpc.model.XWikiObject;
796 796  
797 -
798 798  public class AddUserToGroup {
799 -public static void main(String[] args) throws MalformedURLException, XmlRpcException, NoSuchAlgorithmException {
800 800  
802 + public static void main(String[] args) throws MalformedURLException, XmlRpcException, NoSuchAlgorithmException {
803 +
801 801   //URL of the xwiki instance
802 802   String url = "http://localhost:8080/xwiki/xmlrpc/confluence";
803 803  
... ... @@ -818,6 +818,7 @@
818 818  
819 819   XWikiObject xobjgrp = new XWikiObject();
820 820   xobjgrp.setClassName("XWiki.XWikiGroups");
824 + xobjgrp.setId(-1);
821 821   xobjgrp.setPageId("XWiki.XWikiAllGroup");
822 822   xobjgrp.setProperty("member","XWiki.testuser");
823 823   rpc.storeObject(xobjgrp);
... ... @@ -831,3 +831,4 @@
831 831  }
832 832  
833 833  {{/code}}
838 +

Get Connected