本文整理汇总了Java中com.liferay.portal.util.PortletKeys.PREFS_OWNER_ID_DEFAULT属性的典型用法代码示例。如果您正苦于以下问题:Java PortletKeys.PREFS_OWNER_ID_DEFAULT属性的具体用法?Java PortletKeys.PREFS_OWNER_ID_DEFAULT怎么用?Java PortletKeys.PREFS_OWNER_ID_DEFAULT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.liferay.portal.util.PortletKeys
的用法示例。
在下文中一共展示了PortletKeys.PREFS_OWNER_ID_DEFAULT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setPortletArticle
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: deleteVoiceCommand
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;
}
示例3: checkArticleOnLayout
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;
}
示例4: test
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);
}
}