Search in sources :

Example 1 with LabelInfo

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

the class RepositoryServiceImpl method removeVersionLabel.

@Override
public void removeVersionLabel(SessionInfo sessionInfo, NodeId versionHistoryId, NodeId versionId, Name label) throws RepositoryException {
    HttpLabel request = null;
    try {
        String uri = getItemUri(versionId, sessionInfo);
        String strLabel = getNamePathResolver(sessionInfo).getJCRName(label);
        request = new HttpLabel(uri, new LabelInfo(strLabel, LabelInfo.TYPE_REMOVE));
        initMethod(request, sessionInfo, !isUnLockMethod(request));
        HttpResponse response = executeRequest(sessionInfo, request);
        request.checkSuccess(response);
    } catch (IOException e) {
        throw new RepositoryException(e);
    } catch (DavException ex) {
        throw ExceptionConverter.generate(ex);
    } finally {
        request.releaseConnection();
    }
}
Also used : LabelInfo(org.apache.jackrabbit.webdav.version.LabelInfo) DavException(org.apache.jackrabbit.webdav.DavException) HttpLabel(org.apache.jackrabbit.webdav.client.methods.HttpLabel) HttpResponse(org.apache.http.HttpResponse) RepositoryException(javax.jcr.RepositoryException) IOException(java.io.IOException)

Example 2 with LabelInfo

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

the class RepositoryServiceImpl method addVersionLabel.

@Override
public void addVersionLabel(SessionInfo sessionInfo, NodeId versionHistoryId, NodeId versionId, Name label, boolean moveLabel) throws RepositoryException {
    HttpLabel request = null;
    try {
        String uri = getItemUri(versionId, sessionInfo);
        String strLabel = getNamePathResolver(sessionInfo).getJCRName(label);
        request = new HttpLabel(uri, new LabelInfo(strLabel, moveLabel ? LabelInfo.TYPE_SET : LabelInfo.TYPE_ADD));
        initMethod(request, sessionInfo, !isUnLockMethod(request));
        HttpResponse response = executeRequest(sessionInfo, request);
        request.checkSuccess(response);
    } catch (IOException e) {
        throw new RepositoryException(e);
    } catch (DavException ex) {
        throw ExceptionConverter.generate(ex);
    } finally {
        request.releaseConnection();
    }
}
Also used : LabelInfo(org.apache.jackrabbit.webdav.version.LabelInfo) DavException(org.apache.jackrabbit.webdav.DavException) HttpLabel(org.apache.jackrabbit.webdav.client.methods.HttpLabel) HttpResponse(org.apache.http.HttpResponse) RepositoryException(javax.jcr.RepositoryException) IOException(java.io.IOException)

Example 3 with LabelInfo

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

the class WebdavRequestImpl method getLabelInfo.

/**
     * @see org.apache.jackrabbit.webdav.version.DeltaVServletRequest#getLabelInfo()
     */
public LabelInfo getLabelInfo() throws DavException {
    LabelInfo lInfo = null;
    Document requestDocument = getRequestDocument();
    if (requestDocument != null) {
        Element root = requestDocument.getDocumentElement();
        int depth = getDepth(DEPTH_0);
        lInfo = new LabelInfo(root, depth);
    }
    return lInfo;
}
Also used : LabelInfo(org.apache.jackrabbit.webdav.version.LabelInfo) Element(org.w3c.dom.Element) Document(org.w3c.dom.Document)

Aggregations

LabelInfo (org.apache.jackrabbit.webdav.version.LabelInfo)3 IOException (java.io.IOException)2 RepositoryException (javax.jcr.RepositoryException)2 HttpResponse (org.apache.http.HttpResponse)2 DavException (org.apache.jackrabbit.webdav.DavException)2 HttpLabel (org.apache.jackrabbit.webdav.client.methods.HttpLabel)2 Document (org.w3c.dom.Document)1 Element (org.w3c.dom.Element)1