留言板
Get data from existing Liferay tables using Expando.
Anand Abhyankar,修改在14 年前。
Get data from existing Liferay tables using Expando.
Junior Member 帖子: 57 加入日期: 08-3-26 最近的帖子
Hello All,
How can get data from existing Liferay tables using expando.
I have read Ray's blog about expando, but it gives info about creating new expando tables.
I want to access Liferay's default tables, with out creating my own table using expando.
Please guide me.
Thanks in advance.
How can get data from existing Liferay tables using expando.
I have read Ray's blog about expando, but it gives info about creating new expando tables.
I want to access Liferay's default tables, with out creating my own table using expando.
Please guide me.
Thanks in advance.
Tomas Polesovsky,修改在14 年前。
RE: Get data from existing Liferay tables using Expando.
Liferay Master 帖子: 676 加入日期: 09-2-13 最近的帖子
Hi,
using
you get all expando table definitions.
Using
you get all columns defined for Organization entity in the default table.
Using
you get all rows for Organization in the default table.
Using
you get all values for Organization with ID 'classPK' in the default table.
using
List<expandotable> expandoTables = ExpandoTableLocalServiceUtil
.getExpandoTables(getStart(), getEnd());
</expandotable>
you get all expando table definitions.
Using
String modelResource = "com.liferay.portal.model.Organization";
List<expandocolumn> columns = ExpandoColumnLocalServiceUtil
.getDefaultTableColumns(modelResource);
</expandocolumn>
you get all columns defined for Organization entity in the default table.
Using
String modelResource = "com.liferay.portal.model.Organization";
String expandoTableName = ExpandoTableConstants.DEFAULT_TABLE_NAME;
List<expandorow> expandoRows = ExpandoRowLocalServiceUtil
.getRows(modelResource, expandoTableName, getStart(), getEnd());
</expandorow>
you get all rows for Organization in the default table.
Using
String modelResource = "com.liferay.portal.model.Organization";
String expandoTableName = ExpandoTableConstants.DEFAULT_TABLE_NAME;
long classPK = 0; // ID OF ORGANIZATION
List<expandovalue> values = ExpandoValueLocalServiceUtil
.getRowValues(modelResource, expandoTableName, classPK,
QueryUtil.ALL_POS, QueryUtil.ALL_POS);
</expandovalue>
you get all values for Organization with ID 'classPK' in the default table.
Anand Abhyankar,修改在14 年前。
RE: Get data from existing Liferay tables using Expando.
Junior Member 帖子: 57 加入日期: 08-3-26 最近的帖子
Thanks Tomas Polesovsky for quick your reply.
How can we write a 'template' for this, so that we can have table details in a web-content' ?
Thanks in advance
How can we write a 'template' for this, so that we can have table details in a web-content' ?
Thanks in advance
Tomas Polesovsky,修改在14 年前。
RE: Get data from existing Liferay tables using Expando.
Liferay Master 帖子: 676 加入日期: 09-2-13 最近的帖子
I don't know which details you want. Maybe you can use the custom-attribute-list tag:
I am sorry but I don't understand your "detail template". I don't see your problem here, maybe you could explain it?
<liferay-ui:custom-attribute-list className="com.liferay.portal.model.Organization" classPK="0" editable="<%= true %>" label="<%= true %>" />
I am sorry but I don't understand your "detail template". I don't see your problem here, maybe you could explain it?
Anand Abhyankar,修改在14 年前。
RE: Get data from existing Liferay tables using Expando.
Junior Member 帖子: 57 加入日期: 08-3-26 最近的帖子
Thanks Tomas Polesovsky for you reply!
Just to clarify, as a regular web-content (aka Journal Content) need the template and structure, how can I get data from existing tables using template (vm) ?
For example, if I want to list of users from the user_ table of liferay in web-content, how can I achieve this?
Thanks in advance.
Just to clarify, as a regular web-content (aka Journal Content) need the template and structure, how can I get data from existing tables using template (vm) ?
For example, if I want to list of users from the user_ table of liferay in web-content, how can I achieve this?
Thanks in advance.
Harish Kumar,修改在11 年前。
RE: Get data from existing Liferay tables using Expando.
Expert 帖子: 483 加入日期: 10-7-31 最近的帖子
Hi Anand,
Just create bare bone structure and associate a template with it. Now you put your code inside the template. Here is the sample code -
Create a web content by making use of above structure.
HTH
I want to list of users from the user_ table of liferay in web-content, how can I achieve this?
Just create bare bone structure and associate a template with it. Now you put your code inside the template. Here is the sample code -
#set($userLocalService=$serviceLocator.findService("com.liferay.portal.service.UserLocalService"))
#set($userList=$userLocalService.getUsers(-1,-1))
Make sure to override this property in portal-ext.properties
#
# Input a comma delimited list of variables which are restricted from the
# context in Velocity based Journal templates.
#
journal.template.velocity.restricted.variables=
Create a web content by making use of above structure.
HTH
Ishan Sahore,修改在11 年前。
RE: Get data from existing Liferay tables using Expando.
Junior Member 帖子: 56 加入日期: 12-4-26 最近的帖子Tomáš Polešovský:
Hi,
usingList<expandotable> expandoTables = ExpandoTableLocalServiceUtil .getExpandoTables(getStart(), getEnd()); </expandotable>
you get all expando table definitions.
Hi Tomas,
My Eclipse IDE does not recognise getStart() and getEnd() methods.
Can you elaborate what all imports I need to do.
Thanks,
Ishan.
Harish Kumar,修改在11 年前。
RE: Get data from existing Liferay tables using Expando.
Expert 帖子: 483 加入日期: 10-7-31 最近的帖子
Hi Ishan
getStart() and getEnd() denotes the start and last index here. You can pass -1 for both to get the full list.
HTH
getStart() and getEnd() denotes the start and last index here. You can pass -1 for both to get the full list.
HTH
Ishan Sahore,修改在11 年前。
RE: Get data from existing Liferay tables using Expando.
Junior Member 帖子: 56 加入日期: 12-4-26 最近的帖子Harish Kumar:
Hi Ishan
getStart() and getEnd() denotes the start and last index here. You can pass -1 for both to get the full list.
HTH
Thanks Harish,
I did what u said. It worked.
I am curious to know where do these methods getStart() and getEnd() come from.
Tomáš Polešovský,修改在11 年前。
RE: Get data from existing Liferay tables using Expando.
Liferay Master 帖子: 676 加入日期: 09-2-13 最近的帖子
Hi Ishan,
I copied it somewhere from portal sources. -1 means QueryUtil.ALL_POS.
-- tom +
I copied it somewhere from portal sources. -1 means QueryUtil.ALL_POS.
-- tom +