« Back

Adding asset functionallity to Calendar Events

Company Blogs February 10, 2010 By Juan Fernández Staff

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:
In portal-web/yourPortlet create /asset/full_content.jsp with the content you want to see in Asset Publisher
And that's all! :)
Juan Fernández
Threaded Replies Author Date
Is this for liferay 6.0? And in Liferay 5.2.3,... relax sun May 12, 2010 6:58 AM
Hi Relax: in LR 5.2.3 there were no... Juan Fernández May 12, 2010 7:04 AM
Thank you, I start a new thread for LR 5.2.3 ... relax sun May 12, 2010 8:02 AM
Hi Juan, I want to display leave applied be an... Sandhya A November 20, 2010 7:21 PM
Hi, Sandhya: you can have a personal calendar... Juan Fernández November 21, 2010 7:42 AM
[...] Jan Gregor: You can also create your own... Anonymous July 19, 2011 1:18 AM
Dear Juan, I want to add and event calendar in... Aman Jain November 18, 2012 11:55 PM
Dear Aman Jain: "Please provide complete code... Juan Fernández November 19, 2012 12:03 AM

Is this for liferay 6.0?

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

Thank you
Posted on 5/12/10 6:58 AM.
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
Posted on 5/12/10 7:04 AM in reply to relax sun.
Thank you, I start a new thread for LR 5.2.3

Posted on 5/12/10 8:02 AM in reply to Juan Fernández.
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
Posted on 11/20/10 7:21 PM.
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?
Posted on 11/21/10 7:42 AM in reply to Sandhya A.
[...] Jan Gregor: You can also create your own assets, but this will require a bit more engineering Regards, Jan. Yes it seems... but I'm considering doing it sooner or later for some objects, as it's quite... [...] Read More
Posted on 7/19/11 1:18 AM.
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,
Posted on 11/18/12 11:55 PM.
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.

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
Posted on 11/19/12 12:03 AM in reply to Aman Jain.