Hi Walid, Sergiu is right, the $doc must be already saved by a user who has programming rights, otherwise $doc.getDocument() will return null.
Of course you don't have to change the xwiki code, you just need to create a component, take a look at http://platform.xwiki.org/xwiki/bin/view/DevGuide/WritingComponents For example : $services.revision.approuveVersion($doc.fullName, $version), here "revision" is the name of your component. (I don't know if this method makes sens for your case, but only to give an example) In the component implementation you can get the XWikiDocument instance of the current document and you can do what you want without any problem. In the implementation of the method approuveVersion, you can use what Jeremie suggested : // saving without adding a new version // doc in an instance of XWikiDocument class // context is an instance of XWikiContext class document.setMetaDataDirty(false); document.setContentDirty(false); context.getWiki().saveDocument(document, context); Hoping this help On Mon, May 26, 2014 at 4:57 PM, walid yaich <[email protected]> wrote: > Thanks, > > Means i should add a method to the wrapper API like : $doc.customSave() ? > So i need to download dependencies, build and deploy and compile my own jar > ? > I want to stay in XWIKI standards and be able to upgrade when i want to ... > > > > > > 2014-05-26 16:12 GMT+01:00 Sergiu Dumitriu <[email protected]>: > > > On 05/26/2014 08:47 AM, Jeremie BOUSQUET wrote: > > > Hi, > > > > > > Prior to saving, you can : > > > > > > $doc.getDocument().setMetaDataDirty(false) > > > $doc.getDocument().setContentDirty(false) > > > > But this requires programming rights, so it won't work for normal users. > > The best place to do this is in Java. > > > > You shouldn't save a document in contentview.vm (or any view mode). > > > > > Hope this helps, > > > Jeremie > > > > > > > > > > > > 2014-05-26 13:42 GMT+02:00 walid yaich <[email protected]>: > > > > > >> Hi, > > >> > > >> I added $doc.save() in contentview.vm to save the object added to my > > doc, > > >> this save increment the revision. > > >> > > >> is it possible to tell the save to not increment the version ? > > >> > > >> Thanks in advance :) > > >> _______________________________________________ > > >> devs mailing list > > >> [email protected] > > >> http://lists.xwiki.org/mailman/listinfo/devs > > >> > > > _______________________________________________ > > > devs mailing list > > > [email protected] > > > http://lists.xwiki.org/mailman/listinfo/devs > > > > > > > > > -- > > Sergiu Dumitriu > > http://purl.org/net/sergiu > > _______________________________________________ > > devs mailing list > > [email protected] > > http://lists.xwiki.org/mailman/listinfo/devs > > > _______________________________________________ > devs mailing list > [email protected] > http://lists.xwiki.org/mailman/listinfo/devs > _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs

