Пример #1
0
  private void fillDatabaseAliases(JwSet<Integer> aliasIds) {
    JwList<AcBatchAlias> v =
        _access.getBatchAliasDb().getBatchAliasesBefore(_batch.getStartUtcTs(), aliasIds);
    for (AcBatchAlias e : v) {
      Integer id = e.getAliasId();
      if (isAliasLoaded(id)) continue;

      _aliases.put(id, e);
      //            if ( id == DEBUG_ALIAS_ID )
      //            {
      //                debug(
      //                    "x",
      //                    "Alias "
      //                        + e.getAliasId()
      //                        + " batch "
      //                        + e.getBatchId()
      //                        + " group "
      //                        + e.getGroupCode());
      //                Thread.dumpStack();
      //            }
      if (e.hasGroupCode()) {
        // debug("1","Alias "+ e.getAliasId()+ " batch "+ e.getBatchId()+ " group "+
        // e.getGroupCode());
        addBatchGroup(_batchGroups, e.getBatchId(), e.getGroupCode());
      }
    }
  }
Пример #2
0
  private void logMissing(String modelType, JwSet<Integer> ids) {
    JwList<Integer> sortedIds = ids.toList();
    sortedIds.sort();

    JwLog.error(
        "Account %s, Batch %s, Missing snapshot parent %s %s",
        getAccountCode(), _batch.getId(), modelType, sortedIds);
  }
Пример #3
0
  private void loadLatestModelsRelatedToGroups(
      JwMap<Integer, JwSet<Integer>> m, Integer bId, JwSet<Integer> groups) {
    enterMonitor("AcActionSnapshotLoader.loadGroups");
    try {
      JwList<AcBatchItem> is;
      JwList<AcBatchNest> ns;
      JwList<AcBatchAlias> as;
      JwList<AcBatchFlight> fs;

      JwTimestamp utcTs = _batch.getStartUtcTs();
      is = _access.getBatchItemDb().getLatestViewBeforeByBatchGroups(bId, groups, utcTs);
      ns = _access.getBatchNestDb().getLatestViewBeforeByBatchGroups(bId, groups, utcTs);
      as = _access.getBatchAliasDb().getLatestViewBeforeByBatchGroups(bId, groups, utcTs);
      fs = _access.getBatchFlightDb().getLatestViewBeforeByBatchGroups(bId, groups, utcTs);

      for (AcBatchItem e : is) {
        //                if ( e.hasItemId(DEBUG_ITEM_ID) )
        //                {
        //                    debug("x","Item "+ e.getItemId()+ " batch "+ e.getBatchId()+ " group
        // "+ e.getGroupCode());
        //                    Thread.dumpStack();
        //                }
        _items.putIfMissing(e.getItemId(), e);
        addBatchGroup(m, e.getBatchId(), e.getGroupCode());
      }
      for (AcBatchNest e : ns) {
        _nests.putIfMissing(e.getNestId(), e);
        addBatchGroup(m, e.getBatchId(), e.getGroupCode());
      }
      for (AcBatchAlias e : as) {
        _aliases.putIfMissing(e.getAliasId(), e);
        //                if ( _aliases.putIfMissing(e.getAliasId(), e) )
        //                {
        //                    if ( e.hasAliasId(DEBUG_ALIAS_ID) )
        //                    {
        //                        debug("x", "Alias "
        //                            + e.getAliasId()
        //                            + " batch "
        //                            + e.getBatchId()
        //                            + " group "
        //                            + e.getGroupCode());
        //                        Thread.dumpStack();
        //                    }
        //                }
        addBatchGroup(m, e.getBatchId(), e.getGroupCode());
      }
      for (AcBatchFlight e : fs) {
        _flights.putIfMissing(e.getFlightId(), e);
        addBatchGroup(m, e.getBatchId(), e.getGroupCode());
      }
    } finally {
      exitMonitor();
    }
  }
Пример #4
0
  private void fillDatabaseFlights(JwSet<Integer> flightIds) {
    JwList<AcBatchFlight> v =
        _access.getBatchFlightDb().getBatchFlightsBefore(_batch.getStartUtcTs(), flightIds);
    for (AcBatchFlight e : v) {
      Integer id = e.getFlightId();
      if (isFlightLoaded(id)) continue;

      _flights.put(id, e);
      if (e.hasGroupCode()) {
        // debug("1","Flight "+ e.getFlightId()+ " batch "+ e.getBatchId()+ " group "+
        // e.getGroupCode());
        addBatchGroup(_batchGroups, e.getBatchId(), e.getGroupCode());
      }
    }
  }
Пример #5
0
  private void fillDatabaseItems(JwSet<Integer> itemIds) {
    JwList<AcBatchItem> v =
        _access.getBatchItemDb().getBatchItemsBefore(_batch.getStartUtcTs(), itemIds);
    for (AcBatchItem e : v) {
      Integer id = e.getItemId();
      if (isItemLoaded(id)) continue;

      _items.put(id, e);
      if (e.hasGroupCode()) {
        // debug("1","Item "+ e.getItemId()+ " batch "+ e.getBatchId()+ " group "+
        // e.getGroupCode());
        addBatchGroup(_batchGroups, e.getBatchId(), e.getGroupCode());
      }
    }
  }
Пример #6
0
  public void loadBatch(AcBatch b) {
    enterMonitor("AcActionSnapshotLoader.loadBatch");
    try {
      _batch = b;
      Integer batchId = b.getId();

      JwList<AcBatchItem> items = _access.getBatchItemDb().getAllByBatchId(batchId);
      JwList<AcBatchNest> nests = _access.getBatchNestDb().getAllByBatchId(batchId);
      JwList<AcBatchAlias> aliases = _access.getBatchAliasDb().getAllByBatchId(batchId);
      JwList<AcBatchFlight> flights = _access.getBatchFlightDb().getAllByBatchId(batchId);

      _items = AcBatchItem.toItemIdMap(items);
      //            AcBatchItem e = _items.get(DEBUG_ITEM_ID);
      //            if ( e != null )
      //            {
      //                debug("x","Item "+ e.getItemId()+ " batch "+ e.getBatchId()+ " group "+
      // e.getGroupCode());
      //                Thread.dumpStack();
      //            }

      _nests = AcBatchNest.toNestIdMap(nests);
      _aliases = AcBatchAlias.toAliasIdMap(aliases);
      //            AcBatchAlias e = _aliases.get(DEBUG_ALIAS_ID);
      //            if ( e != null )
      //            {
      //                debug(
      //                    "x",
      //                    "Alias "
      //                        + e.getAliasId()
      //                        + " batch "
      //                        + e.getBatchId()
      //                        + " group "
      //                        + e.getGroupCode());
      //                Thread.dumpStack();
      //            }
      _flights = AcBatchFlight.toFlightIdMap(flights);
    } finally {
      exitMonitor();
    }
  }