JCR checkin/checkout operations

前端 未结 2 967
忘掉有多难
忘掉有多难 2021-02-08 02:37

I\'m just starting to work with JCR (apache jackrabbit), i want to ask simple question (because i coudn\'t find good tutorial for it): So for what do i need Node.checkout and No

2条回答
  •  广开言路
    2021-02-08 02:49

    In Jackrabbit 2.x, the methods on Node are deprecated. Instead, use VersionManager.checkout / checkin (they are available in Jackrabbit 1.x as well). Here is some sample code:

    Node test = s.getRootNode().addNode("test");
    Node t1 = test.addNode("t1");
    t1.addMixin("mix:versionable");
    s.save();
    VersionManager vm = s.getWorkspace().
        getVersionManager();
    vm.checkout("/test/t1");
    t1.setProperty("data", "Hello" + i);
    s.save();
    vm.checkin("/test/t1");
    

提交回复
热议问题