« Development に戻る

Custom fields

Introduction #

Custom attributes is a new feature introduced in Liferay v5.2 that allows extending the profile of users and organizations with fields to store custom information. Custom attributes are also available as a service that can be used from custom portlets to add this feature to any stored entity.

Usage 5.x #

The following picture shows the form that an administrator can use to create a new custom attribute: Once the custom attribute has been created it will appear in the user profile within My Account and the User administration UI:

Usage 6.x #

Navigate to the Control Panel as an administrator and select "Custom Fields" form the left side. You can now edit the custom fields for different types of content. For example if you add a custom field for Organizations you can edit an organization and add content under the "Custom fields" tab on the right.

How is it implemented? #

Custom attributes are implemented using Liferay's ExpandoService. This means that all the data introduced in custom attributes is safely stored within the database and fully indexed using Lucene.

2 添付ファイル
47452 参照数
平均 (4 投票)
平均評価は2.25星中の5です。
コメント
コメント 作成者 日時
It is nice for simple additions. More complex... Tobias Marx 2010/02/02 2:29
@Tobias This is not entirley true, you can... Maarten Scholl 2013/02/26 1:54

It is nice for simple additions. More complex objects can not be added. For example you want to add "plans" to this that look like this:

public class Plan {

private Date startDate;
private Date endDate;
private String title;
private String description;

}

User<->List<Plan>
投稿日時:10/02/02 2:29
@Tobias

This is not entirley true, you can save such an object by serializing it to xml and then save it in a custom attribute.
When retrieving the information you can then deserialize it to retrieve the object instance.

A libray as XStream could be very helpfull for this purpose!

Regards,

Kim Zeevaarders
投稿日時:13/02/26 1:54