掲示板
Get data from existing Liferay tables using Expando.
14年前 に Anand Abhyankar によって更新されました。
Get data from existing Liferay tables using Expando.
Junior Member 投稿: 57 参加年月日: 08/03/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.
14年前 に Tomas Polesovsky によって更新されました。
RE: Get data from existing Liferay tables using Expando.
Liferay Master 投稿: 676 参加年月日: 09/02/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.
14年前 に Anand Abhyankar によって更新されました。
RE: Get data from existing Liferay tables using Expando.
Junior Member 投稿: 57 参加年月日: 08/03/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
14年前 に Tomas Polesovsky によって更新されました。
RE: Get data from existing Liferay tables using Expando.
Liferay Master 投稿: 676 参加年月日: 09/02/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?
14年前 に Anand Abhyankar によって更新されました。
RE: Get data from existing Liferay tables using Expando.
Junior Member 投稿: 57 参加年月日: 08/03/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.
11年前 に Harish Kumar によって更新されました。
RE: Get data from existing Liferay tables using Expando.
Expert 投稿: 483 参加年月日: 10/07/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
11年前 に Ishan Sahore によって更新されました。
RE: Get data from existing Liferay tables using Expando.
Junior Member 投稿: 56 参加年月日: 12/04/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.
11年前 に Harish Kumar によって更新されました。
RE: Get data from existing Liferay tables using Expando.
Expert 投稿: 483 参加年月日: 10/07/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
11年前 に Ishan Sahore によって更新されました。
RE: Get data from existing Liferay tables using Expando.
Junior Member 投稿: 56 参加年月日: 12/04/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.
11年前 に Tomáš Polešovský によって更新されました。
RE: Get data from existing Liferay tables using Expando.
Liferay Master 投稿: 676 参加年月日: 09/02/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 +