Example #1
0
  private boolean isAssetsByReceptionStatus(ReceptionStatus receptionStatus)
      throws CantExecuteQueryException {
    try {
      this.database = openDatabase();
      DatabaseTable databaseTable;
      databaseTable = database.getTable(AssetReceptionDatabaseConstants.ASSET_RECEPTION_TABLE_NAME);
      databaseTable.addStringFilter(
          AssetReceptionDatabaseConstants.ASSET_RECEPTION_RECEPTION_STATUS_COLUMN_NAME,
          receptionStatus.getCode(),
          DatabaseFilterType.EQUAL);
      databaseTable.addStringFilter(
          AssetReceptionDatabaseConstants.ASSET_RECEPTION_CRYPTO_STATUS_COLUMN_NAME,
          CryptoStatus.PENDING_SUBMIT.getCode(),
          DatabaseFilterType.EQUAL);
      databaseTable.loadToMemory();

      return !databaseTable.getRecords().isEmpty();
    } catch (CantLoadTableToMemoryException exception) {

      throw new CantExecuteQueryException(
          "Error executing query in DB.",
          exception,
          "Getting assets by reception status.",
          "Cannot load table to memory.");
    } catch (Exception exception) {

      throw new CantExecuteQueryException(
          CantExecuteQueryException.DEFAULT_MESSAGE,
          FermatException.wrapException(exception),
          "Getting assets by reception status.",
          "Unexpected exception");
    }
  }
Example #2
0
 public List<String> getGenesisTransactionByReceptionStatus(ReceptionStatus receptionStatus)
     throws CantCheckAssetReceptionProgressException {
   return getValueListFromTableByColumn(
       receptionStatus.getCode(),
       AssetReceptionDatabaseConstants.ASSET_RECEPTION_TABLE_NAME,
       AssetReceptionDatabaseConstants.ASSET_RECEPTION_RECEPTION_STATUS_COLUMN_NAME,
       AssetReceptionDatabaseConstants.ASSET_RECEPTION_GENESIS_TRANSACTION_COLUMN_NAME);
 }
Example #3
0
 public void updateReceptionStatusByGenesisTransaction(
     ReceptionStatus receptionStatus, String genesisTransaction)
     throws CantExecuteQueryException, UnexpectedResultReturnedFromDatabaseException {
   updateStringValueByStringField(
       receptionStatus.getCode(),
       AssetReceptionDatabaseConstants.ASSET_RECEPTION_RECEPTION_STATUS_COLUMN_NAME,
       genesisTransaction,
       AssetReceptionDatabaseConstants.ASSET_RECEPTION_GENESIS_TRANSACTION_COLUMN_NAME);
 }