Search in sources :

Example 1 with VersionControlledResource

use of org.apache.jackrabbit.webdav.version.VersionControlledResource in project jackrabbit by apache.

the class CompareBaselineReport method getVersions.

private void getVersions(DavResource collection, List<VersionResource> vList) throws DavException {
    DavResourceIterator it = collection.getMembers();
    while (it.hasNext()) {
        DavResource member = it.nextResource();
        if (member instanceof VersionControlledResource) {
            String href = new HrefProperty(member.getProperty(VersionControlledResource.CHECKED_IN)).getHrefs().get(0);
            DavResourceLocator locator = member.getLocator();
            DavResourceLocator vLocator = locator.getFactory().createResourceLocator(locator.getPrefix(), href);
            DavResource v = member.getFactory().createResource(vLocator, member.getSession());
            if (v instanceof VersionResource) {
                vList.add((VersionResource) v);
            } else {
                log.error("Internal error: DAV:checked-in property must point to a VersionResource.");
            }
        }
        if (member.isCollection()) {
            getVersions(member, vList);
        }
    }
}
Also used : DavResourceIterator(org.apache.jackrabbit.webdav.DavResourceIterator) DavResource(org.apache.jackrabbit.webdav.DavResource) HrefProperty(org.apache.jackrabbit.webdav.property.HrefProperty) VersionResource(org.apache.jackrabbit.webdav.version.VersionResource) VersionControlledResource(org.apache.jackrabbit.webdav.version.VersionControlledResource) DavResourceLocator(org.apache.jackrabbit.webdav.DavResourceLocator)

Example 2 with VersionControlledResource

use of org.apache.jackrabbit.webdav.version.VersionControlledResource in project jackrabbit by apache.

the class AbstractWebdavServlet method doUpdate.

/**
     * The UPDATE method
     *
     * @param request
     * @param response
     * @param resource
     * @throws DavException
     * @throws IOException
     */
protected void doUpdate(WebdavRequest request, WebdavResponse response, DavResource resource) throws DavException, IOException {
    if (!(resource instanceof VersionControlledResource)) {
        response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
        return;
    }
    UpdateInfo info = request.getUpdateInfo();
    MultiStatus ms = ((VersionControlledResource) resource).update(info);
    response.sendMultiStatus(ms);
}
Also used : MultiStatus(org.apache.jackrabbit.webdav.MultiStatus) VersionControlledResource(org.apache.jackrabbit.webdav.version.VersionControlledResource) UpdateInfo(org.apache.jackrabbit.webdav.version.UpdateInfo)

Example 3 with VersionControlledResource

use of org.apache.jackrabbit.webdav.version.VersionControlledResource in project jackrabbit by apache.

the class AbstractWebdavServlet method doMerge.

/**
     * The MERGE method
     *
     * @param request
     * @param response
     * @param resource
     * @throws DavException
     * @throws IOException
     */
protected void doMerge(WebdavRequest request, WebdavResponse response, DavResource resource) throws DavException, IOException {
    if (!(resource instanceof VersionControlledResource)) {
        response.sendError(DavServletResponse.SC_METHOD_NOT_ALLOWED);
        return;
    }
    MergeInfo info = request.getMergeInfo();
    MultiStatus ms = ((VersionControlledResource) resource).merge(info);
    response.sendMultiStatus(ms);
}
Also used : MergeInfo(org.apache.jackrabbit.webdav.version.MergeInfo) MultiStatus(org.apache.jackrabbit.webdav.MultiStatus) VersionControlledResource(org.apache.jackrabbit.webdav.version.VersionControlledResource)

Aggregations

VersionControlledResource (org.apache.jackrabbit.webdav.version.VersionControlledResource)3 MultiStatus (org.apache.jackrabbit.webdav.MultiStatus)2 DavResource (org.apache.jackrabbit.webdav.DavResource)1 DavResourceIterator (org.apache.jackrabbit.webdav.DavResourceIterator)1 DavResourceLocator (org.apache.jackrabbit.webdav.DavResourceLocator)1 HrefProperty (org.apache.jackrabbit.webdav.property.HrefProperty)1 MergeInfo (org.apache.jackrabbit.webdav.version.MergeInfo)1 UpdateInfo (org.apache.jackrabbit.webdav.version.UpdateInfo)1 VersionResource (org.apache.jackrabbit.webdav.version.VersionResource)1