jumal       2002/10/17 09:05:06

  Modified:    src/webdav/server/org/apache/slide/webdav/method
                        DeleteMethod.java MoveMethod.java
               src/webdav/server/org/apache/slide/webdav/util
                        VersioningHelper.java
               src/webdav/server/org/apache/slide/webdav/util/resourcekind
                        AbstractResourceKind.java
  Log:
  DAV:checkout-set is now a protected property.
  
  Revision  Changes    Path
  1.27      +23 -3     
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DeleteMethod.java
  
  Index: DeleteMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/DeleteMethod.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- DeleteMethod.java 12 Aug 2002 12:55:02 -0000      1.26
  +++ DeleteMethod.java 17 Oct 2002 16:05:05 -0000      1.27
  @@ -87,6 +87,7 @@
   import org.apache.slide.webdav.util.resourcekind.AbstractResourceKind;
   import org.apache.slide.webdav.util.resourcekind.ResourceKind;
   import org.apache.slide.webdav.util.resourcekind.CheckedOutVersionControlled;
  +import org.apache.slide.webdav.util.resourcekind.Working;
   import org.apache.slide.util.Configuration;
   
   import org.jdom.Element;
  @@ -252,6 +253,25 @@
               throw new PreconditionViolationException(new 
ViolatedPrecondition(C_NO_VERSION_DELETE,
                                                                                 
WebdavStatus.SC_FORBIDDEN),
                                                        targetUri);
  +            }
  +
  +            // if resource being removed is a checked-out VCR or a WR, 
  +            // remove its URI in the DAV:checkout-set property of the VR
  +            NodeRevisionDescriptors nrds = content.retrieve(slideToken, targetUri);
  +            NodeRevisionDescriptor nrd = content.retrieve(slideToken, nrds);
  +            ResourceKind rk = AbstractResourceKind.determineResourceKind(token, 
nrds, nrd);
  +            if(rk instanceof CheckedOutVersionControlled || rk instanceof Working) {
  +                String vrUri = 
  +                    VersioningHelper.getUriOfAssociatedVR(token, slideToken, 
content, targetUri);
  +                NodeRevisionDescriptors vrNrds = content.retrieve(slideToken, 
vrUri);
  +                NodeRevisionDescriptor vrNrd = content.retrieve(slideToken, vrNrds);
  +                try {
  +                    PropertyHelper.removeHrefFromProperty(vrNrd, P_CHECKOUT_SET, 
targetUri);
  +                    content.store(slideToken, vrUri, vrNrd, null);
  +                }
  +                catch (JDOMException e) {
  +                    e.printStackTrace();
  +                }
               }
           }
       }
  
  
  
  1.54      +31 -13    
jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java
  
  Index: MoveMethod.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/method/MoveMethod.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- MoveMethod.java   8 Oct 2002 13:40:45 -0000       1.53
  +++ MoveMethod.java   17 Oct 2002 16:05:05 -0000      1.54
  @@ -100,6 +100,7 @@
   import org.apache.slide.webdav.util.resourcekind.ResourceKind;
   import org.apache.slide.webdav.util.resourcekind.CheckedOutVersionControlled;
   import org.apache.slide.webdav.util.resourcekind.DeltavCompliantUnmappedUrl;
  +import org.apache.slide.webdav.util.resourcekind.Working;
   import org.apache.slide.webdav.util.resourcekind.Workspace;
   import org.apache.slide.webdav.util.resourcekind.VersionControlled;
   
  @@ -348,16 +349,16 @@
           if( Configuration.useVersionControl() ) {
               
               UriHandler uriHandler = UriHandler.getUriHandler(sourceUri);
  -        if (uriHandler.isVersionUri()) {
  -            throw new PreconditionViolationException(new 
ViolatedPrecondition(DeltavConstants.C_CANNOT_RENAME_VERSION,
  -                                                                              
WebdavStatus.SC_FORBIDDEN),
  -                                                     sourceUri);
  -        }
  -        if (uriHandler.isHistoryUri()) {
  -            throw new PreconditionViolationException(new 
ViolatedPrecondition(DeltavConstants.C_CANNOT_RENAME_HISTORY,
  -                                                                              
WebdavStatus.SC_FORBIDDEN),
  -                                                     sourceUri);
  -        }
  +            if (uriHandler.isVersionUri()) {
  +                throw new PreconditionViolationException(new 
ViolatedPrecondition(DeltavConstants.C_CANNOT_RENAME_VERSION,
  +                                                                                  
WebdavStatus.SC_FORBIDDEN),
  +                                                         sourceUri);
  +            }
  +            if (uriHandler.isHistoryUri()) {
  +                throw new PreconditionViolationException(new 
ViolatedPrecondition(DeltavConstants.C_CANNOT_RENAME_HISTORY,
  +                                                                                  
WebdavStatus.SC_FORBIDDEN),
  +                                                         sourceUri);
  +            }
               if (uriHandler.isWorkingresourceUri()) {
                   throw new PreconditionViolationException(new 
ViolatedPrecondition(DeltavConstants.C_CANNOT_RENAME_WORKING_RESOURCE,
                                                                                     
WebdavStatus.SC_FORBIDDEN),
  @@ -372,6 +373,23 @@
                                                                                      
sourceRevisionDescriptors,
                                                                                      
sourceRevisionDescriptor);
               isCopySourceVCR = (resourceKind instanceof VersionControlled);
  +
  +            // if resource being moved is a checked-out VCR or a WR, 
  +            // update its URI in the DAV:checkout-set property of the VR
  +            if(resourceKind instanceof CheckedOutVersionControlled || resourceKind 
instanceof Working) {
  +                String vrUri = 
  +                    VersioningHelper.getUriOfAssociatedVR(token, slideToken, 
content, sourceUri);
  +                NodeRevisionDescriptors vrNrds = content.retrieve(slideToken, 
vrUri);
  +                NodeRevisionDescriptor vrNrd = content.retrieve(slideToken, vrNrds);
  +                try {
  +                    PropertyHelper.removeHrefFromProperty(vrNrd, P_CHECKOUT_SET, 
sourceUri);
  +                    PropertyHelper.addHrefToProperty(vrNrd, P_CHECKOUT_SET, 
destinationUri);
  +                    content.store(slideToken, vrUri, vrNrd, null);
  +                }
  +                catch (JDOMException e) {
  +                    e.printStackTrace();
  +                }
  +            }
       }
       }
       
  
  
  
  1.79      +14 -3     
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/VersioningHelper.java
  
  Index: VersioningHelper.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/VersioningHelper.java,v
  retrieving revision 1.78
  retrieving revision 1.79
  diff -u -r1.78 -r1.79
  --- VersioningHelper.java     9 Oct 2002 12:57:34 -0000       1.78
  +++ VersioningHelper.java     17 Oct 2002 16:05:05 -0000      1.79
  @@ -808,8 +808,12 @@
                   }
               }
               
  +            // update checked-in VR's DAV:checkout-set property
  +            PropertyHelper.addHrefToProperty(cinNrd, P_CHECKOUT_SET, rUri);
  +
               // Store changes
               content.store( sToken, rNrds.getUri(), rNrd, null ); 
//revisionContent=null
  +            content.store( sToken, cinNrds.getUri(), cinNrd, null );
               return null;
           }
           else {
  @@ -863,6 +867,10 @@
               }
               
               NodeRevisionDescriptors vhrNrds = content.retrieve(sToken, vhUri);
  +
  +            // update version's DAV:checkout-set property
  +            PropertyHelper.addHrefToProperty(rNrd, P_CHECKOUT_SET, autoUpdateUri);
  +            content.store( sToken, rNrds.getUri(), rNrd, null);
               
               // create the workingresource
               UriHandler wrUh = UriHandler.createNextWorkingresourceUri( sToken, 
nsaToken, rUh );
  @@ -1031,6 +1039,9 @@
           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
  +        PropertyHelper.removeHrefFromProperty(coutNrd, P_CHECKOUT_SET, rUri);
  +        content.store(sToken, coutNrds.getUri(), coutNrd, null);
           
           // update VCR to previous VR
           rNrd.removeProperty( P_CHECKED_OUT );
  
  
  
  1.17      +4 -4      
jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/resourcekind/AbstractResourceKind.java
  
  Index: AbstractResourceKind.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-slide/src/webdav/server/org/apache/slide/webdav/util/resourcekind/AbstractResourceKind.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- AbstractResourceKind.java 25 Sep 2002 07:51:44 -0000      1.16
  +++ AbstractResourceKind.java 17 Oct 2002 16:05:06 -0000      1.17
  @@ -184,7 +184,6 @@
           computedProperties.add( P_ACTIVITY_CHECKOUT_SET );
           computedProperties.add( P_ACTIVITY_VERSION_SET );
           computedProperties.add( P_BASELINE_CONTROLLED_COLLECTION_SET );
  -        computedProperties.add( P_CHECKOUT_SET );
           computedProperties.add( P_CURRENT_USER_PRIVILEGE_SET);
           computedProperties.add( P_CURRENT_WORKSPACE_SET );
           computedProperties.add( P_ECLIPSED_SET );
  @@ -209,6 +208,7 @@
           protectedProperties.add( P_BASELINE_CONTROLLED_COLLECTION );
           protectedProperties.add( P_CHECKED_IN );
           protectedProperties.add( P_CHECKED_OUT );
  +        protectedProperties.add( P_CHECKOUT_SET );
           protectedProperties.add( P_CREATIONDATE );
           protectedProperties.add( P_GETCONTENTLANGUAGE );
           protectedProperties.add( P_GETLASTMODIFIED );
  
  
  

--
To unsubscribe, e-mail:   <mailto:slide-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:slide-dev-help@;jakarta.apache.org>

Reply via email to