001
014
015 package com.liferay.portal.service.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.exception.PortalException;
020 import com.liferay.portal.model.LayoutRevision;
021 import com.liferay.portal.model.RecentLayoutRevision;
022 import com.liferay.portal.service.base.RecentLayoutRevisionLocalServiceBaseImpl;
023
024
028 @ProviderType
029 public class RecentLayoutRevisionLocalServiceImpl
030 extends RecentLayoutRevisionLocalServiceBaseImpl {
031
032 @Override
033 public RecentLayoutRevision addRecentLayoutRevision(
034 long userId, long layoutRevisionId, long layoutSetBranchId,
035 long plid)
036 throws PortalException {
037
038 LayoutRevision layoutRevision =
039 layoutRevisionPersistence.findByPrimaryKey(layoutRevisionId);
040
041 RecentLayoutRevision recentLayoutRevision =
042 recentLayoutRevisionPersistence.create(
043 counterLocalService.increment());
044
045 recentLayoutRevision.setGroupId(layoutRevision.getGroupId());
046 recentLayoutRevision.setCompanyId(layoutRevision.getCompanyId());
047 recentLayoutRevision.setUserId(userId);
048 recentLayoutRevision.setLayoutRevisionId(layoutRevisionId);
049 recentLayoutRevision.setLayoutSetBranchId(layoutSetBranchId);
050 recentLayoutRevision.setPlid(plid);
051
052 return recentLayoutRevisionPersistence.update(recentLayoutRevision);
053 }
054
055 @Override
056 public void deleteRecentLayoutRevisions(long layoutRevisionId) {
057 recentLayoutRevisionPersistence.removeByLayoutRevisionId(
058 layoutRevisionId);
059 }
060
061 @Override
062 public void deleteUserRecentLayoutRevisions(long userId) {
063 recentLayoutRevisionPersistence.removeByUserId(userId);
064 }
065
066 @Override
067 public RecentLayoutRevision fetchRecentLayoutRevision(
068 long userId, long layoutSetBranchId, long plid) {
069
070 return recentLayoutRevisionPersistence.fetchByU_L_P(
071 userId, layoutSetBranchId, plid);
072 }
073
074 }