@Override public void importCalEvent(CalEvent calEvent) throws PortalException, SystemException { // Calendar event if (isImported(calEvent)) { return; } long calendarBookingId = counterLocalService.increment(); CalendarResource calendarResource = getCalendarResource(calEvent.getCompanyId(), calEvent.getGroupId()); Date startDate = calEvent.getStartDate(); long startTime = startDate.getTime(); long endTime = startTime + calEvent.getDurationHour() * Time.HOUR + calEvent.getDurationMinute() * Time.MINUTE; if (calEvent.isAllDay()) { endTime = endTime - 1; } String recurrence = getRecurrence(calEvent.getRecurrenceObj()); addCalendarBooking( calEvent.getUuid(), calendarBookingId, calEvent.getCompanyId(), calendarResource.getGroupId(), calEvent.getUserId(), calEvent.getUserName(), calEvent.getCreateDate(), calEvent.getModifiedDate(), calendarResource.getDefaultCalendarId(), calendarResource.getCalendarResourceId(), calEvent.getTitle(), calEvent.getDescription(), calEvent.getLocation(), startTime, endTime, calEvent.getAllDay(), recurrence, calEvent.getFirstReminder(), NotificationType.EMAIL, calEvent.getSecondReminder(), NotificationType.EMAIL); // Resources importCalendarBookingResourcePermissions(calEvent, calendarBookingId); // Subscriptions importSubscriptions(calEvent, calendarBookingId); // Asset importAssets(calEvent, calendarBookingId); // Message boards importMBDiscussion(calEvent, calendarBookingId); // Social importSocialActivities(calEvent, calendarBookingId); // Ratings importRatings( classNameLocalService.getClassNameId(CalEvent.class.getName()), calEvent.getEventId(), classNameLocalService.getClassNameId(CalendarBooking.class.getName()), calendarBookingId); }