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 addExperiment( Experiment experiment ) { if ( experiment == null ) { throw new NullPointerException( "experiment must not be null." ); } if ( !experiments.contains( experiment ) ) { if ( experiment.getPublication() != this ) { throw new IllegalStateException( "You cannot overwrite an Experiment's publication (experiment:"+ experiment.getAc() +"). " + "You must first unlink the underlying experiments from their publication" ); } else { experiment.setPublication( this ); } experiments.add( experiment ); } }
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 addExperiment( Experiment experiment ) { if ( experiment == null ) { throw new NullPointerException( "experiment must not be null." ); } if ( !experiments.contains( experiment ) ) { final Publication pub = experiment.getPublication(); if ( pub != null && pub != this ) { throw new IllegalStateException( "You cannot overwrite an Experiment's publication (experiment:"+ experiment.getAc() +"). " + "You must first unlink the underlying experiments from their publication" ); } else { experiment.setPublication( this ); } experiments.add( experiment ); } }
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 addExperiment( Experiment experiment ) { if ( experiment == null ) { throw new NullPointerException( "experiment must not be null." ); } if ( !experiments.contains( experiment ) ) { final Publication pub = experiment.getPublication(); if ( pub != null && pub != this ) { throw new IllegalStateException( "You cannot overwrite an Experiment's publication (experiment:"+ experiment.getAc() +"). " + "You must first unlink the underlying experiments from their publication" ); } else { experiment.setPublication( this ); } experiments.add( experiment ); } }
/** * Checks if an experiment or the experiments for the same publication are on hold. * If the Experiment object contains a Publication, all the experiments from the publication * are checked. If any of them is on hold, the method will return true. * * @param experiment The experiment to check * @return true if the experiment is on hold, or any of the experiments for the same publication object */ public static boolean isOnHold(Experiment experiment) { if (experiment.getPublication() != null) { return isPublicationOnHold(experiment.getPublication()); } for (Annotation annotation : experiment.getAnnotations()) { if (annotation.getCvTopic() != null && CvTopic.ON_HOLD.equals(annotation.getCvTopic().getShortLabel())) { return true; } } return false; }
/** * Checks if an experiment or the experiments for the same publication are on hold. * If the Experiment object contains a Publication, all the experiments from the publication * are checked. If any of them is on hold, the method will return true. * * @param experiment The experiment to check * @return true if the experiment is on hold, or any of the experiments for the same publication object */ public static boolean isOnHold(Experiment experiment) { if (experiment.getPublication() != null) { return isPublicationOnHold(experiment.getPublication()); } for (Annotation annotation : experiment.getAnnotations()) { if (annotation.getCvTopic() != null && CvTopic.ON_HOLD.equals(annotation.getCvTopic().getShortLabel())) { return true; } } return false; }
if (objectToUpdate.getPublication() == null && candidateObject.getPublication() != null) { objectToUpdate.setPublication(candidateObject.getPublication()); PublicationPersister.getInstance().saveOrUpdate(candidateObject.getPublication());
@Override protected void saveOrUpdateAttributes(Experiment intactObject) throws PersisterException { super.saveOrUpdateAttributes(intactObject); if (intactObject.getBioSource() != null) { BioSourcePersister.getInstance().saveOrUpdate(intactObject.getBioSource()); } if (intactObject.getCvInteraction() != null) { CvObjectPersister.getInstance().saveOrUpdate(intactObject.getCvInteraction()); } else { throw new NullPointerException("Experiment without CvInteraction: " + intactObject.getShortLabel()); } if (intactObject.getCvIdentification() != null) { CvObjectPersister.getInstance().saveOrUpdate(intactObject.getCvIdentification()); } if (intactObject.getPublication() != null) { PublicationPersister.getInstance().saveOrUpdate(intactObject.getPublication()); } for (Interaction interaction : intactObject.getInteractions()) { InteractionPersister.getInstance().saveOrUpdate(interaction); } }
private void synchronizeExperiment( Experiment experiment, boolean synchronizeAnnotatedAttributes ) { experiment.setPublication( synchronize( experiment.getPublication() ) ); if (IntactCore.isInitializedAndDirty(experiment.getInteractions())){ Collection<Interaction> interactions = synchronizeCollection(experiment.getInteractions()); experiment.getInteractions().clear(); experiment.getInteractions().addAll(interactions); } experiment.setCvIdentification(synchronize(experiment.getCvIdentification())); experiment.setCvInteraction( synchronize( experiment.getCvInteraction() ) ); experiment.setBioSource( synchronize( experiment.getBioSource() ) ); if (synchronizeAnnotatedAttributes){ synchronizeAnnotatedObjectCommons( experiment ); } }
@Override protected Experiment syncAttributes(Experiment intactObject) { if (intactObject.getBioSource() != null) { BioSource bioSource = BioSourcePersister.getInstance().syncIfTransient(intactObject.getBioSource()); intactObject.setBioSource(bioSource); } intactObject.setCvInteraction((CvInteraction) CvObjectPersister.getInstance().syncIfTransient(intactObject.getCvInteraction())); if (intactObject.getCvIdentification() != null) { CvIdentification cvIdentification = ( CvIdentification ) CvObjectPersister.getInstance().syncIfTransient( intactObject.getCvIdentification() ); intactObject.setCvIdentification( cvIdentification ); } if (intactObject.getPublication() != null) { Publication publication = PublicationPersister.getInstance().syncIfTransient( intactObject.getPublication() ); intactObject.setPublication( publication ); } return super.syncAttributes(intactObject); }
private void synchronizeExperiment( Experiment experiment, boolean synchronizeAnnotatedAttributes ) { experiment.setPublication( synchronize( experiment.getPublication() ) ); if (IntactCore.isInitializedAndDirty(experiment.getInteractions())){ Collection<Interaction> interactions = synchronizeCollection(experiment.getInteractions()); experiment.getInteractions().clear(); experiment.getInteractions().addAll(interactions); } experiment.setCvIdentification(synchronize(experiment.getCvIdentification())); experiment.setCvInteraction( synchronize( experiment.getCvInteraction() ) ); experiment.setBioSource( synchronize( experiment.getBioSource() ) ); if (synchronizeAnnotatedAttributes){ synchronizeAnnotatedObjectCommons( experiment ); } }
public Experiment createExperimentEmpty(String shortLabel) { Experiment experiment = new Experiment(getInstitution(), shortLabel, createBioSourceRandom()); experiment.setCvInteraction(createCvObject(CvInteraction.class, CvInteraction.COSEDIMENTATION_MI_REF, CvInteraction.COSEDIMENTATION)); experiment.setCvIdentification(createCvObject(CvIdentification.class, CvIdentification.PREDETERMINED_MI_REF, CvIdentification.PREDETERMINED)); experiment.setPublication(createPublicationRandom()); experiment.addXref(createPrimaryReferenceXref(experiment, experiment.getPublication().getShortLabel())); return experiment; }
protected void traverseExperiment(Experiment experiment, IntactVisitor ... visitors) { if (experiment == null) return; for (IntactVisitor visitor : visitors) { visitor.visitExperiment(experiment); } // check if this element has been traversed already, to avoid cyclic recursion if (recursionChecker.isAlreadyTraversed(experiment)) { return; } traverse(experiment.getCvIdentification(), visitors); traverse(experiment.getCvInteraction(), visitors); traverse(experiment.getBioSource(), visitors); traverse(experiment.getPublication(), visitors); traverse(experiment.getInteractions(), visitors); }
protected void traverseExperiment(Experiment experiment, IntactVisitor ... visitors) { if (experiment == null) return; for (IntactVisitor visitor : visitors) { visitor.visitExperiment(experiment); } // check if this element has been traversed already, to avoid cyclic recursion if (recursionChecker.isAlreadyTraversed(experiment)) { return; } traverse(experiment.getCvIdentification(), visitors); traverse(experiment.getCvInteraction(), visitors); traverse(experiment.getBioSource(), visitors); traverse(experiment.getPublication(), visitors); traverse(experiment.getInteractions(), visitors); }
public Experiment createExperimentEmpty(String shortLabel) { Experiment experiment = new Experiment(getInstitution(), shortLabel, createBioSourceRandom()); experiment.setCvInteraction(createCvObject(CvInteraction.class, CvInteraction.COSEDIMENTATION_MI_REF, CvInteraction.COSEDIMENTATION)); experiment.setCvIdentification(createCvObject(CvIdentification.class, CvIdentification.PREDETERMINED_MI_REF, CvIdentification.PREDETERMINED)); final Publication publication = createPublicationRandom(); experiment.setPublication(publication); publication.addExperiment(experiment); experiment.addXref(createPrimaryReferenceXref(experiment, experiment.getPublication().getShortLabel())); return experiment; }
public Experiment createExperimentEmpty(String shortLabel) { Experiment experiment = new Experiment(getInstitution(), shortLabel, createBioSourceRandom()); experiment.setCvInteraction(createCvObject(CvInteraction.class, CvInteraction.COSEDIMENTATION_MI_REF, CvInteraction.COSEDIMENTATION)); experiment.setCvIdentification(createCvObject(CvIdentification.class, CvIdentification.PREDETERMINED_MI_REF, CvIdentification.PREDETERMINED)); final Publication publication = createPublicationRandom(); experiment.setPublication(publication); publication.addExperiment(experiment); experiment.addXref(createPrimaryReferenceXref(experiment, experiment.getPublication().getShortLabel())); return experiment; }
public Experiment cloneExperiment(Experiment experiment) throws IntactClonerException { if (experiment == null) return null; Experiment clone = new Experiment(); clonerManager.addClone(experiment, clone); clone.setCvIdentification(clone(experiment.getCvIdentification())); clone.setCvInteraction(clone(experiment.getCvInteraction())); clone.setBioSource(clone(experiment.getBioSource())); clone.setPublication(clone(experiment.getPublication())); if (isCollectionClonable(experiment.getInteractions())) { Collection<Interaction> interactions = IntactCore.ensureInitializedInteractions(experiment); for (Interaction i : interactions) { clone.addInteraction(clone(i)); } } return clone; }
public Experiment cloneExperiment(Experiment experiment) throws IntactClonerException { if (experiment == null) return null; Experiment clone = new Experiment(); clonerManager.addClone(experiment, clone); clone.setCvIdentification(clone(experiment.getCvIdentification())); clone.setCvInteraction(clone(experiment.getCvInteraction())); clone.setBioSource(clone(experiment.getBioSource())); clone.setPublication(clone(experiment.getPublication())); if (isCollectionClonable(experiment.getInteractions())) { Collection<Interaction> interactions = IntactCore.ensureInitializedInteractions(experiment); for (Interaction i : interactions) { clone.addInteraction(clone(i)); } } return clone; }