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

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


    super(submittable, submissionProperties);
    this.submission = submission;
  }

  public void buildSubmission() {
    Study s = (Study)submittable;
    if (submission != null) {
      Element study = submission.createElement("STUDY");
      //study.setAttribute("accession", s.getAccession());
      study.setAttribute("alias", s.getAlias());

      Element studyDescriptor = submission.createElementNS(null, "DESCRIPTOR");
      Element studyTitle = submission.createElementNS(null, "STUDY_TITLE");
      studyTitle.setTextContent(s.getAlias());
      studyDescriptor.appendChild(studyTitle);

      Element studyType = submission.createElementNS(null, "STUDY_TYPE");
      studyType.setAttribute("existing_study_type", s.getStudyType());
      studyDescriptor.appendChild(studyType);

      // DEPRECATED SRA 1.2
      //Element centerName = doc.createElementNS(null, "CENTER_NAME");
      //centerName.setTextContent(TgacSubmissionConstants.CENTRE_NAME.getKey());
      //studyDescriptor.appendChild(centerName);

      Element centerProjectName = submission.createElementNS(null, "CENTER_PROJECT_NAME");
      centerProjectName.setTextContent(s.getProject().getAlias());
      studyDescriptor.appendChild(centerProjectName);

      Element studyAbstract = submission.createElementNS(null, "STUDY_ABSTRACT");
      //TODO - add Study.getAbstract()
      studyAbstract.setTextContent(s.getAbstract());
      studyDescriptor.appendChild(studyAbstract);

      Element studyDescription = submission.createElementNS(null, "STUDY_DESCRIPTION");
      studyDescription.setTextContent(s.getDescription());
      studyDescriptor.appendChild(studyDescription);

      study.appendChild(studyDescriptor);

      if (submission.getElementsByTagName("STUDY_SET").item(0) != null) {
View Full Code Here


  @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");
      s.setSecurityProfile(new SecurityProfile());

      Document submissionDocument = null;
      try {
          DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
          submissionDocument = docBuilder.newDocument();
View Full Code Here

                          }
                  )
  )
  public Study get(long studyId) throws IOException {
    List eResults = template.query(STUDY_SELECT_BY_ID, new Object[]{studyId}, new StudyMapper());
    Study e = eResults.size() > 0 ? (Study) eResults.get(0) : null;
    return e;
  }
View Full Code Here

    return e;
  }

  public Study lazyGet(long studyId) throws IOException {
    List eResults = template.query(STUDY_SELECT_BY_ID, new Object[]{studyId}, new StudyMapper(true));
    Study e = eResults.size() > 0 ? (Study) eResults.get(0) : null;
    return e;
  }
View Full Code Here

    return template.query(STUDIES_BY_RELATED_SUBMISSION, new Object[]{submissionId}, new StudyMapper());
  }

  public Study getByExperimentId(long experimentId) throws IOException {
    List eResults = template.query(STUDY_SELECT_BY_EXPERIMENT_ID, new Object[]{experimentId}, new StudyMapper());
    Study e = eResults.size() > 0 ? (Study) 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 Study " + id);
          return (Study)element.getObjectValue();
        }
      }
      Study s = dataObjectFactory.getStudy();
      s.setId(id);
      s.setName(rs.getString("name"));
      s.setAlias(rs.getString("alias"));
      s.setAccession(rs.getString("accession"));
      s.setDescription(rs.getString("description"));
      s.setStudyType(rs.getString("studyType"));
      try {
        s.setSecurityProfile(securityProfileDAO.get(rs.getLong("securityProfile_profileId")));

        if (!isLazy()) {
          s.setProject(projectDAO.get(rs.getLong("project_projectId")));

          for (Experiment e : experimentDAO.listByStudyId(id)) {
            s.addExperiment(e);
          }
        }
        else {
          s.setProject(projectDAO.lazyGet(rs.getLong("project_projectId")));
        }
      }
      catch (IOException e1) {
        e1.printStackTrace();
      }
View Full Code Here

  @RequestMapping(value = "/{studyId}", method = RequestMethod.GET)
  public ModelAndView setupForm(@PathVariable Long studyId,
                                ModelMap model) throws IOException {
    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
      Study study = requestManager.getStudyById(studyId);
      Project project;
      if (study != null) {
        if (!study.userCanRead(user)) {
          throw new SecurityException("Permission denied.");
        }
        project = study.getProject();
        model.put("formObj", study);
        model.put("project", project);
        model.put("study", study);
        model.put("title", "Study "+studyId);
      }
View Full Code Here

  public ModelAndView setupForm(@PathVariable Long studyId,
                                @PathVariable Long projectId,
                                ModelMap model) throws IOException {
    try {
      User user = securityManager.getUserByLoginName(SecurityContextHolder.getContext().getAuthentication().getName());
      Study study = null;
      if (studyId == AbstractStudy.UNSAVED_ID) {
        study = dataObjectFactory.getStudy(user);
        model.put("title", "New Study");
      }
      else {
        study = requestManager.getStudyById(studyId);
        model.put("title", "Study "+studyId);
      }

      Project project = requestManager.getProjectById(projectId);
        model.addAttribute("project", project);
        study.setProject(project);
        if (Arrays.asList(user.getRoles()).contains("ROLE_TECH")) {
            SecurityProfile sp = new SecurityProfile(user);
            LimsUtils.inheritUsersAndGroups(study, project.getSecurityProfile());
            study.setSecurityProfile(sp);
        } else {
            study.inheritPermissions(project);
        }

        if (!study.userCanWrite(user)) {
        throw new SecurityException("Permission denied.");
      }
      model.put("formObj", study);
      model.put("study", study);
      model.put("owners", LimsSecurityUtils.getPotentialOwners(user, study, securityManager.listAllUsers()));
View Full Code Here

TOP

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

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.