use of com.liferay.portal.kernel.repository.model.Folder in project liferay-ide by liferay.
the class SongLocalServiceImpl method deleteSong.
@Indexable(type = IndexableType.DELETE)
public Song deleteSong(long songId) throws PortalException, SystemException {
Song song = songPersistence.findByPrimaryKey(songId);
Repository repository = PortletFileRepositoryUtil.fetchPortletRepository(song.getGroupId(), Constants.JUKEBOX_PORTLET_REPOSITORY);
if (repository != null) {
try {
Folder folder = PortletFileRepositoryUtil.getPortletFolder(0, repository.getRepositoryId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, String.valueOf(songId), null);
PortletFileRepositoryUtil.deleteFolder(folder.getFolderId());
} catch (Exception e) {
}
}
return songPersistence.remove(songId);
}
use of com.liferay.portal.kernel.repository.model.Folder in project liferay-ide by liferay.
the class LiferayAlbumService method doGetAlbum.
protected Album doGetAlbum(UserId userId, String appId, Set<String> fields, String albumId, SecurityToken securityToken) throws Exception {
long albumIdLong = GetterUtil.getLong(albumId);
Folder folder = DLAppServiceUtil.getFolder(albumIdLong);
return toAlbum(folder, fields, securityToken);
}
use of com.liferay.portal.kernel.repository.model.Folder in project liferay-ide by liferay.
the class EditorPortlet method serveAddFileEntry.
protected void serveAddFileEntry(ResourceRequest resourceRequest, ResourceResponse resourceResponse) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) resourceRequest.getAttribute(WebKeys.THEME_DISPLAY);
long folderId = ParamUtil.getLong(resourceRequest, "folderId");
Folder folder = DLAppServiceUtil.getFolder(folderId);
String fileEntryTitle = ParamUtil.getString(resourceRequest, "fileEntryTitle");
String content = ParamUtil.getString(resourceRequest, "content");
byte[] bytes = content.getBytes(StringPool.UTF8);
ServiceContext serviceContext = ServiceContextFactory.getInstance(resourceRequest);
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
serviceContext.setAttribute("sourceFileName", fileEntryTitle);
serviceContext.setScopeGroupId(folder.getGroupId());
JSONObject jsonObject = JSONFactoryUtil.createJSONObject();
FileEntry fileEntry = DLAppServiceUtil.addFileEntry(folder.getRepositoryId(), folderId, fileEntryTitle, resourceRequest.getContentType(), fileEntryTitle, StringPool.BLANK, StringPool.BLANK, bytes, serviceContext);
jsonObject.put("fileEntryId", fileEntry.getFileEntryId());
String portalURL = PortalUtil.getPortalURL(themeDisplay);
String fileEntryURL = ShindigUtil.getFileEntryURL(portalURL, fileEntry.getFileEntryId());
jsonObject.put("fileEntryURL", fileEntryURL);
writeJSON(resourceRequest, resourceResponse, jsonObject);
}
use of com.liferay.portal.kernel.repository.model.Folder in project liferay-ide by liferay.
the class ShindigUtil method getGadgetEditorRootFolder.
public static Folder getGadgetEditorRootFolder(long repositoryId) throws Exception {
Folder folder = null;
try {
folder = DLAppServiceUtil.getFolder(repositoryId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, _GADGET_EDITOR_ROOT_FOLDER_NAME);
} catch (Exception e) {
}
if (folder == null) {
ServiceContext serviceContext = new ServiceContext();
serviceContext.setGroupPermissions(new String[] { ActionKeys.ADD_DOCUMENT, ActionKeys.DELETE, ActionKeys.UPDATE, ActionKeys.VIEW });
serviceContext.setGuestPermissions(new String[] { ActionKeys.VIEW });
serviceContext.setScopeGroupId(repositoryId);
folder = DLAppServiceUtil.addFolder(repositoryId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, _GADGET_EDITOR_ROOT_FOLDER_NAME, StringPool.BLANK, serviceContext);
}
return folder;
}
Aggregations