Package javax.jcr

Examples of javax.jcr.Node.restore()


                        }
                    }
                    if (n == null) {
                        throw new PathNotFoundException("Path not found " + nodeId);
                    } else {
                        n.restore(v, sInfo.getNamePathResolver().getJCRPath(relPath), removeExisting);
                    }
                }
                return null;
            }
        }, sInfo);
View Full Code Here


        Version versionB = versionable.getBaseVersion();
        String[] labels = history.getVersionLabels(versionB);
        assertEquals(1, labels.length);
        assertEquals("labelB", labels[0]);
        Version versionA = history.getVersionByLabel("labelA");
        versionable.restore(versionA, true);
        assertEquals("A", versionable.getProperty("foo").getString());
        versionable.restore(versionB, true);
        assertEquals("B", versionable.getProperty("foo").getString());
        return versionable;
    }
View Full Code Here

        assertEquals(1, labels.length);
        assertEquals("labelB", labels[0]);
        Version versionA = history.getVersionByLabel("labelA");
        versionable.restore(versionA, true);
        assertEquals("A", versionable.getProperty("foo").getString());
        versionable.restore(versionB, true);
        assertEquals("B", versionable.getProperty("foo").getString());
        return versionable;
    }

    @SuppressWarnings("deprecation")
View Full Code Here

                    }
                    // do random restores
                    Random rand = new Random();
                    for (i = 0; i < NUM_OPERATIONS / CONCURRENCY; i++) {
                        Version v = (Version) versions.get(rand.nextInt(versions.size()));
                        n.restore(v, true);
                    }
                    n.checkout();
                } catch (Exception e) {
                    final String threadName = Thread.currentThread().getName();
                    final Throwable deepCause = getLevel2Cause(e);
View Full Code Here

        testRootNode.save();
        UserTransactionImpl tx = new UserTransactionImpl(superuser);
        tx.begin();
        Version v10 = n.checkin();
        String versionName = v10.getName();
        n.restore(v10, true);
        assertEquals("Wrong version restored", versionName, n.getBaseVersion().getName());
        tx.commit();
    }
}
View Full Code Here

        n.getVersionHistory().addVersionLabel(v2, "label", false);
        tx.commit();

        tx = new UserTransactionImpl(superuser);
        tx.begin();
        n.restore(v1, false);
        n.getVersionHistory().removeVersion(v2);
        n.checkout();
        v2 = n.checkin().getName();
        n.getVersionHistory().addVersionLabel(v2, "label", false);
        tx.commit();
View Full Code Here

        phase="restore N2 uncommitted.";

        tx = new UserTransactionImpl(s2);
        tx.begin();

        n2.restore("1.0", false);
        Version v2_2 = n2.getBaseVersion();

        check(v1_1, phase, "jcr:rootVersion", 1);
        check(v2_1, phase, "jcr:rootVersion", 1);
        check(v1_2, phase, "1.0", 0);
View Full Code Here

                }
                // do random restores
                Random rand = new Random();
                for (int i = 0; i < NUM_OPERATIONS / CONCURRENCY; i++) {
                    Version v = (Version) versions.get(rand.nextInt(versions.size()));
                    n.restore(v, true);
                }
                n.checkout();
            }
        }, CONCURRENCY);
    }
View Full Code Here

        phase="restore N2 uncommitted.";

        tx = new UserTransactionImpl(s2);
        tx.begin();

        n2.restore("1.0", false);
        Version v2_2 = n2.getBaseVersion();

        check(v1_1, phase, "jcr:rootVersion", 1);
        check(v2_1, phase, "jcr:rootVersion", 1);
        check(v1_2, phase, "1.0", 0);
View Full Code Here

                String versionName = getItemName(versionPath);

                String relPath = DomUtil.getChildText(udElem, XML_RELPATH, NAMESPACE);
                if (relPath == null) {
                    // restore version by name
                    node.restore(versionName, removeExisting);
                } else {
                    Version v = node.getVersionHistory().getVersion(versionName);
                    node.restore(v, relPath, removeExisting);
                }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.