Skip to content

Commit

Permalink
issue smclab#44: update calendarBooking without affect the index
Browse files Browse the repository at this point in the history
  • Loading branch information
mrk-vi committed Mar 9, 2021
1 parent 72fa89a commit 22fac97
Showing 1 changed file with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.service.ServiceContextThreadLocal;
import com.liferay.portal.kernel.service.UserLocalService;
import com.liferay.portal.kernel.util.Portal;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.workflow.WorkflowConstants;
Expand Down Expand Up @@ -960,7 +961,31 @@ protected void updateTitleAndDescription(
calendarBooking.setTitleMap(titleMap);
calendarBooking.setDescriptionMap(descriptionMap);

_calendarBookingLocalService.updateCalendarBooking(calendarBooking);
try {
_updateCalendarBooking(calendarBooking);
} catch (PortalException pe) {
_log.warn(
"Something went wrong while trying" +
" to update calendarBooking");
}
}

private void _updateCalendarBooking(CalendarBooking calendarBooking)
throws PortalException {
_calendarBookingLocalService.updateCalendarBooking(
calendarBooking.getUserId(),
calendarBooking.getCalendarBookingId(),
calendarBooking.getCalendarId(), calendarBooking.getTitleMap(),
calendarBooking.getDescriptionMap(),
calendarBooking.getLocation(), calendarBooking.getStartTime(),
calendarBooking.getEndTime(), calendarBooking.getAllDay(),
calendarBooking.getRecurrence(),
calendarBooking.getFirstReminder(),
calendarBooking.getFirstReminderType(),
calendarBooking.getSecondReminder(),
calendarBooking.getSecondReminderType(),
ServiceContextThreadLocal.getServiceContext()
);
}

private List<String> _getNotificationRecipients(Calendar calendar)
Expand Down Expand Up @@ -1129,8 +1154,7 @@ private void _updateAllBookingModifiedDate(
if (calendarBooking.getModifiedDate().getTime() < date.getTime()) {
parentCalendarBooking.setModifiedDate(date);

_calendarBookingLocalService.updateCalendarBooking(
parentCalendarBooking);
_updateCalendarBooking(parentCalendarBooking);
}

List<CalendarBooking> childCalendarBookings =
Expand All @@ -1145,8 +1169,7 @@ private void _updateAllBookingModifiedDate(

childCalendarBooking.setModifiedDate(date);

_calendarBookingLocalService.updateCalendarBooking(
childCalendarBooking);
_updateCalendarBooking(childCalendarBooking);
}
}

Expand Down

0 comments on commit 22fac97

Please sign in to comment.