6/01/2011

An Overview of Liferay Services - Part 2


This is Part 2 of an overview about all Liferay Services. If you want to read the other posts, take a look here.



How to get the class name id of your entities

Whenever you query the liferay database for entities you will come across the fields classNameId and classPK. This is - for example the case in assetEntry or expandoValue. Those two values tell you which entity class and which entity is referenced. The entity class is mapped by its classNameId. 
You can query for the class name id by using ClassNameLocalServiceUtil and pass the name of your class. The table contains all classNames, even the ones from your own services.


table name: classname
entity: ClassName
Service class: ClassNameLocalServiceUtil


How to get the data, the Asset Publisher displays

If you are using the asset publisher to display dynamic lists consisting of the assets you created you will notice, that the asset publisher doesn´t operate on the assets directly but instead on an entity called "AssetEntry". AssetEntries are automatically created for every asset, the asset publisher can display. So if you intend to modify the values the asset publisher displays and you don´t want to midify the asset publisher directly, take a look here.



table name: assetEntry
entity: AssetEntry
Service class: AssetEntryLocalServiceUtil

How to get Tags that you use to tag assets.

If you are tagging Liferay Assets (Documents, Web Contents, etc), Liferay creates an AssetTag entry for every tag you use. If a tag gets used multiple times, an internal counter is incremented (assetCount). This table helps you to get an overview of all tags used in a community or organization. It allows you to give the User an overview about all already used tags.




table name: assetTag
entity: AssetTag
Service class: AssetTagLocalServiceUtil





Here is the summary

Model DescriptionLiferay ServiceTable Name
ClassName IdsClassNameLocalServiceUtilclassname
AssetPublisher dataAssetEntryLocalServiceUtilassetentry
All available tags in LiferayAssetTagLocalServiceUtilassettag


If you like this tutorial it would be very nice, if you could click on some of the google ads you see on the right side. It helps me run this block and motivates me ;)

If you have any questions, feel free to leave a comment.