本文整理汇总了Java中com.liferay.portal.model.LayoutConstants类的典型用法代码示例。如果您正苦于以下问题:Java LayoutConstants类的具体用法?Java LayoutConstants怎么用?Java LayoutConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LayoutConstants类属于com.liferay.portal.model包,在下文中一共展示了LayoutConstants类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolveListViewRedirectPage
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
/**
* Verifica se a comunidade atual possui alguma página com o portlet de
* todas as comunidades. Se encontrar alguma, faz o redirect para a página.
* Se não encontrar envia para a página de listagem padrão onde são exibidas
* somente as salas da comunidade atual.
*
* @throws SystemException
* @throws PortalException
* @throws IOException
*
*/
private void resolveListViewRedirectPage(ActionRequest req, ActionResponse rsp) throws PortalException, SystemException, IOException {
ThemeDisplay td = (ThemeDisplay) req.getAttribute(WebKeys.THEME_DISPLAY);
long plid = PortalUtil.getPlidFromPortletId(td.getScopeGroupId(), CD_CHAT_ROOM_COMPLETE_LIST_PORTLET_ID);
if (plid != LayoutConstants.DEFAULT_PLID) {
PortletURL portletURL = PortletURLFactoryUtil.create(req, CD_CHAT_ROOM_COMPLETE_LIST_PORTLET_ID, plid, PortletRequest.ACTION_PHASE);
portletURL.setParameter("javax.portlet.action", "listChatRooms");
portletURL.setParameter("p_p_lifecycle", "1");
String url = portletURL.toString();
rsp.sendRedirect(url);
} else {
rsp.setRenderParameter(ChatPortletConstants.VIEW_PARAM, ChatRoomView.LIST.getUrlParamValue());
}
}
示例2: montarlinkParaSala
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
private String montarlinkParaSala(Long roomId, String lifecycle, String parameterKey, String parameterValue, String parameter_p_p_LifeCycle) {
String url = StringPool.BLANK;
try {
ChatRoom chatRoom = ChatRoomLocalServiceUtil.getChatRoom(roomId);
long groupId = chatRoom.getGroupId();
long plid = PortalUtil.getPlidFromPortletId(groupId, CD_CHAT_ROOM_PORTLET_ID);
if (plid != LayoutConstants.DEFAULT_PLID) {
PortletRequest request = (PortletRequest) LiferayFacesContext.getInstance().getExternalContext().getRequest();
PortletURL portletURL = PortletURLFactoryUtil.create(request, CD_CHAT_ROOM_PORTLET_ID, plid, lifecycle);
portletURL.setParameter(parameterKey, parameterValue);
portletURL.setParameter("roomId", roomId.toString());
portletURL.setParameter("p_p_lifecycle", parameter_p_p_LifeCycle);
url = portletURL.toString();
// LiferayFacesContext.getInstance().getExternalContext().redirect(url);
// // colocar quando sair nova versão do bridge jsf do liferay
// (stateless)
LinkSalasCacheUtil.setLinkEntrar(roomId, url);
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return url;
}
示例3: getParentLayoutId
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
@Override
public long getParentLayoutId() {
long parentLayoutId = super.getParentLayoutId();
if (parentLayoutId == LayoutConstants.DEFAULT_PARENT_LAYOUT_ID) {
Layout junctionPointLayout = JunctionPointUtil.getConfiguredJunctionPointLayout(getWrappedModel());
if (junctionPointLayout != null && junctionPointLayout.getParentLayoutId() != LayoutConstants.DEFAULT_PARENT_LAYOUT_ID) {
// HACK! Das Breadcrumb-Portlet fragt erst die ParentLayoutId ab und ruft danach getParentLayout, falls die ID != 0 ist.
// andere Klassen machen dies aber leider ganz anders.
StackTraceElement stackTraceElement = new Exception().getStackTrace()[1];
if ("com.liferay.taglib.ui.BreadcrumbTag".equals(stackTraceElement.getClassName())) {
return -1;
}
}
}
return parentLayoutId;
}
示例4: getPortalPageLayout
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
protected Layout getPortalPageLayout(long userId, long groupId, String portalPageName, boolean privateLayout)
throws Exception {
Layout portalPageLayout = null;
List<Layout> layouts = LayoutLocalServiceUtil.getLayouts(groupId, privateLayout);
for (Layout layout : layouts) {
if (layout.getName(Locale.US).equals(portalPageName)) {
portalPageLayout = layout;
}
}
if (portalPageLayout == null) {
long parentLayoutId = LayoutConstants.DEFAULT_PARENT_LAYOUT_ID;
String type = LayoutConstants.TYPE_PORTLET;
boolean hidden = false;
String friendlyURL = "/" + portalPageName.toLowerCase();
portalPageLayout = ServiceUtil.addLayout(userId, groupId, privateLayout, parentLayoutId, portalPageName,
portalPageName, portalPageName, type, hidden, friendlyURL);
}
return portalPageLayout;
}
示例5: getLayoutView
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
public LayoutView getLayoutView(
long groupId, boolean privateLayout, String rootNodeName,
Locale locale)
throws PortalException, SystemException {
_groupId = groupId;
_privateLayout = privateLayout;
_locale = locale;
_nodeId = 1;
_list = new ArrayList<String>();
_list.add(
"1|0|0|" + LayoutConstants.DEFAULT_PLID + "|" + rootNodeName +
"|0");
_createList(LayoutConstants.DEFAULT_PARENT_LAYOUT_ID, _nodeId, 0);
return new LayoutView(_list, _depth);
}
示例6: LearningActivityBaseAssetRenderer
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
public LearningActivityBaseAssetRenderer (LearningActivity learningactivity, LearningActivityType learningActivityType, boolean isLmsExternalTemplates) throws SystemException,PortalException {
_learningactivity = learningactivity;
_nameKey = learningActivityType.getName();
_portletId = learningActivityType.getPortletId();
_editDetails = learningActivityType.hasEditDetails();
_isLmsExternalTemplates = isLmsExternalTemplates;
ThreadLocalCache<Layout> threadLocalCache =
ThreadLocalCacheManager.getThreadLocalCache(
Lifecycle.REQUEST, LearningActivityBaseAssetRenderer.class.getName());
String layoutKey = _learningactivity.getCompanyId()+StringPool.SLASH+_learningactivity.getGroupId();
_layout = threadLocalCache.get(layoutKey);
if(Validator.isNull(_layout)) {
@SuppressWarnings("unchecked")
List<Layout> layouts = LayoutLocalServiceUtil.dynamicQuery(LayoutLocalServiceUtil.dynamicQuery().
add(PropertyFactoryUtil.forName("privateLayout").eq(false)).
add(PropertyFactoryUtil.forName("type").eq(LayoutConstants.TYPE_PORTLET)).
add(PropertyFactoryUtil.forName("companyId").eq(_learningactivity.getCompanyId())).
add(PropertyFactoryUtil.forName("groupId").eq(_learningactivity.getGroupId())).
add(PropertyFactoryUtil.forName("friendlyURL").eq("/reto")), 0, 1);
if(layouts.isEmpty()) {
throw new NoSuchLayoutException();
}
_layout = layouts.get(0);
threadLocalCache.put(layoutKey, _layout);
}
if(!((LayoutTypePortlet)_layout.getLayoutType()).getPortletIds().contains(_portletId)){
_isRuntimePortlet = true;
}
}
示例7: getURLCalifications
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
public static final PortletURL getURLCalifications(LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse, LearningActivity activity) throws Exception {
long plid = PortalUtil.getPlidFromPortletId(activity.getGroupId(), ACTIVITY_VIEWER_PORTLET_ID);
log.debug("PLID: "+plid);
if (plid == LayoutConstants.DEFAULT_PLID) {
throw new NoSuchLayoutException();
}
PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(plid, LMS_EDITACTIVITY_PORTLET_ID, PortletRequest.RENDER_PHASE);
portletURL.setWindowState(WindowState.NORMAL);
portletURL.setParameter("actionEditingDetails", StringPool.FALSE);
portletURL.setParameter("actionEditingActivity", StringPool.FALSE);
portletURL.setParameter("actionEditingModule", StringPool.FALSE);
portletURL.setParameter("actionCalifications", StringPool.TRUE);
portletURL.setParameter("actId",Long.toString( activity.getActId()));
long userId = PrincipalThreadLocal.getUserId();
if(Validator.isNotNull(userId)) {
//portletURL.setParameter("mvcPath", "/html/editactivity/editactivity.jsp");
portletURL.setParameter("califications", StringPool.TRUE);
portletURL.setParameter("editing", StringPool.FALSE);
portletURL.setParameter("resId",Long.toString( activity.getActId()));
portletURL.setParameter("resModuleId",Long.toString( activity.getModuleId()));
}
portletURL.setParameter("p_o_p_id",ACTIVITY_VIEWER_PORTLET_ID);
//log.debug(" getURLCalifications: "+portletURL);
return portletURL;
}
示例8: getURLEditActivity
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
public static final PortletURL getURLEditActivity(LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse, LearningActivity activity) throws Exception {
PortletURL portletURL = null;
if(activity!=null){
long plid = PortalUtil.getPlidFromPortletId(activity.getGroupId(), ACTIVITY_VIEWER_PORTLET_ID);
log.debug("PLID: "+plid);
if (plid == LayoutConstants.DEFAULT_PLID) {
throw new NoSuchLayoutException();
}
portletURL = liferayPortletResponse.createLiferayPortletURL(plid, LMS_EDITACTIVITY_PORTLET_ID, PortletRequest.RENDER_PHASE);
portletURL.setWindowState(WindowState.NORMAL);
portletURL.setParameter("actId",Long.toString( activity.getActId()));
portletURL.setParameter("moduleId",Long.toString( activity.getModuleId()));
portletURL.setParameter("actionEditingActivity", StringPool.TRUE);
portletURL.setParameter("actionCalifications", StringPool.FALSE);
portletURL.setParameter("actionEditingModule", StringPool.FALSE);
portletURL.setParameter("actionEditingDetails", StringPool.FALSE);
long userId = PrincipalThreadLocal.getUserId();
if(Validator.isNotNull(userId)) {
portletURL.setParameter("mvcPath", "/html/editactivity/editactivity.jsp");
portletURL.setParameter("editing", StringPool.TRUE);
portletURL.setParameter("resId",Long.toString( activity.getActId()));
portletURL.setParameter("resModuleId",Long.toString( activity.getModuleId()));
}
portletURL.setParameter("p_o_p_id",ACTIVITY_VIEWER_PORTLET_ID);
//log.debug(" getURLEditActivity: "+portletURL);
}
return portletURL;
}
示例9: getURLCreateActivity
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
public static final PortletURL getURLCreateActivity(LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse, Module module) throws Exception {
PortletURL portletURL = null;
if(module!=null){
long plid = PortalUtil.getPlidFromPortletId(module.getGroupId(), ACTIVITY_VIEWER_PORTLET_ID);
log.debug("PLID: "+plid);
if (plid == LayoutConstants.DEFAULT_PLID) {
throw new NoSuchLayoutException();
}
portletURL = liferayPortletResponse.createLiferayPortletURL(plid, LMS_EDITACTIVITY_PORTLET_ID, PortletRequest.RENDER_PHASE);
portletURL.setWindowState(WindowState.NORMAL);
portletURL.setParameter("actionEditingActivity", StringPool.TRUE);
portletURL.setParameter("actionEditingDetails", StringPool.FALSE);
portletURL.setParameter("mvcPath", "/html/lmsactivitieslist/newactivity.jsp");
portletURL.setParameter("resModuleId",Long.toString(module.getModuleId()));
portletURL.setParameter("actId",Long.toString(0));
portletURL.setParameter("resId",Long.toString(0));
portletURL.setParameter("p_o_p_id",ACTIVITY_VIEWER_PORTLET_ID);
log.debug(" getURLCreateActivity: "+portletURL);
}
return portletURL;
}
示例10: getURLEditModule
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
public static final PortletURL getURLEditModule(LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse, Module module) throws Exception {
PortletURL portletURL = null;
if(module!=null){
long plid = PortalUtil.getPlidFromPortletId(module.getGroupId(), ACTIVITY_VIEWER_PORTLET_ID);
log.debug("PLID: "+plid);
if (plid == LayoutConstants.DEFAULT_PLID) {
throw new NoSuchLayoutException();
}
portletURL = liferayPortletResponse.createLiferayPortletURL(plid, LMS_EDITMODULE_PORTLET_ID, PortletRequest.RENDER_PHASE);
portletURL.setWindowState(WindowState.NORMAL);
portletURL.setParameter("actionEditingModule", StringPool.TRUE);
portletURL.setParameter("actionEditingActivity", StringPool.FALSE);
portletURL.setParameter("actionEditingDetails", StringPool.FALSE);
portletURL.setParameter("actionCalifications", StringPool.FALSE);
portletURL.setParameter("view", "editmodule");
portletURL.setParameter("moduleId",Long.toString(module.getModuleId()));
portletURL.setParameter("actId","");
portletURL.setParameter("resourcePrimKey",Long.toString(module.getModuleId()));
portletURL.setParameter("editType","edit");
portletURL.setParameter("p_o_p_id",ACTIVITY_VIEWER_PORTLET_ID);
//log.debug(" getURLEditModule: "+portletURL);
}
return portletURL;
}
示例11: getURLCreateModule
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
public static final PortletURL getURLCreateModule(LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse, ThemeDisplay themeDisplay) throws Exception {
Layout layout = null;
@SuppressWarnings("unchecked")
List<Layout> layouts = LayoutLocalServiceUtil.dynamicQuery(LayoutLocalServiceUtil.dynamicQuery().
add(PropertyFactoryUtil.forName("privateLayout").eq(false)).
add(PropertyFactoryUtil.forName("type").eq(LayoutConstants.TYPE_PORTLET)).
add(PropertyFactoryUtil.forName("companyId").eq(themeDisplay.getCompanyId())).
add(PropertyFactoryUtil.forName("groupId").eq(themeDisplay.getScopeGroupId())).
add(PropertyFactoryUtil.forName("friendlyURL").eq("/reto")), 0, 1);
if(layouts.isEmpty()) {
throw new NoSuchLayoutException();
}
layout = layouts.get(0);
PortletURL portletURL = liferayPortletResponse.createLiferayPortletURL(layout.getPlid(), LMS_EDITMODULE_PORTLET_ID, PortletRequest.RENDER_PHASE);
portletURL.setWindowState(WindowState.NORMAL);
portletURL.setParameter("actionEditingModule", StringPool.TRUE);
portletURL.setParameter("actionEditingActivity", StringPool.FALSE);
portletURL.setParameter("actionEditingDetails", StringPool.FALSE);
portletURL.setParameter("actionCalifications", StringPool.FALSE);
portletURL.setParameter("view", "editmodule");
portletURL.setParameter("moduleId",Long.toString(0));
portletURL.setParameter("actId","");
portletURL.setParameter("resourcePrimKey",Long.toString(0));
portletURL.setParameter("editType","add");
portletURL.setParameter("p_o_p_id",ACTIVITY_VIEWER_PORTLET_ID);
//log.debug(" getURLCreateModule: "+portletURL);
return portletURL;
}
示例12: getUltimaPaginaVisitada
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
/**
* Obtem a última URL acessada pelo usuário, antes da página de cadastro
*
* @param req
* @return
* @throws SystemException
* @throws PortalException
*/
public static long getUltimaPaginaVisitada() throws PortalException, SystemException {
LiferayFacesContext facesContext = LiferayFacesContext.getInstance();
long companyId = facesContext.getCompanyId();
PortletRequest req = facesContext.getPortletRequest();
LastPath lp = (LastPath) req.getPortletSession().getAttribute(WebKeys.LAST_PATH, PortletSession.APPLICATION_SCOPE);
// Plid da página para onde redirecionar de volta: ou para a
// página de onde veio
// ou para a página incial
long plid = LayoutConstants.DEFAULT_PLID;
if (lp != null) {
plid = getPlidFromFriendlyURL(companyId, lp.getContextPath() + lp.getPath());
_log.info("PLID : " + plid + " lp " + lp.getContextPath() + lp.getPath());
} else {
_log.info("LP NULL");
}
// Página inicial
if (plid == LayoutConstants.DEFAULT_PLID) {
Group grupoGuest = GroupLocalServiceUtil.getGroup(companyId, GroupConstants.GUEST);
try {
Layout layout = LayoutLocalServiceUtil.getFriendlyURLLayout(grupoGuest.getGroupId(), false, "/principal");
plid = layout.getPlid();
} catch (NoSuchLayoutException e) {
plid = LayoutLocalServiceUtil.getDefaultPlid(grupoGuest.getGroupId(), false);
}
}
return plid;
}
示例13: montarlinkParaBotaoVoltar
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
private String montarlinkParaBotaoVoltar() {
String url = StringPool.BLANK;
try {
ThemeDisplay themeDisplay = (ThemeDisplay) LiferayFacesContext.getInstance().getPortletRequest().getAttribute(WebKeys.THEME_DISPLAY);
long plid = themeDisplay.getPlid();
if (plid != LayoutConstants.DEFAULT_PLID) {
PortletRequest request = (PortletRequest) LiferayFacesContext.getInstance().getExternalContext().getRequest();
PortletURL portletURL = PortletURLFactoryUtil.create(request, CD_CHAT_ROOM_COMPLETE_LIST_PORTLET_ID, plid, PortletRequest.RENDER_PHASE);
url = portletURL.toString();
}
} catch (Exception e) {
throw new RuntimeException(e);
}
return url;
}
示例14: getURLViewInContext
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
@Override
public String getURLViewInContext(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse,
String noSuchEntryRedirect) {
try {
long plid = PortalUtil.getPlidFromPortletId(
_song.getGroupId(), PortletKeys.SONGS);
if (plid == LayoutConstants.DEFAULT_PLID) {
return StringPool.BLANK;
}
PortletURL portletURL = PortletURLFactoryUtil.create(
liferayPortletRequest, PortletKeys.SONGS, plid,
PortletRequest.RENDER_PHASE);
portletURL.setParameter("jspPage", "/html/songs/view_song.jsp");
portletURL.setParameter(
"songId", String.valueOf(_song.getSongId()));
return portletURL.toString();
}
catch (Exception e) {
}
return StringPool.BLANK;
}
示例15: getURLViewInContext
import com.liferay.portal.model.LayoutConstants; //导入依赖的package包/类
@Override
public String getURLViewInContext(
LiferayPortletRequest liferayPortletRequest,
LiferayPortletResponse liferayPortletResponse,
String noSuchEntryRedirect) {
try {
long plid = PortalUtil.getPlidFromPortletId(
_album.getGroupId(), PortletKeys.ALBUMS);
if (plid == LayoutConstants.DEFAULT_PLID) {
return StringPool.BLANK;
}
PortletURL portletURL = PortletURLFactoryUtil.create(
liferayPortletRequest, PortletKeys.ALBUMS, plid,
PortletRequest.RENDER_PHASE);
portletURL.setParameter("jspPage", "/html/albums/view_album.jsp");
portletURL.setParameter(
"albumId", String.valueOf(_album.getAlbumId()));
return portletURL.toString();
}
catch (Exception e) {
}
return StringPool.BLANK;
}