// ##################################################
  // # reporting
  // ##################################################//
  private void reportNoCarditProcessed(AcInputChannel channel, JwTimestamp start, JwTimestamp end) {
    String subject =
        JwUtility.format(
            "No CARDIT processed for channel: %s, account: %s",
            channel.getName(), _access.getAccountCode());

    String msg =
        JwUtility.format(
            "Report run at: %s. No CARDITs processed between %s and %s for %s in account %s",
            _now, start, end, channel.getName(), _access.getAccountCode());

    reportMessage(subject, msg);
  }
 protected AcAirport getAirport(String airportCode) {
   String accountCode = _access.getAccountCode();
   return AcCacheRegistry.instance
       .getAccount(accountCode)
       .getAirportCache()
       .getAirport(airportCode);
 }
 private JwList<AcReceivedFileRollup> getRollupData(
     AcInputChannel channel, JwTimestamp start, JwTimestamp end) {
   debug(
       "Retrieving rollup data for account %s, channel %s, start %s, end %s",
       _access.getAccountCode(), channel.getName(), start, end);
   return _access.getReceivedFileRollupDb().getAllBetweenUtc(channel.getId(), start, end);
 }
  private void init() {
    String accountCode = _access.getAccountCode();
    AcPropertyRegistry pr = AcPropertyRegistries.getAccount(accountCode);

    _emailConfiguration = getEmailConfiguration(pr);
    _logResults = pr.getReceivedFileMonitorLoggingEnabled();
    _alertExpirationMinutes = pr.getReceivedFileAlertExpirationMinutes();
  }
  protected byte[] run() {
    _nowUtcTs = AcGlobals.nowUtc();

    makeModels();

    String accountCode = _access.getAccountCode();
    AcPropertyRegistry pr = AcPropertyRegistries.getAccount(accountCode);
    AcCn46Document document = new AcCn46Document(pr);
    byte[] pdf = document.makeDocument(_models.getValues());
    _isValidCn46Document = document.isValidDocument();
    return pdf;
  }
  protected AcCn46ActualConveyanceModel getModel(
      AcItem i, AcUpuTag upuTag, String offloadingAirport, boolean splitOnDispatchDestination) {
    AcFlight f = getDepartingFlight(i.getId());
    AcResult last = getLastHandledAction(i.getId());

    _dummy.clear();
    _dummy.setTypeFromTag(upuTag);
    if (splitOnDispatchDestination)
      _dummy.setDispatchDestination(upuTag.getDestinationDispatchImpcCode());
    if (last != null) {
      AcAirport a = getAirport(last.getAirportCode());
      _dummy.setLastHandledAirport(last.getAirportCode());
      _dummy.setGeneratedTz(a.getTimeZone());
    }
    _dummy.setOriginAdministration(i.getUpuShortPostName());
    _dummy.setAirportOfOffloading(offloadingAirport);
    if (f != null) {
      _dummy.setAirportOfLoading(f.getOriginAirportCode());
      _dummy.setFlightCarrierCode(f.getOperatorCarrierCode());
      _dummy.setFlightNumber(f.getOperatorNumber());
      _dummy.setFlightNumberDisplayLabel(f.getOperatorNumberDisplayLabel());
      _dummy.setDepartureDt(
          f.hasActualDepartureLocalTs()
              ? f.getActualDepartureLocalTs().getDate()
              : f.getScheduledDepartureLocalDt());
    }
    String key = _dummy.getHashKey();
    AcCn46ActualConveyanceModel model = _models.get(key);
    if (model == null) {
      model = _dummy.getCopy();
      model.setCarrierCode(AcUtility.getAccountCarrierName(_access.getAccountCode()));
      model.setGeneratedTs(_nowUtcTs);
      model.setNote("** Note: This document was generated out of VelocityMail **");
      _models.put(key, model);
    }

    return model;
  }
 private String getAccountCode() {
   return _access.getAccountCode();
 }