Package com.eaglegenomics.simlims.core

Examples of com.eaglegenomics.simlims.core.User


  }

  public JSONObject watchRun(HttpSession session, JSONObject json) {
    Long runId = json.getLong("runId");
    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
      Run run = requestManager.getRunById(runId);
      if (!run.getWatchers().contains(user)) {
        //run.addWatcher(user);
        watchManager.watch(run, user);
        requestManager.saveRun(run);
View Full Code Here


  }

  public JSONObject unwatchRun(HttpSession session, JSONObject json) {
    Long runId = json.getLong("runId");
    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
      Run run = requestManager.getRunById(runId);
      if (run.getWatchers().contains(user)) {
        //run.removeWatcher(user);
        watchManager.unwatch(run, user);
        requestManager.saveRun(run);
View Full Code Here

    return b.toString();
  }

  public JSONObject deleteRun(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("runId")) {
        Long runId = json.getLong("runId");
        try {
          requestManager.deleteRun(requestManager.getRunById(runId));
          return JSONUtils.SimpleJSONResponse("Run deleted");
View Full Code Here

      }
    }
  }

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

      }
    }
  }

  public void removeWatcher(Run run, Long userId) throws IOException {
    User user = securityManager.getUserById(userId);
    if (user != null) {
      Run clone = runs.get(run.getId());
      if (clone == null) {
        run.removeWatcher(user);
        push(run);
View Full Code Here

      }
    }
  }

  public void updateGroupWatcher(Long userId) throws IOException {
    User user = securityManager.getUserById(userId);
    if (user != null) {
      for (Run r : runs.values()) {
        if (user.getGroups().contains(securityManager.getGroupByName("RunWatchers"))) {
          addWatcher(r, userId);
        }
        else {
          if (r.getSecurityProfile() != null && r.getSecurityProfile().getOwner() != null && !r.getSecurityProfile().getOwner().equals(user)) {
            removeWatcher(r, userId);
View Full Code Here

  }

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

      String labelScript = s.getRawState(b);

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

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

    }
  }

  public JSONObject printCustomBarcode(HttpSession session, JSONObject json) {
    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());

      String line1 = json.getString("line1");
      String line2 = json.getString("line2");
      String line3 = json.getString("line3");
      String barcodeit = json.getString("barcodeit");
View Full Code Here

    }
  }

  public JSONObject printCustom1DBarcode(HttpSession session, JSONObject json) {
    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());

      String line1 = json.getString("line1");
      String line2 = json.getString("line2");
      String serviceName = json.getString("serviceName");
View Full Code Here

  @Override
  public User getUserById(Long userId) throws IOException {
    synchronized (usermap) {
      if (!usermap.containsKey(userId)) {
        User u = super.getUserById(userId);
        if (u != null) {
          usermap.put(userId, u);
        }
        return u;
      }
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.