本文整理汇总了Java中com.liferay.portal.service.LayoutLocalServiceUtil类的典型用法代码示例。如果您正苦于以下问题:Java LayoutLocalServiceUtil类的具体用法?Java LayoutLocalServiceUtil怎么用?Java LayoutLocalServiceUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LayoutLocalServiceUtil类属于com.liferay.portal.service包,在下文中一共展示了LayoutLocalServiceUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: dossierDangkyAction
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的package包/类
public void dossierDangkyAction(ActionRequest request,
ActionResponse response) throws PortletException, IOException {
ThemeDisplay themeDisplay = (ThemeDisplay) request
.getAttribute(WebKeys.THEME_DISPLAY);
String pageName = "/dichvucongtructuyen";
String portletName = "oepeserviceregisteronline_WAR_oepeserviceportlet";
String dossierProcId = ParamUtil
.getString(request, "dossierProcId", "");
long plid = 0L;
try {
plid = LayoutLocalServiceUtil.getFriendlyURLLayout(
themeDisplay.getScopeGroupId(), false, pageName).getPlid();
} catch (Exception e) {
e.printStackTrace();
}
PortletURL redirectURL = PortletURLFactoryUtil.create(
PortalUtil.getHttpServletRequest(request), portletName, plid,
PortletRequest.RENDER_PHASE);
redirectURL.setParameter("dossierProcId", dossierProcId);
redirectURL.setParameter("data", "This Value Comes From Welcome Page");
response.sendRedirect(redirectURL.toString());
}
示例2: createDefaultSiteTemplate
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的package包/类
public void createDefaultSiteTemplate(long companyId) throws PortalException, SystemException
{
boolean exists = false;
long layoutSetPrototypeId = 0;
for(LayoutSetPrototype lay:LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototypes(0, LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototypesCount())){
if(lay.getCompanyId() == companyId && "course".equals(lay.getName(LocaleUtil.getDefault()))) {
exists=true;
layoutSetPrototypeId = lay.getLayoutSetPrototypeId();
}
}
if(!exists){
long defaultUserId = UserLocalServiceUtil.getDefaultUserId(companyId);
Map<Locale, String> nameMap = new HashMap<Locale, String>();
nameMap.put(LocaleUtil.getDefault(), "course");
layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil.addLayoutSetPrototype(defaultUserId, companyId, nameMap, "course", true,true,new ServiceContext());
InputStream larStream=this.getClass().getClassLoader().getResourceAsStream("/course.lar");
LayoutLocalServiceUtil.importLayouts(defaultUserId,layoutSetPrototype.getGroup().getGroupId() ,
layoutSetPrototype.getLayoutSet().isPrivateLayout(), getLayoutSetPrototypeParameters(), larStream);
} else {
layoutSetPrototype = LayoutSetPrototypeLocalServiceUtil.getLayoutSetPrototype(layoutSetPrototypeId);
}
}
示例3: addPortletToPage
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的package包/类
public static String addPortletToPage(Layout layout, String portletId, E_ContextPath path, long userId) {
String result = null;
try {
LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) layout.getLayoutType();
// count all portlets currently registered for this column
List<Portlet> portlets = layoutTypePortlet.getAllPortlets(path.getColumnId());
int colSize = portlets != null ? portlets.size() : 0;
// add new portlet at the very end
result = layoutTypePortlet.addPortletId(userId, portletId, path.getColumnId(), colSize, false);
// update the layout
LayoutLocalServiceUtil.updateLayout(layout.getGroupId(),
layout.isPrivateLayout(),
layout.getLayoutId(),
layout.getTypeSettings());
} catch (Throwable t) {
m_objLog.warn(t);
}
return result;
}
示例4: makeElementoComunidade
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的package包/类
private ElementoComunidade makeElementoComunidade(Group grp,
ThemeDisplay td)
throws SystemException, PortalException {
long plid;
long grpId = grp.getGroupId();
if (grp.getPrivateLayoutsPageCount() > 0)
plid = LayoutLocalServiceUtil.getDefaultPlid(grpId, true);
else
plid = LayoutLocalServiceUtil.getDefaultPlid(grpId, false);
Layout layout = LayoutLocalServiceUtil.getLayout(plid);
String grpUrl = PortalUtil.getLayoutURL(layout, td, true);
String grpName = grp.getName();
String grpImgUrl = CommunityIconFinder.findUrl(td, grpId);
return new ElementoComunidade(grpUrl, grpName, grpImgUrl);
}
示例5: getMicroSiteURL
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的package包/类
public static String getMicroSiteURL(PortletRequest request, long groupId)
throws PortalException, SystemException {
String scheme = request.getScheme();
String serverName = request.getServerName();
int serverPort = request.getServerPort();
Group liveGroup = GroupLocalServiceUtil.getGroup(groupId);
int layoutCount = LayoutLocalServiceUtil.getLayoutsCount(liveGroup, false);
if(layoutCount > 0) {
return scheme + HTTP_PREFIX + serverName + StringPool.COLON + serverPort + StringPool.FORWARD_SLASH
+ PUBLIC_PAGE_PREFIX + liveGroup.getFriendlyURL();
}
layoutCount = LayoutLocalServiceUtil.getLayoutsCount(liveGroup, true);
if(layoutCount > 0) {
return scheme + HTTP_PREFIX + serverName + StringPool.COLON + serverPort + StringPool.FORWARD_SLASH
+ PRIVATE_PAGE_PREFIX + liveGroup.getFriendlyURL();
}
return StringPool.POUND;
}
示例6: getUsableJunctionPoints
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的package包/类
@Override
public List<Layout> getUsableJunctionPoints(Layout layout) throws SystemException, PortalException {
long companyId = CompanyThreadLocal.getCompanyId();
long classNameId = ClassNameLocalServiceUtil.getClassNameId(Layout.class);
// Ermittle die Menge aller erlaubten GroupIds
Set<Long> usableGroupIds = getHierarchicalGroupIds(layout);
List<Layout> layouts = new ArrayList<Layout>();
List<ExpandoValue> values = ExpandoValueLocalServiceUtil.getColumnValues(companyId, classNameId,
ExpandoTableConstants.DEFAULT_TABLE_NAME, JUNCTION_POINT_LAYOUT, Boolean.TRUE.toString(), -1, -1);
for (ExpandoValue expandoValue : values) {
long classPK = expandoValue.getClassPK();
Layout jpLayout = LayoutLocalServiceUtil.fetchLayout(classPK);
if (jpLayout != null && usableGroupIds.contains(jpLayout.getGroupId())) {
layouts.add(jpLayout);
}
}
sortLayouts(layouts);
return layouts;
}
示例7: setupPage
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的package包/类
protected void setupPage(long userId, long groupId, PortalPage portalPage, boolean privateLayout) throws Exception {
String portalPageName = portalPage.getName();
String[] portletIds = portalPage.getPortletIds();
Layout portalPageLayout = getPortalPageLayout(userId, groupId, portalPageName, privateLayout);
LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) portalPageLayout.getLayoutType();
layoutTypePortlet.setLayoutTemplateId(userId, "2_columns_i", false);
int columnNumber = 1;
for (String portletId : portletIds) {
if (portletId.endsWith("_INSTANCE_")) {
portletId = portletId + "ABCD";
}
addPortlet(layoutTypePortlet, userId, columnNumber, portletId);
columnNumber++;
}
LayoutLocalServiceUtil.updateLayout(portalPageLayout);
logger.info("Setting up page name=[" + portalPageName + "]");
}
示例8: getPortalPageLayout
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的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;
}
示例9: listChucDanh1
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的package包/类
public void listChucDanh1(ActionRequest request,
ActionResponse response) throws PortletException, IOException {
ThemeDisplay themeDisplay = (ThemeDisplay) request
.getAttribute(WebKeys.THEME_DISPLAY);
System.out.println(" ----------- " + themeDisplay.getPortletDisplay().getPortletName());
String portletName = "jobposmanagement_WAR_oepusermgtportlet";
String pageName = "/dichvucongtructuyen";
//String portletName = "oepeserviceregisteronline_WAR_oepeserviceportlet";
String dossierProcId = ParamUtil
.getString(request, "dossierProcId", "");
long plid = 0L;
try {
plid = LayoutLocalServiceUtil.getFriendlyURLLayout(
themeDisplay.getScopeGroupId(), false, pageName).getPlid();
} catch (Exception e) {
e.printStackTrace();
}
long workingUnitId = ParamUtil
.getLong(request, WorkingUnitKeys.BaseWorkingUnitAttributes.EDIT_ID, PortletKeys.LONG_DEFAULT);
PortletURL redirectURL = PortletURLFactoryUtil.create(
PortalUtil.getHttpServletRequest(request), portletName, themeDisplay.getPlid(),
PortletRequest.RENDER_PHASE);
redirectURL.setParameter(WorkingUnitKeys.BaseWorkingUnitAttributes.EDIT_ID, String.valueOf(workingUnitId));
response.sendRedirect(redirectURL.toString());
}
示例10: listCanBo
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的package包/类
public void listCanBo(ActionRequest request,
ActionResponse response) throws PortletException, IOException {
ThemeDisplay themeDisplay = (ThemeDisplay) request
.getAttribute(WebKeys.THEME_DISPLAY);
//ThemeDisplay themeDisplay = (ThemeDisplay)request.getAttribute(WebKeys.THEME_DISPLAY);
String pageName = "/danh-sach-can-bo";
String portletName = "employeemanagement_WAR_oepusermgtportlet";
long plid = 0L;
try {
plid = LayoutLocalServiceUtil.getFriendlyURLLayout(
themeDisplay.getScopeGroupId(), false, pageName).getPlid();
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(" ----------- " + pageName + " " + themeDisplay.getPlid());
long workingUnitId = ParamUtil
.getLong(request, WorkingUnitKeys.BaseWorkingUnitAttributes.EDIT_ID, PortletKeys.LONG_DEFAULT);
PortletURL redirectURL = PortletURLFactoryUtil.create(
PortalUtil.getHttpServletRequest(request), portletName, plid,
PortletRequest.RENDER_PHASE);
redirectURL.setParameter(WorkingUnitKeys.BaseWorkingUnitAttributes.EDIT_ID, String.valueOf(workingUnitId));
response.sendRedirect(redirectURL.toString());
}
示例11: getLayouts
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的package包/类
public List<Layout> getLayouts(){
try {
return LayoutLocalServiceUtil.getLayouts(getGroupId(), false);
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
}
示例12: LearningActivityBaseAssetRenderer
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的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;
}
}
示例13: getURLCreateModule
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的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;
}
示例14: getPlid
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的package包/类
private long getPlid(long courseId,ThemeDisplay themeDisplay) throws SystemException{
if((Validator.isNull(courseId))&&
(themeDisplay.getLayout().getFriendlyURL().equals("/reto"))) {
return themeDisplay.getLayout().getPlid();
}
Course course = null;
if(Validator.isNotNull(courseId)) {
course = CourseLocalServiceUtil.fetchCourse(courseId);
}
if(Validator.isNull(course)) {
course = CourseLocalServiceUtil.fetchByGroupCreatedId(themeDisplay.getScopeGroupId());
}
if(Validator.isNull(course)) {
return GetterUtil.DEFAULT_LONG;
}
@SuppressWarnings("unchecked")
List<Layout> layouts = LayoutLocalServiceUtil.dynamicQuery(LayoutLocalServiceUtil.dynamicQuery().
add(PropertyFactoryUtil.forName("privateLayout").eq(false)).
add(PropertyFactoryUtil.forName("companyId").eq(course.getCompanyId())).
add(PropertyFactoryUtil.forName("groupId").eq(course.getGroupCreatedId())).
add(PropertyFactoryUtil.forName("friendlyURL").eq("/reto")),0,1);
if(layouts.isEmpty()) {
return GetterUtil.DEFAULT_LONG;
}
else {
return layouts.get(0).getPlid();
}
}
示例15: load
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入依赖的package包/类
@Override
public Layout load(final PortletPreferences preferences, final String key, final String defaultValue) {
final String uuid = preferences.getValue(key, "");
if (StringUtils.isEmpty(uuid)) {
return null;
}
final long companyId = ServiceContextThreadLocal.getServiceContext().getCompanyId();
try {
return LayoutLocalServiceUtil.getLayoutByUuidAndCompanyId(uuid, companyId);
} catch (final SystemException | PortalException e) {
log.error("Could not load layout {}", uuid, e);
return null;
}
}