public void addLifecycleEvent( LifecycleEvent event ) { if( event.getPublication() != null && event.getPublication() != this ) { throw new IllegalArgumentException( "You are trying to add an event to publication "+ event.getPublication().getAc() +" that already belong to an other " + "publication " + getAc() ); } event.setPublication( this ); lifecycleEvents.add( event ); }
public void addLifecycleEvent( LifecycleEvent event ) { if( event.getPublication() != null && event.getPublication() != this ) { throw new IllegalArgumentException( "You are trying to add an event to publication "+ event.getPublication().getAc() +" that already belong to an other " + "publication " + getAc() ); } event.setPublication( this ); lifecycleEvents.add( event ); }
public void removeExperiment( Experiment experiment ) { if ( experiment == null ) { throw new NullPointerException( "experiment must not be null." ); } if ( !experiments.contains( experiment ) ) { experiments.remove( experiment ); if ( experiment.getPublication() != null && experiment.getPublication() != this ) { throw new IllegalStateException( "The experiment ("+ experiment.getAc() + ") you are trying to remove is linked to an other publication ("+ experiment.getPublication().getAc() +")." ); } else { experiment.setPublication( null ); } } }
public void removeExperiment( Experiment experiment ) { if ( experiment == null ) { throw new NullPointerException( "experiment must not be null." ); } if ( !experiments.contains( experiment ) ) { if ( experiment.getPublication() != null && experiment.getPublication() != this ) { throw new IllegalStateException( "The experiment ("+ experiment.getAc() + ") you are trying to remove is linked to another publication ("+ experiment.getPublication().getAc() +")." ); } else { experiment.setPublication( null ); } } else { experiments.remove( experiment ); experiment.setPublication( null ); } }
public void removeExperiment( Experiment experiment ) { if ( experiment == null ) { throw new NullPointerException( "experiment must not be null." ); } if ( !experiments.contains( experiment ) ) { if ( experiment.getPublication() != null && experiment.getPublication() != this ) { throw new IllegalStateException( "The experiment ("+ experiment.getAc() + ") you are trying to remove is linked to another publication ("+ experiment.getPublication().getAc() +")." ); } else { experiment.setPublication( null ); } } else { experiments.remove( experiment ); experiment.setPublication( null ); } }
/** * 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); } } } }
/** * Ensures that the lifecycle events are initialized. * @param publication The publication * @return the initialized events * @since 2.5.0 */ public static List<LifecycleEvent> ensureInitializedLifecycleEvents(Publication publication) { List<LifecycleEvent> events; if (IntactCore.isInitialized(publication.getLifecycleEvents())) { events = publication.getLifecycleEvents(); } else { events = IntactContext.getCurrentInstance().getDaoFactory().getLifecycleEventDao().getByPublicationAc(publication.getAc()); } return events; }
/** * Ensures that the lifecycle events are initialized. * @param publication The publication * @return the initialized events * @since 2.5.0 */ public static List<LifecycleEvent> ensureInitializedLifecycleEvents(Publication publication) { List<LifecycleEvent> events; if (IntactCore.isInitialized(publication.getLifecycleEvents())) { events = publication.getLifecycleEvents(); } else { events = IntactContext.getCurrentInstance().getDaoFactory().getLifecycleEventDao().getByPublicationAc(publication.getAc()); } return events; }
/** * Retrieves the experiment from a publication, initializing them if necessary. * * @param publication the publication * @return The returned experiments are ensured to be initialized * @since 2.4.0 */ public static Collection<Experiment> ensureInitializedExperiments(Publication publication) { Collection<Experiment> experiments; if (IntactCore.isInitialized(publication.getExperiments())) { experiments = publication.getExperiments(); } else { experiments = IntactContext.getCurrentInstance().getDaoFactory().getExperimentDao().getByPubAc(publication.getAc()); } return experiments; }
/** * Retrieves the experiment from a publication, initializing them if necessary. * * @param publication the publication * @return The returned experiments are ensured to be initialized * @since 2.4.0 */ public static Collection<Experiment> ensureInitializedExperiments(Publication publication) { Collection<Experiment> experiments; if (IntactCore.isInitialized(publication.getExperiments())) { experiments = publication.getExperiments(); } else { experiments = IntactContext.getCurrentInstance().getDaoFactory().getExperimentDao().getByPubAc(publication.getAc()); } return experiments; }