问题
I am new to Liferay. Now I need to create the flow chart which has the Liferay table work flow in following scenarios,
1) What are the list of table will reflect/update if we create the site admin?
2) What are the list of table will reflect/update if we create the site?
I tried by opening database tables and noticed that USER_, CONTACT_ will reflect, But I need list of all the related tables which will reflect when we create the site and siteadmin? I am using Liferay 6.2 version.
Thanks in advance.
回答1:
When you want to know the internals of any system it is always best to check the relevant source-code. So in this case you can check the source-code for those classes which are used for CRUD operations on User and Site.
1) What are the list of table will reflect/update if we create the site admin?
- Site-administrator is a Role, which can be applied to a User created in Liferay.
- So if you want all the tables that are created from User-creation till User is assigned the Site-administrator role for a particular site, there here are some which I can recollect:
- User_ (Obvious)
- Contact_ (not so obvious :-) )
- Group_ (Users are also created as a record in this table since Users have public and private pages)
- Address (if you add an address)
- Phone (if you add a Phone)
- Users_Roles (
Power user
role is assigned by default) - UserGroupRole (user and site-role relationship, Site-administrator is a Site-role)
- Users_Groups (user and site relationship)
- For others you should refer the source-code for
UserLocalServiceImpl
,RoleLocalServiceImpl
andGroupLocalServiceImpl
, check the relevant methods prefixedadd
,update
etc. - The corresponding service.xml for these module would reveal the database tables being used.
2) What are the list of table will reflect/update if we create the site?
- Sites are nothing but Groups in Liferay. So its obvious
Group_
table is playing a big role. - Other tables also depend upon what configuration you are doing while creating a Site.
- Then there would be other tables like
Layout
when you start creating pages for a Site.
I would strongly encourage to go ahead and explore the source code for the classes and you would understand the flow - when and what tables are affected.
Here is some convention which might help you traverse the source-code, almost every *LocalServiceImpl
is associated with a *Model
like UserLocalServiceImpl
with UserModel
and almost every *Model
has a corresponding database table with the same name.
Also the name of the functionality would in most cases hints at what service classes are being used to connect to database, like adding a User
would hint at using UserLocalServiceImpl
.
Hope I have understood your question and have been able to give some proper direction.
回答2:
If you want to know this because you also want to write to these tables: Don't go there! You should purely use the API to change the data that Liferay stores. Otherwise you will run into disasters some time in the future - promised.
For just getting the SQL commands that Liferay actually uses, configure portal-ext.properties
and change this default value:
hibernate.show_sql=false
Then go to "Server Administration/Log Levels" and add a new category "org.hibernate.SQL", configure it to the level DEBUG. Then the results show up in the logs. Note that this log configuration is transient and will be reverted on next server start. If you want the setting to be persistent, you'll need to go into Liferay's log4j configuration files.
Remember: You don't want to write to the tables ever. Promise!
来源:https://stackoverflow.com/questions/30164562/liferay-database-table-work-flow