Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.bookmarks.service.impl;
import com.liferay.bookmarks.model.BookmarksFolder;
import com.liferay.bookmarks.service.base.BookmarksFolderServiceBaseImpl;
import com.liferay.portal.aop.AopService;
import com.liferay.portal.kernel.dao.orm.QueryDefinition;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.security.permission.ActionKeys;
import com.liferay.portal.kernel.security.permission.resource.ModelResourcePermission;
import com.liferay.portal.kernel.security.permission.resource.ModelResourcePermissionHelper;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.workflow.WorkflowConstants;
import java.util.ArrayList;
import java.util.List;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferencePolicy;
import org.osgi.service.component.annotations.ReferencePolicyOption;
/**
* @author Brian Wing Shun Chan
*/
@Component(
property = {
"json.web.service.context.name=bookmarks",
"json.web.service.context.path=BookmarksFolder"
},
service = AopService.class
)
public class BookmarksFolderServiceImpl extends BookmarksFolderServiceBaseImpl {
@Override
public BookmarksFolder addFolder(
long parentFolderId, String name, String description,
ServiceContext serviceContext)
throws PortalException {
ModelResourcePermissionHelper.check(
_bookmarksFolderModelResourcePermission, getPermissionChecker(),
serviceContext.getScopeGroupId(), parentFolderId,
ActionKeys.ADD_FOLDER);
return bookmarksFolderLocalService.addFolder(
getUserId(), parentFolderId, name, description, serviceContext);
}
@Override
public void deleteFolder(long folderId) throws PortalException {
_bookmarksFolderModelResourcePermission.check(
getPermissionChecker(),
bookmarksFolderLocalService.getFolder(folderId), ActionKeys.DELETE);
bookmarksFolderLocalService.deleteFolder(folderId);
}
@Override
public void deleteFolder(long folderId, boolean includeTrashedEntries)
throws PortalException {
_bookmarksFolderModelResourcePermission.check(
getPermissionChecker(),
bookmarksFolderLocalService.getFolder(folderId), ActionKeys.DELETE);
bookmarksFolderLocalService.deleteFolder(
folderId, includeTrashedEntries);
}
@Override
public BookmarksFolder getFolder(long folderId) throws PortalException {
BookmarksFolder folder = bookmarksFolderLocalService.getFolder(
folderId);
_bookmarksFolderModelResourcePermission.check(
getPermissionChecker(), folder, ActionKeys.VIEW);
return folder;
}
@Override
public List getFolderIds(long groupId, long folderId)
throws PortalException {
ModelResourcePermissionHelper.check(
_bookmarksFolderModelResourcePermission, getPermissionChecker(),
groupId, folderId, ActionKeys.VIEW);
List folderIds = getSubfolderIds(groupId, folderId, true);
folderIds.add(0, folderId);
return folderIds;
}
@Override
public List getFolders(long groupId) {
return bookmarksFolderPersistence.filterFindByGroupId(groupId);
}
@Override
public List getFolders(long groupId, long parentFolderId) {
return bookmarksFolderPersistence.filterFindByG_P_S(
groupId, parentFolderId, WorkflowConstants.STATUS_APPROVED);
}
@Override
public List getFolders(
long groupId, long parentFolderId, int start, int end) {
return getFolders(
groupId, parentFolderId, WorkflowConstants.STATUS_APPROVED, start,
end);
}
@Override
public List getFolders(
long groupId, long parentFolderId, int status, int start, int end) {
if (status == WorkflowConstants.STATUS_ANY) {
return bookmarksFolderPersistence.filterFindByG_P(
groupId, parentFolderId, start, end);
}
return bookmarksFolderPersistence.filterFindByG_P_S(
groupId, parentFolderId, status, start, end);
}
@Override
public List