Example #1
0
  public CashMoneyWalletImpl(
      final PluginDatabaseSystem pluginDatabaseSystem,
      final UUID pluginId,
      final ErrorManager errorManager,
      String walletPublicKey)
      throws CantGetCashMoneyWalletException {
    this.pluginDatabaseSystem = pluginDatabaseSystem;
    this.pluginId = pluginId;
    this.errorManager = errorManager;
    this.walletPublicKey = walletPublicKey;

    try {
      this.dao = new CashMoneyWalletDao(pluginDatabaseSystem, pluginId, errorManager);
      dao.initialize();

      if (dao.walletExists(walletPublicKey)) this.walletPublicKey = walletPublicKey;
      else throw new CashMoneyWalletDoesNotExistException();

    } catch (Exception e) {
      errorManager.reportUnexpectedPluginException(
          Plugins.BITDUBAI_CSH_WALLET_CASH_MONEY,
          UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN,
          e);
      throw new CantGetCashMoneyWalletException(
          CantGetCashMoneyWalletException.DEFAULT_MESSAGE, e, null, null);
    }
  }