Foren
Get data from existing Liferay tables using Expando.
Anand Abhyankar, geändert vor 14 Jahren.
Get data from existing Liferay tables using Expando.
Junior Member Beiträge: 57 Beitrittsdatum: 26.03.08 Neueste Beiträge
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, geändert vor 14 Jahren.
RE: Get data from existing Liferay tables using Expando.
Liferay Master Beiträge: 676 Beitrittsdatum: 13.02.09 Neueste Beiträge
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, geändert vor 14 Jahren.
RE: Get data from existing Liferay tables using Expando.
Junior Member Beiträge: 57 Beitrittsdatum: 26.03.08 Neueste Beiträge
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, geändert vor 14 Jahren.
RE: Get data from existing Liferay tables using Expando.
Liferay Master Beiträge: 676 Beitrittsdatum: 13.02.09 Neueste Beiträge
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, geändert vor 14 Jahren.
RE: Get data from existing Liferay tables using Expando.
Junior Member Beiträge: 57 Beitrittsdatum: 26.03.08 Neueste Beiträge
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, geändert vor 11 Jahren.
RE: Get data from existing Liferay tables using Expando.
Expert Beiträge: 483 Beitrittsdatum: 31.07.10 Neueste Beiträge
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, geändert vor 11 Jahren.
RE: Get data from existing Liferay tables using Expando.
Junior Member Beiträge: 56 Beitrittsdatum: 26.04.12 Neueste BeiträgeTomáš 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, geändert vor 11 Jahren.
RE: Get data from existing Liferay tables using Expando.
Expert Beiträge: 483 Beitrittsdatum: 31.07.10 Neueste Beiträge
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, geändert vor 11 Jahren.
RE: Get data from existing Liferay tables using Expando.
Junior Member Beiträge: 56 Beitrittsdatum: 26.04.12 Neueste BeiträgeHarish 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ý, geändert vor 11 Jahren.
RE: Get data from existing Liferay tables using Expando.
Liferay Master Beiträge: 676 Beitrittsdatum: 13.02.09 Neueste Beiträge
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 +