Package uk.ac.bbsrc.tgac.miso.core.data.impl

Examples of uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectOverview


  @Override
  public boolean respondsTo(Event event) {
    if (event instanceof ProjectOverviewEvent) {
      ProjectOverviewEvent poe = (ProjectOverviewEvent)event;
      ProjectOverview po = poe.getEventObject();
      if (poe.getEventType().equals(MisoEventType.POOL_CONSTRUCTION_COMPLETE) && po.getAllPoolsConstructed()) {
        //log.info("Project "+poe.getEventObject().getProject().getAlias() +": " + poe.getEventMessage());
        return true;
      }
    }
    return false;
View Full Code Here


  @Override
  public void generateResponse(Event event) {
    if (event instanceof ProjectOverviewEvent) {
      ProjectOverviewEvent re = (ProjectOverviewEvent)event;
      ProjectOverview po = re.getEventObject();

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

        Alert a = new DefaultAlert(user);
        a.setAlertTitle("Pool construction complete for project " + po.getProject().getAlias() + "(" + po.getProject().getName() + ")");
        a.setAlertText("The following Project's Pools have been prepared and are ready to run: "+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

      else {
        log.debug("Update: got clone of " + clone.getId());
        clone.setProgress(cloner.deepClone(p.getProgress()));

        for (ProjectOverview po : p.getOverviews()) {
          ProjectOverview cloneOverview = clone.getOverviewById(po.getOverviewId());
          if (cloneOverview != null) {
            cloneOverview.setAllSampleQcPassed(po.getAllSampleQcPassed());
            cloneOverview.setLibraryPreparationComplete(po.getLibraryPreparationComplete());
            cloneOverview.setAllLibrariesQcPassed(po.getAllLibrariesQcPassed());
            cloneOverview.setAllPoolsConstructed(po.getAllPoolsConstructed());
            cloneOverview.setAllRunsCompleted(po.getAllRunsCompleted());
            cloneOverview.setPrimaryAnalysisCompleted(po.getPrimaryAnalysisCompleted());
          }
          else {
            log.debug("Original project has an overview, but it seems it hasn't been cloned.");
          }
        }
View Full Code Here

  public void addWatcher(ProjectOverview overview, Long userId) throws IOException {
    User user = securityManager.getUserById(userId);
    if (user != null) {
      for (Project clone : projects.values()) {
        ProjectOverview cloneOverview = clone.getOverviewById(overview.getOverviewId());
        if (cloneOverview != null) {
          log.debug("Added watcher " + userId + " to overview " + overview.getOverviewId());
          cloneOverview.addWatcher(user);
          clone.addWatcher(user);
          break;
        }
      }
    }
View Full Code Here

  public void removeWatcher(ProjectOverview overview, Long userId) throws IOException {
    User user = securityManager.getUserById(userId);
    if (user != null) {
      for (Project clone : projects.values()) {
        ProjectOverview cloneOverview = clone.getOverviewById(overview.getOverviewId());
        if (cloneOverview != null) {
          log.debug("Removed watcher " + userId + " from overview " + overview.getOverviewId());
          cloneOverview.removeWatcher(user);
          clone.removeWatcher(user);
          break;
        }
      }
    }
View Full Code Here

      Project clone = projects.get(project.getId());
      log.debug("Added watcher " + userId + " to project " + project.getId());
      if (clone == null) {
        project.addWatcher(user);
        for (ProjectOverview po : project.getOverviews()) {
          ProjectOverview pOverview = project.getOverviewById(po.getOverviewId());
          if (pOverview != null) {
            pOverview.addWatcher(user);
          }
        }

        push(project);
      }
      else {
        clone.addWatcher(user);
        for (ProjectOverview po : clone.getOverviews()) {
          ProjectOverview cloneOverview = clone.getOverviewById(po.getOverviewId());
          if (cloneOverview != null) {
            cloneOverview.addWatcher(user);
          }
        }
      }
    }
  }
View Full Code Here

    if (user != null) {
      Project clone = projects.get(project.getId());
      if (clone == null) {
        project.removeWatcher(user);
        for (ProjectOverview po : project.getOverviews()) {
          ProjectOverview pOverview = project.getOverviewById(po.getOverviewId());
          if (pOverview != null) {
            pOverview.removeWatcher(user);
          }
        }

        push(project);
      }
      else {
        clone.removeWatcher(user);
        for (ProjectOverview po : clone.getOverviews()) {
          ProjectOverview cloneOverview = clone.getOverviewById(po.getOverviewId());
          if (cloneOverview != null) {
            cloneOverview.removeWatcher(user);
          }
        }
      }
    }
  }
View Full Code Here

    return e;
  }

  public ProjectOverview getProjectOverviewById(long overviewId) throws IOException {
    List eResults = template.query(OVERVIEW_SELECT_BY_ID, new Object[]{overviewId}, new ProjectOverviewMapper());
    ProjectOverview e = eResults.size() > 0 ? (ProjectOverview) eResults.get(0) : null;
    return e;
  }
View Full Code Here

    return e;
  }

  public ProjectOverview lazyGetProjectOverviewById(long overviewId) throws IOException {
    List eResults = template.query(OVERVIEW_SELECT_BY_ID, new Object[]{overviewId}, new ProjectOverviewMapper(true));
    ProjectOverview e = eResults.size() > 0 ? (ProjectOverview) eResults.get(0) : null;
    return e;
  }
View Full Code Here

        if ((element = lookupCache(cacheManager).get(DbUtils.hashCodeCacheKeyFor(id))) != null) {
          log.debug("Cache hit on map for ProjectOverview " + id);
          return (ProjectOverview)element.getObjectValue();
        }
      }
      ProjectOverview overview = new ProjectOverview();

      try {
        Project p = lazyGet(rs.getLong("project_projectId"));
        overview.setProject(p);

        overview.setOverviewId(id);
        overview.setPrincipalInvestigator(rs.getString("principalInvestigator"));
        overview.setStartDate(rs.getDate("startDate"));
        overview.setEndDate(rs.getDate("endDate"));
        overview.setNumProposedSamples(rs.getInt("numProposedSamples"));
        overview.setLocked(rs.getBoolean("locked"));
        overview.setAllSampleQcPassed(rs.getBoolean("allSampleQcPassed"));
        overview.setLibraryPreparationComplete(rs.getBoolean("libraryPreparationComplete"));
        overview.setAllLibrariesQcPassed(rs.getBoolean("allLibraryQcPassed"));
        overview.setAllPoolsConstructed(rs.getBoolean("allPoolsConstructed"));
        overview.setAllRunsCompleted(rs.getBoolean("allRunsCompleted"));
        overview.setPrimaryAnalysisCompleted(rs.getBoolean("primaryAnalysisCompleted"));
        overview.setLastUpdated(rs.getTimestamp("lastUpdated"));

        overview.setSamples(p.getSamples());
        overview.setLibraries(libraryDAO.listByProjectId(rs.getLong("project_projectId")));
        overview.setRuns(runDAO.listByProjectId(rs.getLong("project_projectId")));
        overview.setNotes(noteDAO.listByProjectOverview(id));

        overview.setWatchers(new HashSet<User>(watcherDAO.getWatchersByEntityName(overview.getWatchableIdentifier())));
        if (overview.getProject().getSecurityProfile() != null &&
            overview.getProject().getSecurityProfile().getOwner() != null)
          overview.addWatcher(overview.getProject().getSecurityProfile().getOwner());
        for (User u : watcherDAO.getWatchersByWatcherGroup("ProjectWatchers")) {
          overview.addWatcher(u);
        }
      }
      catch (IOException e) {
        e.printStackTrace();
      }
View Full Code Here

TOP

Related Classes of uk.ac.bbsrc.tgac.miso.core.data.impl.ProjectOverview

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.