本文整理汇总了Java中com.liferay.portal.kernel.util.WebKeys类的典型用法代码示例。如果您正苦于以下问题:Java WebKeys类的具体用法?Java WebKeys怎么用?Java WebKeys使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WebKeys类属于com.liferay.portal.kernel.util包,在下文中一共展示了WebKeys类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: displayTerm
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
@Override
public String displayTerm(HttpServletRequest request, FacetConfiguration facetConfiguration, String queryTerm) {
String folderName = queryTerm;
if ("0".equals(queryTerm)) {
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
Locale locale = themeDisplay.getLocale();
folderName = language.get(locale, "root-folder");
} else {
Indexer<?> indexer = FolderSearcher.getInstance();
SearchContext searchContext = SearchContextFactory.getInstance(request);
searchContext.setFolderIds(new long[]{Long.parseLong(queryTerm)});
searchContext.setKeywords(StringPool.BLANK);
try {
Hits results = indexer.search(searchContext);
if (results.getLength() > 0) {
Document document = results.doc(0);
Field title = document.getField(Field.TITLE);
folderName = title.getValue();
}
} catch (SearchException e) {
LOG.warn("Could not retrieve folder name from id [" + queryTerm + "]", e);
}
}
return folderName;
}
示例2: run
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
@Override
public void run(HttpServletRequest request, HttpServletResponse response) throws ActionException {
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
Layout currentLayout = themeDisplay.getLayout();
List<Layout> searchLayouts = this.getSearchLayouts(currentLayout);
Map<Layout, List<SearchUrl>> searchUrls;
searchUrls = searchLayouts.stream()
.collect(Collectors.toMap(
Function.identity(),
layout -> generateSearchUrl(request, themeDisplay, layout)
));
request.setAttribute(REQUEST_ATTR_FLASHLIGHT_URLS, new SearchUrlContainer(searchUrls));
}
示例3: renderADT
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
/**
* Renders an ADT.
*
* @param request the request
* @param response the response
* @param templateCtx the template context
* @param templateUUID the UUID of the ADT (DDMTemplate object/table) to render
* @throws TemplateNotFoundException if no template having such UUID could be found
* @throws CouldNotRenderTemplateException if the template could not be rendered
*/
public void renderADT(RenderRequest request, RenderResponse response, Map<String, Object> templateCtx, String templateUUID) throws CouldNotRenderTemplateException, TemplateNotFoundException {
HttpServletRequest httpServletRequest = this.portal.getHttpServletRequest(request);
HttpServletResponse httpServletResponse = this.portal.getHttpServletResponse(response);
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
long companyId = themeDisplay.getCompanyId();
try {
List<DDMTemplate> ddmTemplates = this.getDDMTemplateLocalService().getDDMTemplatesByUuidAndCompanyId(templateUUID, companyId);
if (ddmTemplates.isEmpty()) {
throw new TemplateNotFoundException("No ADT found with companyId ["+companyId+"] and UUID ["+templateUUID+"]");
}
String renderedTemplate = this.getPortletDisplayTemplate().renderDDMTemplate(httpServletRequest, httpServletResponse, ddmTemplates.get(0), Collections.emptyList(), templateCtx);
response.getWriter().write(renderedTemplate);
} catch (Exception e) {
throw new CouldNotRenderTemplateException("Could not render from ADT [" + templateUUID + "]", e);
}
}
示例4: ContactGroupTerm
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
public ContactGroupTerm(ActionRequest request) {
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
contactGroupId = ParamUtil.getLong(request, CONTACT_GROUP_ID);
groupId = themeDisplay.getScopeGroupId();
companyId = themeDisplay.getCompanyId();
userId = themeDisplay.getUserId();
createDate = ParamUtil.getDate(request, CREATE_DATE,
DateTimeUtils.getDateTimeFormat(DateTimeUtils._VN_DATE_TIME_FORMAT));
modifiedDate = ParamUtil.getDate(request, MODIFIED_DATE,
DateTimeUtils.getDateTimeFormat(DateTimeUtils._VN_DATE_TIME_FORMAT));
groupName = ParamUtil.getString(request, GROUP_NAME);
contactList = ParamUtil.getString(request, CONTACT_LIST);
shared = ParamUtil.getInteger(request, SHARED);
}
示例5: getSearchContext
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
/**
* Get searchcontext.
*
* @return searchcontext object
* @throws Exception
*/
protected SearchContext getSearchContext() throws Exception {
ThemeDisplay themeDisplay =
(ThemeDisplay) _portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
SearchContext searchContext = new SearchContext();
searchContext.setCompanyId(themeDisplay.getCompanyId());
searchContext.setStart(_queryParams.getStart());
searchContext.setEnd(_queryParams.getEnd());
searchContext.setSorts(_queryParams.getSorts());
// Set facets.
_facetsBuilder.setFacets(searchContext);
return searchContext;
}
示例6: setGroupsParam
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
/**
* Set groups parameter.
*/
protected void setGroupsParam() {
ThemeDisplay themeDisplay =
(ThemeDisplay) _portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
String scopeFilter =
ParamUtil.getString(_portletRequest, GSearchWebKeys.FILTER_SCOPE);
long[] groupIds;
if ("this-site".equals(scopeFilter)) {
groupIds = new long[] {
themeDisplay.getScopeGroupId()
};
}
else {
groupIds = new long[] {};
}
_queryParams.setGroupIds(groupIds);
}
示例7: getLayoutByFriendlyURL
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
/**
* Get layout by friendlyurl.
*
* @param resourceRequest
* @return layout
* @throws PortalException if layout is not found
*/
public static Layout getLayoutByFriendlyURL(
PortletRequest portletRequest, String layoutFriendlyURL)
throws PortalException {
ThemeDisplay themeDisplay =
(ThemeDisplay) portletRequest.getAttribute(WebKeys.THEME_DISPLAY);
if (layoutFriendlyURL != null) {
return LayoutLocalServiceUtil.getFriendlyURLLayout(
themeDisplay.getScopeGroupId(),
themeDisplay.getLayout().isPrivateLayout(), layoutFriendlyURL);
}
throw new PortalException(
"Couldn't find asset publisher layout for " + layoutFriendlyURL +
". Please check configuration.");
}
示例8: MBContext
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
public MBContext(ActionRequest actionRequest) {
ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
WebKeys.THEME_DISPLAY);
//Fetch data
numberOfMB = ParamUtil.getLong(actionRequest, "numberOfMB",0);
categoryId = ParamUtil.getLong(actionRequest, "categoryId",MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID);
subject = ParamUtil.getString(actionRequest, "subject","dummy subject");
body = ParamUtil.getString(actionRequest, "body","dummy body");
anonymous = ParamUtil.getBoolean(actionRequest, "anonymous",false);
allowPingbacks = ParamUtil.getBoolean(actionRequest, "allowPingbacks",false);
priority = ParamUtil.getDouble(actionRequest, "priority",0.0);
parentCategoryId = ParamUtil.getLong(actionRequest, "parentCategoryId",MBCategoryConstants.DEFAULT_PARENT_CATEGORY_ID);
categoryName = ParamUtil.getString(actionRequest, "categoryName","dummy Category Name");
description = ParamUtil.getString(actionRequest, "description","dummy description");
threadId = ParamUtil.getLong(actionRequest, "threadId",0);
siteGroupId = ParamUtil.getLong(actionRequest, "siteGroupId",themeDisplay.getScopeGroupId());
// Sites
String[] groupsStrIds = ParamUtil.getStringValues(actionRequest, "groupIds",
new String[] { String.valueOf(themeDisplay.getScopeGroupId()) });
groupIds = CommonUtil.convertStringToLongArray(groupsStrIds);
}
示例9: create
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
/**
* Create Dummy data
*
* @param request
* @throws Exception
*/
public void create(ActionRequest request) throws Exception {
T paramContext = getContext(request);
if(!validate(paramContext)) {
throw new Exception("Validation Error");
}
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
ServiceContext serviceContext = ServiceContextFactory.getInstance(Group.class.getName(), request);
paramContext.setThemeDisplay(themeDisplay);
paramContext.setServiceContext(serviceContext);
exec(request, paramContext);
}
示例10: removePortletAction
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
/**
* Remove portlet from the page
*
* @param request The request
* @param response The response
*/
@ProcessAction(name = "removePortlet")
public void removePortletAction(ActionRequest request, ActionResponse response) throws IOException {
Layout currentLayout = (Layout) request.getAttribute(WebKeys.LAYOUT);
String portletId = ParamUtil.getString(request, RQ_PARAM_PORTLET_ID, null);
if(portletId != null) {
Matcher m = PATTERN_PORTLET_ID.matcher(portletId);
if(m.matches()) {
try {
this.serviceRef.removePortlet(currentLayout, portletId);
} catch(PortalException e) {
LOG.error("Unable to remove portlet", e);
}
}
}
}
示例11: add
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
public void add(
ActionRequest actionRequest, ActionResponse actionResponse) {
ThemeDisplay themeDisplay = (ThemeDisplay)actionRequest.getAttribute(
WebKeys.THEME_DISPLAY);
int firstParameter = ParamUtil.getInteger(
actionRequest, "firstParameter");
int secondParameter = ParamUtil.getInteger(
actionRequest, "secondParameter");
int result = _sampleService.add(firstParameter, secondParameter);
PortletURL portletURL = PortletURLFactoryUtil.create(
actionRequest, "arquillian_sample_portlet", themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
portletURL.setParameter(
"firstParameter", String.valueOf(firstParameter));
portletURL.setParameter(
"secondParameter", String.valueOf(secondParameter));
portletURL.setParameter("result", String.valueOf(result));
actionRequest.setAttribute(WebKeys.REDIRECT, portletURL.toString());
}
示例12: application_EntitlementFromRequest
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
/**
* Creates a Application_Entitlement object out of fields from the request.
*
* @param request
* @return application_Entitlement
*/
public static Application_Entitlement application_EntitlementFromRequest(ActionRequest request) {
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
Application_Entitlement model = new Application_EntitlementImpl();
_log.debug("themeDisplay.getCompanyId(): " + themeDisplay.getCompanyId());
model.setApplicationEntitlementID(ParamUtil.getLong(request, "ApplicationEntitlementId"));
model.setCompanyId(themeDisplay.getCompanyId());
model.setUserId(themeDisplay.getUserId());
model.setApplicationId(ParamUtil.getLong(request, "applicationId"));
model.setEntitlementId(ParamUtil.getLong(request, "entitlementId"));
model.setName(ParamUtil.getString(request, "name").trim());
model.setMotivation(ParamUtil.getString(request, "motivation").trim());
return model;
}
示例13: legalDetailsFromRequest
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
/**
* Creates a LegalDetails object out of fields from the request.
*
* @param request
* @return legalDetails
*/
public static LegalDetails legalDetailsFromRequest(ActionRequest request) {
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
LegalDetails model = new LegalDetailsImpl();
model.setCompanyId(themeDisplay.getCompanyId());
model.setUserId(themeDisplay.getUserId());
model.setLegalDetailsId(ParamUtil.getLong(request, "legalDetailsId"));
model.setAddress(ParamUtil.getString(request, "address").trim());
model.setEmail(ParamUtil.getString(request, "email").trim());
model.setFax(ParamUtil.getString(request, "fax").trim());
model.setLegalForm(ParamUtil.getString(request, "legalForm").trim());
model.setName(ParamUtil.getString(request, "name").trim());
model.setRegistrationCourt(ParamUtil.getString(request, "registrationCourt").trim());
model.setTelephone(ParamUtil.getString(request, "telephone").trim());
model.setURL(ParamUtil.getString(request, "URL").trim());
model.setValueAddedTaxNo(ParamUtil.getString(request, "valueAddedTaxNo").trim());
return model;
}
示例14: regionFromRequest
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
/**
* Creates a Region object out of fields from the request.
*
* @param request
* @return region
*/
public static Region regionFromRequest(ActionRequest request) {
ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);
Region model = new RegionImpl();
model.setCompanyId(themeDisplay.getCompanyId());
model.setUserId(themeDisplay.getUserId());
model.setRegionId(ParamUtil.getLong(request, "regionId"));
model.setAgs(ParamUtil.getInteger(request, "ags"));
model.setCoordniates_x(ParamUtil.getDouble(request, "coordniates_x"));
model.setCoordniates_y(ParamUtil.getDouble(request, "coordniates_y"));
model.setName(ParamUtil.getString(request, "regionName").trim());
model.setParentRegion(ParamUtil.getLong(request, "parentRegionId"));
return model;
}
示例15: getURLViewInContext
import com.liferay.portal.kernel.util.WebKeys; //导入依赖的package包/类
@Override
public final String getURLViewInContext(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse,
String noSuchEntryRedirect) throws Exception {
ThemeDisplay themeDisplay = (ThemeDisplay) liferayPortletRequest.getAttribute(WebKeys.THEME_DISPLAY);
PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(_layout.getPlid(), _portletId, PortletRequest.RENDER_PHASE);
portletURL.setParameter("actId",Long.toString( _learningactivity.getActId()));
portletURL.setParameter("moduleId",Long.toString( _learningactivity.getModuleId()));
portletURL.setParameter("actionEditingActivity", StringPool.FALSE);
portletURL.setParameter("actionEditingDetails", StringPool.FALSE);
portletURL.setParameter("actionEditingModule", StringPool.FALSE);
portletURL.setParameter("actionCalifications", StringPool.FALSE);
portletURL.setParameter("activityStarted", StringPool.TRUE);
String mvcPath = getMvcPathView(themeDisplay.getUserId(),liferayPortletResponse,liferayPortletRequest.getWindowState());
if(Validator.isNotNull(mvcPath)){
portletURL.setParameter("mvcPath",mvcPath);
}
prepareRuntimePortlet(portletURL);
return portletURL.toString();
}