Package com.eaglegenomics.simlims.core

Examples of com.eaglegenomics.simlims.core.User


  }

  public JSONObject checkAlerts(HttpSession session, JSONObject json) {
    JSONObject response = new JSONObject();
    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
      if (!requestManager.listUnreadAlertsByUserId(user.getUserId()).isEmpty()) {
        response.put("newAlerts", true);
      }
    }
    catch (IOException e) {
      e.printStackTrace();
View Full Code Here


  public JSONObject getAlerts(HttpSession session, JSONObject json) {
    StringBuilder b = new StringBuilder();

    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
      List<Alert> alerts;
      if (json.has("showReadAlerts") && json.getBoolean("showReadAlerts")) {
        alerts = new ArrayList<Alert>(requestManager.listAlertsByUserId(user.getUserId()));
      }
      else {
        alerts = new ArrayList<Alert>(requestManager.listUnreadAlertsByUserId(user.getUserId()));
      }
      Collections.sort(alerts);
      for (Alert a : alerts) {
        if (a.getAlertLevel().equals(AlertLevel.CRITICAL) || a.getAlertLevel().equals(AlertLevel.HIGH)) {
          b.append("<div alertId='" + a.getAlertId() + "' class=\"dashboard error\">");
View Full Code Here

    long limit = 20;
    if (json.has("limit")) limit = json.getLong("limit");

    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
      if (user.isAdmin()) {
        List<Alert> alerts = new ArrayList<Alert>(requestManager.listAlertsByUserId(0L, limit));
        Collections.sort(alerts);
        Collections.reverse(alerts);
        for (Alert a : alerts) {
          if (a.getAlertLevel().equals(AlertLevel.CRITICAL) || a.getAlertLevel().equals(AlertLevel.HIGH)) {
View Full Code Here

  }

  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);
      }
View Full Code Here

  }

  public JSONObject setAllAlertsAsRead(HttpSession session, JSONObject json) {

    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
      List<Alert> alerts = new ArrayList<Alert>(requestManager.listUnreadAlertsByUserId(user.getUserId()));
      for (Alert a : alerts) {
        if (a.getAlertUser().equals(user)) {
          a.setAlertRead(true);
          requestManager.saveAlert(a);
        }
View Full Code Here

  }

  @Override
  public File getLabel(BarcodableSchema<File, T> s,T b) {
    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());

      String rasterString = s.getRawState(b);

      File f = misoFileManager.generateTemporaryFile(user.getLoginName() + "_"+b.getClass().getSimpleName().toLowerCase()+"-", ".printjob");
      FileUtils.write(f, rasterString);

      return f;
    }
    catch (IOException e) {
View Full Code Here

      }
    }
  }

  public void addWatcher(Pool pool, Long userId) throws IOException {
    User user = securityManager.getUserById(userId);
    if (user != null) {
      Pool clone = pools.get(pool.getId());
      if (clone == null) {
        pool.addWatcher(user);
        push(pool);
View Full Code Here

      }
    }
  }

  public void removeWatcher(Pool pool, Long userId) throws IOException {
    User user = securityManager.getUserById(userId);
    if (user != null && pool.getWatchers().contains(user)) {
      Pool clone = pools.get(pool.getId());
      if (clone == null) {
        pool.removeWatcher(user);
        push(pool);
View Full Code Here

      }
    }
  }

  public void updateGroupWatcher(Long userId) throws IOException {
    User user = securityManager.getUserById(userId);
    if (user != null) {
      poolWatchers.clear();
      poolWatchers.addAll(securityManager.listUsersByGroupName("PoolWatchers"));

      for (Pool p : pools.values()) {
        if (user.getGroups().contains(securityManager.getGroupByName("PoolWatchers"))) {
          addWatcher(p, userId);
        }
        else {
          if (p.getSecurityProfile() != null && p.getSecurityProfile().getOwner() != null && !p.getSecurityProfile().getOwner().equals(user)) {
            removeWatcher(p, userId);
View Full Code Here

  public void setSubmissionManager(SubmissionManager submissionManager) {
    this.submissionManager = submissionManager;
  }

  public JSONObject deleteStudy(HttpSession session, JSONObject json) {
    User user;
    try {
      user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
    }
    catch (IOException e) {
      e.printStackTrace();
      return JSONUtils.SimpleJSONError("Error getting currently logged in user.");
    }

    if (user != null && user.isAdmin()) {
      if (json.has("studyId")) {
        Long studyId = json.getLong("studyId");
        try {
          requestManager.deleteStudy(requestManager.getStudyById(studyId));
          return JSONUtils.SimpleJSONResponse("Study deleted");
View Full Code Here

TOP

Related Classes of com.eaglegenomics.simlims.core.User

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.