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);
}
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";
}
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";
// }
}
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();
}
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";
}
}
Aggregations