Exemplo n.º 1
0
  public boolean isAccountBeingUsed(Account account) {
    if (log.isDebugEnabled())
      log.debug(
          String.format(
              "Checking account %s, user_id %s for last registration with location service",
              account.getId(), account.getUser_id()));

    IPeekLocationService locationService = new PeekLocationService();
    Date lastUpdated = null;
    try {
      lastUpdated = locationService.getLastUpdatedTimestamp(account.getUser_id());
    } catch (DALException e) {
      log.error(UtilsTools.getExceptionStackTrace(e));
    }
    if (lastUpdated == null) {
      log.debug("Last updated value not found, so we should still check this account");
      return true;
    }
    Date now = new Date();
    Long interval = dayMultiplier * mailcheckDisableIntervalInHours;
    Long sinceLastConnection = now.getTime() - lastUpdated.getTime();
    if (sinceLastConnection > interval) {
      if (log.isDebugEnabled())
        log.debug(
            String.format(
                "Last mail check was %s hours ago, > %s hour interval , we will not check this account",
                sinceLastConnection / dayMultiplier, interval / dayMultiplier));
      return false;
    }

    return true;
  }
Exemplo n.º 2
0
 private BigDecimal randomExpenseAmount(Account account, Date date, Double part) {
   BigDecimal balance = balanceWorker.getBalance(account.getId(), date);
   if (BigDecimal.ZERO.compareTo(balance) >= 0) return BigDecimal.ZERO;
   else {
     return new BigDecimal((int) (Math.random() * balance.doubleValue() * part));
   }
 }
Exemplo n.º 3
0
 protected boolean isMessageAlreadyProcessed(
     String messageId, Account account, String storeBucket, Set<String> storeMessageIds)
     throws MessageStoreException {
   return messageId != null
       && (storeMessageIds.contains(messageId)
           || messageIdStore.hasMessage(
               account.getId(), storeBucket, messageId, account.getCountry()));
 }