Package org.apache.slide.content

Examples of org.apache.slide.content.NodeRevisionDescriptors


     *
     * @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, slideContextPath);
            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

            NodeProperty coutProp = rNrd.getProperty( P_CHECKED_OUT );
            NodeProperty predSetProp = rNrd.getProperty( P_PREDECESSOR_SET );
            NodeProperty autoUpdProp = rNrd.getProperty( P_AUTO_UPDATE );
           
            // prepare auto-update
            NodeRevisionDescriptors autoUpdNrds = null;
            NodeRevisionDescriptor autoUpdNrd = null;
            if( autoUpdProp != null ) {
                Element autoUpdElm = pHelp.parsePropertyValue( (String)autoUpdProp.getValue() );
                String autoUpdUri = autoUpdElm.getTextTrim();
                autoUpdNrds = content.retrieve( sToken, autoUpdUri );
                autoUpdNrd = content.retrieve( sToken, autoUpdNrds );
            }
           
            // Retrieve VHR
            Element coutElm = pHelp.parsePropertyValue( (String)coutProp.getValue() );
            String vrUriOld = coutElm.getTextTrim();
            UriHandler vrUhOld = UriHandler.getUriHandler( vrUriOld );
            NodeRevisionNumber vrNrnOld = new NodeRevisionNumber( vrUhOld.getVersionName() );
            String vhrUri = vrUhOld.getAssociatedHistoryUri();
            NodeRevisionDescriptors vhrNrds = content.retrieve( sToken, vhrUri );
            NodeRevisionDescriptor vhrNrd = content.retrieve( sToken, vhrNrds ); //vhrUri
            NodeProperty vSetProp = vhrNrd.getProperty( P_VERSION_SET );
           
            // Retrieve old VR
            NodeRevisionDescriptor vrNrdOld =
                content.retrieve( sToken, vhrNrds, vrNrnOld ); // vrUriOld
           
            // update the old VR's DAV:checkout-set property
            if (!PropertyHelper.removeHrefFromProperty(vrNrdOld, P_CHECKOUT_SET, rUri)) {
                StringBuffer b = new StringBuffer("Invalid path");
                PropertyHelper propertyHelper = PropertyHelper.getPropertyHelper(sToken, nsaToken, sConf);
                NodeProperty checkoutSetProp = propertyHelper.getProperty(P_CHECKOUT_SET, vhrNrds, vrNrdOld, slideContextPath);
                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, vhrNrds.getUri(), vrNrdOld, null);
           
            // check preconditions
            ViolatedPrecondition violatedPrecondition =
                getCheckinPreconditionViolation( predSetProp, vhrNrds, forkOk, autoUpdNrd );
            if (violatedPrecondition != null) {
                throw new PreconditionViolationException(violatedPrecondition, rUri);
            }
           
            // check forking
            String forkBranch = getForkBranch(predSetProp, vhrNrds, forkOk);
            NodeRevisionDescriptor vrNrdNew = null;
            if (forkBranch != null) {
                // Create a new branch
                NodeRevisionNumber branchedRevisionNumber =
                    content.fork(sToken, vhrNrds.getUri(), forkBranch, vrNrdOld);
                vhrNrds = content.retrieve( sToken, vhrUri );
                vrNrdNew = content.retrieve(sToken, vhrNrds, branchedRevisionNumber);
                vrNrdNew.setContentLength(rNrd.getContentLength());
            }
            else {
View Full Code Here

     *
     * @throws     SlideException
     */
    public void update(String vcrUri, String vrUri) throws SlideException {
       
        NodeRevisionDescriptors vcrRevisionDescriptors = content.retrieve( sToken,vcrUri );
        NodeRevisionDescriptor vcrRevisionDescriptor = content.retrieve( sToken, vcrRevisionDescriptors);
       
        NodeRevisionDescriptors vrRevisionDescriptors = content.retrieve( sToken, vrUri );
        NodeRevisionDescriptor vrRevisionDescriptor = content.retrieve( sToken, vrRevisionDescriptors); // vrUri
       
        update(vcrRevisionDescriptors, vcrRevisionDescriptor, vrRevisionDescriptors, vrRevisionDescriptor);
    }
View Full Code Here

     *             modifying it.
     *
     * @throws     SlideException
     */
    public boolean mustCheckoutAutoVersionedVCR(String resourceUri) throws SlideException {
        NodeRevisionDescriptors vcrRevisionDescriptors = content.retrieve(sToken,resourceUri);
        NodeRevisionDescriptor vcrRevisionDescriptor = content.retrieve( sToken, vcrRevisionDescriptors);
        return mustCheckoutAutoVersionedVCR(vcrRevisionDescriptors, vcrRevisionDescriptor);
    }
View Full Code Here

     *             modifying it.
     *
     * @throws    SlideException
     */
    public boolean mustCheckinAutoVersionedVCR(SlideToken slideToken, String resourceUri) throws SlideException {
        NodeRevisionDescriptors vcrRevisionDescriptors = content.retrieve(sToken,resourceUri);
        NodeRevisionDescriptor vcrRevisionDescriptor = content.retrieve( sToken, vcrRevisionDescriptors);
        return mustCheckinAutoVersionedVCR(slideToken, vcrRevisionDescriptors, vcrRevisionDescriptor);
    }
View Full Code Here

     * @throws     LabeledRevisionNotFoundException if no revision with the specified
     *                                              label was found.
     */
    private static String getLabeledResourceUri(NamespaceAccessToken nsaToken, SlideToken sToken, Content content, String resourcePath, String label) throws SlideException, LabeledRevisionNotFoundException {
       
        NodeRevisionDescriptors revisionDescriptors =
            content.retrieve( sToken, resourcePath );
        NodeRevisionDescriptor revisionDescriptor =
            content.retrieve( sToken, revisionDescriptors);
        ResourceKind resourceKind = AbstractResourceKind.determineResourceKind( nsaToken, resourcePath, revisionDescriptor);
       
        if ( (resourceKind instanceof VersionControlled) && (label != null) ) {
            String vrUri = getUriOfAssociatedVR(nsaToken, sToken, content, revisionDescriptors.getUri());
            UriHandler vrUriHandler = UriHandler.getUriHandler(vrUri);
            String historyUri = vrUriHandler.getAssociatedHistoryUri();
            revisionDescriptors = content.retrieve(sToken, historyUri);
            revisionDescriptor = retrieveLabeledRevision(nsaToken, sToken, content, historyUri, label);
        }
View Full Code Here

       
        NodeRevisionDescriptor labeledRevision = null;
       
        UriHandler historyUriHandler = UriHandler.getUriHandler(historyUri);
        if (historyUriHandler.isHistoryUri()) {
            NodeRevisionDescriptors historyNrds = content.retrieve(sToken, historyUri);
            NodeRevisionDescriptor historyNrd =
                content.retrieve(sToken, historyNrds, NodeRevisionNumber.HIDDEN_0_0);
            NodeProperty versionSet = historyNrd.getProperty(P_VERSION_SET);
            try {
                XMLValue versionSetValue = new XMLValue(versionSet.getValue().toString());
View Full Code Here

                                              Content content,
                                              String resourceUri) throws SlideException {
       
        String vrUri = null;
       
        NodeRevisionDescriptors revisionDescriptors = content.retrieve(sToken, resourceUri);
        if (!revisionDescriptors.isVersioned()) {
            NodeRevisionDescriptor revisionDescriptor =
                content.retrieve( sToken, revisionDescriptors);
            NodeProperty property = revisionDescriptor.getProperty(P_CHECKED_OUT);
            if ( (property == null) || (property.getValue() == null) ) {
                property = revisionDescriptor.getProperty(P_CHECKED_IN);
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.