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

Examples of uk.ac.bbsrc.tgac.miso.core.data.Project


    StringBuffer sb = new StringBuffer();
    String projectId = (String) json.get("projectId");

    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
      Project project = requestManager.getProjectById(Long.parseLong(projectId));

      session.setAttribute("project", project);

      String studyHTML = "";
      for (Study r : project.getStudies()) {
         studyHTML+="<li><a href='/miso/study/"+r.getId()+"/project/"+project.getId()+"'>"+r.getName()+"</a></li>";
      }
      StringBuilder b = new StringBuilder();
      b.append("<div onclick=\"Effect.toggle('preview"+projectId+"','blind'); return false;\">" +
              "<img src=\"/styles/images/moreinfo.png\" class=\"previewimage\"/></div>");
      b.append("<br/><div id=\"preview"+projectId+"\" class='exppreview'>");
      b.append("Description: <b>" + project.getDescription() + "</b><br/>");
      b.append("Owner: <b>" + project.getSecurityProfile().getOwner().getFullName() + "</b><br/>");
      b.append("studies: <ul class=\"bullets\">"+studyHTML+"</ul>");
      b.append("</div>");
      return JSONUtils.SimpleJSONResponse(b.toString());

    }
View Full Code Here


    dataObjectFactory = new TgacDataObjectFactory();
  }

  @Test
  public void testStudyXmlGeneration() {
      Project p = dataObjectFactory.getProject();
      p.setAlias("Submission Test Project");
      //creates a Study object and sets parameters
      Study s = dataObjectFactory.getStudy();
      s.setProject(p);
      s.setAlias("Submission Test Study");
      s.setDescription("A test of the Submission XML generation process");
View Full Code Here

      ModelMap model) throws IOException {
    try {
      User user = securityManager
          .getUserByLoginName(SecurityContextHolder.getContext()
              .getAuthentication().getName());
      Project project = requestManager.getProjectById(projectId);
      if (!project.userCanRead(user)) {
        throw new SecurityException("Permission denied.");
      }
      //return new ModelAndView("/pages/listRequests.jsp", "requests", requestManager.listAllRequests(user, project));
            return null;
    } catch (IOException ex) {
View Full Code Here

  }

  public void push(Project project) {
    if (enabled) {
      if (project != null) {
        Project clone = cloner.deepClone(project);
        if (clone != null) {
          if (projects.containsKey(project.getId())) {
            if (clone.getProgress() != null) {
              log.debug("Not replacing Project " + clone.getId() + ": " + clone.getProgress().name());
            }
          }
          else {
            applyListeners(clone);

            for (ProjectOverview po : clone.getOverviews()) {
              applyListeners(po);
            }

            projects.put(project.getId(), clone);
            if (clone.getProgress() != null) {
              log.debug("Queued Project " + clone.getId() + ": " + clone.getProgress().name());
            }
          }
        }
      }
    }
View Full Code Here

  }

  public void pop(Project project) {
    if (enabled) {
      if (project != null) {
        Project clone = projects.get(project.getId());
        if (clone != null) {
          removeListeners(clone);
          for (ProjectOverview po : clone.getOverviews()) {
            removeListeners(po);
            po = null;
          }

          clone = null;
View Full Code Here

  }

  private void update(Project p) throws IOException {
    if (enabled) {
      //don't just replace the object - set required fields otherwise we have to reset all the object's listeners
      Project clone = projects.get(p.getId());
      if (clone == null) {
        log.debug("Update: no clone - pushing");
        //new project - add all ProjectWatchers!
        for (User u : securityManager.listUsersByGroupName("ProjectWatchers")) {
          p.addWatcher(u);
          for (ProjectOverview po : p.getOverviews()) {
            po.addWatcher(u);
          }
        }
        push(p);
      }
      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());
View Full Code Here

  }

  public void addWatcher(Project project, Long userId) throws IOException {
    User user = securityManager.getUserById(userId);
    if (user != null) {
      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

  }

  public void removeWatcher(Project project, Long userId) throws IOException {
    User user = securityManager.getUserById(userId);
    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

    if (a.getJSONObject(0).getString("value").equals("Project")) {
      for (JSONObject j : (Iterable<JSONObject>) a) {
        if (j.getString("name").equals("ids")) {
          try {
            Project p = requestManager.getProjectById(new Long(j.getString("value")));
            if (p != null) {
              reportables.add(p);
            }
          }
          catch (IOException e) {
View Full Code Here

  public void buildReport() throws ReportingException {
    if (reportables.size() == 1) {
      List reportableslist = new ArrayList<Reportable>(reportables);
      Reportable reportable = (Reportable) reportableslist.get(0);
      reportable.buildReport();
      Project project = (Project) reportable;
      try {
        report = new Document();
        PdfWriter writer = PdfWriter.getInstance(report, stream);
        report.open();
        report.add(new Paragraph("Project Summary"));
        PdfContentByte cb = writer.getDirectContent();
        cb.setLineWidth(2.0f);     // Make a bit thicker than 1.0 default
        cb.setGrayStroke(0.9f); // 1 = black, 0 = white
        float x = 72f;
        float y = 200f;
        cb.moveTo(x, y);
        cb.lineTo(x + 72f * 6, y);
        cb.stroke();

        report.add(new Paragraph(project.getAlias()));
        report.add(new Paragraph(project.getDescription()));

        PdfPTable t = new PdfPTable(1);
        t.setHorizontalAlignment(Element.ALIGN_CENTER);
        t.setWidthPercentage(100f); // this would be the 100 from setHorizontalLine
        t.setSpacingAfter(5f);
        t.setSpacingBefore(0f);
        t.getDefaultCell().setUseVariableBorders(true);
        t.getDefaultCell().setVerticalAlignment(Element.ALIGN_MIDDLE);
        t.getDefaultCell().setHorizontalAlignment(Element.ALIGN_CENTER);
        t.getDefaultCell().setBorder(Image.BOTTOM); // This generates the line
        t.getDefaultCell().setBorderWidth(1f); // this would be the 1 from setHorizontalLine
        t.getDefaultCell().setPadding(0);
        t.addCell("");
        report.add(t);

        x = 72f;
        y = 100f;
        cb.moveTo(x, y);
        cb.lineTo(x + 72f * 6, y);
        cb.stroke();

        if (project.getSamples().size() > 0) {
          report.add(new Paragraph("Samples"));
          for (Sample sample : project.getSamples()) {
            Paragraph sPara = new Paragraph(sample.getAlias(), FontFactory.getFont("Helvetica", 12, Font.BOLD));
            sPara.setIndentationLeft(20);
            report.add(sPara);
            report.add(new Paragraph(sample.getDescription()));
          }
View Full Code Here

TOP

Related Classes of uk.ac.bbsrc.tgac.miso.core.data.Project

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.