Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (C) 2009 eXo Platform SAS.
   *
   * This is free software; you can redistribute it and/or modify it
   * under the terms of the GNU Lesser General Public License as
   * published by the Free Software Foundation; either version 2.1 of
   * the License, or (at your option) any later version.
   *
   * This software is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this software; if not, write to the Free
  * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  */
 package org.exoplatform.services.jcr.webdav.command.deltav.report;
 
 
 import java.util.Set;
 
Created by The eXo Platform SAS Author : Vitaly Guly.

Version:
$Id: $
 
 
 public class VersionTreeResponseEntity implements StreamingOutput
 {

   
logger.
 
    private static Log log = ExoLogger.getLogger("exo.jcr.component.webdav.VersionTreeResponseEntity");

   
XML writer.
 
    protected XMLStreamWriter xmlStreamWriter;

   
Name space context.
 
    protected final WebDavNamespaceContext namespaceContext;

   
The list of versions.
 
    private Set<VersionResourceversions;

   
The list of properties.
 
    private Set<QNameproperties;

   
 
    public VersionTreeResponseEntity(WebDavNamespaceContext namespaceContextVersionedResource versionedResource,
       Set<QNamepropertiesthrows RepositoryExceptionIllegalResourceTypeException
    {
       this. = namespaceContext;
       this. = properties;
        = versionedResource.getVersionHistory().getVersions();
    }

   
 
    public void write(OutputStream outputStreamthrows IOException
    {
       try
      {
         this. =
            XMLOutputFactory.newInstance().createXMLStreamWriter(outputStream.);
         .writeStartElement("D""multistatus""DAV:");
         .writeNamespace("D""DAV:");
         .writeAttribute("xmlns:b""urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/");
         Iterator<VersionResourceversionIterator = .iterator();
         while (versionIterator.hasNext())
         {
            VersionResource versionResource = versionIterator.next();
            .writeStartElement("DAV:""response");
            .writeStartElement("DAV:""href");
            .writeCharacters(versionResource.getIdentifier().toASCIIString());
            .writeEndElement();
            PropstatGroupedRepresentation propstat =
               new PropstatGroupedRepresentation(versionResourcefalse);
            PropertyWriteUtil.writePropStats(propstat.getPropStats());
            .writeEndElement();
         }
         .writeEndElement();
      }
      catch (Exception exc)
      {
         .error(exc.getMessage(), exc);
         throw new IOException(exc.getMessage());
      }
   }
New to GrepCode? Check out our FAQ X