Package org.eurekaj.api.datatypes.basic

Examples of org.eurekaj.api.datatypes.basic.BasicAlertEvaluation


 
  @Override
  public void addAccountNamesToNewQueue(List<String> accountNameList) {
    Hashtable<String, AlertEvaluation> alertEvaluationHash = new Hashtable<>();
   
    for (BasicAlertEvaluation alertEvaluation: RiakAbstractDao.getListFromRiakBucket(riakClient, newAlertEvaluationQueueBucketKey, new BasicAlertEvaluation(), BasicAlertEvaluation.class)) {
      if (alertEvaluation != null && alertEvaluation.getAccountName() != null) {
        alertEvaluationHash.put(alertEvaluation.getAccountName(), alertEvaluation);
      }
    }
   
    //Add only the new AlertEvaluations to the new queue
    List<BasicAlertEvaluation> alertEvaluationsToAdd = new ArrayList<>();
    for (String account : accountNameList) {
      if (alertEvaluationHash.get(account) == null) {
        BasicAlertEvaluation newAlertEvaluation = new BasicAlertEvaluation();
        newAlertEvaluation.setId(account);
        newAlertEvaluation.setAccountName(account);
        newAlertEvaluation.setQueue("new");
        alertEvaluationsToAdd.add(newAlertEvaluation);
      }
    }
   
    for (BasicAlertEvaluation alertEvaluation : alertEvaluationsToAdd) {
View Full Code Here


    RiakAbstractDao.deleteObjectInBucket(riakClient, alertEvaluationQueueBucketKey + ";evaluating", accountName);
  }
 
  @Override
  public String getNextAccountToEvaluateAndMarkAsEvaluating() {
    BasicAlertEvaluation nextAccount = null;
   
    for (BasicAlertEvaluation alertEvaluation: RiakAbstractDao.getListFromRiakBucket(riakClient, newAlertEvaluationQueueBucketKey, new BasicAlertEvaluation(), BasicAlertEvaluation.class)) {
      nextAccount = alertEvaluation;
      break;
    }
   
   
    if (nextAccount != null) {
      RiakAbstractDao.deleteObjectInBucket(riakClient, newAlertEvaluationQueueBucketKey, nextAccount.getAccountName());
      nextAccount.setQueue("evaluating");
      RiakAbstractDao.persistObjectInBucket(riakClient, alertEvaluationQueueBucketKey + ";" + nextAccount.getQueue(),  nextAccount.getAccountName(), nextAccount);
      return nextAccount.getId();
    } else {
      return null;
    }
  }
View Full Code Here

    //Fetch any account already in the new queue and add the new AlertEvaluations to the new queue
    DBIterator iterator = db.iterator();
    iterator.seek(bytes(alertEvaluationQueueBucketKey + ";new"));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(alertEvaluationQueueBucketKey + ";new")) {
      BasicAlertEvaluation alertEvaluation = new Gson().fromJson(asString(iterator.next().getValue()), BasicAlertEvaluation.class);
      alertEvaluationHash.put(alertEvaluation.getAccountName(), alertEvaluation);
    }
   
    //Add only the new AlertEvaluations to the new queue
    List<BasicAlertEvaluation> alertEvaluationsToAdd = new ArrayList<>();
    for (String accountName : accountNameList) {
      if (alertEvaluationHash.get(accountName) == null) {
        BasicAlertEvaluation newAlertEvaluation = new BasicAlertEvaluation();
        newAlertEvaluation.setId(accountName);
        newAlertEvaluation.setAccountName(accountName);
        newAlertEvaluation.setQueue("new");
        alertEvaluationsToAdd.add(newAlertEvaluation);
      }
    }
   
    //Write the new Alert Evaluations to the new queue
View Full Code Here

    }
  }

  @Override
  public synchronized String getNextAccountToEvaluateAndMarkAsEvaluating() {
    BasicAlertEvaluation nextAccount = null;
   
    DBIterator iterator = db.iterator();
    iterator.seek(bytes(alertEvaluationQueueBucketKey + ";new"));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(alertEvaluationQueueBucketKey + ";new")) {
      BasicAlertEvaluation alertEvaluation = new Gson().fromJson(asString(iterator.next().getValue()), BasicAlertEvaluation.class);
      nextAccount = alertEvaluation;
      break;
    }
   
    //Write the new Alert Evaluations to the new queue
View Full Code Here

TOP

Related Classes of org.eurekaj.api.datatypes.basic.BasicAlertEvaluation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.