@Test public void revertToRevision() throws TTException, WebApplicationException, IOException, ParserConfigurationException, SAXException, InterruptedException { final NodeIdRepresentation rid = new NodeIdRepresentation( CoreTestHelper.getStorage(CoreTestHelper.PATHS.PATH1.getFile())); rid.deleteResource(CoreTestHelper.RESOURCENAME, 8); rid.deleteResource(CoreTestHelper.RESOURCENAME, 11); rid.deleteResource(CoreTestHelper.RESOURCENAME, 14); assertEquals(ASSEQUALS, 4, treetank.getLastRevision(CoreTestHelper.RESOURCENAME)); treetank.revertToRevision(CoreTestHelper.RESOURCENAME, 1); final StreamingOutput sOutput = rid.getResource( CoreTestHelper.RESOURCENAME, 14, new HashMap<QueryParameter, String>()); final ByteArrayOutputStream output = new ByteArrayOutputStream(); sOutput.write(output); final Document doc = DOMHelper.buildDocument(output); final Node node = doc.getElementsByTagName("continent").item(0); final Attr attribute = (Attr) node.getAttributes().getNamedItem(NAME); final String africaString = attribute.getTextContent(); assertNotNull("check if africa (14) exists in the latest version", africaString); assertEquals(ASSEQUALS, 5, treetank.getLastRevision(CoreTestHelper.RESOURCENAME)); output.close(); }
public void revertToRevision(final String resourceName, final long backToRevision) throws JaxRxException, TTException { ISession session = null; INodeWriteTrx wtx = null; boolean abort = false; try { session = mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY)); wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling); wtx.revertTo(backToRevision); wtx.commit(); } catch (final TTException exce) { abort = true; throw new JaxRxException(exce); } finally { WorkerHelper.closeWTX(abort, wtx, session); } }
DatabaseRepresentation { public void revertToRevision(final String resourceName, final long backToRevision) throws JaxRxException, TTException { ISession session = null; INodeWriteTrx wtx = null; boolean abort = false; try { session = mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY)); wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling); wtx.revertTo(backToRevision); wtx.commit(); } catch (final TTException exce) { abort = true; throw new JaxRxException(exce); } finally { WorkerHelper.closeWTX(abort, wtx, session); } } }
DatabaseRepresentation { public void revertToRevision(final String resourceName, final long backToRevision) throws JaxRxException, TTException { ISession session = null; INodeWriteTrx wtx = null; boolean abort = false; try { session = mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY)); wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling); wtx.revertTo(backToRevision); wtx.commit(); } catch (final TTException exce) { abort = true; throw new JaxRxException(exce); } finally { WorkerHelper.closeWTX(abort, wtx, session); } } DatabaseRepresentation(final IStorage pDatabase, final IBackendFactory pStorageFac,
        final IRevisioning pRevision); }
DatabaseRepresentation { public void revertToRevision(final String resourceName, final long backToRevision) throws JaxRxException, TTException { ISession session = null; INodeWriteTrx wtx = null; boolean abort = false; try { session = mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY)); wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling); wtx.revertTo(backToRevision); wtx.commit(); } catch (final TTException exce) { abort = true; throw new JaxRxException(exce); } finally { WorkerHelper.closeWTX(abort, wtx, session); } } DatabaseRepresentation(final IStorage pDatabase, final IBackendFactory pStorageFac,
        final IRevisioning pRevision); void createResource(final InputStream inputStream, final String resourceName); StreamingOutput getResource(final String resourceName,
        final Map<QueryParameter, String> queryParams); StreamingOutput performQueryOnResource(final String resource, final String query,
        final Map<QueryParameter, String> otherParams); StreamingOutput getResourcesNames(); void add(final InputStream input, final String resource); void deleteResource(final String resourceName); final boolean shred(final InputStream xmlInput, final String resource); long getLastRevision(final String resourceName); OutputStream getModificHistory(final String resourceName, // NOPMD this method needs alls these
        // functions
        final String revisionRange, final boolean nodeid, final OutputStream output, final boolean wrap); void revertToRevision(final String resourceName, final long backToRevision); }
DatabaseRepresentation { public void revertToRevision(final String resourceName, final long backToRevision) throws JaxRxException, TTException { ISession session = null; INodeWriteTrx wtx = null; boolean abort = false; try { session = mDatabase.getSession(new SessionConfiguration(resourceName, StandardSettings.KEY)); wtx = new NodeWriteTrx(session, session.beginBucketWtx(), HashKind.Rolling); wtx.revertTo(backToRevision); wtx.commit(); } catch (final TTException exce) { abort = true; throw new JaxRxException(exce); } finally { WorkerHelper.closeWTX(abort, wtx, session); } } DatabaseRepresentation(final IStorage pDatabase, final IBackendFactory pStorageFac,
        final IRevisioning pRevision); void createResource(final InputStream inputStream, final String resourceName); StreamingOutput getResource(final String resourceName,
        final Map<QueryParameter, String> queryParams); StreamingOutput performQueryOnResource(final String resource, final String query,
        final Map<QueryParameter, String> otherParams); StreamingOutput getResourcesNames(); void add(final InputStream input, final String resource); void deleteResource(final String resourceName); final boolean shred(final InputStream xmlInput, final String resource); long getLastRevision(final String resourceName); OutputStream getModificHistory(final String resourceName, // NOPMD this method needs alls these
        // functions
        final String revisionRange, final boolean nodeid, final OutputStream output, final boolean wrap); void revertToRevision(final String resourceName, final long backToRevision);  }