本文整理汇总了Java中com.liferay.portal.util.PortletKeys类的典型用法代码示例。如果您正苦于以下问题:Java PortletKeys类的具体用法?Java PortletKeys怎么用?Java PortletKeys使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PortletKeys类属于com.liferay.portal.util包,在下文中一共展示了PortletKeys类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPortletArticle
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
public static void setPortletArticle(String portletId, String articleId, Layout layout, long userId, long groupId, long companyId) {
try {
long ownerId = PortletKeys.PREFS_OWNER_ID_DEFAULT;
int ownerType = PortletKeys.PREFS_OWNER_TYPE_LAYOUT;
//Retrieve the portlet preferences for the journal portlet instance just created
PortletPreferences prefs = PortletPreferencesLocalServiceUtil.getPreferences(companyId,
ownerId,
ownerType,
layout.getPlid(),
portletId);
// set desired article id for content display portlet
prefs.setValue("articleId", articleId);
prefs.setValue("groupId", String.valueOf(groupId));
//update the portlet preferences
PortletPreferencesLocalServiceUtil.updatePreferences(ownerId, ownerType, layout
.getPlid(), portletId, prefs);
} catch (Throwable t) {
m_objLog.warn(t);
}
}
示例2: getDefaultPortletJSONObject
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
protected JSONObject getDefaultPortletJSONObject(String journalArticleId) {
JSONObject portletJSONObject = JSONFactoryUtil.createJSONObject();
portletJSONObject.put("portletId", PortletKeys.JOURNAL_CONTENT);
JSONObject portletPreferencesJSONObject =
JSONFactoryUtil.createJSONObject();
portletPreferencesJSONObject.put("articleId", journalArticleId);
portletPreferencesJSONObject.put("groupId", groupId);
portletPreferencesJSONObject.put("portletSetupShowBorders", false);
portletJSONObject.put(
"portletPreferences", portletPreferencesJSONObject);
return portletJSONObject;
}
示例3: hasJournalFolderPermission
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
/***
* This was taken from JournalFolderPermission which is located in
* portal-impl. The code was shortened because we are expecting to evaluate
* just Delete and Update actions for now.
*
* @param folder
* @return true if it has permission the given action
*/
private boolean hasJournalFolderPermission(final JournalFolder folder, final String actionId) {
PermissionChecker permissionChecker;
try {
permissionChecker = getPermissionChecker();
} catch (PrincipalException e) {
log.error(e);
return false;
}
Boolean hasPermission = StagingPermissionUtil.hasPermission(permissionChecker, folder.getGroupId(),
JournalFolder.class.getName(), folder.getFolderId(), PortletKeys.JOURNAL, actionId);
if (hasPermission != null) {
return hasPermission.booleanValue();
}
return _hasPermission(permissionChecker, folder, actionId);
}
开发者ID:rivetlogic,项目名称:liferay-document-and-media-treeview,代码行数:27,代码来源:EnhancedJournalAppServiceImpl.java
示例4: deleteVoiceCommand
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
public static PortletPreferences deleteVoiceCommand(ActionRequest request, String voiceCommand)
throws PortalException, SystemException, ReadOnlyException, ValidatorException, IOException {
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
long plid = themeDisplay.getLayout().getPlid();
long ownerId = PortletKeys.PREFS_OWNER_ID_DEFAULT;
int ownerType = PortletKeys.PREFS_OWNER_TYPE_LAYOUT;
long companyId = themeDisplay.getCompanyId();
PortletPreferences preference = request.getPreferences();
Map<String, String[]> preferencesMap = new HashMap<String, String[]>(preference.getMap());
preferencesMap.remove(voiceCommand);
PortletPreferencesLocalServiceUtil.deletePortletPreferences(ownerId, ownerType, plid, SpeechConstants.PORTLET_NAMESPACE);
preference = PortletPreferencesLocalServiceUtil.getPreferences(companyId, ownerId, ownerType, plid,
SpeechConstants.PORTLET_NAMESPACE);
for (Map.Entry<String, String[]> entry : preferencesMap.entrySet()) {
preference.setValue(entry.getKey(), entry.getValue()[0]);
}
preference.store();
return preference;
}
示例5: setExtraContent
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
@Override
public String setExtraContent(UploadRequest uploadRequest,PortletResponse portletResponse, Course course) {
log.debug("*******setExtraContent**********");
try {
String value=ParamUtil.getString(uploadRequest, "ceroton-value", "");
log.debug("****ceroton-value:"+value);
if(Validator.isNull(value)){
return "ceroton_ct.n-value-required";
}
try {
if(Integer.parseInt(value)<= 0){
return "ceroton_ct.n-value-positive";
}
} catch (NumberFormatException nfe){
return "ceroton_ct.n-value-number";
}
PortletPreferences prefs= PortalPreferencesLocalServiceUtil.getPreferences(course.getCompanyId(), course.getGroupCreatedId(), PortletKeys.PREFS_OWNER_TYPE_COMPANY);
if(!prefs.isReadOnly("ceroton-value")){
prefs.setValue("ceroton-value", value);
prefs.store();
}
} catch (Exception e) {
e.printStackTrace();
return "ceroton_ct.extra-content-error";
}
return null;
}
示例6: checkArticleOnLayout
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
public static boolean checkArticleOnLayout(Layout layout, String articleId, String columnId, long companyId) {
boolean result = false;
try {
long ownerId = PortletKeys.PREFS_OWNER_ID_DEFAULT;
int ownerType = PortletKeys.PREFS_OWNER_TYPE_LAYOUT;
LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) layout.getLayoutType();
List<Portlet> portlets = layoutTypePortlet.getAllPortlets(columnId);
if (portlets != null) {
for (Portlet portlet: portlets) {
//m_objLog.debug("Found portlet "+portlet.getPortletId()+" =? "+PortletKeys.JOURNAL_CONTENT);
if (portlet.getPortletId().startsWith(PortletKeys.JOURNAL_CONTENT+"_INSTANCE")) {
PortletPreferences prefs = PortletPreferencesLocalServiceUtil.getPreferences(companyId,
ownerId,
ownerType,
layout.getPlid(),
portlet.getPortletId());
String jArticleId = prefs.getValue("articleId", "");
if (jArticleId.equals(articleId)) {
result = true;
break;
}
}
}
}
} catch (Throwable t) {
m_objLog.warn(t);
}
return result;
}
示例7: addArticle
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
public static String addArticle(E_ContextPath path, JournalArticle article, Layout layout, long userId, long groupId, long companyId) {
String journalPortletId = null;
try {
journalPortletId = addPortletToPage(layout, PortletKeys.JOURNAL_CONTENT, path, userId);
setPortletArticle(journalPortletId, article.getArticleId() ,layout, userId, groupId, companyId);
} catch (Throwable t) {
journalPortletId = null;
m_objLog.warn(t);
}
return journalPortletId;
}
示例8: test
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
public static void test() {
try {
if (globalCompanyId == -1)
initGlobals();
Layout layout = getLayout(globalGroupId, E_ContextPath.HOME.getPath());
LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) layout.getLayoutType();
List<Portlet> portlets = layoutTypePortlet.getAllPortlets();
if (portlets != null) {
for (Portlet portlet: portlets) {
m_objLog.debug("Found portlet "+portlet.getPortletId()+" =? "+PortletKeys.JOURNAL_CONTENT);
if (portlet.getPortletId().startsWith(E_SampleContent.FRONTEND_HEADER.getDataPath())) {
long ownerId = PortletKeys.PREFS_OWNER_ID_DEFAULT;
int ownerType = PortletKeys.PREFS_OWNER_TYPE_LAYOUT;
PortletPreferences prefs = PortletPreferencesLocalServiceUtil.getPreferences(globalCompanyId,
ownerId,
ownerType,
layout.getPlid(),
portlet.getPortletId());
if (prefs != null) {
Enumeration<String> names = prefs.getNames();
while (names.hasMoreElements()) {
String name = names.nextElement();
m_objLog.debug("Got preference "+name+"="+prefs.getValue(name, "N/A"));
}
} else {
m_objLog.debug("Could not extract portlet prefs!");
}
}
}
}
} catch (Throwable t) {
m_objLog.error(t);
}
}
示例9: hasJournalArticlePermission
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
/***
* This was taken from JournalArticlePermission which is located in
* portal-impl. The code was shortened because we are expecting to evaluate
* just Delete and Update actions for now.
*
* @return
*/
private boolean hasJournalArticlePermission(final JournalArticle article, final String actionId) {
PermissionChecker permissionChecker;
try {
permissionChecker = getPermissionChecker();
} catch (PrincipalException e) {
log.error(e);
return false;
}
Boolean hasPermission = StagingPermissionUtil.hasPermission(permissionChecker, article.getGroupId(),
JournalArticle.class.getName(), article.getResourcePrimKey(), PortletKeys.JOURNAL, actionId);
if (hasPermission != null) {
return hasPermission.booleanValue();
}
if (article.isPending()) {
hasPermission = WorkflowPermissionUtil.hasPermission(permissionChecker, article.getGroupId(),
JournalArticle.class.getName(), article.getResourcePrimKey(), actionId);
if (hasPermission != null) {
return hasPermission.booleanValue();
}
}
if (permissionChecker.hasOwnerPermission(article.getCompanyId(), JournalArticle.class.getName(),
article.getResourcePrimKey(), article.getUserId(), actionId)) {
return true;
}
return permissionChecker.hasPermission(article.getGroupId(), JournalArticle.class.getName(),
article.getResourcePrimKey(), actionId);
}
开发者ID:rivetlogic,项目名称:liferay-document-and-media-treeview,代码行数:43,代码来源:EnhancedJournalAppServiceImpl.java
示例10: processAction
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
public void processAction(StrutsPortletAction originalStrutsPortletAction, PortletConfig portletConfig, ActionRequest actionRequest,ActionResponse actionResponse) throws Exception {
originalStrutsPortletAction.processAction(originalStrutsPortletAction, portletConfig, actionRequest, actionResponse);
Portlet portlet = getPortlet(actionRequest);
if (portlet.getPortletName().equals(PortletKeys.ASSET_PUBLISHER)) {
PortletPreferences preferences = PortletPreferencesFactoryUtil.getPortletSetup(actionRequest, portlet.getPortletId());
preferences.setValue("moreInfoUrl", ParamUtil.getString(actionRequest, "moreInfoUrl"));
preferences.setValue("moreInfoUrlLabel", ParamUtil.getString(actionRequest, "moreInfoUrlLabel"));
preferences.store();
}
}
示例11: redirectUpdateAccount
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
protected void redirectUpdateAccount(
HttpServletRequest request, HttpServletResponse response, User user)
throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(
WebKeys.THEME_DISPLAY);
PortletURL portletURL = PortletURLFactoryUtil.create(
request, PortletKeys.LOGIN, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
portletURL.setParameter("saveLastPath", Boolean.FALSE.toString());
portletURL.setParameter("struts_action", "/login/update_account");
PortletURL redirectURL = PortletURLFactoryUtil.create(
request, PortletKeys.FAST_LOGIN, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
redirectURL.setParameter("struts_action", "/login/login_redirect");
redirectURL.setParameter("emailAddress", user.getEmailAddress());
redirectURL.setParameter("anonymousUser", Boolean.FALSE.toString());
redirectURL.setPortletMode(PortletMode.VIEW);
redirectURL.setWindowState(LiferayWindowState.POP_UP);
portletURL.setParameter("redirect", redirectURL.toString());
portletURL.setParameter("userId", String.valueOf(user.getUserId()));
portletURL.setParameter("emailAddress", user.getEmailAddress());
portletURL.setParameter("firstName", user.getFirstName());
portletURL.setParameter("lastName", user.getLastName());
portletURL.setPortletMode(PortletMode.VIEW);
portletURL.setWindowState(LiferayWindowState.POP_UP);
response.sendRedirect(portletURL.toString());
}
示例12: UserSearchContainer
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
public UserSearchContainer(
PortletRequest portletRequest, String curParam,
PortletURL iteratorURL) {
super(
portletRequest, new UserDisplayTerms(portletRequest),
new UserSearchTerms(portletRequest), curParam, DEFAULT_DELTA,
iteratorURL, headerNames, EMPTY_RESULTS_MESSAGE);
PortletConfig portletConfig =
(PortletConfig)portletRequest.getAttribute(
JavaConstants.JAVAX_PORTLET_CONFIG);
UserDisplayTerms displayTerms = (UserDisplayTerms)getDisplayTerms();
UserSearchTerms searchTerms = (UserSearchTerms)getSearchTerms();
String portletName = portletConfig.getPortletName();
if (!portletName.equals(PortletKeys.USERS_ADMIN)) {
displayTerms.setStatus(WorkflowConstants.STATUS_APPROVED);
searchTerms.setStatus(WorkflowConstants.STATUS_APPROVED);
}
iteratorURL.setParameter(
UserDisplayTerms.STATUS, Integer.toString(displayTerms.getStatus()));
iteratorURL.setParameter(
UserDisplayTerms.EMAIL_ADDRESS, displayTerms.getEmailAddress());
iteratorURL.setParameter(
UserDisplayTerms.FIRST_NAME, displayTerms.getFirstName());
iteratorURL.setParameter(
UserDisplayTerms.LAST_NAME, displayTerms.getLastName());
iteratorURL.setParameter(
UserDisplayTerms.SCREEN_NAME, displayTerms.getScreenName());
iteratorURL.setParameter(
UserDisplayTerms.TEAM, Long.toString(displayTerms.getTeamId()));
try {
PortalPreferences preferences =
PortletPreferencesFactoryUtil.getPortalPreferences(
portletRequest);
String orderByCol = ParamUtil.getString(
portletRequest, "orderByCol");
String orderByType = ParamUtil.getString(
portletRequest, "orderByType");
if (Validator.isNotNull(orderByCol) &&
Validator.isNotNull(orderByType)) {
preferences.setValue(
PortletKeys.USERS_ADMIN, "users-order-by-col", orderByCol);
preferences.setValue(
PortletKeys.USERS_ADMIN, "users-order-by-type",
orderByType);
}
else {
orderByCol = preferences.getValue(
PortletKeys.USERS_ADMIN, "users-order-by-col", "last-name");
orderByType = preferences.getValue(
PortletKeys.USERS_ADMIN, "users-order-by-type", "asc");
}
OrderByComparator orderByComparator =
UsersAdminUtil.getUserOrderByComparator(
orderByCol, orderByType);
setOrderableHeaders(orderableHeaders);
setOrderByCol(orderByCol);
setOrderByType(orderByType);
setOrderByComparator(orderByComparator);
}
catch (Exception e) {
_log.error(e);
}
//Cargamos el displayTerms
}
示例13: getBlogLinks
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
public static List<ContentLinks> getBlogLinks(
long groupId,
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse,
ThemeDisplay themeDisplay,
boolean getLinks,
boolean getImages)
throws Exception {
_log.debug("getBlogLinks for groupId " + String.valueOf(groupId));
List<ContentLinks> contentLinksList = new ArrayList<ContentLinks>();
List<BlogsEntry> blogsEntryList = BlogsEntryLocalServiceUtil.getGroupEntries(groupId, WorkflowConstants.STATUS_APPROVED, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(
PortalUtil.getControlPanelPlid(liferayPortletRequest),
PortletKeys.BLOGS_ADMIN,
PortletRequest.RENDER_PHASE);
portletURL.setWindowState(LiferayWindowState.POP_UP);
portletURL.setParameter("struts_action", "/blogs_admin/edit_entry");
for (BlogsEntry blogsEntry : blogsEntryList) {
if (!hasPermissionView(groupId, blogsEntry.getModelClassName(), blogsEntry.getPrimaryKey(), themeDisplay)) {
continue;
}
String content = blogsEntry.getContent();
if (content != null) {
List<String> links = parseLinks(content, getLinks, getImages);
if (links.size() > 0) {
portletURL.setParameter("entryId", String.valueOf(blogsEntry.getEntryId()));
ContentLinks contentLinks = new ContentLinks();
contentLinks.setClassName(blogsEntry.getModelClassName());
contentLinks.setClassPK(blogsEntry.getEntryId());
contentLinks.setContentTitle(blogsEntry.getTitle());
contentLinks.setContentEditLink(portletURL.toString());
contentLinks.setModifiedDate(blogsEntry.getModifiedDate());
contentLinks.setStatus(blogsEntry.getStatus());
_log.debug("Extracting links from blog entry " + blogsEntry.getEntryId() + " - " + blogsEntry.getTitle());
for (String link : links) {
contentLinks.addLink(link);
}
contentLinksList.add(contentLinks);
}
}
}
return contentLinksList;
}
示例14: getBookmarkLinks
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
public static List<ContentLinks> getBookmarkLinks(
long groupId,
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse,
ThemeDisplay themeDisplay,
boolean getLinks,
boolean getImages)
throws Exception {
_log.debug("getBookmarkLinks for groupId " + String.valueOf(groupId));
List<ContentLinks> contentLinksList = new ArrayList<ContentLinks>();
List<BookmarksEntry> bookmarksEntryList = BookmarksEntryLocalServiceUtil.getGroupEntries(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(
PortalUtil.getControlPanelPlid(liferayPortletRequest),
PortletKeys.BOOKMARKS,
PortletRequest.RENDER_PHASE);
portletURL.setWindowState(LiferayWindowState.POP_UP);
portletURL.setParameter("struts_action", "/bookmarks/edit_entry");
for (BookmarksEntry bookmarksEntry : bookmarksEntryList) {
if (!hasPermissionView(groupId, bookmarksEntry.getModelClassName(), bookmarksEntry.getPrimaryKey(), themeDisplay)) {
continue;
}
String link = bookmarksEntry.getUrl();
if (link != null) {
portletURL.setParameter("folderId", String.valueOf(bookmarksEntry.getFolderId()));
portletURL.setParameter("entryId", String.valueOf(bookmarksEntry.getEntryId()));
ContentLinks contentLinks = new ContentLinks();
contentLinks.setClassName(bookmarksEntry.getModelClassName());
contentLinks.setClassPK(bookmarksEntry.getEntryId());
contentLinks.setContentTitle(bookmarksEntry.getName());
contentLinks.setContentEditLink(portletURL.toString());
contentLinks.setModifiedDate(bookmarksEntry.getModifiedDate());
_log.debug("Extracting link from bookmarks entry " + bookmarksEntry.getEntryId() + " - " + bookmarksEntry.getName());
contentLinks.addLink(link);
contentLinksList.add(contentLinks);
}
}
return contentLinksList;
}
示例15: getMBMessageLinks
import com.liferay.portal.util.PortletKeys; //导入依赖的package包/类
public static List<ContentLinks> getMBMessageLinks(
long groupId,
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse,
ThemeDisplay themeDisplay,
boolean getLinks,
boolean getImages)
throws Exception {
_log.debug("getMBMessageLinks for groupId " + String.valueOf(groupId));
List<ContentLinks> contentLinksList = new ArrayList<ContentLinks>();
List<MBMessage> messageList = MBMessageLocalServiceUtil.getGroupMessages(groupId, WorkflowConstants.STATUS_APPROVED, QueryUtil.ALL_POS, QueryUtil.ALL_POS);
PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(
PortalUtil.getControlPanelPlid(liferayPortletRequest),
PortletKeys.MESSAGE_BOARDS,
PortletRequest.RENDER_PHASE);
portletURL.setWindowState(LiferayWindowState.POP_UP);
portletURL.setParameter("struts_action", "/message_boards/edit_message");
for (MBMessage message : messageList) {
if (!hasPermissionView(groupId, message.getModelClassName(), message.getPrimaryKey(), themeDisplay)) {
continue;
}
String content = message.getBody();
if (message.isFormatBBCode()) {
content = BBCodeTranslatorUtil.getHTML(message.getBody());
content = StringUtil.replace(content, "@[email protected]/emoticons", themeDisplay.getPathThemeImages() + "/emoticons");
}
if (content != null) {
List<String> links = parseLinks(content, getLinks, getImages);
if (links.size() > 0) {
portletURL.setParameter("messageId", String.valueOf(message.getMessageId()));
ContentLinks contentLinks = new ContentLinks();
contentLinks.setClassName(message.getModelClassName());
contentLinks.setClassPK(message.getMessageId());
contentLinks.setContentTitle(message.getSubject());
contentLinks.setContentEditLink(portletURL.toString());
contentLinks.setModifiedDate(message.getModifiedDate());
contentLinks.setStatus(message.getStatus());
_log.debug("Extracting links from message " + message.getMessageId() + " - " + message.getSubject());
for (String link : links) {
contentLinks.addLink(link);
}
contentLinksList.add(contentLinks);
}
}
}
return contentLinksList;
}