Example usage for com.liferay.portal.kernel.webdav Resource getLock

List of usage examples for com.liferay.portal.kernel.webdav Resource getLock

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.webdav Resource getLock.

Prototype

public Lock getLock();

Source Link

Usage

From source file:it.smc.calendar.sync.caldav.methods.ProppatchMethodImpl.java

License:Open Source License

protected WebDAVProps getStoredProperties(WebDAVRequest webDAVRequest) throws PortalException, SystemException {

    WebDAVStorage storage = webDAVRequest.getWebDAVStorage();

    Resource resource = storage.getResource(webDAVRequest);

    WebDAVProps webDavProps = null;/*from  w  w w . j a v  a 2s .  c  o  m*/

    if (resource.getPrimaryKey() <= 0) {
        if (_log.isWarnEnabled()) {
            _log.warn("There is no primary key set for resource");
        }

        throw new InvalidRequestException();
    } else if (resource.isLocked()) {
        Lock lock = resource.getLock();

        if ((lock == null) || !lock.getUuid().equals(webDAVRequest.getLockUuid())) {

            throw new LockException();
        }
    }

    webDavProps = WebDAVPropsLocalServiceUtil.getWebDAVProps(webDAVRequest.getCompanyId(),
            resource.getClassName(), resource.getPrimaryKey());

    return webDavProps;
}