本文整理汇总了Java中com.liferay.portal.service.LayoutLocalServiceUtil.updateLayout方法的典型用法代码示例。如果您正苦于以下问题:Java LayoutLocalServiceUtil.updateLayout方法的具体用法?Java LayoutLocalServiceUtil.updateLayout怎么用?Java LayoutLocalServiceUtil.updateLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.liferay.portal.service.LayoutLocalServiceUtil
的用法示例。
在下文中一共展示了LayoutLocalServiceUtil.updateLayout方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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 + "]");
}
示例3: createLayout
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入方法依赖的package包/类
public static Layout createLayout(long adminId, long companyId, long groupId, E_ContextPath path, String actualPath) {
Layout result = null;
boolean privateLayout = false;
String description = null;
String type = path.getType();
long parentLayoutId = path.isHidden() ? homeLayoutId : LayoutConstants.DEFAULT_PARENT_LAYOUT_ID;
ServiceContext ctx = new ServiceContext();
if (actualPath == null)
actualPath = path.getPath();
try {
result = LayoutLocalServiceUtil.addLayout(adminId, groupId,
privateLayout, parentLayoutId, path.getName(), path.getTitle(), description,
type, path.isHidden(), actualPath, ctx);
// layout.setLayoutPrototypeLinkEnabled(false);
if (!type.equals(LayoutConstants.TYPE_URL)) {
Theme theme = getTheme(companyId, path.getThemeId());
if (theme != null) {
result.setThemeId(path.getThemeId());
result = LayoutLocalServiceUtil.updateLookAndFeel(groupId,
false, result.getLayoutId(), path.getThemeId(), "01", "", false);
} else
m_objLog.warn("Did not find theme: " + path.getThemeId() + " for url "
+ path.getPath());
LayoutTemplate template = getLayoutTemplate(path.getTemplateId());
LayoutTypePortlet layoutTypePortlet = (LayoutTypePortlet) result
.getLayoutType();
if (template != null) {
layoutTypePortlet.setLayoutTemplateId(0, path.getTemplateId(), false);
m_objLog.debug("Set layout template: "
+ template.getLayoutTemplateId() + " for url "
+ path.getPath());
} else
m_objLog.warn("Did not find layout template: " + path.getTemplateId()
+ " for url " + path.getPath());
} else {
// set the value of the "link to page"
UnicodeProperties props = result.getTypeSettingsProperties();
props.put( "url", path.getTitle() );
result.setTypeSettingsProperties( props );
LayoutLocalServiceUtil.updateLayout( result ); //
}
m_objLog.debug("Added layout for url " + actualPath + ", group: "
+ groupId + ", company: " + companyId + ", user: "
+ adminId);
updatePermissions(result, path);
} catch (Throwable t) {
m_objLog.error(t);
}
return result;
}
示例4: addLayoutTemplate
import com.liferay.portal.service.LayoutLocalServiceUtil; //导入方法依赖的package包/类
protected void addLayoutTemplate(InputStream inputStream) throws Exception {
String content = StringUtil.read(inputStream);
if (Validator.isNull(content)) {
return;
}
JSONObject jsonObject = JSONFactoryUtil.createJSONObject(content);
JSONObject layoutTemplateJSONObject = jsonObject.getJSONObject(
"layoutTemplate");
String name = getName(layoutTemplateJSONObject.getString("name"));
LayoutPrototype layoutPrototype = getLayoutPrototype(companyId, name);
if (layoutPrototype != null) {
if (!developerModeEnabled) {
if (_log.isInfoEnabled()) {
_log.info(
"Layout prototype with name " + name +
" already exists for company " + companyId);
}
return;
}
LayoutPrototypeLocalServiceUtil.deleteLayoutPrototype(
layoutPrototype);
}
layoutPrototype =
LayoutPrototypeLocalServiceUtil.addLayoutPrototype(
userId, companyId, getMap(name), name, true, serviceContext);
JSONArray columnsJSONArray = layoutTemplateJSONObject.getJSONArray(
"columns");
Layout layout = layoutPrototype.getLayout();
addLayoutColumns(
layout, LayoutTypePortletConstants.COLUMN_PREFIX, columnsJSONArray);
LayoutLocalServiceUtil.updateLayout(
layout.getGroupId(), layout.isPrivateLayout(), layout.getLayoutId(),
layout.getTypeSettings());
}