List of usage examples for com.liferay.portal.kernel.webdav Resource getPrimaryKey
public long getPrimaryKey();
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 av a 2s .c om*/ 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; }
From source file:it.smc.calendar.sync.caldav.util.CalDAVUtil.java
License:Open Source License
public static String getResourceETag(Resource resource) { StagedModel model = (StagedModel) resource.getModel(); Date modifiedDate = model.getModifiedDate(); if (model instanceof Calendar) { Calendar calendar = (Calendar) model; try {/*from w ww.j a v a 2 s . com*/ modifiedDate = CalendarUtil.getLastCalendarModifiedDate(calendar.getCalendarId()); } catch (Exception e) { _log.error(e); } } return String.valueOf(resource.getPrimaryKey()) + StringPool.UNDERLINE + modifiedDate.getTime(); }