Foros de discusión

CalEvent

David Gitonga, modificado hace 10 años.

CalEvent

Junior Member Mensajes: 63 Fecha de incorporación: 26/07/13 Mensajes recientes
I want to add calendar event to my calender through code, which as of now am able to do,
the problem is with groupId,

the calendar event is only visible to a particular site and not all sites.
e.g when am adding task i want that task to be added to my calendar event which is in different portal site.

the other problem is when i click on event title instead of opening the event its throwing an error on server log

No AssetEntry exists with the key {classNameId=10009, classPK=27}

so how do i add my calevent to assetEntry?

Thank you.
thumbnail
Bijan Vakili, modificado hace 10 años.

RE: CalEvent

Expert Mensajes: 375 Fecha de incorporación: 10/03/09 Mensajes recientes
Hi David, best is to follow Liferay:


                AssetEntry assetEntry = assetEntryLocalService.updateEntry(
                        userId, event.getGroupId(), event.getCreateDate(),
                        event.getModifiedDate(), CalEvent.class.getName(),
                        event.getEventId(), event.getUuid(), 0, assetCategoryIds,
                        assetTagNames, true, null, null, null, ContentTypes.TEXT_HTML,
                        event.getTitle(), event.getDescription(), null, null, null, 0, 0,
                        null, false);

                assetLinkLocalService.updateLinks(
                        userId, assetEntry.getEntryId(), assetLinkEntryIds,
                        AssetLinkConstants.TYPE_RELATED);


Reference:
See the following class in the Liferay source code. Especially the addEvent and updateAsset methods. Depending on what version of Liferay you're using, it may be slightly differente. Below URIs are for trunk.
com.liferay.portlet.calendar.service.impl.CalEventLocalServiceImpl
addEvent
https://github.com/liferay/liferay-portal/blob/master/portal-impl/src/com/liferay/portlet/calendar/service/impl/CalEventLocalServiceImpl.java#L136

updateAsset
https://github.com/liferay/liferay-portal/blob/master/portal-impl/src/com/liferay/portlet/calendar/service/impl/CalEventLocalServiceImpl.java#L758
thumbnail
Rahul Pande, modificado hace 10 años.

RE: CalEvent

Expert Mensajes: 310 Fecha de incorporación: 7/07/10 Mensajes recientes
Hi David,

Please use following method to add event. This method will take care of adding details into other tables

addEvent(long userId, String title, String description, int startDateMonth,
			int startDateDay, int startDateYear, int startDateHour,
			int startDateMinute, int endDateMonth, int endDateDay,
			int endDateYear, int durationHour, int durationMinute,
			boolean allDay, boolean timeZoneSensitive, String type,
			boolean repeating, TZSRecurrence recurrence, int remindBy,
			int firstReminder, int secondReminder,
			ServiceContext serviceContext)


HTH
Rahul Pande
Cesar Quinteiro, modificado hace 10 años.

RE: CalEvent

Junior Member Mensajes: 34 Fecha de incorporación: 18/10/11 Mensajes recientes
Rahul Pande:
Hi David,

Please use following method to add event. This method will take care of adding details into other tables

addEvent(long userId, String title, String description, int startDateMonth,
			int startDateDay, int startDateYear, int startDateHour,
			int startDateMinute, int endDateMonth, int endDateDay,
			int endDateYear, int durationHour, int durationMinute,
			boolean allDay, boolean timeZoneSensitive, String type,
			boolean repeating, TZSRecurrence recurrence, int remindBy,
			int firstReminder, int secondReminder,
			ServiceContext serviceContext)


HTH
Rahul Pande


Hi Rahul

I am using that method, everything works fine, except the "reminders" they doesn't send any email, If I check in the calendar portlet the event is created with the correct data, but not email is send, If I create de event "by Hand" the email is send it, but not If I do by code.

Do I miss something?
thumbnail
Rahul Pande, modificado hace 10 años.

RE: CalEvent

Expert Mensajes: 310 Fecha de incorporación: 7/07/10 Mensajes recientes
Cesar Quinteiro:


I am using that method, everything works fine, except the "reminders" they doesn't send any email, If I check in the calendar portlet the event is created with the correct data, but not email is send, If I create de event "by Hand" the email is send it, but not If I do by code.

Do I miss something?


Hi Cesar,

Are you setting remindBy to CalEventConstants.REMIND_BY_EMAIL ? If yes then please check the configuration of calendar portlet and make sure that reminder mail is enabled.


HTH
Rahul Pande
Cesar Quinteiro, modificado hace 10 años.

RE: CalEvent

Junior Member Mensajes: 34 Fecha de incorporación: 18/10/11 Mensajes recientes
Rahul Pande:
Cesar Quinteiro:


I am using that method, everything works fine, except the "reminders" they doesn't send any email, If I check in the calendar portlet the event is created with the correct data, but not email is send, If I create de event "by Hand" the email is send it, but not If I do by code.

Do I miss something?


Hi Cesar,

Are you setting remindBy to CalEventConstants.REMIND_BY_EMAIL ? If yes then please check the configuration of calendar portlet and make sure that reminder mail is enabled.


HTH
Rahul Pande


Hi Rahul

yes I am using value “1” for remindBy, that I guess it means by REMIND_BY_EMAIL, (I compare in the database with the manual calEvents that works) and in the configuration reminder mail is enable. Otherwise the "manual way" doesn’t work.

I has found that when you create a event by hand no code (directly in the interface) then ir creates also a MBMessage row, but when you create by code using the mention method, doesn’t creates any row in the MBMessage table. Is necessary to create this row? If yes with which data?
What else can I check?

regards
Cesar
David Gitonga, modificado hace 10 años.

RE: CalEvent

Junior Member Mensajes: 63 Fecha de incorporación: 26/07/13 Mensajes recientes
Sorry guys i didn't reply on time,
i followed your suggestions and it really worked,
Cesar Quinteiro, modificado hace 10 años.

RE: CalEvent

Junior Member Mensajes: 34 Fecha de incorporación: 18/10/11 Mensajes recientes
David Gitonga:
Sorry guys i didn't reply on time,
i followed your suggestions and it really worked,


And the reminder it works for you?
David Gitonga, modificado hace 10 años.

RE: CalEvent

Junior Member Mensajes: 63 Fecha de incorporación: 26/07/13 Mensajes recientes
Cesar Quinteiro:
David Gitonga:
Sorry guys i didn't reply on time,
i followed your suggestions and it really worked,


And the reminder it works for you?


I didn't test for reminder since my requirement didn't include it. but maybe it would work.
Cesar Quinteiro, modificado hace 10 años.

RE: CalEvent

Junior Member Mensajes: 34 Fecha de incorporación: 18/10/11 Mensajes recientes
David Gitonga:
Cesar Quinteiro:
David Gitonga:
Sorry guys i didn't reply on time,
i followed your suggestions and it really worked,


And the reminder it works for you?


I didn't test for reminder since my requirement didn't include it. but maybe it would work.


I will appreciate if you check that, just put 1 in remindBy and a value in seconds in firstReminder that corresponds the time before the event you want to send the reminder.