问题描述
换句话说,我需要查看哪些数据库表才能将Portlet映射到组织中的页面?如果有这样的事情?我们正在使用Liferay 6.1.20
In other words, Which Database tables do i need to look into for the mapping of a portlet to a page in an organization? If there is such a thing?! We are using Liferay 6.1.20
推荐答案
除了市场Portlet .
如果您有权访问数据库,则可以在Layout
表上触发一个简单的查询,以了解在您的portlet的所有页面中添加了什么:
If you have access to the Database you can fire a simple query on the Layout
table to know in what all pages your portlet is added:
SELECT * FROM Layout WHERE typeSettings LIKE '%my_WAR_myportlet%';
您还可以使用service-builder构建FinderImpl以通过portlet执行此查询,并将该portlet添加到页面中以所需的任何格式显示.
Also you can build a FinderImpl with service-builder to execute this query through a portlet and add that portlet to page to display in whatever format you want.
下面是另一个解决方案,无需部署任何portlet,也无需访问数据库(在MySQL DB上进行了测试):
Below is another solution without deploying any portlet and without having access to the DB (tested on MySQL DB):
- 转到服务器管理
- 转到脚本"标签
- 从语言"下拉列表中选择
Beanshell
-
在文本区域中粘贴以下脚本代码,然后按执行按钮:
- Go to Server Administration
- Go to Script tab
- Select
Beanshell
from the Language drop-down Paste the following script code in the textarea and press the button execute:
import com.liferay.portal.kernel.dao.jdbc.DataAccess;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.util.StringBundler;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
con = DataAccess.getUpgradeOptimizedConnection();
// your custom query here
String sqlQuery = "SELECT * FROM Layout WHERE typeSettings LIKE '%my_WAR_myportlet%'";
out.println("SQL Query: "+ sqlQuery);
ps = con.prepareStatement(sqlQuery);
rs = ps.executeQuery();
ResultSetMetaData rsmd = rs.getMetaData();
int columnCount = rsmd.getColumnCount();
List rows = new ArrayList();
List columnLabels = new ArrayList();
columnLabels.add("Sr. No.");
for (int c = 1; c <= columnCount; c++) {
String cl = rsmd.getColumnLabel(c);
columnLabels.add(cl);
}
while (rs.next()) {
List row = new ArrayList(columnCount);
for (int c = 1; c <= columnCount; c++) {
Object value = rs.getObject(c);
row.add(value);
}
rows.add(row);
}
// --- formatting the results ---
out.append("<div class=\"lfr-search-container \"><div class=\"results-grid\">");
out.append("<table class=\"taglib-search-iterator\">");
out.append("<thead>");
out.append("<tr class=\"portlet-section-header results-header\">");
for (String value : columnLabels) {
out.append("<th>");
out.append(value);
out.append("</th>");
}
out.append("</tr>");
out.append("</thead>");
out.append("<tbody>");
boolean alt = false;
long resultsCount = 1;
for (List line : rows) {
out.append("<tr class=\"portlet-section-alternate results-row " + (alt ? "alt" : "") + "\">");
// for sr. no.
out.append("<td>");
out.append(resultsCount + "");
out.append("</td>");
resultsCount = resultsCount + 1;
for (Iterator iterator = line.iterator(); iterator.hasNext();) {
Object value = (Object) iterator.next();
out.append("<td>");
if (value != null) {
out.append(value.toString());
} else {
out.append("<span style=\"font-style:italic\">null</span>");
}
out.append("</td>");
}
out.append("</tr>");
alt = !alt;
}
out.append("</tbody>");
out.append("</table>");
out.append("</div></div>");
} catch (Exception exp) {
out.println("ERROR: " + exp);
throw exp;
}
finally {
DataAccess.cleanUp(con, ps, rs);
}
请记住将字符串my_WAR_myportlet
更改为您的portletId
Please remember to change the string my_WAR_myportlet
to your portletId
希望这会有所帮助.
这篇关于我如何找到-Liferay 6.1中哪些页面上部署了哪些portlet?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!