pnever      2002/10/31 06:50:10

  Modified:    src/webdav/server/org/apache/slide/webdav/util
                        VersioningHelper.java
  Log:
  Added handling for DAV:comment, DAV:getcontentlanguage and DAV:displayname of VRs
  
  Revision  Changes    Path
  1.81      +29 -10    
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.80
  retrieving revision 1.81
  diff -u -r1.80 -r1.81
  --- VersioningHelper.java     24 Oct 2002 08:31:05 -0000      1.80
  +++ VersioningHelper.java     31 Oct 2002 14:50:10 -0000      1.81
  @@ -291,10 +291,17 @@
                   vrNrd.setProperty( p );
           }
           
  -        // Copy content-type VCR->VR
  +        // 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
  +        vrNrd.setName(rNrd.getName()); // P_DISPLAYNAME
  +        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();
  @@ -347,7 +354,6 @@
           vrNrd.setETag( vrUri.hashCode()+"_"+req.getContentLength() ); // P_GETETAG
           vrNrd.setCreationDate( new Date() ); // P_CREATIONDATE
           vrNrd.setLastModified( new Date() ); // P_GETLASTMODIFIED
  -        vrNrd.setName(vrUh.getVersionName() ); // P_DISPLAYNAME
           vrNrd.setProperty(
               new NodeProperty(P_VERSION_NAME, vrUh.getVersionName()) );
           
  @@ -421,6 +427,8 @@
           vcrNrd.setLastModified( new Date() ); //P_GETLASTMODIFIED
           vcrNrd.setContentLength( evNrd.getContentLength() ); // P_GETCONTENTLENGTH
           vcrNrd.setContentType( evNrd.getContentType() ); // P_GETCONTENTTYPE
  +        vcrNrd.setContentLanguage(evNrd.getContentLanguage()); // 
P_GETCONTENTLANGUAGE
  +        
           String[] utok = vcrUh.getUriTokens();
           vcrNrd.setName( utok[utok.length - 1] ); // P_DISPLAYNAME
           vcrNrd.setCreationDate( new Date() ); // P_CREATIONDATE
  @@ -890,6 +898,7 @@
                   wrNrd.setProperty( cinfProp );
               wrNrd.setContentType(rNrd.getContentType()); // P_GETCONTENTTYPE
               wrNrd.setContentLength( rNrd.getContentLength() ); // P_GETCONTENTLENGTH
  +            wrNrd.setContentLanguage(rNrd.getContentLanguage()); // 
P_GETCONTENTLANGUAGE
               wrNrd.setETag( wrUri.hashCode()+"_"+rNrd.getContentLength() ); // 
P_GETETAG
               wrNrd.setLastModified( new Date() ); //P_GETLASTMODIFIED
               wrNrd.setCreationDate( new Date() ); // P_CREATIONDATE
  @@ -1060,18 +1069,19 @@
        * @param resourcePath the request URI
        * @param forkOk true, if the request body contained a DAV:fork-ok element
        * @param keepCheckedOut true, if the request body contained a 
DAV:keep-checked-out element
  +     * @param autoVersion true, if the checkin is due to auto-versioning
        * @return the URI of the created version resource
        * @throws SlideException
        * @throws JDOMException
        * @throws IOException
        * @throws PreconditionViolatedException
        */
  -    public String checkin( String resourcePath, boolean forkOk, boolean 
keepCheckedOut )
  +    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 );
  +        return checkin( rNrds, rNrd, forkOk, keepCheckedOut, autoVersion );
       }
       
       /**
  @@ -1080,14 +1090,15 @@
        * @param rNrd the revision descriptor instance
        * @param forkOk true, if the request body contained a DAV:fork-ok element
        * @param keepCheckedOut true, if the request body contained a 
DAV:keep-checked-out element
  +     * @param autoVersion true, if the checkin is due to auto-versioning
        * @return the URI of the created version resource
        * @throws SlideException
        * @throws JDOMException
        * @throws IOException
        * @throws PreconditionViolatedException
        */
  -    public String checkin( NodeRevisionDescriptors rNrds,
  -                          NodeRevisionDescriptor rNrd, boolean forkOk, boolean 
keepCheckedOut )
  +    public String checkin( NodeRevisionDescriptors rNrds, NodeRevisionDescriptor 
rNrd,
  +                          boolean forkOk, boolean keepCheckedOut, boolean 
autoVersion )
           throws SlideException, JDOMException, IOException, 
PreconditionViolationException {
           
           Iterator i;
  @@ -1177,6 +1188,14 @@
               // Copy specific live properties VCR/WR -> VR
               vrNrdNew.setContentType(rNrd.getContentType()); // P_GETCONTENTTYPE
               vrNrdNew.setContentLength(rNrd.getContentLength()); // 
P_GETCONTENTLENGTH
  +            vrNrdNew.setContentLanguage( rNrd.getContentLanguage() ); // 
P_GETCONTENTLANGUAGE
  +            vrNrdNew.setName( rNrd.getName() ); // P_DISPLAYNAME
  +            String comment = (autoVersion ? "CREATED BY AUTO-VERSIONING. " : "");
  +            if( rNrd.exists(P_COMMENT) )
  +                comment += (String)rNrd.getProperty(P_COMMENT).getValue();
  +            vrNrdNew.setProperty(
  +                new NodeProperty(P_COMMENT, comment) );
  +            
               vrNrdNew.setProperty( rNrd.getProperty(P_CHECKOUT_FORK) );
               vrNrdNew.setProperty( rNrd.getProperty(P_CHECKIN_FORK) );
               
  @@ -1220,7 +1239,6 @@
               vhrNrd.setProperty( new NodeProperty(
                                      P_VERSION_SET, 
((String)vSetProp.getValue())+pHelp.createHrefValue(vrUriNew)) );
               
  -            vrNrdNew.setName(vrUhNew.getVersionName() ); // P_DISPLAYNAME
               vrNrdNew.setETag( vrUriNew.hashCode()+"_"+req.getContentLength() ); // 
P_GETETAG
               vrNrdNew.setCreationDate( new Date() ); // P_CREATIONDATE
               vrNrdNew.setLastModified( new Date() ); // P_GETLASTMODIFIED
  @@ -1505,6 +1523,7 @@
           vcrRevisionDescriptor.setLastModified(new Date());
           
vcrRevisionDescriptor.setContentLength(vrRevisionDescriptor.getContentLength());
           vcrRevisionDescriptor.setContentType(vrRevisionDescriptor.getContentType());
  +        
vcrRevisionDescriptor.setContentLanguage(vrRevisionDescriptor.getContentLanguage());
           vcrRevisionDescriptor.setETag(vcrRevisionDescriptors.getUri().hashCode()+
                                             
"_"+vcrRevisionDescriptor.getContentLength());
           
  
  
  

--
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