Search in sources :

Example 1 with HttpLabel

use of org.apache.jackrabbit.webdav.client.methods.HttpLabel 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 HttpLabel

use of org.apache.jackrabbit.webdav.client.methods.HttpLabel 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)

Aggregations

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 LabelInfo (org.apache.jackrabbit.webdav.version.LabelInfo)2