Foros de discusión
Create calendar programmaticlly and adding Permissions model
juan meza, modificado hace 8 años.
Create calendar programmaticlly and adding Permissions model
Regular Member Mensajes: 228 Fecha de incorporación: 6/01/14 Mensajes recientes
Hi, I have Liferay 6.2 GA4...
I create a calendar in my portlet, with this code:
that works fine, and the calendar gets created... but after that i am facing an issue...
If I try to set permissions to the calendar, i get a blank page with an error in the log:
so how can i create the calendar with permissions? i want to create it with the default permissions, which are:
Permissions
Viewable by: Site Members
how can i do this??
thank you!!
I create a calendar in my portlet, with this code:
long calendarId = CounterLocalServiceUtil.increment(Calendar.class.getName());
calendar = CalendarLocalServiceUtil.createCalendar(calendarId);
calendar.setName(BIRTHDAYS_CALENDAR_NAME);
calendar.setGroupId(themeDisplay.getScopeGroupId());
calendar.setUserId(themeDisplay.getUserId());
calendar.setCreateDate(new Date());
calendar.setCompanyId(themeDisplay.getCompanyId());
calendar.setUserName(themeDisplay.getUser().getFullName());
calendar.setModifiedDate(new Date());
calendar.setCalendarResourceId(getCalendarDefault(themeDisplay.getScopeGroupId()).getCalendarResourceId());
calendar.setColor(6663561);
CalendarLocalServiceUtil.addCalendar(calendar);
that works fine, and the calendar gets created... but after that i am facing an issue...
If I try to set permissions to the calendar, i get a blank page with an error in the log:
java.lang.IllegalArgumentException: Permissioned model is null
so how can i create the calendar with permissions? i want to create it with the default permissions, which are:
Permissions
Viewable by: Site Members
how can i do this??
thank you!!
Tobias Liefke, modificado hace 8 años.
RE: Create calendar programmaticlly and adding Permissions model
Junior Member Mensajes: 78 Fecha de incorporación: 23/11/12 Mensajes recientes
If you crosspost a question on multiple sites, please add a reference to the other postings as well:
Same question on Stackoverflow
Same question on Stackoverflow
juan meza, modificado hace 8 años.
RE: Create calendar programmaticlly and adding Permissions model
Regular Member Mensajes: 228 Fecha de incorporación: 6/01/14 Mensajes recientes
Hi, I found an answer, ill leave it here in case it helps someone!
you just have to add the modelResource method after creating the calendar:
you just have to add the modelResource method after creating the calendar:
ResourceLocalServiceUtil.addModelResources(calendar, serviceContext);
vipul gupta, modificado hace 8 años.
RE: Create calendar programmaticlly and adding Permissions model
New Member Mensajes: 4 Fecha de incorporación: 11/08/15 Mensajes recientes
Hey, Can you tell me how to get that recurrence object back am trying to get it from CalendarBooking object..
CalendarBooking booking=CalendarBookingLocalServiceUtil.getCalendarBooking(calendarBookingId);
Recurrence recur=booking.getRecurrenceObj();
But Its giving me an unsupported Operation exception
CalendarBooking booking=CalendarBookingLocalServiceUtil.getCalendarBooking(calendarBookingId);
Recurrence recur=booking.getRecurrenceObj();
But Its giving me an unsupported Operation exception