public static boolean isOnHold(Publication publication) { if (publication == null) { throw new NullPointerException("You must give a non null publication"); } for (Annotation a : publication.getAnnotations()) { if (a.getCvTopic() != null && CvTopic.ON_HOLD.equals(a.getCvTopic().getShortLabel())) { return true; } } for (Experiment experiment : publication.getExperiments()) { if (ExperimentUtils.isOnHold(experiment)) { return true; } } return false; }
public static boolean isOnHold(Publication publication) { if (publication == null) { throw new NullPointerException("You must give a non null publication"); } for (Annotation a : publication.getAnnotations()) { if (a.getCvTopic() != null && CvTopic.ON_HOLD.equals(a.getCvTopic().getShortLabel())) { return true; } } for (Experiment experiment : publication.getExperiments()) { if (ExperimentUtils.isOnHold(experiment)) { return true; } } return false; }
public Collection<GeneralMessage> check(Experiment experiment) throws SanityRuleException { Collection<GeneralMessage> messages = new ArrayList<GeneralMessage>(); if(ExperimentUtils.isOnHold(experiment)){ messages.add(new GeneralMessage( MessageDefinition.EXPERIMENT_ON_HOLD, experiment)); } else { // TODO this can be removed when all the experiments have a Publication object in the DB String pubmedId = ExperimentUtils.getPubmedId(experiment); if (pubmedId != null) { final List<Experiment> experimentsSamePubmed = IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getExperimentDao().getByPubId(pubmedId); for (Experiment experimentSamePubmed : experimentsSamePubmed) { if (ExperimentUtils.isOnHold(experimentSamePubmed)) { messages.add(new GeneralMessage( MessageDefinition.EXPERIMENT_ON_HOLD, experiment)); } } } } return messages; } }