示例#1
0
 public int checkAuthority(Object budgetKey, String authority) {
   Log.info(this, this.getKeyAsString() + " Checking with: " + authority);
   for (int i = 0; i < this.budgetDrawerList.size(); i++) {
     BudgetDrawer drawer = (BudgetDrawer) this.budgetDrawerList.get(i);
     Log.info(
         this, this.getKeyAsString() + " Authority found: " + drawer.getComp_id().getAuthority());
     if (drawer.getComp_id().getAuthority().trim().equalsIgnoreCase(authority)) {
       if (drawer.getStatus().equalsIgnoreCase("03")) {
         i = this.budgetDrawerList.size();
         Log.info(
             this,
             this.getKeyAsString()
                 + "Authority: "
                 + drawer.getComp_id().getAuthority()
                 + " is inactive");
         return BudgetReturn.AUTHORITYNOTACTIVE;
       } else {
         i = this.budgetDrawerList.size();
         return BudgetReturn.NOEXCEPTION;
       }
     }
   }
   Log.info(this, this.getKeyAsString() + "No matching authority found.");
   return BudgetReturn.NOAUTHORITY;
 }
示例#2
0
  public boolean isMaxLockExpired() {
    String sTimeOutPeriod =
        PropertiesManager.getInstance(this.getOrganizationId())
            .getProperty("budgetservice", "lockingPeriod", "30");
    long timeOut = 2000L * (Long.parseLong(sTimeOutPeriod));
    Calendar now = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
    long diff = now.getTimeInMillis() - this.getLockingStart().getTimeInMillis();

    if (diff > timeOut) {
      Log.info(this, "Lock Max Expired. Will be Timed out. ");
      return true;
    }
    return false;
  }
示例#3
0
  public BigDecimal setLocked(boolean _locked, String userId, BigDecimal token) {
    if (_locked) {
      this.locked = _locked;
      this.lockingToken = token;
      this.setLockingId(userId);
      this.setLockingStart(Calendar.getInstance(TimeZone.getTimeZone("GMT")));
      return this.lockingToken;
    } else {
      Calendar now = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
      long diff = now.getTimeInMillis() - this.getLockingStart().getTimeInMillis();
      Log.info(this, "TransactionTotal Time: " + diff);
      this.locked = _locked;
      this.lockingToken = new BigDecimal(0);
      this.setLockingId("");
      this.setLockingStart(now);

      return this.lockingToken;
    }
  }