Package org.apache.slide.content

Examples of org.apache.slide.content.NodeRevisionNumber


        //NodeRevisionDescriptors vhrNrds = content.retrieve( sToken, vhrUri );
        content.create(
            sToken, vhrUri, null, vhrNrd, null ); //branch=null, revisionContent=null
       
        // Create VR node
        NodeRevisionNumber vrVersion = vrNrd.getRevisionNumber();
        SubjectNode vrNode = new SubjectNode();
        UriHandler vrUh =
            UriHandler.createVersionUri( vhrUh, String.valueOf(vrVersion) );
        String vrUri = String.valueOf( vrUh );
        structure.create( sToken, vrNode, String.valueOf(vrUh) );
View Full Code Here


            // get checked-in VR
            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 ) {
View Full Code Here

        // get checked-out VR
        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
View Full Code Here

           
            // 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());
            }
View Full Code Here

                        !vhrNrds.getUri().equals(predecessorUriHandler.getAssociatedHistoryUri()) ) {
                        return new ViolatedPrecondition(C_VERSION_HISTORY_IS_TREE, WebdavStatus.SC_FORBIDDEN);
                    }
                   
                    // check precondition C_CHECKIN_FORK_FORBIDDEN
                    NodeRevisionNumber predecessorNrn = new NodeRevisionNumber(predecessorUriHandler.getVersionName());
                    NodeRevisionDescriptor predecessorNrd = content.retrieve(stok,
                                                                             vhrNrds,
                                                                             predecessorNrn);
                    NodeProperty predecessorCheckinForkProperty = predecessorNrd.getProperty(P_CHECKIN_FORK);
                    if (predecessorCheckinForkProperty != null
                            && !predecessorCheckinForkProperty.getValue().toString().equals(""))
                    {
                        Enumeration predecessorSuccessors = vhrNrds.getSuccessors(predecessorNrn);
                        if ( (predecessorSuccessors != null) &&
                                (predecessorSuccessors.hasMoreElements()) &&
                                (predecessorCheckinForkProperty.getValue() != null) ) {
                           
                            String checkinFork = getElementName(predecessorCheckinForkProperty.getValue().toString());
                           
                            if (E_FORBIDDEN.equals(checkinFork)) {
                                return new ViolatedPrecondition(C_CHECKIN_FORK_FORBIDDEN, WebdavStatus.SC_FORBIDDEN);
                            }
                               
                                // check precondition C_CHECKIN_FORK_DISCOURAGED
                            else if (E_DISCOURAGED.equals(checkinFork) && !isForkOk ) {
                                return new ViolatedPrecondition(C_CHECKIN_FORK_DISCOURAGED, WebdavStatus.SC_CONFLICT);
                            }
                        }
                    }
                   
                    // check precondition C_NO_OVERWRITE_BY_AUTO_UPDATE
                    if( autoUpdNrd != null ) {
                        NodeProperty cinProp = autoUpdNrd.getProperty( P_CHECKED_IN );
                        if( cinProp != null ) {
                            Element cinHrefElm = pHelp.parsePropertyValue( (String)cinProp.getValue() );
                            UriHandler cinUh = new UriHandler( cinHrefElm.getTextTrim() );
                            NodeRevisionNumber cinNrn = new NodeRevisionNumber( cinUh.getVersionName() );
                            if( !vhrNrds.getUri().equals(cinUh.getAssociatedHistoryUri()) ) {
                                // violation
                                return new ViolatedPrecondition(C_NO_OVERWRITE_BY_AUTO_UPDATE, WebdavStatus.SC_CONFLICT);
                            }
                            if( !vhrNrds.isAncestorDescendant(cinNrn, predecessorNrn) ) {
View Full Code Here

                String href = ((Element)iterator.next()).getTextTrim();
                if (href != null) {
                   
                    UriHandler predecessorUriHandler = UriHandler.getUriHandler( href);
                   
                    NodeRevisionNumber predecessorNrn = new NodeRevisionNumber(predecessorUriHandler.getVersionName());
                    NodeRevisionDescriptor predecessorNrd = content.retrieve(sToken,
                                                                             vhrNrds,
                                                                             predecessorNrn);
                    NodeProperty predecessorCheckinForkProperty = predecessorNrd.getProperty(P_CHECKIN_FORK);
                    if (predecessorCheckinForkProperty != null) {
                       
                        Enumeration predecessorSuccessors = vhrNrds.getSuccessors(predecessorNrn);
                        if ( (predecessorSuccessors != null) &&
                            predecessorSuccessors.hasMoreElements() ) {
                            forkBranch = "branch_" + predecessorNrn.toString();
                        }
                    }
                   
                }
            }
View Full Code Here

                UriHandler vrUriHandler = null;
                boolean found = false;
                while ( !found && versionSetIterator.hasNext() ) {
                    vrUri = ((Element)versionSetIterator.next()).getText();
                    vrUriHandler = UriHandler.getUriHandler(vrUri);
                    NodeRevisionNumber vrRevisionNumber = new NodeRevisionNumber(vrUriHandler.getVersionName());
                    vrNrd = content.retrieve(sToken, historyNrds, vrRevisionNumber);
                    labelNameSetProperty = vrNrd.getProperty(P_LABEL_NAME_SET);
                    if ( (labelNameSetProperty != null) && (labelNameSetProperty.getValue() != null) ) {
                        labelNameSetString = labelNameSetProperty.getValue().toString();
                        if (labelNameSetString != null) {
View Full Code Here

    public void revokePermission(Connection connection, Uri uri, NodePermission permission)
        throws ServiceAccessException {
        if (permission == null) return;
        PreparedStatement statement = null;
        try {
            NodeRevisionNumber revisionNumber = permission.getRevisionNumber();
            statement =
                connection.prepareStatement(
                    "delete from PERMISSIONS where PERMISSIONS.OBJECT_ID in (select ou.URI_ID from URI ou, URI su, URI au where ou.URI_STRING = ? and SUBJECT_ID = su.URI_ID and su.URI_STRING = ? and ACTION_ID = au.URI_ID and au.URI_STRING = ? and VERSION_NO" + ((revisionNumber == null) ? " IS NULL " : " = '" + revisionNumber.toString() + "'"));
            statement.setString(1, permission.getObjectUri());
            statement.setString(2, permission.getSubjectUri());
            statement.setString(3, permission.getActionUri());
            statement.executeUpdate();
        } catch (SQLException e) {
View Full Code Here

    NodePermission permission)
    throws ServiceAccessException {
        if (permission == null) return;
    PreparedStatement statement = null;
    try {
      NodeRevisionNumber revisionNumber = permission.getRevisionNumber();
      statement =
        connection.prepareStatement(
          "delete from PERMISSIONS, URI ou, URI su, URI au where OBJECT_ID = ou.URI_ID and ou.URI_STRING = ? and SUBJECT_ID = su.URI_ID and su.URI_STRING = ? and ACTION_ID = au.URI_ID and au.URI_STRING = ? and VERSION_NO = ?");
      statement.setString(1, permission.getObjectUri());
      statement.setString(2, permission.getSubjectUri());
      statement.setString(3, permission.getActionUri());
            statement.setString(3, revisionNumber.toString());
      statement.executeUpdate();
    } catch (SQLException e) {
      getLogger().log(e, LOG_CHANNEL, Logger.ERROR);
      throw new ServiceAccessException(service, e);
    } finally {
View Full Code Here

        Store store = uri.getStore();
        store.storeObject(uri, object);
       
        if (setModificationDate) {
            try {
                NodeRevisionDescriptor revisionDescriptor = store.retrieveRevisionDescriptor(uri, new NodeRevisionNumber());
                revisionDescriptor.setModificationDate(new Date());
                revisionDescriptor.setModificationUser(
                    securityHelper.getPrincipal(token).getPath().lastSegment());
                store.storeRevisionDescriptor(uri, revisionDescriptor );
            }
View Full Code Here

TOP

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

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.