protected void initActionableDynamicQuery(ActionableDynamicQuery actionableDynamicQuery) {
    actionableDynamicQuery.setBaseLocalService(
        com.liferay.calendar.service.CalendarNotificationTemplateLocalServiceUtil.getService());
    actionableDynamicQuery.setClass(CalendarNotificationTemplate.class);
    actionableDynamicQuery.setClassLoader(getClassLoader());

    actionableDynamicQuery.setPrimaryKeyPropertyName("calendarNotificationTemplateId");
  }
  @Override
  public List<CalendarNotificationTemplate> fetchStagedModelsByUuidAndCompanyId(
      String uuid, long companyId) {

    return CalendarNotificationTemplateLocalServiceUtil
        .getCalendarNotificationTemplatesByUuidAndCompanyId(
            uuid,
            companyId,
            QueryUtil.ALL_POS,
            QueryUtil.ALL_POS,
            new StagedModelModifiedDateComparator<CalendarNotificationTemplate>());
  }
  @Override
  public ActionableDynamicQuery getActionableDynamicQuery() {
    ActionableDynamicQuery actionableDynamicQuery = new DefaultActionableDynamicQuery();

    actionableDynamicQuery.setBaseLocalService(
        com.liferay.calendar.service.CalendarNotificationTemplateLocalServiceUtil.getService());
    actionableDynamicQuery.setClass(CalendarNotificationTemplate.class);
    actionableDynamicQuery.setClassLoader(getClassLoader());

    actionableDynamicQuery.setPrimaryKeyPropertyName("calendarNotificationTemplateId");

    return actionableDynamicQuery;
  }
  @Override
  public CalendarNotificationTemplate fetchStagedModelByUuidAndGroupId(String uuid, long groupId) {

    return CalendarNotificationTemplateLocalServiceUtil
        .fetchCalendarNotificationTemplateByUuidAndGroupId(uuid, groupId);
  }
  @Override
  public void deleteStagedModel(CalendarNotificationTemplate calendarNotificationTemplate) {

    CalendarNotificationTemplateLocalServiceUtil.deleteCalendarNotificationTemplate(
        calendarNotificationTemplate);
  }
  @Override
  protected void doImportStagedModel(
      PortletDataContext portletDataContext,
      CalendarNotificationTemplate calendarNotificationTemplate)
      throws Exception {

    long userId = portletDataContext.getUserId(calendarNotificationTemplate.getUserUuid());

    Map<Long, Long> calendarIds =
        (Map<Long, Long>) portletDataContext.getNewPrimaryKeysMap(Calendar.class);

    long calendarId =
        MapUtil.getLong(
            calendarIds,
            calendarNotificationTemplate.getCalendarId(),
            calendarNotificationTemplate.getCalendarId());

    NotificationType notificationType =
        NotificationType.parse(calendarNotificationTemplate.getNotificationType());
    NotificationTemplateType notificationTemplateType =
        NotificationTemplateType.parse(calendarNotificationTemplate.getNotificationTemplateType());

    ServiceContext serviceContext =
        portletDataContext.createServiceContext(calendarNotificationTemplate);

    CalendarNotificationTemplate importedCalendarNotificationTemplate = null;

    String body =
        ExportImportHelperUtil.replaceImportContentReferences(
            portletDataContext,
            calendarNotificationTemplate,
            calendarNotificationTemplate.getBody());

    if (portletDataContext.isDataStrategyMirror()) {
      CalendarNotificationTemplate existingCalendarNotificationTemplate =
          fetchStagedModelByUuidAndGroupId(
              calendarNotificationTemplate.getUuid(), portletDataContext.getScopeGroupId());

      if (existingCalendarNotificationTemplate == null) {
        serviceContext.setUuid(calendarNotificationTemplate.getUuid());

        importedCalendarNotificationTemplate =
            CalendarNotificationTemplateLocalServiceUtil.addCalendarNotificationTemplate(
                userId,
                calendarId,
                notificationType,
                calendarNotificationTemplate.getNotificationTypeSettings(),
                notificationTemplateType,
                calendarNotificationTemplate.getSubject(),
                body,
                serviceContext);
      } else {
        importedCalendarNotificationTemplate =
            CalendarNotificationTemplateLocalServiceUtil.updateCalendarNotificationTemplate(
                existingCalendarNotificationTemplate.getCalendarNotificationTemplateId(),
                calendarNotificationTemplate.getNotificationTypeSettings(),
                calendarNotificationTemplate.getSubject(),
                body,
                serviceContext);
      }
    } else {
      importedCalendarNotificationTemplate =
          CalendarNotificationTemplateLocalServiceUtil.addCalendarNotificationTemplate(
              userId,
              calendarId,
              notificationType,
              calendarNotificationTemplate.getNotificationTypeSettings(),
              notificationTemplateType,
              calendarNotificationTemplate.getSubject(),
              body,
              serviceContext);
    }

    portletDataContext.importClassedModel(
        calendarNotificationTemplate, importedCalendarNotificationTemplate);
  }