Package org.eurekaj.api.datatypes.basic

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


    List<AlertRecipient> alertRecipientList = new ArrayList<>();

    DBIterator iterator = db.iterator();
    iterator.seek(bytes(alertRecipientBucketKey + accountName));
    while (iterator.hasNext() && asString(iterator.peekNext().getKey()).startsWith(alertRecipientBucketKey + accountName)) {
      BasicAlertRecipient alert = gson.fromJson(asString(iterator.next().getValue()), BasicAlertRecipient.class);
      alertRecipientList.add(alert);
    }

    return alertRecipientList;
  }
View Full Code Here


  }

  @Override
  public AlertRecipient getAlertRecipient(String accountName, String alertRecipientName) {
    String json = asString(db.get(bytes(alertRecipientBucketKey + accountName + ";" + alertRecipientName)));
    BasicAlertRecipient alertRecipient = gson.fromJson(json, BasicAlertRecipient.class);
    return alertRecipient;
  }
View Full Code Here

    return alertRecipient;
  }

  @Override
  public void persistAlertRecipient(AlertRecipient alertRecipient) {
    db.put(bytes(alertRecipientBucketKey + alertRecipient.getAccountName() + ";" +  alertRecipient.getId()), bytes(gson.toJson(new BasicAlertRecipient(alertRecipient))));   
  }
View Full Code Here

    if (isGet(e) && isAdmin(loggedInUser)) { // Get account for current user
      List<AlertRecipient> alertRecipientList = getAdministrationService().getAlertRecipients(loggedInUser.getAccountName());
      JsonArray alertArray = new JsonArray();
      for (AlertRecipient ar : alertRecipientList) {
        BasicAlertRecipient basicAr = new BasicAlertRecipient(ar);
        alertArray.add(new Gson().toJsonTree(basicAr, BasicAlertRecipient.class));
      }
     
      JsonObject alertPlugins = new JsonObject();
      alertPlugins.add("alertRecipients", alertArray);

      jsonResponse = alertPlugins.toString();
    } else if ((isPost(e) || isPut(e)) && isAdmin(loggedInUser)) {
      AlertRecipientModel alertRecipientModel = new Gson().fromJson(messageContent, AlertRecipientModel.class);
      BasicAlertRecipient alertRecipient = alertRecipientModel.getAlertRecipient();
     
      if (id != null) {
        alertRecipient.setId(id);
      }
      alertRecipient.setAccountName(loggedInUser.getAccountName());
     
     
      logger.info("Persisting Alert Recipient: " + new Gson().toJson(alertRecipient));
     
      getAdministrationService().persistAlertRecipient(alertRecipient);
View Full Code Here

    }
   
  @Override
  public List<AlertRecipient> getAlertRecipients(String accountName) {
    List<AlertRecipient> retList = new ArrayList<>();
    retList.addAll(RiakAbstractDao.getListFromRiakBucket(riakClient, alertRecipientBucketKey, new BasicAlertRecipient(), BasicAlertRecipient.class));
    return retList;
  }
View Full Code Here

    return retList;
  }

  @Override
  public AlertRecipient getAlertRecipient(String accountName, String alertRecipientName) {
    return RiakAbstractDao.getObjectFromBucket(riakClient, alertRecipientBucketKey, accountName + ";" + alertRecipientName, new BasicAlertRecipient(), BasicAlertRecipient.class);
  }
View Full Code Here

TOP

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

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.