Foros

Inicio » Liferay IDE » English

Vista combinada Visión Plana Vista de árbol
Discusiones [ Anterior | Siguiente ]
toggle
David Gitonga
CalEvent
26 de octubre de 2013 2:43
Respuesta

David Gitonga

Ranking: Junior Member

Mensajes: 50

Fecha de incorporación: 26 de julio de 2013

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.
Bijan Vakili
RE: CalEvent
26 de octubre de 2013 19:03
Respuesta

Bijan Vakili

Ranking: Regular Member

Mensajes: 141

Fecha de incorporación: 10 de marzo de 2009

Mensajes recientes

Hi David, best is to follow Liferay:

 1
 2                AssetEntry assetEntry = assetEntryLocalService.updateEntry(
 3                        userId, event.getGroupId(), event.getCreateDate(),
 4                        event.getModifiedDate(), CalEvent.class.getName(),
 5                        event.getEventId(), event.getUuid(), 0, assetCategoryIds,
 6                        assetTagNames, true, null, null, null, ContentTypes.TEXT_HTML,
 7                        event.getTitle(), event.getDescription(), null, null, null, 0, 0,
 8                        null, false);
 9
10                assetLinkLocalService.updateLinks(
11                        userId, assetEntry.getEntryId(), assetLinkEntryIds,
12                        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
Rahul Pande
RE: CalEvent
31 de octubre de 2013 5:55
Respuesta

Rahul Pande

Ranking: Regular Member

Mensajes: 229

Fecha de incorporación: 6 de julio de 2010

Mensajes recientes

Hi David,

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

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


HTH
Rahul Pande
Cesar Quinteiro
RE: CalEvent
23 de noviembre de 2013 18:40
Respuesta

Cesar Quinteiro

Ranking: Junior Member

Mensajes: 30

Fecha de incorporación: 18 de octubre de 2011

Mensajes recientes

Rahul Pande:
Hi David,

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

1addEvent(long userId, String title, String description, int startDateMonth,
2            int startDateDay, int startDateYear, int startDateHour,
3            int startDateMinute, int endDateMonth, int endDateDay,
4            int endDateYear, int durationHour, int durationMinute,
5            boolean allDay, boolean timeZoneSensitive, String type,
6            boolean repeating, TZSRecurrence recurrence, int remindBy,
7            int firstReminder, int secondReminder,
8            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?
Rahul Pande
RE: CalEvent
24 de noviembre de 2013 23:00
Respuesta

Rahul Pande

Ranking: Regular Member

Mensajes: 229

Fecha de incorporación: 6 de julio de 2010

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
RE: CalEvent
25 de noviembre de 2013 11:57
Respuesta

Cesar Quinteiro

Ranking: Junior Member

Mensajes: 30

Fecha de incorporación: 18 de octubre de 2011

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
RE: CalEvent
3 de diciembre de 2013 22:51
Respuesta

David Gitonga

Ranking: Junior Member

Mensajes: 50

Fecha de incorporación: 26 de julio de 2013

Mensajes recientes

Sorry guys i didn't reply on time,
i followed your suggestions and it really worked,
Cesar Quinteiro
RE: CalEvent
4 de diciembre de 2013 1:10
Respuesta

Cesar Quinteiro

Ranking: Junior Member

Mensajes: 30

Fecha de incorporación: 18 de octubre de 2011

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
RE: CalEvent
4 de diciembre de 2013 2:14
Respuesta

David Gitonga

Ranking: Junior Member

Mensajes: 50

Fecha de incorporación: 26 de julio de 2013

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
RE: CalEvent
4 de diciembre de 2013 8:58
Respuesta

Cesar Quinteiro

Ranking: Junior Member

Mensajes: 30

Fecha de incorporación: 18 de octubre de 2011

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.