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


Java DLFileEntry.getTitle方法代码示例

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


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

示例1: getUploadList

import com.liferay.portlet.documentlibrary.model.DLFileEntry; //导入方法依赖的package包/类
public List<ResultItem> getUploadList(Long id) {

		List<FieldResult> fieldResults = formController.getFieldResults(id);
		List<ResultItem> resultItems = new ArrayList<ResultItem>();

		for (FieldResult fieldResult : fieldResults) {

			if (fieldResult.getContent() != null && !fieldResult.getContent().isEmpty()) {

				Date date = fieldResult.getResult().getCreated();
				List<ResultItem> items = new ArrayList<ResultItem>();

				for (String fileEntryId : fieldResult.getContent().split("\\,")) {

					try {
						DLFileEntry dlFileEntry = DLFileEntryLocalServiceUtil.getDLFileEntry(new Long(fileEntryId));

						String name = dlFileEntry.getTitle();
						String content = "/../documents/" + dlFileEntry.getGroupId() + "/" + dlFileEntry.getFolderId() + "/" + URLEncoder.encode(dlFileEntry.getTitle(), "UTF-8") + "/" + dlFileEntry.getUuid();

						items.add(new ResultItem(name, content));
					} catch (Exception e) {
						e.printStackTrace();
					}
				}

				resultItems.add(new ResultItem(date, items));
			}
		}

		return resultItems;
	}
 
开发者ID:mahytom,项目名称:liferay-webforms,代码行数:33,代码来源:GraphicBean.java

示例2: cloneFile

import com.liferay.portlet.documentlibrary.model.DLFileEntry; //导入方法依赖的package包/类
private long cloneFile(long entryId, LearningActivity actNew, long userId, ServiceContext serviceContext){
	
	long assetEntryId = 0;
	boolean addGroupPermissions = serviceContext.isAddGroupPermissions();
	
	try {
		if(log.isDebugEnabled()){log.debug("EntryId: "+entryId);}
		AssetEntry docAsset = AssetEntryLocalServiceUtil.getAssetEntry(entryId);
		//docAsset.getUrl()!=""
		//DLFileEntryLocalServiceUtil.getDLFileEntry(fileEntryId)
		if(log.isDebugEnabled()){log.debug(docAsset.getClassPK());}
		DLFileEntry docfile = DLFileEntryLocalServiceUtil.getDLFileEntry(docAsset.getClassPK());
		InputStream is = DLFileEntryLocalServiceUtil.getFileAsStream(userId, docfile.getFileEntryId(), docfile.getVersion());
		
		//Crear el folder
		DLFolder dlFolder = DLFolderUtil.createDLFoldersForLearningActivity(userId, serviceContext.getScopeGroupId(), serviceContext);

		long repositoryId = DLFolderConstants.getDataRepositoryId(actNew.getGroupId(), DLFolderConstants.DEFAULT_PARENT_FOLDER_ID);
		
		String ficheroStr = docfile.getTitle();	
		if(!docfile.getTitle().endsWith(docfile.getExtension())){
			ficheroStr = ficheroStr +"."+ docfile.getExtension();
		}
		
		serviceContext.setAddGroupPermissions(true);
		FileEntry newFile = DLAppLocalServiceUtil.addFileEntry(
				serviceContext.getUserId(), repositoryId , dlFolder.getFolderId() , ficheroStr, docfile.getMimeType(), 
				docfile.getTitle(), StringPool.BLANK, StringPool.BLANK, is, docfile.getSize() , serviceContext ) ;
		
		
		AssetEntry asset = AssetEntryLocalServiceUtil.getEntry(DLFileEntry.class.getName(), newFile.getPrimaryKey());
		
		if(log.isDebugEnabled()){log.debug(" asset : " + asset.getEntryId());};
		
		assetEntryId = asset.getEntryId();
		
	} catch (NoSuchEntryException nsee) {
		log.error(" asset not exits ");
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	} finally {
		serviceContext.setAddGroupPermissions(addGroupPermissions);
	}
	
	return assetEntryId;
}
 
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:48,代码来源:CourseCopyUtil.java


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