/** * <p>Returns true if two annotated objects are equal. The generic way to do the check * is:</p> * a) If they have the same AC, consider them equal<br/> * b) Otherwise, clone both objects (excluding the ACs) and invoke equals() on them */ protected boolean areEqual(AnnotatedObject source, AnnotatedObject target) { if (source instanceof CvObject && areCvObjectsEqual((CvObject)source, (CvObject)target)) { return true; } else if (source instanceof Interaction && areInteractionsEqual((Interaction)source, (Interaction)target)) { return true; } // clone both source and target to try a perfect equals on them try { if (clone(source).equals(clone(target))) { return true; } } catch (IntactClonerException e) { throw new PersisterException("Problem cloning source or target, to check if they are equal", e); } return false; }
protected <X extends Xref, A extends Alias> void copyAnotatedObjectCommons( AnnotatedObject<X, A> source, AnnotatedObject<X, A> target ) { // if the source does not have an AC, we should not update the target shortLabel, fullName and owner // as it does not make much sense //if (source.getAc() != null) { copyProperty(source, "shortLabel", target); copyProperty(source, "fullName", target); copyProperty(source, "owner", target); //} copyXrefCollection( source.getXrefs(), target.getXrefs() ); copyAliasCollection( source.getAliases(), target.getAliases(), source, target ); copyAnnotationCollection( source.getAnnotations(), target.getAnnotations() ); }
protected void copyExperiment( Experiment source, Experiment target ) { copyProperty(source, "bioSource", target); copyProperty(source, "publication", target); copyProperty(source, "cvIdentification", target); copyProperty(source, "cvInteraction", target); copyCollection( source.getInteractions(), target.getInteractions() ); }
protected void copyInteraction( Interaction source, Interaction target ) { copyProperty(source, "KD", target); copyProperty(source, "crc", target); copyProperty(source, "cvInteractionType", target); copyCollection( source.getComponents(), target.getComponents() ); copyCollection( source.getExperiments(), target.getExperiments() ); copyCollection( source.getConfidences(), target.getConfidences() ); copyCollection( source.getParameters(), target.getParameters() ); copyInteractorCommons( source, target ); // we have ommited CRC on purpose }
if (source.getAc() == null && areEqual(source, target)) { return false; copyInstitution( ( Institution ) source, ( Institution ) target ); } else if ( source instanceof Publication ) { copyPublication( ( Publication ) source, ( Publication ) target ); } else if ( source instanceof LifecycleEvent ) { copyLifecycleEvent( ( LifecycleEvent ) source, ( LifecycleEvent ) target ); } else if ( source instanceof CvObject ) { copyCvObject( ( CvObject ) source, ( CvObject ) target ); } else if ( source instanceof Experiment ) { copyExperiment( ( Experiment ) source, ( Experiment ) target ); } else if ( source instanceof Interaction ) { copyInteraction( ( Interaction ) source, ( Interaction ) target ); } else if ( source instanceof Interactor ) { copyInteractor( ( Interactor ) source, ( Interactor ) target ); } else if ( source instanceof BioSource ) { copyBioSource( ( BioSource ) source, ( BioSource ) target ); } else if ( source instanceof Component ) { copyComponent( ( Component ) source, ( Component ) target ); } else if ( source instanceof Feature ) { copyFeature( ( Feature ) source, ( Feature ) target ); } else { throw new IllegalArgumentException( "DefaultEntityStateCopier doesn't copy " + source.getClass().getName() ); copyAnotatedObjectCommons( source, target );
protected void copyInteractor( Interactor source, Interactor target ) { copyCollection( source.getActiveInstances(), target.getActiveInstances() ); copyInteractorCommons( source, target ); }
public CorePersisterImpl(IntactContext intactContext, Finder finder) { this.dataContext = intactContext.getDataContext(); this.finder = finder; annotatedObjectsToPersist = Maps.newHashMap(); annotatedObjectsToMerge = Maps.newHashMap(); synched = Maps.newHashMap(); keyBuilder = new KeyBuilder(); entityStateCopier = new DefaultEntityStateCopier(); statistics = new PersisterStatistics(); }
if (areEqual((AnnotatedObject)sourceProperty, (AnnotatedObject)targetProperty)) { return false;
if (source.getAc() == null && areEqual(source, target)) { return false; copyInstitution( ( Institution ) source, ( Institution ) target ); } else if ( source instanceof Publication ) { copyPublication( ( Publication ) source, ( Publication ) target ); } else if ( source instanceof LifecycleEvent ) { copyLifecycleEvent( ( LifecycleEvent ) source, ( LifecycleEvent ) target ); } else if ( source instanceof CvObject ) { copyCvObject( ( CvObject ) source, ( CvObject ) target ); } else if ( source instanceof Experiment ) { copyExperiment( ( Experiment ) source, ( Experiment ) target ); } else if ( source instanceof Interaction ) { copyInteraction( ( Interaction ) source, ( Interaction ) target ); } else if ( source instanceof Interactor ) { copyInteractor( ( Interactor ) source, ( Interactor ) target ); } else if ( source instanceof BioSource ) { copyBioSource( ( BioSource ) source, ( BioSource ) target ); } else if ( source instanceof Component ) { copyComponent( ( Component ) source, ( Component ) target ); } else if ( source instanceof Feature ) { copyFeature( ( Feature ) source, ( Feature ) target ); } else { throw new IllegalArgumentException( "DefaultEntityStateCopier doesn't copy " + source.getClass().getName() ); copyAnotatedObjectCommons( source, target );
protected void copyInteraction( Interaction source, Interaction target ) { copyProperty(source, "KD", target); copyProperty(source, "crc", target); copyProperty(source, "cvInteractionType", target); copyCollection( source.getComponents(), target.getComponents() ); copyCollection( source.getExperiments(), target.getExperiments() ); copyCollection( source.getConfidences(), target.getConfidences() ); copyCollection( source.getParameters(), target.getParameters() ); copyInteractorCommons( source, target ); // we have ommited CRC on purpose }
protected void copyInteractor( Interactor source, Interactor target ) { copyCollection( source.getActiveInstances(), target.getActiveInstances() ); copyInteractorCommons( source, target ); }
public CorePersisterImpl(IntactContext intactContext, Finder finder) { this.dataContext = intactContext.getDataContext(); this.finder = finder; annotatedObjectsToPersist = Maps.newHashMap(); annotatedObjectsToMerge = Maps.newHashMap(); synched = Maps.newHashMap(); keyBuilder = new KeyBuilder(); entityStateCopier = new DefaultEntityStateCopier(); statistics = new PersisterStatistics(); }
if (areEqual((AnnotatedObject)sourceProperty, (AnnotatedObject)targetProperty)) { return false;
protected void copyExperiment( Experiment source, Experiment target ) { copyProperty(source, "bioSource", target); copyProperty(source, "publication", target); copyProperty(source, "cvIdentification", target); copyProperty(source, "cvInteraction", target); copyCollection( source.getInteractions(), target.getInteractions() ); }
protected <X extends Xref, A extends Alias> void copyAnotatedObjectCommons( AnnotatedObject<X, A> source, AnnotatedObject<X, A> target ) { // if the source does not have an AC, we should not update the target shortLabel, fullName and owner // as it does not make much sense //if (source.getAc() != null) { copyProperty(source, "shortLabel", target); copyProperty(source, "fullName", target); copyProperty(source, "owner", target); //} copyXrefCollection( source.getXrefs(), target.getXrefs() ); copyAliasCollection( source.getAliases(), target.getAliases(), source, target ); copyAnnotationCollection( source.getAnnotations(), target.getAnnotations() ); }
/** * <p>Returns true if two annotated objects are equal. The generic way to do the check * is:</p> * a) If they have the same AC, consider them equal<br/> * b) Otherwise, clone both objects (excluding the ACs) and invoke equals() on them */ protected boolean areEqual(AnnotatedObject source, AnnotatedObject target) { if (source instanceof CvObject && areCvObjectsEqual((CvObject)source, (CvObject)target)) { return true; } else if (source instanceof Interaction && areInteractionsEqual((Interaction)source, (Interaction)target)) { return true; } // clone both source and target to try a perfect equals on them try { if (clone(source).equals(clone(target))) { return true; } } catch (IntactClonerException e) { throw new PersisterException("Problem cloning source or target, to check if they are equal", e); } return false; }
protected void copyPublication( Publication source, Publication target ) { copyCollection( source.getExperiments(), target.getExperiments() ); copyCollection( source.getLifecycleEvents(), target.getLifecycleEvents() ); copyProperty(source, "currentOwner", target); copyProperty(source, "currentReviewer", target); copyProperty(source, "publicationId", target); copyProperty(source, "status", target); }
protected void copyPublication( Publication source, Publication target ) { copyCollection( source.getExperiments(), target.getExperiments() ); copyCollection( source.getLifecycleEvents(), target.getLifecycleEvents() ); copyProperty(source, "currentOwner", target); copyProperty(source, "currentReviewer", target); copyProperty(source, "publicationId", target); copyProperty(source, "status", target); }
protected void copyFeature( Feature source, Feature target ) { //copyProperty(source, "component", target); copyProperty(source, "cvFeatureIdentification", target); copyProperty(source, "cvFeatureType", target); copyCollection( source.getRanges(), target.getRanges() ); }
protected void copyFeature( Feature source, Feature target ) { //copyProperty(source, "component", target); copyProperty(source, "cvFeatureIdentification", target); copyProperty(source, "cvFeatureType", target); copyCollection( source.getRanges(), target.getRanges() ); }