juergen     02/03/18 02:15:49

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        PropPatchMethod.java
  Log:
  Added DeltaV checkin/checkout for auto-versioning.
  (ralf)
  
  Revision  Changes    Path
  1.29      +79 -10    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java
  
  Index: PropPatchMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- PropPatchMethod.java      28 Jan 2002 16:41:37 -0000      1.28
  +++ PropPatchMethod.java      18 Mar 2002 10:15:49 -0000      1.29
  @@ -1,7 +1,7 @@
   /*
  - * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java,v
 1.28 2002/01/28 16:41:37 juergen Exp $
  - * $Revision: 1.28 $
  - * $Date: 2002/01/28 16:41:37 $
  + * $Header: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/PropPatchMethod.java,v
 1.29 2002/03/18 10:15:49 juergen Exp $
  + * $Revision: 1.29 $
  + * $Date: 2002/03/18 10:15:49 $
    *
    * ====================================================================
    *
  @@ -83,13 +83,15 @@
   import org.apache.slide.structure.*;
   import org.apache.slide.lock.*;
   import org.apache.slide.content.*;
  +import org.apache.slide.webdav.util.*;
  +import org.apache.slide.util.*;
   
   /**
    * PROPPATCH method.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Remy Maucherat</a>
    */
  -public class PropPatchMethod extends WebdavMethod {
  +public class PropPatchMethod extends WebdavMethod implements DeltavConstants {
       
       
       // -------------------------------------------------------------- Constants
  @@ -259,16 +261,70 @@
           
           try {
               
  -            NodeRevisionDescriptors revisionDescriptors =
  +            VersioningHelper vHelp =
  +                VersioningHelper.getVersioningHelper(slideToken, token, req, resp, 
getConfig() );
  +            // Changed for DeltaV --start--
  +            //                NodeRevisionDescriptors revisionDescriptors =
  +            //                    content.retrieve(slideToken, resourcePath);
  +            NodeRevisionDescriptors revisionDescriptors;
  +            
  +            if( !Configuration.useVersionControl() ) {
  +                revisionDescriptors =
                   content.retrieve(slideToken, resourcePath);
  +            }
  +            else {
  +                revisionDescriptors =
  +                    vHelp.retrieveRevisionDescriptors( resourcePath );
  +            }
  +            // Changed for DeltaV --end--
  +            
  +            NodeRevisionNumber revisionNumber =
  +                revisionDescriptors.getLatestRevision();
               NodeRevisionDescriptor revisionDescriptor = null;
  +            if (revisionNumber != null) {
  +                try {
  +                    // Changed for DeltaV --start--
  +                    //                        oldRevisionDescriptor = 
content.retrieve
  +                    //                            (slideToken, revisionDescriptors);
  +                    if( !Configuration.useVersionControl() ) {
  +                        revisionDescriptor = content.retrieve
  +                            (slideToken, revisionDescriptors);
  +                    }
  +                    else {
  +                        revisionDescriptor = vHelp.retrieveLatestRevisionDescriptor(
  +                            resourcePath, revisionDescriptors );
  +                    }
  +                    // Changed for DeltaV --end--
  +                } catch (RevisionDescriptorNotFoundException e) {
  +                }
  +            }
               
  -            try {
  -                revisionDescriptor =
  -                    content.retrieve(slideToken, revisionDescriptors);
  -            } catch (RevisionDescriptorNotFoundException ex) {
  +            if (revisionDescriptor == null) {
                   revisionDescriptor = new NodeRevisionDescriptor(0);
  -                // TODO : Create the initial revision ?
  +            }
  +            
  +
  +            // check preconditions
  +            ViolatedPrecondition violatedPrecondition = null;
  +            // TODO: check DAV:cannot-modify-version-controlled-property
  +            // TODO: check DAV:cannot-modify-version
  +            // TODO: check DAV:cannot-modify-protected-property
  +            // TODO: check DAV:supported-live-property-set
  +            if (violatedPrecondition != null) {
  +                throw new PreconditionViolationException(violatedPrecondition);
  +            }
  +            
  +            // Changed for DeltaV --start--
  +            if( Configuration.useVersionControl() ) {
  +                NodeProperty avProp =
  +                    revisionDescriptor.getProperty( P_AUTO_VERSION );
  +                
  +                if( avProp != null && avProp.getValue() != null
  +                   && ((String)avProp.getValue()).indexOf(E_CHECKOUT_CHECKIN) >= 0 
) {
  +                    
  +                    vHelp.checkout(
  +                        revisionDescriptors, revisionDescriptor, false, false ); 
//forkOk=false, applyToVersion=false
  +                }
               }
               
               // Modifying the properties
  @@ -316,6 +372,19 @@
               if (allOperationsExcecuted)
                   content.store(slideToken, resourcePath, revisionDescriptor, null);
               
  +            // Changed for DeltaV --start--
  +            if( Configuration.useVersionControl() ) {
  +                NodeProperty avProp =
  +                    revisionDescriptor.getProperty( P_AUTO_VERSION );
  +                
  +                if( avProp != null && avProp.getValue() != null
  +                   && ((String)avProp.getValue()).indexOf(E_CHECKOUT_CHECKIN) >= 0 
) {
  +                    
  +                    vHelp.checkin(
  +                        revisionDescriptors, revisionDescriptor, false, false ); 
//forkOk=false, keepCheckedOut=false
  +                }
  +            }
  +            // Changed for DeltaV --end--
               
               resp.setContentType("text/xml; charset=UTF-8");
               
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to