21 September, 2013

Useful Expando Service Methods

Hello Friends,

Below are some expando service methods which can be frequently useful if you are playing with expando tables.

1) Create Expando table

ExpandoTable table = ExpandoTableLocalServiceUtil.addTable(long companyId, long classNameId, String tableName);


2) Create Columns

ExpandoColumn column = ExpandoColumnLocalServiceUtil.addColumn(
        long tableId, String name, int type);

3) Create Rows

ExpandoRow row = ExpandoRowLocalServiceUtil.addRow(long tableId, long classPK);

4) Store Value

ExpandoValue value = ExpandoValueLocalServiceUtil.addValue(
        long classNameId, long tableId, long columnId, long classPK,String data);

5) Remove operations

Table:
ExpandoTableLocalServiceUtil.deleteTable(long tableId)
Column:
ExpandoColumnLocalServiceUtil.deleteColumn(long columnId)
Row:
ExpandoRowLocalServiceUtil.deleteRow(long rowId)
Value:
ExpandoValueLocalServiceUtil.deleteValue(long valueId)

6) Update Operations

Table:
ExpandoTableLocalServiceUtil.updateTable(long tableId, String name)
ExpandoTableLocalServiceUtil.updateExpandoTable(ExpandoTable table)
Column:
ExpandoColumnLocalServiceUtil.updateColumn(long columnId,String name, int type)
ExpandoColumnLocalServiceUtil.updateExpandoColumn(
        com.liferay.portlet.expando.model.ExpandoColumn expandoColumn);
Row:
ExpandoRowLocalServiceUtil.updateExpandoRow(
        com.liferay.portlet.expando.model.ExpandoRow expandoRow)
Value:
ExpandoValueLocalServiceUtil.updateExpandoValue(
        com.liferay.portlet.expando.model.ExpandoValue expandoValue)


Rate Me:

3 Discussion:

Jitendra said...

What is the best way to get object using expando value ?
i.e get User object from expando value .

Which one is the best way dynamic query or Liferay service API ?

Jignesh Vachhani said...

Better to use expando service as it can help during migration.

Jitendra Rajput said...

But how about performance then ? Because if you use expando it will check for each and every record inside Expando Table .