/** * Adds the 'on-hold' to a publication. * * @param intactContext The IntactContext as accessing data is necessary * @param publication the publication to hold * @param reason the reason for the 'on-hold' status * @since 2.5.0 */ public static void markAsOnHold(IntactContext intactContext, Publication publication, String reason) { CvTopic onholdTopic = intactContext.getDaoFactory().getCvObjectDao(CvTopic.class).getByShortLabel(CvTopic.ON_HOLD); if (onholdTopic == null) throw new IllegalStateException("CvTopic on-hold was not found in the database"); Annotation annotation = new Annotation(onholdTopic, reason); publication.addAnnotation(annotation); }
/** * Adds the 'on-hold' to a publication. * * @param intactContext The IntactContext as accessing data is necessary * @param publication the publication to hold * @param reason the reason for the 'on-hold' status * @since 2.5.0 */ public static void markAsOnHold(IntactContext intactContext, Publication publication, String reason) { CvTopic onholdTopic = intactContext.getDaoFactory().getCvObjectDao(CvTopic.class).getByShortLabel(CvTopic.ON_HOLD); if (onholdTopic == null) throw new IllegalStateException("CvTopic on-hold was not found in the database"); Annotation annotation = new Annotation(onholdTopic, reason); publication.addAnnotation(annotation); }
/** * Add the dataset annotation for each experiment in the list * @param publications : the publications */ private void addDatasetToExperimentsAndPublication(List<Publication> publications) throws IOException, DatasetException { for (Publication p : publications){ if (!processedPublications.contains(p.getAc()) && isPublicationEligibleForDataset(p)){ processedPublications.add(p.getAc()); String pubId = p.getShortLabel(); // if publication has not been processed, we add the dataset to the publication if (this.listOfpublicationUpdated.add(pubId)){ Annotation annotation = createNewDataset(); log.info("Add dataset to " + p.getAc() + ": " + p.getShortLabel()); p.addAnnotation(annotation); for (Experiment exp : p.getExperiments()){ Annotation annotation2 = createNewDataset(); log.info("Add dataset to " + exp.getAc() + ": " + exp.getShortLabel()); exp.addAnnotation(annotation2); IntactContext.getCurrentInstance().getCorePersister().saveOrUpdate(exp); } IntactContext.getCurrentInstance().getCorePersister().saveOrUpdate(p); } } } }