当前位置: 首页>>代码示例>>Java>>正文


Java Folder.getFolderId方法代码示例

本文整理汇总了Java中com.liferay.portal.kernel.repository.model.Folder.getFolderId方法的典型用法代码示例。如果您正苦于以下问题:Java Folder.getFolderId方法的具体用法?Java Folder.getFolderId怎么用?Java Folder.getFolderId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liferay.portal.kernel.repository.model.Folder的用法示例。


在下文中一共展示了Folder.getFolderId方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findFolder

import com.liferay.portal.kernel.repository.model.Folder; //导入方法依赖的package包/类
public static Folder findFolder(final long company, final long groupId, final long repoId,
                                final long userId, final String name, final boolean createIfNotExists) {
    String[] folderPath = name.split("/");
    Folder foundFolder = null;
    int count = 0;
    Long parentId = 0L;
    while (count < folderPath.length) {
        String folder = folderPath[count];
        if (!folder.equals("")) {
            foundFolder = findFolder(groupId, parentId, folder);

            if (foundFolder == null && createIfNotExists) {
                foundFolder = createDocumentFolder(company, groupId, repoId, userId, parentId,
                        folder);
                SetupPermissions.updatePermission(
                        "Folder " + name + ", creating folder " + "segment " + folder, groupId,
                        company, foundFolder.getFolderId(), JournalFolder.class, null,
                        SetupWebFolders.DEFAULT_PERMISSIONS);
            }

            if (foundFolder == null) {
                break;
            }
            parentId = foundFolder.getFolderId();
        }
        count++;
    }
    return foundFolder;
}
 
开发者ID:mimacom,项目名称:liferay-db-setup-core,代码行数:30,代码来源:FolderUtil.java

示例2: createDLFolders

import com.liferay.portal.kernel.repository.model.Folder; //导入方法依赖的package包/类
private long createDLFolders(Long userId,Long repositoryId,PortletRequest portletRequest,long actId) throws PortalException, SystemException{
	//Variables for folder ids
	Long dlMainFolderId = 0L;
	//Search for folder in Document Library
       boolean dlMainFolderFound = false;
       //Get main folder
       try {
       	//Get main folder
       	Folder dlFolderMain = DLAppLocalServiceUtil.getFolder(repositoryId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,DOCUMENTLIBRARY_MAINFOLDER+actId);
       	dlMainFolderId = dlFolderMain.getFolderId();
       	dlMainFolderFound = true;
       	//Get portlet folder
       } catch (Exception ex){
       }
       
	ServiceContext serviceContext= ServiceContextFactory.getInstance( DLFolder.class.getName(), portletRequest);
	//Damos permisos al archivo para usuarios de comunidad.
	serviceContext.setAddGroupPermissions(true);
       
       //Create main folder if not exist
       if(!dlMainFolderFound){
       	Folder newDocumentMainFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, DOCUMENTLIBRARY_MAINFOLDER+actId, DOCUMENTLIBRARY_MAINFOLDER+actId, serviceContext);
       	dlMainFolderFound = true;
       	dlMainFolderId = newDocumentMainFolder.getFolderId();
       }
       //Create portlet folder if not exist
       return dlMainFolderId;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:29,代码来源:ResourceExternalLearningActivityType.java

示例3: createDLFolders

import com.liferay.portal.kernel.repository.model.Folder; //导入方法依赖的package包/类
private long createDLFolders(Long userId,Long repositoryId,PortletRequest portletRequest) throws PortalException, SystemException{
	//Variables for folder ids
	Long dlMainFolderId = 0L;
	//Search for folder in Document Library
       boolean dlMainFolderFound = false;
       //Get main folder
       try {
       	//Get main folder
       	Folder dlFolderMain = DLAppLocalServiceUtil.getFolder(repositoryId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,DOCUMENTLIBRARY_MAINFOLDER);
       	dlMainFolderId = dlFolderMain.getFolderId();
       	dlMainFolderFound = true;
       	//Get portlet folder
       } catch (Exception ex){
       }
       
	ServiceContext serviceContext= ServiceContextFactory.getInstance( DLFolder.class.getName(), portletRequest);
	//Damos permisos al archivo para usuarios de comunidad.
	serviceContext.setAddGroupPermissions(true);
       
       //Create main folder if not exist
       if(!dlMainFolderFound){
       	Folder newDocumentMainFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, DOCUMENTLIBRARY_MAINFOLDER, DOCUMENTLIBRARY_MAINFOLDER, serviceContext);
       	dlMainFolderFound = true;
       	dlMainFolderId = newDocumentMainFolder.getFolderId();
       }
       //Create portlet folder if not exist
    
 
       return dlMainFolderId;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:31,代码来源:ResourceInternalActivity.java

示例4: setupSiteDocuments

import com.liferay.portal.kernel.repository.model.Folder; //导入方法依赖的package包/类
public static void setupSiteDocuments(final Site site,
                                      final long groupId, final long company) {
    for (Document doc : site.getDocument()) {
        String folderPath = doc.getDocumentFolderName();
        String documentName = doc.getDocumentFilename();
        String documentTitle = doc.getDocumentTitle();
        String extension = doc.getExtension();
        String filenameInFilesystem = doc.getFileSystemName();
        long repoId = groupId;
        long userId = LiferaySetup.getRunAsUserId();
        Long folderId = 0L;
        Folder f = null;
        if (folderPath != null && !folderPath.equals("")) {
            f = FolderUtil.findFolder(company, groupId, repoId, userId, folderPath, true);
            folderId = f.getFolderId();
        }
        FileEntry fe = DocumentUtil.findDocument(documentName, folderPath, groupId, company,
                groupId, userId);
        byte[] fileBytes = null;
        try {
            fileBytes = ResourcesUtil.getFileBytes(filenameInFilesystem);
        } catch (IOException e) {
            LOG.error("Can not read file: " + filenameInFilesystem + ". Skipping file");
            continue;
        }
        if (fileBytes != null) {
            if (fe == null) {
                fe = DocumentUtil.createDocument(company, groupId, folderId, documentName,
                        documentTitle, userId, repoId, fileBytes);
                LOG.info(documentName + " is not found! It will be created! ");
            } else {
                LOG.info(documentName + " is found! Content will be updated! ");
                DocumentUtil.updateFile(fe, fileBytes, userId,
                        documentName);
            }
            SetupPermissions.updatePermission("Document " + folderPath + "/" + documentName,
                    groupId, company, fe.getFileEntryId(), DLFileEntry.class,
                    doc.getRolePermissions(), DEFAULT_PERMISSIONS);
        }
    }
}
 
开发者ID:mimacom,项目名称:liferay-db-setup-core,代码行数:42,代码来源:SetupDocuments.java

示例5: createIGFolders

import com.liferay.portal.kernel.repository.model.Folder; //导入方法依赖的package包/类
/**
 * Create folders for upload images from our portlet to ImageGallery portlet
 * @param request
 * @param userId
 * @param groupId
 * @param serviceContext
 * @return
 * @throws PortalException
 * @throws SystemException
 */
private void createIGFolders(ActionRequest request,Long userId,Long repositoryId, ServiceContext serviceContext) throws PortalException, SystemException{
	//Variables for folder ids
	Long igMainFolderId = 0L;
	Long igPortletFolderId = 0L;
	Long igRecordFolderId = 0L;
       //Search for folders
       boolean igMainFolderFound = false;
       boolean igPortletFolderFound = false;
       try {
       	//Get the main folder
       	Folder igMainFolder = DLAppLocalServiceUtil.getFolder(repositoryId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,IMAGEGALLERY_MAINFOLDER);
       	igMainFolderId = igMainFolder.getFolderId();
       	igMainFolderFound = true;
       	//Get the portlet folder
       	Folder igPortletFolder = DLAppLocalServiceUtil.getFolder(repositoryId,igMainFolderId,IMAGEGALLERY_PORTLETFOLDER);
       	igPortletFolderId = igPortletFolder.getFolderId();
       	igPortletFolderFound = true;
       } catch (Exception ex) {
       	//Not found main folder
       }
       //Create main folder if not exist
       if(!igMainFolderFound) {
       	Folder newImageMainFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, IMAGEGALLERY_MAINFOLDER, IMAGEGALLERY_MAINFOLDER_DESCRIPTION, serviceContext);
       	igMainFolderId = newImageMainFolder.getFolderId();
       	igMainFolderFound = true;
       }
       //Create portlet folder if not exist
       if(igMainFolderFound && !igPortletFolderFound){
       	Folder newImagePortletFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, igMainFolderId, IMAGEGALLERY_PORTLETFOLDER, IMAGEGALLERY_PORTLETFOLDER_DESCRIPTION, serviceContext);
       	igPortletFolderFound = true;
       	igPortletFolderId = newImagePortletFolder.getFolderId();
       }
       //Create this record folder
       if(igPortletFolderFound){
       	SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
       	Date date = new Date();
       	String igRecordFolderName=dateFormat.format(date)+SEPARATOR+userId;
       	Folder newImageRecordFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, igPortletFolderId,igRecordFolderName, "", serviceContext);
       	igRecordFolderId = newImageRecordFolder.getFolderId();
       }
       igFolderId = igRecordFolderId;
     }
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:53,代码来源:moduleUpload.java

示例6: createIGFolders

import com.liferay.portal.kernel.repository.model.Folder; //导入方法依赖的package包/类
private long createIGFolders(PortletRequest request,long userId,long repositoryId) throws PortalException, SystemException{
//Variables for folder ids
Long igMainFolderId = 0L;
Long igPortletFolderId = 0L;
Long igRecordFolderId = 0L;
   //Search for folders
   boolean igMainFolderFound = false;
   boolean igPortletFolderFound = false;
   try {
   	//Get the main folder
   	Folder igMainFolder = DLAppLocalServiceUtil.getFolder(repositoryId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,IMAGEGALLERY_MAINFOLDER);
   	igMainFolderId = igMainFolder.getFolderId();
   	igMainFolderFound = true;
   	//Get the portlet folder
   	DLFolder igPortletFolder = DLFolderLocalServiceUtil.getFolder(repositoryId,igMainFolderId,IMAGEGALLERY_PORTLETFOLDER);
   	igPortletFolderId = igPortletFolder.getFolderId();
   	igPortletFolderFound = true;
   } catch (Exception ex) {
   }
   
ServiceContext serviceContext= ServiceContextFactory.getInstance( DLFolder.class.getName(), request);
//Damos permisos al archivo para usuarios de comunidad.
serviceContext.setAddGroupPermissions(true);
serviceContext.setAddGuestPermissions(true);
   //Create main folder if not exist
   if(!igMainFolderFound) {
   	Folder newImageMainFolder=DLAppLocalServiceUtil.addFolder(userId, repositoryId, 0, IMAGEGALLERY_MAINFOLDER, IMAGEGALLERY_MAINFOLDER_DESCRIPTION, serviceContext);
   	igMainFolderId = newImageMainFolder.getFolderId();
   	igMainFolderFound = true;
   }
   //Create portlet folder if not exist
   if(igMainFolderFound && !igPortletFolderFound){
   	Folder newImagePortletFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, igMainFolderId, IMAGEGALLERY_PORTLETFOLDER, IMAGEGALLERY_PORTLETFOLDER_DESCRIPTION, serviceContext);	    	
   	igPortletFolderFound = true;
   	igPortletFolderId = newImagePortletFolder.getFolderId();
   }
   //Create this record folder
   if(igPortletFolderFound){
   	SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
   	Date date = new Date();
   	String igRecordFolderName=dateFormat.format(date)+StringPool.UNDERLINE+userId;
   	Folder newImageRecordFolder = DLAppLocalServiceUtil.addFolder(userId,repositoryId, igPortletFolderId,igRecordFolderName, igRecordFolderName, serviceContext);
   	igRecordFolderId = newImageRecordFolder.getFolderId();
   }
   return igRecordFolderId;
 }
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:47,代码来源:BaseCourseAdminPortlet.java

示例7: createIGFolders

import com.liferay.portal.kernel.repository.model.Folder; //导入方法依赖的package包/类
private long createIGFolders(PortletRequest request,long userId,long repositoryId) throws PortalException, SystemException{
	//Variables for folder ids
	Long igMainFolderId = 0L;
	Long igPortletFolderId = 0L;
	Long igRecordFolderId = 0L;
	//Search for folders
	boolean igMainFolderFound = false;
	boolean igPortletFolderFound = false;
	try {
		//Get the main folder
		Folder igMainFolder = DLAppLocalServiceUtil.getFolder(repositoryId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,IMAGEGALLERY_MAINFOLDER);
		igMainFolderId = igMainFolder.getFolderId();
		igMainFolderFound = true;
		//Get the portlet folder
		DLFolder igPortletFolder = DLFolderLocalServiceUtil.getFolder(repositoryId,igMainFolderId,IMAGEGALLERY_PORTLETFOLDER);
		igPortletFolderId = igPortletFolder.getFolderId();
		igPortletFolderFound = true;
	} catch (Exception ex) {
	}

	ServiceContext serviceContext= ServiceContextFactory.getInstance( DLFolder.class.getName(), request);
	//Damos permisos al archivo para usuarios de comunidad.
	serviceContext.setAddGroupPermissions(true);
	serviceContext.setAddGuestPermissions(true);

	//Create main folder if not exist
	if(!igMainFolderFound) {
		Folder newImageMainFolder=DLAppLocalServiceUtil.addFolder(userId, repositoryId, 0, IMAGEGALLERY_MAINFOLDER, IMAGEGALLERY_MAINFOLDER_DESCRIPTION, serviceContext);
		igMainFolderId = newImageMainFolder.getFolderId();
		igMainFolderFound = true;
	}
	//Create portlet folder if not exist
	if(igMainFolderFound && !igPortletFolderFound){
		Folder newImagePortletFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, igMainFolderId, IMAGEGALLERY_PORTLETFOLDER, IMAGEGALLERY_PORTLETFOLDER_DESCRIPTION, serviceContext);	    	
		igPortletFolderFound = true;
		igPortletFolderId = newImagePortletFolder.getFolderId();
	}
	//Create this record folder
	if(igPortletFolderFound){
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
		Date date = new Date();
		String igRecordFolderName=dateFormat.format(date)+SEPARATOR+userId;
		Folder newImageRecordFolder = DLAppLocalServiceUtil.addFolder(userId,repositoryId, igPortletFolderId,igRecordFolderName, igRecordFolderName, serviceContext);
		igRecordFolderId = newImageRecordFolder.getFolderId();
	}
	return igRecordFolderId;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:48,代码来源:modulePortlet.java

示例8: createDLFolders

import com.liferay.portal.kernel.repository.model.Folder; //导入方法依赖的package包/类
private long createDLFolders(Long userId,Long repositoryId,PortletRequest portletRequest) throws PortalException, SystemException{
	//Variables for folder ids
	Long dlMainFolderId = 0L;
	Long dlPortletFolderId = 0L;
	Long dlRecordFolderId = 0L;
	//Search for folder in Document Library
	boolean dlMainFolderFound = false;
	boolean dlPortletFolderFound = false;
	//Get main folder
	try {
		//Get main folder
		Folder folderMain = DLAppLocalServiceUtil.getFolder(repositoryId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,moduleUpload.DOCUMENTLIBRARY_MAINFOLDER);
		dlMainFolderId = folderMain.getFolderId();
		dlMainFolderFound = true;
		//Get portlet folder
		Folder dlFolderPortlet = DLAppLocalServiceUtil.getFolder(repositoryId,dlMainFolderId,moduleUpload.DOCUMENTLIBRARY_PORTLETFOLDER);
		dlPortletFolderId = dlFolderPortlet.getFolderId();
		dlPortletFolderFound = true;
	} catch (Exception ex){
	}

	ServiceContext serviceContext= ServiceContextFactory.getInstance( DLFolder.class.getName(), portletRequest);
	//Damos permisos al archivo para usuarios de comunidad.
	serviceContext.setAddGroupPermissions(true);

	//Create main folder if not exist
	if(!dlMainFolderFound){
		Folder newDocumentMainFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, moduleUpload.DOCUMENTLIBRARY_MAINFOLDER, moduleUpload.DOCUMENTLIBRARY_MAINFOLDER_DESCRIPTION, serviceContext);
		//DLFolderLocalServiceUtil.addFolderResources(newDocumentMainFolder, true, false);
		dlMainFolderId = newDocumentMainFolder.getFolderId();
		dlMainFolderFound = true;
	}
	//Create portlet folder if not exist
	if(dlMainFolderFound && !dlPortletFolderFound){
		Folder newDocumentPortletFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, dlMainFolderId , moduleUpload.DOCUMENTLIBRARY_PORTLETFOLDER, moduleUpload.DOCUMENTLIBRARY_PORTLETFOLDER_DESCRIPTION, serviceContext);
		//DLFolderLocalServiceUtil.addFolderResources(newDocumentPortletFolder, true, false);
		dlPortletFolderFound = true;
		dlPortletFolderId = newDocumentPortletFolder.getFolderId();
	}

	//Create this record folder
	if(dlPortletFolderFound){
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
		Date date = new Date();
		String dlRecordFolderName = dateFormat.format(date)+moduleUpload.SEPARATOR+userId;
		Folder newDocumentRecordFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, dlPortletFolderId, dlRecordFolderName, dlRecordFolderName, serviceContext);
		//DLFolderLocalServiceUtil.addFolderResources(newDocumentRecordFolder, true, false);
		dlRecordFolderId = newDocumentRecordFolder.getFolderId();
	}
	return dlRecordFolderId;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:52,代码来源:OnlineActivity.java

示例9: createDLFoldersP2P

import com.liferay.portal.kernel.repository.model.Folder; //导入方法依赖的package包/类
public static long createDLFoldersP2P(Long userId,Long repositoryId,PortletRequest portletRequest) throws PortalException, SystemException{
	//Variables for folder ids
	Long dlMainFolderId = 0L;
	Long dlPortletFolderId = 0L;
	Long dlRecordFolderId = 0L;
	//Search for folder in Document Library
       boolean dlMainFolderFound = false;
       boolean dlPortletFolderFound = false;
       
       Folder dlFolderMain = null;
       //Get main folder
       try {
       	//Get main folder
       	dlFolderMain = DLAppLocalServiceUtil.getFolder(repositoryId,DLFolderConstants.DEFAULT_PARENT_FOLDER_ID,moduleUpload.DOCUMENTLIBRARY_MAINFOLDER);
       	dlMainFolderId = dlFolderMain.getFolderId();
       	dlMainFolderFound = true;
       	//Get portlet folder
       	Folder dlFolderPortlet = DLAppLocalServiceUtil.getFolder(repositoryId,dlMainFolderId,moduleUpload.DOCUMENTLIBRARY_PORTLETFOLDER);
       	dlPortletFolderId = dlFolderPortlet.getFolderId();
       	dlPortletFolderFound = true;
       } catch (Exception ex){
       	//Not found Main Folder
       }
       
	ServiceContext serviceContext= ServiceContextFactory.getInstance( DLFolder.class.getName(), portletRequest);
	//Damos permisos al archivo para usuarios de comunidad.
	serviceContext.setAddGroupPermissions(true);
       
       //Create main folder if not exist
       if(!dlMainFolderFound || dlFolderMain==null){
       	Folder newDocumentMainFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, DLFolderConstants.DEFAULT_PARENT_FOLDER_ID, moduleUpload.DOCUMENTLIBRARY_MAINFOLDER, moduleUpload.DOCUMENTLIBRARY_MAINFOLDER_DESCRIPTION, serviceContext);
       	dlMainFolderId = newDocumentMainFolder.getFolderId();
       	dlMainFolderFound = true;
       }
       //Create portlet folder if not exist
       if(dlMainFolderFound && !dlPortletFolderFound){
       	Folder newDocumentPortletFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, dlMainFolderId , moduleUpload.DOCUMENTLIBRARY_PORTLETFOLDER, moduleUpload.DOCUMENTLIBRARY_PORTLETFOLDER_DESCRIPTION, serviceContext);
       	dlPortletFolderFound = true;
           dlPortletFolderId = newDocumentPortletFolder.getFolderId();
       }

       //Create this record folder
       if(dlPortletFolderFound){
       	SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
       	Date date = new Date();
       	String dlRecordFolderName = dateFormat.format(date)+moduleUpload.SEPARATOR+userId;
       	Folder newDocumentRecordFolder = DLAppLocalServiceUtil.addFolder(userId, repositoryId, dlPortletFolderId, dlRecordFolderName, dlRecordFolderName, serviceContext);
       	dlRecordFolderId = newDocumentRecordFolder.getFolderId();
       }
       return dlRecordFolderId;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:52,代码来源:DLFolderUtil.java


注:本文中的com.liferay.portal.kernel.repository.model.Folder.getFolderId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。