本文整理汇总了Java中com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil类的典型用法代码示例。如果您正苦于以下问题:Java DLFileEntryLocalServiceUtil类的具体用法?Java DLFileEntryLocalServiceUtil怎么用?Java DLFileEntryLocalServiceUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DLFileEntryLocalServiceUtil类属于com.liferay.portlet.documentlibrary.service包,在下文中一共展示了DLFileEntryLocalServiceUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addDocTemplate
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
public void addDocTemplate(ActionRequest actionRequest,
ActionResponse actionResponse) throws PortletException {
ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
try {
String templateNo = ParamUtil.getString(actionRequest, "templateNo");
String title = ParamUtil.getString(actionRequest, "title");
String enTitle = ParamUtil.getString(actionRequest, "enTitle");
String _uuid = ParamUtil.getString(actionRequest, "fileEntryUuid");
DLFileEntry fileEntry = DLFileEntryLocalServiceUtil.getFileEntryByUuidAndGroupId(_uuid, serviceContext.getScopeGroupId());
DocTemplate docTemplate = DocTemplateLocalServiceUtil.addDocTemplate(templateNo, title, enTitle, fileEntry.getFileEntryId(), serviceContext);
if (docTemplate != null) {
SessionMessages.add(actionRequest.getPortletSession(), DocTemplateKeys.SuccessMessageKeys.ORG_OEP_CORE_UTILITIES_DOSSIERMGT_PORTLET_DOCTEMPLATE_SUCCESS_ADDNEW);
_log.info("doc template have been added successfylly");
} else {
_log.error("There is an Erron in adding doc template");
}
actionResponse.setRenderParameter("mvcPath",
"/html/dossiermgt/portlet/doctemplate/edit_doctemplate.jsp");
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:24,代码来源:DocTemplatePortlet.java
示例2: getExternImageURLs
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
private JSONArray getExternImageURLs(Application application) {
JSONArray result = JSONFactoryUtil.createJSONArray();
try {
List<MultiMedia> allMultiMedias = applicationLocalService.getMultiMedias(application.getApplicationId());
_log.debug("allMultiMedias.size(): " + allMultiMedias.size());
for (MultiMedia multiMedia : allMultiMedias) {
_log.debug("multiMedia.getImageId(): " + multiMedia.getImageId());
if (multiMedia.getImageId() != 0) {
DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(multiMedia.getImageId());
result.put("http://" + AppConstants.COMPANY_VIRTUAL_HOST + "/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true));
}
}
} catch (SystemException se) {
_log.error(se.getMessage());
} catch (PortalException pe) {
_log.error(pe.getMessage());
}
return result;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:20,代码来源:OGPD_EntityLocalServiceImpl.java
示例3: getOpenDataEntitiesForWidget
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
public JSONArray getOpenDataEntitiesForWidget() {
JSONArray result = JSONFactoryUtil.createJSONArray();
try {
List<Application> apps = applicationPersistence.findByuseOpenData(Constants.USE_OPEN_DATA);
for (Application app: apps) {
JSONObject _ogpd_Entity = JSONFactoryUtil.createJSONObject();
_ogpd_Entity.put("id", app.getApplicationId());
_ogpd_Entity.put("name", app.getName());
_ogpd_Entity.put("beschreibung", app.getDescription());
if (app.getLogoImageId() != 0) {
DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(app.getLogoImageId());
_ogpd_Entity.put("icon", "http://" + AppConstants.COMPANY_VIRTUAL_HOST + "/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true));
}
_ogpd_Entity.put("plattform", app.getTargetOS());
result.put(_ogpd_Entity);
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:26,代码来源:OGPD_EntityLocalServiceImpl.java
示例4: getIconURL
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
public String getIconURL(long applicationId) throws Exception {
String result = "";
try {
// _log.debug("getIconURL(applicationId " + applicationId + ")");
Application application = applicationLocalService.getApplication(applicationId);
if (application.getLogoImageId() != 0) {
DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(application.getLogoImageId());
result = "http://localhost/documents/10180/0/" +
HttpUtil.encodeURL(HtmlUtil.unescape(fe.getTitle())) +
StringPool.SLASH +
fe.getUuid() +
"?version=" + fe.getVersion() +
"&t=" + fe.getModifiedDate().getTime() +
"&imageThumbnail=1";
}
} catch (SystemException se) {
_log.error("applicationId: " + applicationId);
_log.error(se.getMessage());
} catch (PortalException pe) {
_log.error("applicationId: " + applicationId);
_log.error(pe.getMessage());
}
return result;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:26,代码来源:ApplicationServiceImpl.java
示例5: getExternIconURL
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
private String getExternIconURL(Application application) throws Exception {
String result = "";
try {
if (application.getLogoImageId() != 0) {
DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(application.getLogoImageId());
result = "http://" + AppConstants.COMPANY_VIRTUAL_HOST + "/documents/10180/0/" +
HttpUtil.encodeURL(HtmlUtil.unescape(fe.getTitle())) +
StringPool.SLASH +
fe.getUuid() +
"?version=" + fe.getVersion() +
"&t=" + fe.getModifiedDate().getTime() +
"&imageThumbnail=1";
}
} catch (SystemException se) {
_log.error(se.getMessage());
} catch (PortalException pe) {
_log.error(pe.getMessage());
}
return result;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:22,代码来源:ApplicationServiceImpl.java
示例6: getImageURLs
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
public List<String> getImageURLs(long applicationId) {
List<String> result = new ArrayList<String>();
try {
List<MultiMedia> allMultiMedias = applicationLocalService.getMultiMedias(applicationId);
for (MultiMedia multiMedia : allMultiMedias) {
DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(multiMedia.getImageId());
result.add("http://localhost/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true));
}
} catch (SystemException se) {
_log.error(se.getMessage());
} catch (PortalException pe) {
_log.error(pe.getMessage());
}
return result;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:17,代码来源:ApplicationServiceImpl.java
示例7: getExternImageURLs
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
public List<String> getExternImageURLs(Application application) {
List<String> result = new ArrayList<String>();
try {
List<MultiMedia> allMultiMedias = applicationLocalService.getMultiMedias(application.getApplicationId());
for (MultiMedia multiMedia : allMultiMedias) {
DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(multiMedia.getImageId());
result.add("http://" + AppConstants.COMPANY_VIRTUAL_HOST + "/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true));
}
} catch (SystemException se) {
_log.error(se.getMessage());
} catch (PortalException pe) {
_log.error(pe.getMessage());
}
return result;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:17,代码来源:ApplicationServiceImpl.java
示例8: getImageBytes
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
private byte[] getImageBytes(long imgId) {
byte[] result = null;
try {
DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(imgId);
InputStream in = fe.getContentStream();
// BufferedReader br = new BufferedReader(new
// InputStreamReader(in));
ByteArrayOutputStream bout = new ByteArrayOutputStream();
// BufferedWriter bw = new BufferedWriter(new
// OutputStreamWriter(bout));
byte[] buffer = new byte[1024];
int len;
while ((len = in.read(buffer)) != -1) {
bout.write(buffer, 0, len);
}
result = bout.toByteArray();
} catch (Throwable t) {
}
return result;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:22,代码来源:ApplicationPortlet.java
示例9: getFileContent
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
private byte[] getFileContent(DLFileEntry dfile) {
m_objLog.debug("getFileContent::start()");
byte[] result = null;
if (dfile != null) {
try {
InputStream stream = DLFileEntryLocalServiceUtil.getFileAsStream(
dfile.getUserId(), dfile.getFileEntryId(),
dfile.getVersion());
result = IOUtils.toByteArray(stream);
} catch (Throwable t) {
m_objLog.error("Error retrieving file contents",t);
}
}
m_objLog.debug("getFileContent::end()");
return result;
}
开发者ID:fraunhoferfokus,项目名称:particity,代码行数:18,代码来源:ExportWriter.java
示例10: getUploadedFiles
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
public List<Document> getUploadedFiles(Long id) {
Field field = getField(id);
List<Document> documents = new ArrayList<Document>();
if (field.getTempValue() != null) {
String[] fields = field.getTempValue().split("\\,");
for (String fileEntryId : fields) {
try {
if (!fileEntryId.isEmpty()) {
DLFileEntry dlFileEntry = DLFileEntryLocalServiceUtil.getDLFileEntry(new Long(fileEntryId));
documents.add(new Document("" + dlFileEntry.getFileEntryId(), dlFileEntry.getTitle(), dlFileEntry.getMimeType()));
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
return documents;
}
开发者ID:mahytom,项目名称:liferay-webforms,代码行数:23,代码来源:WebFormBean.java
示例11: updateDocTemplate
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
public void updateDocTemplate(ActionRequest actionRequest,
ActionResponse actionResponse) throws PortletException {
try {
ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
long docTemplateId = ParamUtil.getLong(actionRequest, "docTemplateId");
String templateNo = ParamUtil.getString(actionRequest, "templateNo");
String title = ParamUtil.getString(actionRequest, "title");
String enTitle = ParamUtil.getString(actionRequest, "enTitle");
String _uuid = ParamUtil.getString(actionRequest, "fileEntryUuid", "");
DLFileEntry fileEntry = null;
if (!"".equals(_uuid)) {
fileEntry = DLFileEntryLocalServiceUtil.getFileEntryByUuidAndGroupId(_uuid, serviceContext.getScopeGroupId());
}
DocTemplate docTemplate = DocTemplateLocalServiceUtil.getDocTemplate(docTemplateId);
if (docTemplate != null) {
if (fileEntry != null) {
docTemplate = DocTemplateLocalServiceUtil.updateDocTemplate(docTemplateId, templateNo, title, enTitle, fileEntry.getFileEntryId(), serviceContext);
}
else {
docTemplate = DocTemplateLocalServiceUtil.updateDocTemplate(docTemplateId, templateNo, title, enTitle, docTemplate.getFileEntryId(), serviceContext);
}
if (docTemplate != null) {
SessionMessages.add(actionRequest.getPortletSession(), DocTemplateKeys.SuccessMessageKeys.ORG_OEP_CORE_UTILITIES_DOSSIERMGT_PORTLET_DOCTEMPLATE_SUCCESS_UPDATE);
_log.info("doc template have been updated successfylly");
} else {
_log.error("There is an error in update doc template");
}
} else {
_log.error("Could not find doc template.");
}
actionResponse.setRenderParameter("mvcPath",
"/html/dossiermgt/portlet/doctemplate/list_doctemplate.jsp");
} catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:openegovplatform,项目名称:OEPv2,代码行数:37,代码来源:DocTemplatePortlet.java
示例12: getRegionEntitiesForWidget
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
public JSONArray getRegionEntitiesForWidget(String regionID) {
JSONArray result = JSONFactoryUtil.createJSONArray();
try {
long regionId = 1;
if (regionID.trim().length() > 0) {
regionId = Long.valueOf(regionID);
}
List<Application> apps = regionLocalService.getApplications(regionId);
for (Application app: apps) {
JSONObject _ogpd_Entity = JSONFactoryUtil.createJSONObject();
_ogpd_Entity.put("id", app.getApplicationId());
_ogpd_Entity.put("name", app.getName());
_ogpd_Entity.put("beschreibung", app.getDescription());
if (app.getLogoImageId() != 0) {
DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(app.getLogoImageId());
_ogpd_Entity.put("icon", "http://" + AppConstants.COMPANY_VIRTUAL_HOST + "/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true));
}
_ogpd_Entity.put("plattform", app.getTargetOS());
result.put(_ogpd_Entity);
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:30,代码来源:OGPD_EntityLocalServiceImpl.java
示例13: getUploadList
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的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
示例14: getNewApplications
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
public List<List> getNewApplications(long companyId, int year, int month, int day, int count) throws SystemException {
List<List> result = new ArrayList<List>();
Date modifiedDate = PortalUtil.getDate(month, day, year);
Date now = new Date();
List<Application> applications = applicationPersistence.findAll();
List<Application> applications2 = new ArrayList<Application>();
for (Application app: applications) {
applications2.add(app);
}
OrderByComparator orderByComparator = CustomComparatorUtil.getApplicationOrderByComparator("modifiedDate", "desc");
Collections.sort(applications2, orderByComparator);
applications2 = applications2.subList(0, count);
for (Application application: applications2) {
if (application.getLifeCycleStatus() >= 4) {
List toAdd = new ArrayList();
toAdd.add(application);
DLFileEntry fe;
try {
fe = DLFileEntryLocalServiceUtil.getDLFileEntry(application.getLogoImageId());
String iconUrl = "http://localhost/documents/10180/0/" +
HttpUtil.encodeURL(HtmlUtil.unescape(fe.getTitle())) +
StringPool.SLASH +
fe.getUuid() +
"?version=" + fe.getVersion() +
"&t=" + fe.getModifiedDate().getTime() +
"&imageThumbnail=1";
toAdd.add(iconUrl);
} catch (PortalException e) {
_log.error(e.getMessage());
}
result.add(toAdd);
}
}
return result;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:45,代码来源:ApplicationLocalServiceImpl.java
示例15: getOGPD_Entities
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
public JSONArray getOGPD_Entities() {
// JSONFactoryUtil _jsonFactoryUtil = new JSONFactoryUtil();
JSONArray result = JSONFactoryUtil.createJSONArray();
try {
List<Application> apps = applicationPersistence.findByuseOpenData(Constants.USE_OPEN_DATA);
for (Application app: apps) {
List<Link> links = applicationPersistence.getLinks(app.getApplicationId());
String url = "";
for (Link link: links) {
if (link.getType() == Constants.TARGET_LINK) {
url = link.getUrl();
}
}
_log.debug("url: " + url);
JSONObject _ogpd_Entity = JSONFactoryUtil.createJSONObject();
_ogpd_Entity.put("name", "govapps_" + String.valueOf(app.getApplicationId()));
_ogpd_Entity.put("title", app.getName());
_ogpd_Entity.put("author", app.getLegalDetails());
_ogpd_Entity.put("notes", app.getDescription());
String categoryString = app.getCategoryString();
String[] categoryArray = categoryString.split(",");
JSONArray groups = JSONFactoryUtil.createJSONArray();
for (int i=0; i<categoryArray.length ; i++) {
groups.put(categoryArray[i].trim());
}
_ogpd_Entity.put("groups", groups);
_ogpd_Entity.put("type", "app");
JSONArray resources = JSONFactoryUtil.createJSONArray();
JSONObject resource = JSONFactoryUtil.createJSONObject();
resource.put("url", url);
resource.put("format", "application/octet-stream");
resources.put(resource);
_ogpd_Entity.put("resources", resources);
_ogpd_Entity.put("license_id", app.getLicense());
JSONObject extra = JSONFactoryUtil.createJSONObject();
JSONArray dates = JSONFactoryUtil.createJSONArray();
JSONObject date = JSONFactoryUtil.createJSONObject();
date.put("role", "erstellt");
date.put("date", app.getCreateDate());
dates.put(date);
extra.put("dates", dates);
JSONObject terms_of_use = JSONFactoryUtil.createJSONObject();
extra.put("terms_of_use", terms_of_use);
extra.put("used_datasets", getUsedDatasets(app));
extra.put("sector", app.getSector());
JSONArray images = getExternImageURLs(app);
if (app.getLogoImageId() != 0) {
DLFileEntry fe = DLFileEntryLocalServiceUtil.getDLFileEntry(app.getLogoImageId());
images.put("http://" + AppConstants.COMPANY_VIRTUAL_HOST + "/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true));
}
extra.put("images", images);
extra.put("ogd_version", "v1.0");
_ogpd_Entity.put("extras", extra);
result.put(_ogpd_Entity);
}
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:77,代码来源:OGPD_EntityLocalServiceImpl.java
示例16: getNewApplications
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
public List<List> getNewApplications(long companyId, int year, int month, int day, int count) throws SystemException {
_log.debug("getNewApplications2: ");
List<List> result = new ArrayList<List>();
try {
Date modifiedDate = PortalUtil.getDate(month, day, year);
Date now = new Date();
DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(Application.class);
Criterion criterion = null;
criterion = RestrictionsFactoryUtil.between("modifiedDate",modifiedDate,now);
dynamicQuery.add(criterion);
dynamicQuery.add(PropertyFactoryUtil.forName("lifeCycleStatus").eq(E_Stati.APPLICATION_STATUS_VERIFIED.getIntStatus()));
Order defaultOrder = OrderFactoryUtil.desc("modifiedDate");
dynamicQuery.addOrder(defaultOrder);
dynamicQuery.setLimit(0, count);
List<Application> applications = ApplicationLocalServiceUtil.dynamicQuery(dynamicQuery);
for (Application application: applications) {
List toAdd = new ArrayList();
toAdd.add(application);
if (application.getLogoImageId() != 0) {
DLFileEntry fe;
fe = DLFileEntryLocalServiceUtil.getDLFileEntry(application.getLogoImageId());
//String iconUrl = "http://localhost/documents/10180/0/" + HttpUtil.encodeURL(fe.getTitle(), true);
String iconUrl = "http://localhost/documents/10180/0/" +
HttpUtil.encodeURL(HtmlUtil.unescape(fe.getTitle())) +
StringPool.SLASH +
fe.getUuid() +
"?version=" + fe.getVersion() +
"&t=" + fe.getModifiedDate().getTime() +
"&imageThumbnail=1";
toAdd.add(iconUrl);
}
result.add(toAdd);
}
} catch (Exception e) {
_log.error(e.getMessage());
e.printStackTrace();
}
return result;
}
开发者ID:fraunhoferfokus,项目名称:govapps,代码行数:51,代码来源:ApplicationServiceImpl.java
示例17: addZipEntry
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
@Override
public String addZipEntry(LearningActivity actividad, Long assetEntryId,PortletDataContext context, Element entryElementLoc)
throws PortalException, SystemException {
AssetEntry docAsset= AssetEntryLocalServiceUtil.getAssetEntry(assetEntryId);
log.info("mimeType: " + docAsset.getMimeType());
DLFileEntry docfile=DLFileEntryLocalServiceUtil.getDLFileEntry(docAsset.getClassPK());
log.info("docFile: " + docfile.getFileEntryId());
String extension = "";
if(!docfile.getTitle().endsWith(docfile.getExtension()) && docfile.getExtension().equals("")){
if(docfile.getMimeType().equals("image/jpeg")){
extension= ".jpg";
}else if(docfile.getMimeType().equals("image/png")){
extension= ".png";
}else if(docfile.getMimeType().equals("video/mpeg")){
extension= ".mpeg";
}else if(docfile.getMimeType().equals("application/pdf")){
extension= ".pdf";
}else{
String ext[] = extension.split("/");
if(ext.length>1){
extension = ext[1];
}
}
}else if(!docfile.getTitle().endsWith(docfile.getExtension()) && !docfile.getExtension().equals("")){
extension="."+docfile.getExtension();
}
log.info("file Title: " + docfile.getTitle());
String title = changeSpecialCharacter(docfile.getTitle());
title += extension;
log.info("title: " + title);
String pathqu = getEntryPath(context, docfile);
String pathFile = getFilePath(context, docfile,actividad.getActId());
Element entryElementfe= entryElementLoc.addElement("dlfileentry");
entryElementfe.addAttribute("path", pathqu);
entryElementfe.addAttribute("file", pathFile+title);
context.addZipEntry(pathqu, docfile);
log.info("pathqu: " + pathqu);
log.info("pathFile: " + pathFile);
//Guardar el fichero en el zip.
InputStream input = DLFileEntryLocalServiceUtil.getFileAsStream(docfile.getUserId(), docfile.getFileEntryId(), docfile.getVersion());
context.addZipEntry(getFilePath(context, docfile,actividad.getActId())+title, input);
String txt = (actividad.getTypeId() == 2) ? "external":"internal";
log.info(" - Resource "+ txt + ": " + title);
return null;
}
开发者ID:TelefonicaED,项目名称:liferaylms-portlet,代码行数:56,代码来源:BaseLearningActivityType.java
示例18: cloneFile
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的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
示例19: usePreviewImage
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
public void usePreviewImage(Field field) throws NumberFormatException, PortalException, SystemException, UnsupportedEncodingException {
DLFileEntry dlFileEntry = DLFileEntryLocalServiceUtil.getDLFileEntry(new Long(this.tempDocument.getId()));
String url = "/../documents/" + dlFileEntry.getGroupId() + "/" + dlFileEntry.getFolderId() + "/" + URLEncoder.encode(dlFileEntry.getTitle(), "UTF-8") + "/" + dlFileEntry.getUuid();
field.getValue().setContent(url);
}
开发者ID:mahytom,项目名称:liferay-webforms,代码行数:9,代码来源:WebFormControlBean.java
示例20: getFiles
import com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil; //导入依赖的package包/类
public DocumentModel getFiles() throws SystemException, NumberFormatException, PortalException {
List<Document> documents = new ArrayList<Document>();
List<DLFileEntry> dlFileEntries = new ArrayList<DLFileEntry>();
OrderByComparator obc = new EntryNameComparator();
if (this.selectedTreeFolder != null) {
DLFolder dlFolder = DLFolderLocalServiceUtil.getDLFolder(new Long(this.selectedTreeFolder.getId()));
dlFileEntries = ListUtil.copy(DLFileEntryLocalServiceUtil.getFileEntries(dlFolder.getGroupId(), dlFolder.getFolderId(), -1, -1, obc));
} else {
PortletRequest portletRequest = (PortletRequest) LiferayFacesContext.getCurrentInstance().getExternalContext().getRequest();
ThemeDisplay themeDisplay = (ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
dlFileEntries = ListUtil.copy(DLFileEntryLocalServiceUtil.getFileEntries(themeDisplay.getScopeGroupId(), new Long(0), -1, -1, obc));
}
for (DLFileEntry dlFileEntry : dlFileEntries) {
documents.add(new Document("" + dlFileEntry.getFileEntryId(), dlFileEntry.getTitle(), dlFileEntry.getExtension()));
}
this.files = new DocumentModel(documents);
return files;
}
开发者ID:mahytom,项目名称:liferay-webforms,代码行数:28,代码来源:WebFormControlBean.java
注:本文中的com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论