Package org.apache.slide.content

Examples of org.apache.slide.content.NodeRevisionDescriptors


        try {
           
            try {
                boolean isLockedNullResource = false;
               
                NodeRevisionDescriptors revisionDescriptors =
                    content.retrieve(slideToken, resourcePath);
               
                NodeRevisionNumber revisionNumber =
                    revisionDescriptors.getLatestRevision();
                NodeRevisionDescriptor oldRevisionDescriptor = null;
                if (revisionNumber != null) {
                    try {
                        oldRevisionDescriptor = content.retrieve
                            (slideToken, revisionDescriptors);
View Full Code Here


    public void versionControl( String resourcePath ) throws SlideException {
        UriHandler rUh = UriHandler.getUriHandler( resourcePath );
        Iterator i;
        Enumeration j;
       
        NodeRevisionDescriptors rNrds = content.retrieve( sToken, resourcePath );
        NodeRevisionDescriptor rNrd = content.retrieve( sToken, rNrds );
        ResourceKind rRk = AbstractResourceKind.determineResourceKind( nsaToken, resourcePath, rNrd );
        if( !rRk.isSupportedMethod(req.getMethod()) ) {
            throw new MethodNotAllowedException( rRk );
        }
       
        // Check for rRk = K_VERSION_CONTROLLED*
        if( rRk instanceof VersionControlled ) {
            // nothing to do
            return;
        }
       
        // Set initial VR properties
        NodeRevisionDescriptor vrNrd =
            new NodeRevisionDescriptor(req.getContentLength());
        i = pHelp.createInitialProperties(VersionImpl.getInstance()).iterator();
        while( i.hasNext() )
            vrNrd.setProperty( (NodeProperty)i.next() );
       
        // Copy dead properties VCR -> VR
        j = rNrd.enumerateProperties();
        while( j.hasMoreElements() ) {
            NodeProperty p = (NodeProperty)j.nextElement();
            if( p.isLiveProperty() )
                continue;
            if( !vrNrd.exists(p.getName()) )
                vrNrd.setProperty( p );
        }
       
        // Copy properties VCR->VR
        NodeRevisionContent rNrc = content.retrieve( sToken, rNrds, rNrd );
        vrNrd.setContentType(rNrd.getContentType()); // P_GETCONTENTTYPE
        vrNrd.setContentLength(rNrd.getContentLength()); // P_GETCONTENTLENGTH
        vrNrd.setContentLanguage(rNrd.getContentLanguage()); // P_GETCONTENTLANGUAGE
        String comment = "INITIAL VERSION. ";
        if( rNrd.exists(P_COMMENT) )
            comment += (String)rNrd.getProperty(P_COMMENT).getValue();
        vrNrd.setProperty(
            new NodeProperty(P_COMMENT, comment) );
       
        // Set initial VHR properties
        Vector vhrLabels = new Vector();
        Hashtable vhrProps = new Hashtable();
        String vhrBranch = NodeRevisionDescriptors.MAIN_BRANCH;
        NodeRevisionDescriptor vhrNrd =
            new NodeRevisionDescriptor( NodeRevisionNumber.HIDDEN_0_0, vhrBranch, vhrLabels, vhrProps );
        i = pHelp.createInitialProperties(VersionHistoryImpl.getInstance()).iterator();
        while( i.hasNext() )
            vhrNrd.setProperty( (NodeProperty)i.next() );
       
        // Set initial VCR properties (do not overwrite existing!!)
        i = pHelp.createInitialProperties(VersionControlledImpl.getInstance()).iterator();
        while( i.hasNext() ) {
            NodeProperty p = (NodeProperty)i.next();
            if( !rNrd.exists(p.getName()) )
                rNrd.setProperty( p );
        }
       
        // Create VHR/VR
        UriHandler vhrUh = UriHandler.createNextHistoryUri( sToken, nsaToken, rUh );
        String vhrUri = String.valueOf( vhrUh );
        SubjectNode vhrNode = new SubjectNode();
        structure.create( sToken, vhrNode, String.valueOf(vhrUh) );
        content.create( sToken, vhrUri, true ); //isVersioned=true
        content.create( sToken, vhrUri, vrNrd, rNrc );
        NodeRevisionDescriptors vhrNrds =
            content.retrieve( sToken, vhrUri );
        content.create(
            sToken, vhrUri, null, vhrNrd, null ); //branch=null, revisionContent=null
       
        // Create VR node
View Full Code Here

        if ( ! evUh.isVersionUri() ) {
            throw new PreconditionViolationException(
                new ViolatedPrecondition(C_MUST_BE_VERSION, WebdavStatus.SC_CONFLICT), resourcePath);
        }
        NodeRevisionNumber evNrn = new NodeRevisionNumber( evUh.getVersionName() );
        NodeRevisionDescriptors rNrds = null;
        NodeRevisionDescriptor rNrd = null;
        NodeRevisionDescriptors vcrNrds = null;
        NodeRevisionDescriptor vcrNrd = null;
        NodeRevisionDescriptors evNrds = null;
        NodeRevisionDescriptor evNrd = null;
       
        try {
            rNrds = content.retrieve( sToken, resourcePath );
            rNrd = content.retrieve( sToken, rNrds );
View Full Code Here

        Iterator i;
       
        UriHandler rUh = UriHandler.getUriHandler( resourcePath );
        NodeRevisionDescriptor rNrd = null;
        try {
            NodeRevisionDescriptors rNrds = content.retrieve( sToken, resourcePath );
            rNrd = content.retrieve( sToken, rNrds );
        }
        catch( ObjectNotFoundException e ) {}; // can be ignored here!
       
        ResourceKind rRk = AbstractResourceKind.determineResourceKind( nsaToken, resourcePath, rNrd );
View Full Code Here

     */
    public String checkout( String resourcePath, boolean forkOk, boolean applyToVersion, boolean isAutoVersionCheckout )
        throws SlideException, JDOMException, IOException, PreconditionViolationException  {
       
        UriHandler rUh = UriHandler.getUriHandler( resourcePath );
        NodeRevisionDescriptors rNrds = content.retrieve( sToken, resourcePath );
        NodeRevisionDescriptor rNrd = content.retrieve( sToken, rNrds );
       
        if( rUh.isVersionUri() ) {
            NodeRevisionContent rNrc = content.retrieve( sToken, rNrds, rNrd );
            return checkout( rNrds, rNrd, rNrc, forkOk, null ); // autoUpdateUri=null
View Full Code Here

            NodeProperty cinProp = rNrd.getProperty( P_CHECKED_IN );
            String cinHref = getElementValue((String)cinProp.getValue());
            UriHandler cinUriHandler = UriHandler.getUriHandler(cinHref);
            String cinhUri = cinUriHandler.getAssociatedHistoryUri();
            NodeRevisionNumber cinNrn = new NodeRevisionNumber(cinUriHandler.getVersionName());
            NodeRevisionDescriptors cinNrds = content.retrieve(sToken, cinhUri);
            NodeRevisionDescriptor cinNrd = content.retrieve(sToken, cinNrds, cinNrn);
           
            // working resource feature
            if( applyToVersion ) {
                NodeRevisionContent cinNrc = content.retrieve( sToken, cinNrds, cinNrd );
                return checkout( cinNrds, cinNrd, cinNrc, forkOk, rUri ); // autoUpdateUri=rUri
            }
           
            ViolatedPrecondition violatedPrecondition = getCheckoutPreconditionViolation(cinNrds, cinNrd, forkOk);
            if (violatedPrecondition != null) {
                throw new PreconditionViolationException(violatedPrecondition, rNrds.getUri());
            }
           
            NodeRevisionDescriptors vhrNrds = content.retrieve(sToken, cinhUri);
           
            // do the checkout
            backupSpecificLiveProperties(rNrds, rNrd);
            rNrd.removeProperty( cinProp );
            rNrd.setProperty(
View Full Code Here

                throw new PreconditionViolationException(violatedPrecondition, rNrds.getUri());
               
               
            }
           
            NodeRevisionDescriptors vhrNrds = content.retrieve(sToken, vhUri);
           
            // create the workingresource
            UriHandler wrUh = UriHandler.createNextWorkingresourceUri( sToken, nsaToken, rUh );
            String wrUri = String.valueOf( wrUh );
            SubjectNode wrNode = new SubjectNode();
View Full Code Here

     *
     * @param     resourcePath  the path of the resource to uncheckout.
     */
    public void uncheckout(String resourcePath) throws SlideException, JDOMException, IOException, PreconditionViolationException  {
       
        NodeRevisionDescriptors rNrds = content.retrieve( sToken, resourcePath );
        NodeRevisionDescriptor rNrd = content.retrieve( sToken, rNrds );
        uncheckout( rNrds, rNrd);
    }
View Full Code Here

        NodeProperty coutProp = rNrd.getProperty( P_CHECKED_OUT );
        String coutHref = getElementValue((String)coutProp.getValue());
        UriHandler coutUriHandler = UriHandler.getUriHandler(coutHref);
        String coutUri = coutUriHandler.getAssociatedHistoryUri();
        NodeRevisionNumber coutNrn = new NodeRevisionNumber(coutUriHandler.getVersionName());
        NodeRevisionDescriptors coutNrds = content.retrieve(sToken, coutUri);
        NodeRevisionDescriptor coutNrd = content.retrieve(sToken, coutNrds, coutNrn);
        NodeRevisionContent coutNrc = content.retrieve( sToken, coutNrds, coutNrd );
       
        // update its DAV:checkout-set property
        if (!PropertyHelper.removeHrefFromProperty(coutNrd, P_CHECKOUT_SET, rUri)) {
            StringBuffer b = new StringBuffer("Invalid path");
            PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(sToken, nsaToken, sConf);
            NodeProperty checkoutSetProp = propertyHelper.getProperty(P_CHECKOUT_SET, coutNrds, coutNrd, req.getContextPath(), null);
            if( checkoutSetProp != null && checkoutSetProp.getValue() != null ) {
                XMLValue checkoutSetValue = new XMLValue( checkoutSetProp.getValue().toString() );
                if (checkoutSetValue.iterator().hasNext()) {
                    b.append(" - please use "+checkoutSetValue.getTextValue()+" instead");
                }
            }
            throw new ConflictException(
                rUri, new SlideException(b.toString()));
        }
        content.store(sToken, coutNrds.getUri(), coutNrd, null);
       
        // update VCR to previous VR
        rNrd.removeProperty( P_CHECKED_OUT );
        update( rNrds, rNrd, coutNrds, coutNrd );
       
View Full Code Here

     * @throws PreconditionViolatedException
     */
    public String checkin( String resourcePath, boolean forkOk, boolean keepCheckedOut, boolean autoVersion )
        throws SlideException, JDOMException, IOException, PreconditionViolationException  {
       
        NodeRevisionDescriptors rNrds = content.retrieve( sToken, resourcePath );
        NodeRevisionDescriptor rNrd = content.retrieve( sToken, rNrds );
        return checkin( rNrds, rNrd, forkOk, keepCheckedOut, autoVersion );
    }
View Full Code Here

TOP

Related Classes of org.apache.slide.content.NodeRevisionDescriptors

Copyright © 2018 www.massapicom. 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.