Package uk.ac.bbsrc.tgac.miso.core.event

Examples of uk.ac.bbsrc.tgac.miso.core.event.Alert


  public JSONObject setAlertAsRead(HttpSession session, JSONObject json) {
    Long alertId = json.getLong("alertId");
    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
      Alert a = requestManager.getAlertById(alertId);
      if (a.getAlertUser().equals(user)) {
        a.setAlertRead(true);
        requestManager.saveAlert(a);
      }
      else {
        JSONUtils.SimpleJSONError("You do not have the rights to set this alert as read");
      }
View Full Code Here


      }
    )
  )
  public Alert get(long alertId) throws IOException {
    List<Alert> eResults = template.query(ALERT_SELECT_BY_ID, new Object[]{alertId}, new AlertMapper());
    Alert e = eResults.size() > 0 ? eResults.get(0) : null;
    return e;
  }
View Full Code Here

    }

    @Override
    public Alert mapRow(ResultSet rs, int rowNum) throws SQLException {
      long id = rs.getLong("alertId");
      Alert a = null;

      try {
        if (isCacheEnabled() && lookupCache(cacheManager) != null) {
          Element element;
          if ((element = lookupCache(cacheManager).get(DbUtils.hashCodeCacheKeyFor(id))) != null) {
            log.debug("Cache hit on map for Alert " + id);
            return (Alert)element.getObjectValue();
          }
        }


        try {
          if (rs.getLong("userId") == LimsUtils.SYSTEM_USER_ID) {
            a = new SystemAlert();
          }
          else {
            User u = securityManager.getUserById(rs.getLong("userId"));
            a = new DefaultAlert(u);
          }
          a.setAlertId(id);
          a.setAlertTitle(rs.getString("title"));
          a.setAlertText(rs.getString("text"));
          a.setAlertRead(rs.getBoolean("isRead"));
          a.setAlertLevel(AlertLevel.get(rs.getString("level")));
          a.setAlertDate(rs.getDate("date"));
        }
        catch (IOException e1) {
          e1.printStackTrace();
        }
View Full Code Here

    this.alertLevel = alertLevel;
  }

  @Override
  public int compareTo(Object o) {
    Alert a = (Alert)o;
    if (getAlertId() != null && a.getAlertId() != null) {
      if (getAlertId() < a.getAlertId()) return -1;
      if (getAlertId() > a.getAlertId()) return 1;
    }
    return 0;
  }
View Full Code Here

  @Override
  public void generateResponse(Event event) {
    log.info("Responding to event: " + event.getEventMessage() + ". Raising alert...");
    User u = new UserImpl();
    u.setFullName("Bar baz");
    Alert a = new MockAlert(u);
    a.setAlertText(a.getAlertText() + " ("+event.getEventMessage()+")");

    for (AlerterService as : alerterServices) {
      try {
        as.raiseAlert(a);
      }
View Full Code Here

  public void generateResponse(Event event) {
    log.info("Responding to event: " + event.getEventMessage() + ". Raising alert...");

    User u = new UserImpl();
    u.setFullName("Foo bar");
    Alert a = new MockAlert(u);
    a.setAlertTitle("New alert for " + u.getFullName());
    a.setAlertText(a.getAlertText() + " ("+event.getEventMessage()+")");

    for (AlerterService as : alerterServices) {
      try {
        as.raiseAlert(a);
      }
View Full Code Here

    if (event instanceof ProjectOverviewEvent) {
      ProjectOverviewEvent re = (ProjectOverviewEvent)event;
      ProjectOverview po = re.getEventObject();

      for (User user : po.getWatchers()) {
        Alert a = new DefaultAlert(user);
        a.setAlertTitle("All runs have now completed for project " + po.getProject().getAlias() + "(" + po.getProject().getName() + ")");
        a.setAlertText("The following runs associated with this Project have been completed: "+po.getProject().getAlias()+" ("+event.getEventMessage()+"). Please view Project " +po.getProject().getProjectId() + " in MISO for more information");

        for (AlerterService as : alerterServices) {
          try {
            as.raiseAlert(a);
          }
View Full Code Here

    if (event instanceof ProjectOverviewEvent) {
      ProjectOverviewEvent re = (ProjectOverviewEvent)event;
      ProjectOverview po = re.getEventObject();

      for (User user : po.getWatchers()) {
        Alert a = new DefaultAlert(user);
        a.setAlertTitle("Primary analysis for project " + po.getProject().getAlias() + "(" + po.getProject().getName() + ")");
        a.setAlertText("The primary analysis related to this Project has completed: "+po.getProject().getAlias()+" ("+event.getEventMessage()+"). Please view Project " +po.getProject().getProjectId() + " in MISO for more information");

        for (AlerterService as : alerterServices) {
          try {
            as.raiseAlert(a);
          }
View Full Code Here

    this.alertLevel = alertLevel;
  }

  @Override
  public int compareTo(Object o) {
    Alert a = (Alert)o;
    if (getAlertId() != null && a.getAlertId() != null) {
      if (getAlertId() < a.getAlertId()) return -1;
      if (getAlertId() > a.getAlertId()) return 1;
    }
    return 0;
  }
View Full Code Here

      Pool p = pe.getEventObject();

      for (User user : p.getWatchers()) {
        log.info("Responding to " + user.getLoginName());

        Alert a = new DefaultAlert(user);
        //TODO change to p.getAlias() when added
        a.setAlertTitle("Pool " + p.getName() + "(" + p.getId() + ")");
        a.setAlertText("The following Pool is ready to run: "+p.getName()+" ("+event.getEventMessage()+"). Please view Pool " +p.getId() + " in MISO for more information");

        for (AlerterService as : alerterServices) {
          try {
            as.raiseAlert(a);
          }
View Full Code Here

TOP

Related Classes of uk.ac.bbsrc.tgac.miso.core.event.Alert

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.