Guest User

Untitled

a guest
Feb 21st, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. @Override
  2. protected Summary doGetSummary(
  3. Document document, Locale locale, String snippet,
  4. PortletURL portletURL) {
  5.  
  6. LiferayPortletURL liferayPortletURL = (LiferayPortletURL)portletURL;
  7.  
  8. liferayPortletURL.setLifecycle(PortletRequest.ACTION_PHASE);
  9.  
  10. try {
  11. liferayPortletURL.setWindowState(LiferayWindowState.EXCLUSIVE);
  12. }
  13. catch (WindowStateException wse) {
  14. }
  15.  
  16. String groupId = document.get("scopeGroupId");
  17. String folderId = document.get("folderId");
  18. String fileName = DLFileEntryLocalServiceUtil.getFileEntry(Long.parseLong(document.get("entryClassPK"))).getName();
  19.  
  20. String title = fileName;
  21.  
  22. String content = snippet;
  23.  
  24. if (Validator.isNull(snippet)) {
  25. content = StringUtil.shorten(document.get(Field.CONTENT), 200);
  26. }
  27.  
  28. portletURL.setParameter("struts_action", "/document_library/get_file");
  29. portletURL.setParameter("groupId", groupId);
  30. portletURL.setParameter("folderId", folderId);
  31. portletURL.setParameter("name", fileName);
  32.  
  33. return new Summary(title, content, portletURL);
  34. }
Add Comment
Please, Sign In to add comment