Message Boards

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Relations with Liferay tables
relations liferay tables
Answer
10/17/11 9:33 AM
Hello everybody, and congratulations for this great work!

Which would be the most correct approach to make a relation between the XMLPF created tables and an standard table from Liferay (User_ table in my case).

Thank you in advance,

Greetings!

Juanjo

RE: Relations with Liferay tables
Answer
10/19/11 10:01 PM as a reply to Juanjo Hernández.
Thank you very much Juanjo,


Actually XMLPF generated tables, automaticly insert companyId, groupId and userId fields. Those fields are also automaticly populated with information pertaining to the user that inserts the data into the table.

What this means is that if a user with liferay userId = 999 inserts a record with a generated XMLPF portlet, internally it will update its userId field with its Liferay userId (999). This way you can control wich records are inserted by which user.

Is this info what you needed ?


Saludos, Jack.

Pd.: Today this feature, silently inserts this 3 fields in your defined table with out telling you nothing, one of the next things I am going to do is to take this data out of the main table to another with this and other data (to track also, updates, deletes, etc.) and avoid contamination of main defined table, and also to be able to ingnore permisions.

RE: Relations with Liferay tables
relations liferay tables
Answer
11/4/11 4:15 PM as a reply to Jack A. Rider.
Hello Jack,

Thank you for this interesting information, but my question exactly was about the relation with other Liferay tables (The User_ table was only an example). If I want make relations like DetailFilesType or ValidationType with Liferay tables, what would be the best practice?

Thank you in advance

Juanjo!

RE: Relations with Liferay tables
Answer
11/5/11 11:27 AM as a reply to Juanjo Hernández.
Hola Juanjo,


There are no special relations with Liferay tables, if you want to make validations in a XMLPF generated portlet, with one of the tables of Liferay portal, you have to touch source code.

There is an aproach, that maybe helps you, but its just an idea and I dont know if it would work. Think of this scenario:

1.- You have a portlet that needs a validation against liferay Users_ table.
2.- As there is no direct validation to tables, not defined in the xml, you can make a definition like this:

table: Myusers
fields: myuserId
name
etc.

3.- Generate portlets, deploy ... this will create Myusers table in the database.
4.- Replace this file with a view of Liferay Users_ file, observing Myusers table structure.
5.- Try and tell us if it worked.

If this aproach works, will solve validations, and frees you of programing but remember views are Read Only "tables".

With this working, maybe a more "usable" aproach us to use triggers to add,update,delete rows a Myusers table from Users_ . But this requires a higher knowledge of databases.


Saludos, Jack.