Title: remove revision

Hi,

At the last line of below code, I attempted to remove the revisions of an uri. But it threw RevisionDescriptorNotFoundException!

        try
        {
                token = Domain.accessNamespace(new SecurityToken(new String()),"version");

                Structure structure = token.getStructureHelper();
                Security security = token.getSecurityHelper();
                Content content = token.getContentHelper();

                CredentialsToken credToken = new CredentialsToken(new String("root"));
                System.out.println("success new CredentialsToken");

                SlideToken slideToken = new SlideToken(credToken);

                SubjectNode subject = new SubjectNode();
                structure.create(slideToken, subject, "/test/1.txt");

                // --- Creating a versioned revision descriptors ---
                content.create(slideToken, "/test/1.txt", true);
                NodeRevisionDescriptors revisionDescriptors =
                        content.retrieve(slideToken, "/test/1.txt");

                // --- Now creating revision ---

                NodeRevisionDescriptor nrd = new NodeRevisionDescriptor(0);
                nrd.setProperty("revision", "2");                              

                String text = "Version 2 being created.";
                nrd.setContentLength(text.length());
                nrd.setProperty("property","value");
                StringBufferInputStream reader = new StringBufferInputStream(text);

                NodeRevisionContent nrc = new NodeRevisionContent();
                nrc.setContent(reader);
                content.create(slideToken, "/test/1.txt", nrd, nrc);

                // --- Try to remove ---
                nrd = content.retrieve(slideToken, revisionDescriptors);
                content.remove(slideToken, "/test/1.txt", nrd );

Stacktrace >>
org.apache.slide.content.RevisionDescriptorNotFoundException: No revision descriptor found on object /test/1.txt
        at slidestore.reference.JDBCDescriptorsStore.retrieveRevisionDescriptor(JDBCDescriptorsStore.java:1483)
        at org.apache.slide.store.StandardStore.retrieveRevisionDescriptor(StandardStore.java:550)
        at org.apache.slide.content.ContentImpl.retrieve(ContentImpl.java:254)
        at org.apache.slide.content.ContentImpl.retrieve(ContentImpl.java:284)

Any help appreciated.
Thien


Reply via email to