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.LayoutBranch;
021 import com.liferay.portal.model.RecentLayoutBranch;
022 import com.liferay.portal.service.base.RecentLayoutBranchLocalServiceBaseImpl;
023
024
028 @ProviderType
029 public class RecentLayoutBranchLocalServiceImpl
030 extends RecentLayoutBranchLocalServiceBaseImpl {
031
032 @Override
033 public RecentLayoutBranch addRecentLayoutBranch(
034 long userId, long layoutBranchId, long layoutSetBranchId, long plid)
035 throws PortalException {
036
037 LayoutBranch layoutBranch = layoutBranchPersistence.findByPrimaryKey(
038 layoutBranchId);
039
040 RecentLayoutBranch recentLayoutBranch =
041 recentLayoutBranchPersistence.create(
042 counterLocalService.increment());
043
044 recentLayoutBranch.setGroupId(layoutBranch.getGroupId());
045 recentLayoutBranch.setCompanyId(layoutBranch.getCompanyId());
046 recentLayoutBranch.setUserId(userId);
047 recentLayoutBranch.setLayoutBranchId(layoutBranchId);
048 recentLayoutBranch.setLayoutSetBranchId(layoutSetBranchId);
049 recentLayoutBranch.setPlid(plid);
050
051 return recentLayoutBranchPersistence.update(recentLayoutBranch);
052 }
053
054 @Override
055 public void deleteRecentLayoutBranches(long layoutBranchId) {
056 recentLayoutBranchPersistence.removeByLayoutBranchId(layoutBranchId);
057 }
058
059 @Override
060 public void deleteUserRecentLayoutBranches(long userId) {
061 recentLayoutBranchPersistence.removeByUserId(userId);
062 }
063
064 @Override
065 public RecentLayoutBranch fetchRecentLayoutBranch(
066 long userId, long layoutSetBranchId, long plid) {
067
068 return recentLayoutBranchPersistence.fetchByU_L_P(
069 userId, layoutSetBranchId, plid);
070 }
071
072 }