Adding asset functionallity to Calendar Events

Liferay's objects are being encapsulated into assets (documents, web contents, blog entries are being encapsulated in the new asset concept) and it allows the portal objects to be treated in a consistent way.

There are several portlets that are designed to work with this kind of objects and you may be interested in doing this with your custom objects.

I have been working with the Calendar Events to add this functionallity for Liferay 6.0, and this blog entry is the result of that experience. This will allow us to tag and categorize calendar events, so that we can search them much easier, create them not only from the calendar but from the asset publisher and track the creation from several places.

If you have created a custom object (for example "school_teacher") and you want to convert it into an asset, these are the steps to follow:

 
In YourObjectLocalServiceImpl.java, in every CRUD  (create, read, update and delete) method, add a call to its respective asset method through the assetEntryLocalService object
 
BlogsEntryLocalServiceImpl example:
 
public void deleteEntry(BlogsEntry entry) throws PortalException, SystemException {
 [...] 
// Asset
 assetEntryLocalService.deleteEntry( BlogsEntry.class.getName(), entry.getEntryId()); 
[...]
}
 
To make your content available in the Asset Publisher Portlet you have to follow these steps
 
Create the following classes:
YourObjectAssetRendererFactory (extends BaseAssetRendererFactory) 
YourObjectAssetRenderer (extends BaseAssetRenderer) 
 
In liferay-portlet.xml add this line to your portlet:
 
<asset-renderer-factory>com.liferay.portlet.your_portlet.YourObjectAssetRendererFactory</asset-renderer-factory>
 
In portal-web/yourPortlet create /asset/full_content.jsp with the content you want to see in Asset Publisher
 
And that's all! :)
 
Regards
Juan Fernández
 
[Update]
[/Update]
Blogs
Is this for liferay 6.0?

And in Liferay 5.2.3, what is the way to solve this problem?

Thank you
Hi Relax:
in LR 5.2.3 there were no infrastructure for implementing this. This is for Liferay 6.0. Sorry.
Depending on your problem, several approaches to solving it may be suitable. Use the forums to expose your problem and let the community help you
Hi Juan,

I want to display leave applied be an employee in a calendar. I am trying to make use of the existing Calendar portlet(Liferay 6.0.5). Is it possible to color code the calendar? If so how?. My requirement is I want to display different types of leave in different colors.

Also how to make the calendar private? i.e the calendar in liferay is a shared calendar. all the logged in users can view the events. Is it possible to make it private. The event that user A adds, should be viewable only by him.

Or is there other portlet for this,

Any help will be highly appreciated.

Thanks in advance
Hi, Sandhya:

you can have a personal calendar portlet in every user's private pages. Moreover, you can set event permissions so that only certain users can see certain events.

To color the calendar (one color for each event) you'll have to do it by yourself, as Liferay doesn't provide that functionality.

For further questions, please use the forums, as it's much easier to work with, ok?
Regards!
Dear Juan,

I want to add and event calendar in Asset Publisher,so that when I add an event in Event Calendar,it will automatically be displayed in Asset Publisher.
Please provide complete code details as I am new to Liferay.

Thanks and Regards,
Dear Aman Jain:
"Please provide complete code details as I am new to Liferay." << funny! emoticon
Please use the forums (forums.liferay.com) when you have a problem, not a blog comment, and ask if anybody can help you resolve your problem. Don't expect anyone to send you your feature implemented, but some advice in how to implement your feature.
Regards,
Juan

ps: you don't need to code anything for that feature. CalEvents are part of the Asset Publisher and you can create and display events from the A.P without modifying anything