001
014
015 package com.liferay.portal.service.impl;
016
017 import com.liferay.portal.NoSuchWebDAVPropsException;
018 import com.liferay.portal.kernel.exception.PortalException;
019 import com.liferay.portal.kernel.exception.SystemException;
020 import com.liferay.portal.kernel.webdav.WebDAVException;
021 import com.liferay.portal.model.WebDAVProps;
022 import com.liferay.portal.service.base.WebDAVPropsLocalServiceBaseImpl;
023 import com.liferay.portal.util.PortalUtil;
024
025 import java.util.Date;
026
027
030 public class WebDAVPropsLocalServiceImpl
031 extends WebDAVPropsLocalServiceBaseImpl {
032
033 @Override
034 public void deleteWebDAVProps(String className, long classPK)
035 throws SystemException {
036
037 long classNameId = PortalUtil.getClassNameId(className);
038
039 try {
040 webDAVPropsPersistence.removeByC_C(classNameId, classPK);
041 }
042 catch (NoSuchWebDAVPropsException nswdavpe) {
043 }
044 }
045
046 @Override
047 public WebDAVProps getWebDAVProps(
048 long companyId, String className, long classPK)
049 throws SystemException {
050
051 long classNameId = PortalUtil.getClassNameId(className);
052
053 WebDAVProps webDavProps = webDAVPropsPersistence.fetchByC_C(
054 classNameId, classPK);
055
056 if (webDavProps == null) {
057 webDavProps = webDAVPropsPersistence.create(
058 counterLocalService.increment());
059
060 Date now = new Date();
061
062 webDavProps.setCompanyId(companyId);
063 webDavProps.setCreateDate(now);
064 webDavProps.setModifiedDate(now);
065 webDavProps.setClassNameId(classNameId);
066 webDavProps.setClassPK(classPK);
067
068 webDAVPropsLocalService.updateWebDAVProps(webDavProps);
069 }
070
071 return webDavProps;
072 }
073
074 @Override
075 public void storeWebDAVProps(WebDAVProps webDavProps)
076 throws PortalException, SystemException {
077
078 try {
079 webDavProps.store();
080 }
081 catch (Exception e) {
082 throw new WebDAVException("Problem trying to store WebDAVProps", e);
083 }
084
085 webDAVPropsPersistence.update(webDavProps);
086 }
087
088 }