本文整理汇总了Java中com.liferay.portal.kernel.service.ServiceContext.setAddGuestPermissions方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceContext.setAddGuestPermissions方法的具体用法?Java ServiceContext.setAddGuestPermissions怎么用?Java ServiceContext.setAddGuestPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.kernel.service.ServiceContext
的用法示例。
在下文中一共展示了ServiceContext.setAddGuestPermissions方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateFile
import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
public static FileEntry updateFile(long userId, long companyId, long groupId, long fileEntryId,
InputStream inputStream, String fileName, String fileType, long fileSize, String destination, String desc,
ServiceContext serviceContext) throws Exception {
FileEntry fileEntry = null;
if (inputStream != null && fileSize > 0 && Validator.isNotNull(fileName)) {
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
User user = UserLocalServiceUtil.getUser(serviceContext.getUserId());
PermissionChecker checker = PermissionCheckerFactoryUtil.create(user);
PermissionThreadLocal.setPermissionChecker(checker);
DLAppLocalServiceUtil.updateFileEntry(userId, fileEntryId, fileName, fileType,
System.currentTimeMillis() + StringPool.DASH + fileName, desc, StringPool.BLANK, true, inputStream,
fileSize, serviceContext);
}
return fileEntry;
}
示例2: _addJournalArticle
import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
private JournalArticle _addJournalArticle(
Long groupId, WebPageElementCreatorForm webPageElementCreatorForm) {
ServiceContext serviceContext = new ServiceContext();
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
serviceContext.setScopeGroupId(groupId);
Try<JournalArticle> journalArticleTry = Try.fromFallible(() ->
_journalArticleService.addArticle(
groupId, webPageElementCreatorForm.getFolder(), 0, 0, null,
true, webPageElementCreatorForm.getTitleMap(),
webPageElementCreatorForm.getDescriptionMap(),
webPageElementCreatorForm.getText(),
webPageElementCreatorForm.getStructure(),
webPageElementCreatorForm.getTemplate(), null,
webPageElementCreatorForm.getDisplayDateMonth(),
webPageElementCreatorForm.getDisplayDateDay(),
webPageElementCreatorForm.getDisplayDateYear(),
webPageElementCreatorForm.getDisplayDateHour(),
webPageElementCreatorForm.getDisplayDateMinute(), 0, 0, 0, 0, 0,
true, 0, 0, 0, 0, 0, true, true, null, serviceContext));
return journalArticleTry.getUnchecked();
}
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:27,代码来源:WebPageElementNestedCollectionResource.java
示例3: _updateJournalArticle
import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
private JournalArticle _updateJournalArticle(
Long journalArticleId,
WebPageElementUpdaterForm webPageElementUpdaterForm) {
ServiceContext serviceContext = new ServiceContext();
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
serviceContext.setScopeGroupId(webPageElementUpdaterForm.getGroup());
Try<JournalArticle> journalArticleTry = Try.fromFallible(() ->
_journalArticleService.updateArticle(
webPageElementUpdaterForm.getUser(),
webPageElementUpdaterForm.getGroup(),
webPageElementUpdaterForm.getFolder(),
String.valueOf(journalArticleId),
webPageElementUpdaterForm.getVersion(),
webPageElementUpdaterForm.getTitleMap(),
webPageElementUpdaterForm.getDescriptionMap(),
webPageElementUpdaterForm.getText(), null, serviceContext));
return journalArticleTry.getUnchecked();
}
开发者ID:liferay,项目名称:com-liferay-apio-architect,代码行数:24,代码来源:WebPageElementNestedCollectionResource.java
示例4: _addBlogsEntry
import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
private BlogsEntry _addBlogsEntry(
Long groupId, BlogPostingForm blogPostingForm) {
ServiceContext serviceContext = new ServiceContext();
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
serviceContext.setScopeGroupId(groupId);
Try<BlogsEntry> blogsEntryTry = Try.fromFallible(
() -> _blogsService.addEntry(
blogPostingForm.getHeadline(),
blogPostingForm.getAlternativeHeadline(),
blogPostingForm.getDescription(),
blogPostingForm.getArticleBody(),
blogPostingForm.getDisplayDateMonth(),
blogPostingForm.getDisplayDateDay(),
blogPostingForm.getDisplayDateYear(),
blogPostingForm.getDisplayDateHour(),
blogPostingForm.getDisplayDateMinute(), false, false, null,
null, null, null, serviceContext));
return blogsEntryTry.getUnchecked();
}
示例5: cloneFile
import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
public static FileEntry cloneFile(long userId, long groupId, long fileEntryId,
String destination, ServiceContext serviceContext)
throws Exception {
FileEntry fileEntry = DLAppLocalServiceUtil.getFileEntry(fileEntryId);
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
if(Validator.isNull(destination)) {
destination = StringPool.BLANK;
} else if(destination.indexOf(StringPool.SLASH) < 0) {
destination += StringPool.SLASH;
}
destination += calendar.get(Calendar.YEAR) + StringPool.SLASH;
destination += calendar.get(Calendar.MONTH) + StringPool.SLASH;
destination += calendar.get(Calendar.DAY_OF_MONTH);
DLFolder dlFolder = DLFolderUtil.getTargetFolder(userId, groupId, groupId, false, 0, destination,
StringPool.BLANK, false, serviceContext);
User user = UserLocalServiceUtil.getUser(serviceContext.getUserId());
PermissionChecker checker = PermissionCheckerFactoryUtil.create(user);
PermissionThreadLocal.setPermissionChecker(checker);
String title = getFileName(fileEntry.getTitle());
return DLAppLocalServiceUtil.addFileEntry(userId, groupId, dlFolder.getFolderId(), title,
fileEntry.getMimeType(), System.currentTimeMillis() + StringPool.DASH + title, title,
StringPool.BLANK, fileEntry.getContentStream(), fileEntry.getSize(), serviceContext);
}
示例6: _updateBlogsEntry
import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
private BlogsEntry _updateBlogsEntry(
Long blogsEntryId, BlogPostingForm blogPostingForm) {
ServiceContext serviceContext = new ServiceContext();
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
BlogsEntry blogsEntry = _getBlogsEntry(blogsEntryId);
serviceContext.setScopeGroupId(blogsEntry.getGroupId());
Try<BlogsEntry> blogsEntryTry = Try.fromFallible(
() -> _blogsService.updateEntry(
blogsEntryId, blogPostingForm.getHeadline(),
blogPostingForm.getAlternativeHeadline(),
blogPostingForm.getDescription(),
blogPostingForm.getArticleBody(),
blogPostingForm.getDisplayDateMonth(),
blogPostingForm.getDisplayDateDay(),
blogPostingForm.getDisplayDateYear(),
blogPostingForm.getDisplayDateHour(),
blogPostingForm.getDisplayDateMinute(), false, false, null,
null, null, null, serviceContext));
return blogsEntryTry.getUnchecked();
}
示例7: addServiceFileTemplate
import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
public ServiceFileTemplate addServiceFileTemplate(long serviceInfoId, String fileTemplateNo, String templateName, long fileEntryId,
ServiceContext serviceContext) throws PortalException, IOException {
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
ServiceFileTemplatePK fileTemplatePK = new ServiceFileTemplatePK(serviceInfoId, fileTemplateNo);
ServiceFileTemplate serviceFileTemplate = serviceFileTemplatePersistence.create(fileTemplatePK);
serviceFileTemplate.setTemplateName(templateName);
serviceFileTemplate.setFileEntryId(fileEntryId);
return serviceFileTemplatePersistence.update(serviceFileTemplate);
}
示例8: uploadFile
import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
/**
*
* @param userId
* @param groupId
* @param inputStream
* @param sourceFileName
* @param fileType
* @param fileSize
* @param destination
* @param serviceContext
* @return null if inputStream is null or sourceFileName is null
* @throws Exception
*/
public static FileEntry uploadFile(long userId, long groupId, long fileEntryId, InputStream inputStream, String sourceFileName,
String fileType, long fileSize, String destination, ServiceContext serviceContext)
throws Exception {
FileEntry fileEntry = null;
if (inputStream != null && Validator.isNotNull(sourceFileName)) {
if(Validator.isNull(fileType)) {
fileType = MimeTypesUtil.getContentType(sourceFileName);
}
if(fileSize == 0) {
fileSize = inputStream.available();
//byte[] bytes = FileUtil.getBytes(inputStream, -1, false);
//fileSize = bytes.length;
}
String title = getFileName(sourceFileName);
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
if(destination == null) {
destination = StringPool.BLANK;
}
destination += calendar.get(Calendar.YEAR) + StringPool.SLASH;
destination += calendar.get(Calendar.MONTH) + StringPool.SLASH;
destination += calendar.get(Calendar.DAY_OF_MONTH);
DLFolder dlFolder = DLFolderUtil.getTargetFolder(userId, groupId, groupId, false, 0, destination,
StringPool.BLANK, false, serviceContext);
User user = UserLocalServiceUtil.getUser(serviceContext.getUserId());
PermissionChecker checker = PermissionCheckerFactoryUtil.create(user);
PermissionThreadLocal.setPermissionChecker(checker);
if(fileEntryId > 0) {
fileEntry = DLAppLocalServiceUtil.updateFileEntry(userId, fileEntryId, sourceFileName,
fileType, title, title, title, true, inputStream, fileSize, serviceContext);
} else {
fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, groupId, dlFolder.getFolderId(), title,
fileType, title, title,
StringPool.BLANK, inputStream, fileSize, serviceContext);
}
}
return fileEntry;
}
示例9: uploadFile
import com.liferay.portal.kernel.service.ServiceContext; //导入方法依赖的package包/类
public static FileEntry uploadFile(long userId, long companyId, long groupId, InputStream inputStream,
String fileName, String fileType, long fileSize, String destination, String desc,
ServiceContext serviceContext) throws Exception {
FileEntry fileEntry = null;
if (inputStream != null && fileSize > 0 && Validator.isNotNull(fileName)) {
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
Calendar calendar = Calendar.getInstance();
calendar.setTime(new Date());
destination += calendar.get(Calendar.YEAR) + StringPool.SLASH;
destination += calendar.get(Calendar.MONTH) + StringPool.SLASH;
destination += calendar.get(Calendar.DAY_OF_MONTH);
DLFolder dlFolder = DLFolderUtil.getTargetFolder(userId, groupId, groupId, false, 0, destination, desc,
false, serviceContext);
User user = UserLocalServiceUtil.getUser(serviceContext.getUserId());
PermissionChecker checker = PermissionCheckerFactoryUtil.create(user);
PermissionThreadLocal.setPermissionChecker(checker);
fileEntry = DLAppLocalServiceUtil.addFileEntry(userId, groupId, dlFolder.getFolderId(), fileName, fileType,
System.currentTimeMillis() + StringPool.DASH + fileName, desc, StringPool.BLANK, inputStream,
fileSize, serviceContext);
}
return fileEntry;
}