Package org.eurekaj.api.datatypes.basic

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


          if (account != null && newAccessToken != null && newAccessToken.getId() != null && newAccessToken.getId().length() >= 16) {
            newAccessToken.setAccountName(account.getId());
            logger.info("Persisting AccessToken: " + new Gson().toJson(newAccessToken));
            getAccountService().persistAccessToken(newAccessToken);
            if (account.getAccessTokens() == null) {
              BasicAccount newAccount = new BasicAccount(account);
              newAccount.setAccessTokens(new ArrayList<String>());
              account = newAccount;
            }
            account.getAccessTokens().add(newAccessToken.getId());
            getAccountService().persistAccount(account);
          }
View Full Code Here


       
        logger.info(messageContent);
       
        if ((isPost(e) || isPut(e)) && isRoot(session)) {
            //Update the account
            BasicAccount account = new Gson().fromJson(messageContent, BasicAccount.class);
            logger.info("Account Name: " + account.getId());
            logger.info("Account Type: " + account.getAccountType());

            getAccountService().persistAccount(account);
        } else if (isPost(e) && session != null) { //Register new account
          //TODO: Verify that account name is unique!!
          JSONObject jsonObject = BuildJsonObjectsUtil.extractJsonContents(getHttpMessageContent(e));

            Account account = ParseJsonObjects.parseAccount(jsonObject);
            logger.info("Account Name: " + account.getId());
            BasicAccount basicAccount = new BasicAccount(account);
            basicAccount.setAccountType("new");

            getAccountService().persistAccount(account);
        } else if(isGet(e) && id != null && session != null) { //Get account for current user
          logger.info("Getting account for: " + session.getAccountName());
          Account account = getAccountService().getAccount(session.getAccountName());
View Full Code Here

  }

  @Override
  public Account getAccount(String id) {
    String json = asString(db.get(bytes(accountBucketKey + id)));
    BasicAccount account = gson.fromJson(json, BasicAccount.class);
    return account;
  }
View Full Code Here

    return account;
  }

  @Override
  public void persistAccount(Account account) {
    db.put(bytes(accountBucketKey + account.getId()), bytes(gson.toJson(new BasicAccount(account))));
  }
View Full Code Here

                newUser.setUserName(session.getEmail());
                getAccountService().persistUser(newUser);
               
                logger.info("persisted user: " + new Gson().toJson(newUser));
               
                BasicAccount newAccount = new BasicAccount();
                newAccount.setId(httpUser.getAccountName());
                newAccount.setAccountType("new");
               
                getAccountService().persistAccount(newAccount);
               
                jsonResponse = "{ \"registered\": " + "true, \"uuidToken\": \"" + updatedSession.getUuid() + "\"}";
              } else {
View Full Code Here

    try {
      logger.info("Running ProcessAlertEvaluationQueue");
      String accountName = dbPlugin.getAlertEvaluationQueueDao().getNextAccountToEvaluateAndMarkAsEvaluating();
      while (accountName != null) {
        logger.info("Processing alerts for account " + accountName);
        BasicAccount account = new BasicAccount(dbPlugin.getAccountDao().getAccount(accountName));
        account.setLastEvaluatedForAlerts(System.currentTimeMillis());
        dbPlugin.getAccountDao().persistAccount(account);
       
        //Get alerts for account
        for (Alert alert : dbPlugin.getAlertDao().getAlerts(accountName)) {
          logger.info("Evaluating alert: " + alert.getAlertName() + " for account: " + alert.getAccountName());
          if (alert.isActivated()) {
            AlertStatus oldStatus = alert.getStatus();
            List<LiveStatistics> statList = getStatistic(alert.getGuiPath(), alert.getAlertDelay(), account.getId());
            //Get statistics and evaluate alert condition
            AlertStatus newStatus = evaluateStatistics(alert, statList);
            if (oldStatus != newStatus && statList.size() >= 1) {
                        //Status have changed, store new triggeredAlert and send email
              logger.info("Alert status changed: " + newStatus.getStatusName() + " num plugins: " + alert.getSelectedEmailSenderList().size());
View Full Code Here

TOP

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

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.