本文整理汇总了Java中com.liferay.portlet.documentlibrary.model.DLFolderConstants类的典型用法代码示例。如果您正苦于以下问题:Java DLFolderConstants类的具体用法?Java DLFolderConstants怎么用?Java DLFolderConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DLFolderConstants类属于com.liferay.portlet.documentlibrary.model包,在下文中一共展示了DLFolderConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCustomImage
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
public FileEntry getCustomImage() {
Repository repository =
PortletFileRepositoryUtil.fetchPortletRepository(
getGroupId(), Constants.JUKEBOX_PORTLET_REPOSITORY);
if (repository == null) {
return null;
}
try {
return PortletFileRepositoryUtil.getPortletFileEntry(
repository.getRepositoryId(),
DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
String.valueOf(getAlbumId()));
}
catch (Exception e) {
return null;
}
}
示例2: getCustomImage
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
public FileEntry getCustomImage() {
Repository repository =
PortletFileRepositoryUtil.fetchPortletRepository(
getGroupId(), Constants.JUKEBOX_PORTLET_REPOSITORY);
if (repository == null) {
return null;
}
try {
return PortletFileRepositoryUtil.getPortletFileEntry(
repository.getRepositoryId(),
DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
String.valueOf(getArtistId()));
}
catch (Exception e) {
return null;
}
}
示例3: deleteAlbum
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
@Indexable(type = IndexableType.DELETE)
public Album deleteAlbum(long albumId) throws PortalException {
Album album = albumPersistence.findByPrimaryKey(albumId);
List<Song> songs = songLocalService.getSongsByAlbumId(albumId);
for (Song song : songs) {
songLocalService.deleteSong(song.getSongId());
}
try {
PortletFileRepositoryUtil.deletePortletFileEntry(
album.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
String.valueOf(albumId));
}
catch (Exception e) {
}
return albumPersistence.remove(albumId);
}
示例4: deleteSong
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
@Indexable(type = IndexableType.DELETE)
public Song deleteSong(long songId) throws PortalException {
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);
}
示例5: deleteArtist
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
@Indexable(type = IndexableType.DELETE)
public Artist deleteArtist(long artistId) throws PortalException {
Artist artist = artistPersistence.findByPrimaryKey(artistId);
List<Album> albums = albumLocalService.getAlbumsByArtistId(artistId);
for (Album album : albums) {
albumLocalService.deleteAlbum(album.getAlbumId());
}
try {
PortletFileRepositoryUtil.deletePortletFileEntry(
artist.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
String.valueOf(artistId));
}
catch (Exception e) {
}
return artistPersistence.remove(artistId);
}
示例6: addDLFileEntries
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
protected void addDLFileEntries(String fileEntriesDirName)
throws Exception {
Set<String> resourcePaths = servletContext.getResourcePaths(
resourcesDir.concat(fileEntriesDirName));
if (resourcePaths == null) {
return;
}
for (String resourcePath : resourcePaths) {
if (resourcePath.endsWith(StringPool.SLASH)) {
addDLFolder(
DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, resourcePath);
}
else {
addDLFileEntry(resourcePath);
}
}
}
示例7: addDLFileEntries
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
protected void addDLFileEntries(String fileEntriesDirName)
throws Exception {
File dlDocumentsDir = new File(_resourcesDir, fileEntriesDirName);
if (!dlDocumentsDir.isDirectory()|| !dlDocumentsDir.canRead()) {
return;
}
File[] files = dlDocumentsDir.listFiles();
if (ArrayUtil.isEmpty(files)) {
return;
}
for (File file : files) {
if (file.isDirectory()) {
addDLFolder(DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, file);
}
else {
addDLFileEntry(
DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, file);
}
}
}
示例8: addDLFileEntries
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
protected void addDLFileEntries(String dirName) throws Exception {
Set<String> resourcePaths = servletContext.getResourcePaths(
resourcesDir.concat(dirName));
if (resourcePaths == null) {
return;
}
for (String resourcePath : resourcePaths) {
if (resourcePath.endsWith(StringPool.SLASH)) {
addDLFolder(
DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, resourcePath);
}
else {
addDLFileEntry(resourcePath);
}
}
}
示例9: addDLFileEntries
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
protected void addDLFileEntries(String dirName) throws Exception {
File dir = new File(_resourcesDir, dirName);
if (!dir.isDirectory()|| !dir.canRead()) {
return;
}
File[] files = dir.listFiles();
if (ArrayUtil.isEmpty(files)) {
return;
}
for (File file : files) {
if (file.isDirectory()) {
addDLFolder(DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, file);
}
else {
addDLFileEntry(
DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, file);
}
}
}
示例10: getCustomImage
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
public FileEntry getCustomImage() throws SystemException {
Repository repository =
PortletFileRepositoryUtil.fetchPortletRepository(
getGroupId(), Constants.JUKEBOX_PORTLET_REPOSITORY);
if (repository == null) {
return null;
}
try {
return PortletFileRepositoryUtil.getPortletFileEntry(
repository.getRepositoryId(),
DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
String.valueOf(getAlbumId()));
}
catch (Exception e) {
return null;
}
}
示例11: getCustomImage
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
public FileEntry getCustomImage() throws SystemException {
Repository repository =
PortletFileRepositoryUtil.fetchPortletRepository(
getGroupId(), Constants.JUKEBOX_PORTLET_REPOSITORY);
if (repository == null) {
return null;
}
try {
return PortletFileRepositoryUtil.getPortletFileEntry(
repository.getRepositoryId(),
DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
String.valueOf(getArtistId()));
}
catch (Exception e) {
return null;
}
}
示例12: deleteAlbum
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
@Indexable(type = IndexableType.DELETE)
public Album deleteAlbum(long albumId)
throws PortalException, SystemException {
Album album = albumPersistence.findByPrimaryKey(albumId);
List<Song> songs = songLocalService.getSongsByAlbumId(albumId);
for (Song song : songs) {
songLocalService.deleteSong(song.getSongId());
}
try {
PortletFileRepositoryUtil.deletePortletFileEntry(
album.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
String.valueOf(albumId));
}
catch (Exception e) {
}
return albumPersistence.remove(albumId);
}
示例13: deleteSong
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
@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);
}
示例14: deleteArtist
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
@Indexable(type = IndexableType.DELETE)
public Artist deleteArtist(long artistId)
throws PortalException, SystemException {
Artist artist = artistPersistence.findByPrimaryKey(artistId);
List<Album> albums = albumLocalService.getAlbumsByArtistId(artistId);
for (Album album : albums) {
albumLocalService.deleteAlbum(album.getAlbumId());
}
try {
PortletFileRepositoryUtil.deletePortletFileEntry(
artist.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,
String.valueOf(artistId));
}
catch (Exception e) {
}
return artistPersistence.remove(artistId);
}
示例15: importQuestionAnswers
import com.liferay.portlet.documentlibrary.model.DLFolderConstants; //导入依赖的package包/类
@Override
public void importQuestionAnswers(PortletDataContext context, Element entryElement, long questionId, long userId, ServiceContext serviceContext) throws SystemException, PortalException{
for(Element aElement:entryElement.elements("questionanswer")){
String patha = aElement.attributeValue("path");
TestAnswer oldanswer=(TestAnswer)context.getZipEntryAsObject(patha);
TestAnswer answer = TestAnswerLocalServiceUtil.addTestAnswer(questionId, oldanswer.getAnswer(), oldanswer.getFeedbackCorrect(), oldanswer.getFeedbacknocorrect(), oldanswer.isIsCorrect());
//Si tenemos ficheros en las descripciones de las respuestas.
for (Element actElementFile : aElement.elements("descriptionfile")) {
FileEntry oldFile = (FileEntry)context.getZipEntryAsObject(actElementFile.attributeValue("path"));
ModuleDataHandlerImpl m = new ModuleDataHandlerImpl();
FileEntry newFile;
long folderId=0;
String description = "";
try {
InputStream input = context.getZipEntryAsInputStream(actElementFile.attributeValue("file"));
long repositoryId = DLFolderConstants.getDataRepositoryId(context.getScopeGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);
folderId = DLFolderUtil.createDLFoldersForLearningActivity(userId,repositoryId,serviceContext).getFolderId();
newFile = DLAppLocalServiceUtil.addFileEntry(userId, repositoryId , folderId , oldFile.getTitle(), "contentType", oldFile.getTitle(), StringPool.BLANK, StringPool.BLANK, IOUtils.toByteArray(input), serviceContext );
description = ImportUtil.descriptionFileParserLarToDescription(answer.getAnswer(), oldFile, newFile);
} catch(DuplicateFileException dfl){
FileEntry existingFile = DLAppLocalServiceUtil.getFileEntry(context.getScopeGroupId(), folderId, oldFile.getTitle());
description = ImportUtil.descriptionFileParserLarToDescription(answer.getAnswer(), oldFile, existingFile);
} catch (Exception e) {
e.printStackTrace();
}
answer.setAnswer(description);
TestAnswerLocalServiceUtil.updateTestAnswer(answer);
}
}
}