本文整理汇总了Java中com.liferay.portlet.documentlibrary.service.DLFileEntryLocalServiceUtil类的典型用法代码示例。如果您正苦于以下问题:Java DLFileEntryLocalServiceUtil类的具体用法?Java DLFileEntryLocalServiceUtil怎么用?Java DLFileEntryLocalServiceUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DLFileEntryLocalServiceUtil类属于com.liferay.portlet.documentlibrary.service包,在下文中一共展示了DLFileEntryLocalServiceUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}