Forum

Accueil » Liferay Portal » English » 3. Development

Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
jam dah
how to retreive list of calendar events from CalendarBooking
25 août 2014 09:13
Réponse

jam dah

Rang: New Member

Publications: 15

Date d'inscription: 13 août 2014

Publications Récentes

Hi,
I am newer on liferay,I am using liferay 6.2-ga2.
I need to retreive list of calendar events from CalendarBooking, need your helps.
i added the calender service jar to my classpath, i found this code in the liferay forums, but it didn't work for me.
1 DynamicQuery dynamicQuery = DynamicQueryFactoryUtil.forClass(CalendarBooking.class, classLoader);
2         Conjunction primaryCriteria = RestrictionsFactoryUtil.conjunction();
3         //primaryCriteria.add(PropertyFactoryUtil.forName("startDate").le(todayDate));
4         dynamicQuery.add(primaryCriteria);
5         dynamicQuery.addOrder(OrderFactoryUtil.desc("startDate"));
6         dynamicQuery.setLimit(0, 20);
7         return (List<CalendarBooking>) CalendarBookingLocalServiceUtil.dynamicQuery(dynamicQuery);

Thanks
Manali Lalaji
RE: how to retreive list of calendar events from CalendarBooking
25 août 2014 09:46
Réponse

Manali Lalaji

Rang: Expert

Publications: 362

Date d'inscription: 9 mars 2010

Publications Récentes

Hi,

Are you creating your own custom Entity? Can you try below code?

1
2public List<CalendarEventModel> getEvents() throws SystemException, PortalException {
3
4final List<CalendarBooking> calEventsList = getAllCalendarBookingEvent();
5  for (CalendarBooking calendarBooking : calEventsList) {
6   //
7  }
8}


In getAllCalendarBookingEvent() method, can you try adding accessing CalendarBookingLocalServiceUtil.getCalendarBookings(0,0) and get eventIds for the same.



HTH!
jam dah
RE: how to retreive list of calendar events from CalendarBooking
25 août 2014 08:53
Réponse

jam dah

Rang: New Member

Publications: 15

Date d'inscription: 13 août 2014

Publications Récentes

Thanks for your help,
but it showed me two errors
1The method getAllCalendarBookingEvent() is undefined for the type

1The method getCalendarEventModel(CalendarBooking) is undefined for the type

Thanks
Manali Lalaji
RE: how to retreive list of calendar events from CalendarBooking
25 août 2014 09:50
Réponse

Manali Lalaji

Rang: Expert

Publications: 362

Date d'inscription: 9 mars 2010

Publications Récentes

jam dah:
Thanks for your help,
but it showed me two errors
1The method getAllCalendarBookingEvent() is undefined for the type

1The method getCalendarEventModel(CalendarBooking) is undefined for the type

Thanks


Hi,

You can also try to retrive using DynamicQuery for CalendarBooking class:

 1
 2 DynamicQuery query = DynamicQueryFactoryUtil.forClass(CalendarBooking.class, portalClassLoader)
 3                    .add(PropertyFactoryUtil.forName("startTime").le(endDate.getTime()))            
 4                     .addOrder(OrderFactoryUtil.desc("startTime"));
 5                                           
 6             List< CalendarBooking> events = CalendarBookingLocalServiceUtil.dynamicQuery(query);
 7             for ( CalendarBooking event : events)
 8             {
 9                 ...
10            }   



Refer: link , link1

HTH!