@Override
  public void storeSendSchedule(SendSchedule schedule) {
    try {
      // Get record representation:
      Record rec = SEND_SCHEDULE_SCHEMA.createRecord();
      if (schedule.isIDSet()) SEND_SCHEDULE_COLUMN_ID.storeValue(rec, schedule.getID());
      SEND_SCHEDULE_COLUMN_PROJECT.storeValue(
          rec, getProjectRecordReference(schedule.getProject()));
      SEND_SCHEDULE_COLUMN_RECEIVER.storeValue(
          rec,
          transmissionStore.getCorrespondentRecordReference(schedule.getReceiver(), true, false));
      SEND_SCHEDULE_COLUMN_INTERVAL.storeValue(rec, schedule.getTransmitIntervalS());
      SEND_SCHEDULE_COLUMN_ENCRYPT.storeValue(rec, schedule.isEncrypt());
      SEND_SCHEDULE_COLUMN_ENABLED.storeValue(rec, schedule.isEnabled());
      SEND_SCHEDULE_COLUMN_HEARTBEAT_INTERVAL.storeValue(rec, schedule.getHeartbeatInterval());
      SEND_SCHEDULE_COLUMN_NO_DATA_COUNTER.storeValue(rec, schedule.getNoDataToSendCounter());

      // Store/update the record in the db:
      rsWrapper.recordStore.store(rec);

      // Check/set id on the object:
      if (schedule.isIDSet()) // if the object already had an ID...
      { // then it should match the ID on the record, so let's verify:
        if (schedule.getID() != SEND_SCHEDULE_COLUMN_ID.retrieveValue(rec).intValue())
          throw new IllegalStateException("Non-matching schedule ID"); // this should never happen
      } else
        // Set id in object as on the record:
        schedule.setID(SEND_SCHEDULE_COLUMN_ID.retrieveValue(rec).intValue());
    } catch (DBException e) {
      client.logError("Error upon storing send schedule", e);
    }
  }
 @Override
 public List<SendSchedule> retrieveSendSchedulesForTransmissionType(
     Transmission.Type transmissionType, boolean enabledOnly) {
   List<SendSchedule> schedules = new ArrayList<SendSchedule>();
   for (SendSchedule schedule :
       retrieveSendSchedules(
           enabledOnly
               ? new EqualityConstraint(SEND_SCHEDULE_COLUMN_ENABLED, Boolean.TRUE)
               : null))
     if (schedule.getProject() != null
         && schedule.getReceiver() != null
         && (transmissionType == null
             || transmissionType.ordinal()
                 == schedule.getReceiver().getTransmissionType().ordinal()))
       schedules.add(schedule);
   return schedules;
 }