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 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 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 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 ) ) { 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 ); } } }
objectToUpdate.setPublication(candidateObject.getPublication());
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 ); } }
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; }
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; }
@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); }
/** * Builds a SHALLOW copy of the Experiment parameter. This means that a new Experiment instance is returned, but you * should be aware that the object references it contains <b>point to the objects referenced in the original object * </b>. * * @param experiment The Experiment you want a shallow copy of * * @return Experiment a new Experiment instance containing new references to the parameter object's attributes. * * @throws NullPointerException thrown if required items are not present in the parameter Experiment instance. */ public static Experiment getShallowCopy( Experiment experiment ) { Experiment ex = new Experiment( experiment.getOwner(), experiment.getShortLabel(), experiment.getBioSource() ); ex.ac = ( experiment.getAc() ); ex.setAnnotations( experiment.getAnnotations() ); ex.setCvInteraction( experiment.getCvInteraction() ); ex.setCvIdentification( experiment.getCvIdentification() ); ex.setFullName( experiment.getFullName() ); ex.setRelatedExperiment( experiment.getRelatedExperiment() ); ex.setXrefs( experiment.getXrefs() ); ex.setPublication( experiment.getPublication() ); return ex; }
/** * Builds a SHALLOW copy of the Experiment parameter. This means that a new Experiment instance is returned, but you * should be aware that the object references it contains <b>point to the objects referenced in the original object * </b>. * * @param experiment The Experiment you want a shallow copy of * * @return Experiment a new Experiment instance containing new references to the parameter object's attributes. * * @throws NullPointerException thrown if required items are not present in the parameter Experiment instance. */ public static Experiment getShallowCopy( Experiment experiment ) { Experiment ex = new Experiment( experiment.getOwner(), experiment.getShortLabel(), experiment.getBioSource() ); ex.ac = ( experiment.getAc() ); ex.setAnnotations( experiment.getAnnotations() ); ex.setCvInteraction( experiment.getCvInteraction() ); ex.setCvIdentification( experiment.getCvIdentification() ); ex.setFullName( experiment.getFullName() ); ex.setRelatedExperiment( experiment.getRelatedExperiment() ); ex.setXrefs( experiment.getXrefs() ); ex.setPublication( experiment.getPublication() ); return ex; }
/** * Builds a SHALLOW copy of the Experiment parameter. This means that a new Experiment instance is returned, but you * should be aware that the object references it contains <b>point to the objects referenced in the original object * </b>. * * @param experiment The Experiment you want a shallow copy of * * @return Experiment a new Experiment instance containing new references to the parameter object's attributes. * * @throws NullPointerException thrown if required items are not present in the parameter Experiment instance. */ public static Experiment getShallowCopy( Experiment experiment ) { Experiment ex = new Experiment( experiment.getOwner(), experiment.getShortLabel(), experiment.getBioSource() ); ex.ac = ( experiment.getAc() ); ex.setAnnotations( experiment.getAnnotations() ); ex.setCvInteraction( experiment.getCvInteraction() ); ex.setCvIdentification( experiment.getCvIdentification() ); ex.setFullName( experiment.getFullName() ); ex.setRelatedExperiment( experiment.getRelatedExperiment() ); ex.setXrefs( experiment.getXrefs() ); ex.setPublication( experiment.getPublication() ); return ex; }
experiment.setPublication(publication); publication.addExperiment(experiment); experiment.setPublication(publication); publication.addExperiment(experiment);