Search in sources :

Example 1 with Study

use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.

the class StudyOperationsService method unpublishStudy.

/**
     * Unpublish a study entry in the database
     *
     * @param studyId         ID of study to unpublish
     * @param unpublishReason Reason the study is being unpublished
     * @param user            User performing request
     */
public void unpublishStudy(Long studyId, UnpublishReason unpublishReason, SecureUser user) {
    Study study = studyRepository.findOne(studyId);
    // Before we unpublish the study get its associated housekeeping
    Long housekeepingId = study.getHousekeeping().getId();
    Housekeeping housekeepingAttachedToStudy = housekeepingRepository.findOne(housekeepingId);
    //Set the unpublishDate and a new lastUpdateDate in houskeeping
    java.util.Date unpublishDate = new java.util.Date();
    housekeepingAttachedToStudy.setCatalogUnpublishDate(unpublishDate);
    housekeepingAttachedToStudy.setLastUpdateDate(unpublishDate);
    //Set the reason for unpublishing
    housekeepingAttachedToStudy.setUnpublishReason(unpublishReason);
    housekeepingAttachedToStudy.setIsPublished(false);
    //Set the unpublised status in housekeeping
    CurationStatus status = curationStatusRepository.findByStatus("Unpublished from catalog");
    housekeepingAttachedToStudy.setCurationStatus(status);
    updateStatus(study, housekeepingAttachedToStudy, user);
}
Also used : Housekeeping(uk.ac.ebi.spot.goci.model.Housekeeping) Study(uk.ac.ebi.spot.goci.model.Study) Date(java.util.Date) CurationStatus(uk.ac.ebi.spot.goci.model.CurationStatus) Date(java.util.Date)

Example 2 with Study

use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.

the class DiseaseTraitController method viewDiseaseTraitToDelete.

// Delete a disease trait
@RequestMapping(value = "/{diseaseTraitId}/delete", produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.GET)
public String viewDiseaseTraitToDelete(Model model, @PathVariable Long diseaseTraitId) {
    DiseaseTrait diseaseTraitToView = diseaseTraitRepository.findOne(diseaseTraitId);
    Collection<Study> studiesLinkedToTrait = studyRepository.findByDiseaseTraitId(diseaseTraitId);
    model.addAttribute("studies", studiesLinkedToTrait);
    model.addAttribute("totalStudies", studiesLinkedToTrait.size());
    model.addAttribute("diseaseTrait", diseaseTraitToView);
    return "delete_disease_trait";
}
Also used : Study(uk.ac.ebi.spot.goci.model.Study) DiseaseTrait(uk.ac.ebi.spot.goci.model.DiseaseTrait) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with Study

use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.

the class StudyController method viewStudyToUnpublish.

@RequestMapping(value = "/{studyId}/unpublish", produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.GET)
public String viewStudyToUnpublish(Model model, @PathVariable Long studyId) {
    Study studyToUnpublish = studyRepository.findOne(studyId);
    // Check if it has any associations or ancestry information
    //        Collection<Association> associations = associationRepository.findByStudyId(studyId);
    //        Collection<Ancestry> ancestryInfo = ancestryRepository.findByStudyId(studyId);
    //
    //        // If so warn the curator
    //        if (!associations.isEmpty() || !ancestryInfo.isEmpty()) {
    //            model.addAttribute("study", studyToUnpublish);
    //            return "unpublish_study_with_associations_warning";
    //
    //        }
    //        else {
    model.addAttribute("studyToUnpublish", studyToUnpublish);
    return "unpublish_study";
//        }
}
Also used : Study(uk.ac.ebi.spot.goci.model.Study) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 4 with Study

use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.

the class StudyController method assignStudyCurator.

// Assign a curator to a study
@RequestMapping(value = "/{studyId}/assign", produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.POST)
public String assignStudyCurator(@PathVariable Long studyId, @ModelAttribute Assignee assignee, RedirectAttributes redirectAttributes, HttpServletRequest request) {
    // Find the study and the curator user wishes to assign
    Study study = studyRepository.findOne(studyId);
    if (assignee.getCuratorId() == null) {
        String blankAssignee = "Cannot assign a blank value as a curator for study: " + study.getAuthor() + ", " + " pubmed = " + study.getPubmedId();
        redirectAttributes.addFlashAttribute("blankAssignee", blankAssignee);
    } else {
        studyOperationsService.assignStudyCurator(study, assignee, currentUserDetailsService.getUserFromRequest(request));
    }
    return "redirect:" + assignee.getUri();
}
Also used : Study(uk.ac.ebi.spot.goci.model.Study) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 5 with Study

use of uk.ac.ebi.spot.goci.model.Study in project goci by EBISPOT.

the class StudyController method viewStudyToDelete.

// Delete an existing study
@RequestMapping(value = "/{studyId}/delete", produces = MediaType.TEXT_HTML_VALUE, method = RequestMethod.GET)
public String viewStudyToDelete(Model model, @PathVariable Long studyId) {
    Study studyToDelete = studyRepository.findOne(studyId);
    // Check if it has any associations
    Collection<Association> associations = associationRepository.findByStudyId(studyId);
    Long housekeepingId = studyToDelete.getHousekeeping().getId();
    Housekeeping housekeepingAttachedToStudy = housekeepingRepository.findOne(housekeepingId);
    model.addAttribute("studyToDelete", studyToDelete);
    if (housekeepingAttachedToStudy.getCatalogPublishDate() != null) {
        return "delete_published_study_warning";
    } else if (!associations.isEmpty()) {
        return "delete_study_with_associations_warning";
    } else {
        return "delete_study";
    }
}
Also used : Housekeeping(uk.ac.ebi.spot.goci.model.Housekeeping) Study(uk.ac.ebi.spot.goci.model.Study) Association(uk.ac.ebi.spot.goci.model.Association) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Study (uk.ac.ebi.spot.goci.model.Study)65 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)23 Association (uk.ac.ebi.spot.goci.model.Association)14 SecureUser (uk.ac.ebi.spot.goci.model.SecureUser)14 Test (org.junit.Test)11 ArrayList (java.util.ArrayList)8 AssociationValidationView (uk.ac.ebi.spot.goci.curation.model.AssociationValidationView)7 LastViewedAssociation (uk.ac.ebi.spot.goci.curation.model.LastViewedAssociation)7 MultiStudyNoteForm (uk.ac.ebi.spot.goci.curation.model.MultiStudyNoteForm)7 Housekeeping (uk.ac.ebi.spot.goci.model.Housekeeping)7 SnpAssociationStandardMultiForm (uk.ac.ebi.spot.goci.curation.model.SnpAssociationStandardMultiForm)5 HttpServletRequest (javax.servlet.http.HttpServletRequest)4 NoteSubject (uk.ac.ebi.spot.goci.model.NoteSubject)4 SingleNucleotidePolymorphism (uk.ac.ebi.spot.goci.model.SingleNucleotidePolymorphism)4 Autowired (org.springframework.beans.factory.annotation.Autowired)3 PageRequest (org.springframework.data.domain.PageRequest)3 Pageable (org.springframework.data.domain.Pageable)3 Service (org.springframework.stereotype.Service)3 StudyNoteForm (uk.ac.ebi.spot.goci.curation.model.StudyNoteForm)3 ErrorNotification (uk.ac.ebi.spot.goci.curation.model.errors.ErrorNotification)3