Dive to Liferay Organization Custom Field and logo stored in Database

Recently I spent two weeks working on Liferay Organization Custom Field with Twitter API. It was frustrating to deal with Twitter API, because it has Rate limit, even though we use Streaming API, it also has connection limit.

In the blog, I'll record what I understand Organization Custom Field and organization logo from database. To my surprise, in the organization_ table, there's no column to store logo, I have to join other tables to get that.

1. organization_



This is the organization table structure, what I get from the table is organizationId, parentOrganizationId, name. I need parentOrganizationId to get the organization hiearchery the user is in.

2. If we login in Liferay as admin, we can go to control panel. In the left Nav bar, we can find custom fields link, then we go and find Organization. Here we can add custom field like Facebook account, Twitter account.

3. Where do Liferay store custom_field, which tables do they use? Apparently, we can see there's no column to store custom field. In fact, custom filed relates four tables.

3.1) exapndovalue




In the table, we can get the data which we input in our custom field. And the classPK is our organizationId.

3.2) expandocolumn




The table stores our custom field names. Here we can see I define three custom fields in Organization: twitter, facebook and myspace.

3.3)expandotable



The table defines if we set up custom field for which model like organization or User or other component in Liferay.

3.4) className_




In the table, we can get Organization Mode, then we can get classNameId. When we get classNameId, we can get tableId from expandotable. When we get tableId, we can get columnId according to tableId and name. Then we can get a list of organizations' custom fields data.


4. How can we get organization logo?

The logo image is stored in image table, I don't want to give details about it. One thing which is very strange that there's no a table directly store the relationship between organization and logo(image). Instead, it uses group_, layoutset to build the relationship.

4.1) group_: which stores the relationship between classpk and groupId. Here classPK is organizationId. You can see classPK used in many tables. In my case, I just need to get groupId through classPK.


4.2) layoutset: Here is the place to store relationship between logoId and groupId. When you upload a logo in Organization detail page, it will store two rows in layoutset table, one is for public page, the other is for private page. I don't dive into the area. The column privateLayout decides it.



That's all the tables I used to get a list of organizations' twitter screen name. 







  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值