Foren

Liferay persistence and datamodel - best way to figure it out?

Heimo Laukkanen, geändert vor 13 Jahren.

Liferay persistence and datamodel - best way to figure it out?

New Member Beiträge: 20 Beitrittsdatum: 06.07.10 Neueste Beiträge
Is there a description of datamodels used in Liferay somewhere, meaning description of ideas and usage of different entities ( and their properties ) in Liferay?

I've gone through hibernate configuration, database structure, checked out some model objects and their services - but none of them really do explain how entities relate to each other and what do they really mean. You can figure them out - mostly, but some things make you scratch your head. For example tag assets are not that self explanatory, especially since they have funny attributes like classnameid and classpk -- before you finally figure them out.

Created service APIs are also quite a mess:

public static java.util.List<com.liferay.portlet.tags.model.TagsAsset> getAssets(
long groupId, long[] classNameIds, long[] entryIds, long[] notEntryIds,
boolean andOperator, boolean excludeZeroViewCount, int start, int end)


...... clearly generated apis are not suitable for human consumption without some additional knowledge :-D

So what are the best ways to capture that knowledge?
thumbnail
Alexey Kakunin, geändert vor 13 Jahren.

RE: Liferay persistence and datamodel - best way to figure it out?

Liferay Master Beiträge: 621 Beitrittsdatum: 07.07.08 Neueste Beiträge
Hi!

So far, I did not saw any liferay data-model decription (in any form, UML, wiki, doc - anything else).
So, still best documentation - is Liferay sources - hopefully they are open-source and quite clear - at least not too difficult to read and discover.

First - need to understand how ServiceBuilder works and what patterns it used. Most services & models are very similar and used same ways to work.

Second - understand some major entities: Group, User, Layout & LayoutSet, Organization...

Third - go from your practical tasks: if you need to do something - try to find something similar already implemented in Liferay - find how it is implemented in Liferay Source-Code and try to do by similar way.

Liferay API is huge. it will be very hard to study it whole from down - for some methods (like your pointed with AssetTags) you will never understand why it is used, how it is used and what exactly it is doing - without looks in specific Liferay code for it's usage. So, my suggestion to go "from top" - from specific functionality you are interested in, and go down and looks what API and how is used to implement it.


==
Alexey Kakunin
EmForge: Liferay Based Project Hosting Service
Heimo Laukkanen, geändert vor 13 Jahren.

RE: Liferay persistence and datamodel - best way to figure it out?

New Member Beiträge: 20 Beitrittsdatum: 06.07.10 Neueste Beiträge
Alexey Kakunin:
Hi!

So far, I did not saw any liferay data-model decription (in any form, UML, wiki, doc - anything else).
So, still best documentation - is Liferay sources - hopefully they are open-source and quite clear - at least not too difficult to read and discover.

First - need to understand how ServiceBuilder works and what patterns it used. Most services & models are very similar and used same ways to work.

Second - understand some major entities: Group, User, Layout & LayoutSet, Organization...

Third - go from your practical tasks: if you need to do something - try to find something similar already implemented in Liferay - find how it is implemented in Liferay Source-Code and try to do by similar way.

Liferay API is huge. it will be very hard to study it whole from down - for some methods (like your pointed with AssetTags) you will never understand why it is used, how it is used and what exactly it is doing - without looks in specific Liferay code for it's usage. So, my suggestion to go "from top" - from specific functionality you are interested in, and go down and looks what API and how is used to implement it.


Thanks, this is quite exactly something that I am trying to do currently.

However looking at the datamodel I seem to become - from time to time - confused about some decisions, as there are numerous things that overlap each other and it is not clear at first how and when each other is used.

Most importantly at first, how do id, uuid and resource primary key differ in objects ( like JournalArticle ) and how these different identifiers are used for different things and why. It is not self explanatory from the model - nor from just browsing through the codebase.

Has anyone yet written documentation describing the major entities in the Liferay core? Would it be possible to include that or proper descriptions of entities and their fields into the service.xml for future reference?

And thanks Alexey for all your answers and thoughts, you really help we onwards emoticon