« 返回到 Development

Custom fields

(从 Custom attributes 进行重定向)

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 附件
73372 查看
平均 (4 票)
满分为 5,平均得分为 2.25。
评论
讨论主题回复 作者 日期
It is nice for simple additions. More complex... Tobias Marx 2010年2月2日 上午2:29
@Tobias This is not entirley true, you can... Maarten Scholl 2013年2月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-2-2 上午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-2-26 上午1:54 发帖。