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(); }
protected Key keyForInstitution(Institution institution) { final Collection<InstitutionXref> institutionXrefs = XrefUtils.getIdentityXrefs(institution); Key key; if (institutionXrefs.isEmpty()) { key = keyForAnnotatedObject(institution); } else { key = new Key("Institution:" + concatPrimaryIds(institutionXrefs)); } return key; }
return keyCache.get(cacheKey); } else if (ao instanceof Institution) { key = keyForInstitution((Institution) ao); } else if (ao instanceof Publication) { key = keyForPublication((Publication) ao); } else if (ao instanceof CvObject) { key = keyForCvObject((CvObject) ao); } else if (ao instanceof Experiment) { key = keyForExperiment((Experiment) ao); } else if (ao instanceof Interaction) { key = keyForInteraction((Interaction) ao); } else if (ao instanceof Interactor) { key = keyForInteractor((Interactor) ao); } else if (ao instanceof BioSource) { key = keyForBioSource((BioSource) ao); } else if (ao instanceof Component) { key = keyForComponent((Component) ao); } else if (ao instanceof Feature) { key = keyForFeature((Feature) ao); } else { throw new IllegalArgumentException("KeyBuilder doesn't build key for: " + ao.getClass().getName());
public Key keyForXref(Xref xref) { return new Key(keyFor(xref.getParent()).getUniqueString() + "::" + xref.getPrimaryId()); }
private Alias synchronizeAlias( Alias alias, AnnotatedObject parent ) { if (alias.getAc() != null) { return IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getAliasDao().getByAc(alias.getAc()); } alias.setCvAliasType( synchronize( alias.getCvAliasType() ) ); alias.setParent(parent); if (alias.getAc() == null && parent.getAc() != null) { annotatedObjectsToPersist.put(keyBuilder.keyForAlias(alias), alias); } return alias; }
private Annotation synchronizeAnnotation( Annotation annotation, AnnotatedObject parent ) { if (annotation.getAc() != null) { return IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getAnnotationDao().getByAc(annotation.getAc()); } else { } annotation.setCvTopic( synchronize( annotation.getCvTopic() ) ); if (annotation.getAc() == null && parent.getAc() != null) { annotatedObjectsToPersist.put(keyBuilder.keyForAnnotation(annotation, parent), annotation); } return annotation; }
protected Key keyForPublication(Publication publication) { return keyForAnnotatedObject(publication); }
protected Key keyForCvObject(CvObject cvObject) { String key = cvObject.getIdentifier(); if (key == null) { // search for identity final Collection<CvObjectXref> xrefs = XrefUtils.getIdentityXrefs(cvObject); if (!xrefs.isEmpty()) { key = concatPrimaryIds(xrefs); } else { key = cvObject.getShortLabel(); } } key = cvObject.getClass().getSimpleName() + "__" + key; return new Key(key); }
public Key keyForAnnotation(Annotation annotation, AnnotatedObject parent) { return new Key(keyFor(parent).getUniqueString() + "::" + annotation.getCvTopic() + "_" + annotation.getAnnotationText()); }
private Alias synchronizeAlias( Alias alias, AnnotatedObject parent ) { if (alias.getAc() != null) { return IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getAliasDao().getByAc(alias.getAc()); } alias.setCvAliasType( synchronize( alias.getCvAliasType() ) ); alias.setParent(parent); if (alias.getAc() == null && parent.getAc() != null) { annotatedObjectsToPersist.put(keyBuilder.keyForAlias(alias), alias); } return alias; }
private Annotation synchronizeAnnotation( Annotation annotation, AnnotatedObject parent ) { if (annotation.getAc() != null) { return IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getAnnotationDao().getByAc(annotation.getAc()); } else { } annotation.setCvTopic( synchronize( annotation.getCvTopic() ) ); if (annotation.getAc() == null && parent.getAc() != null) { annotatedObjectsToPersist.put(keyBuilder.keyForAnnotation(annotation, parent), annotation); } return annotation; }
protected Key keyForPublication(Publication publication) { return keyForAnnotatedObject(publication); }
protected Key keyForCvObject(CvObject cvObject) { String key = cvObject.getIdentifier(); if (key == null) { // search for identity final Collection<CvObjectXref> xrefs = XrefUtils.getIdentityXrefs(cvObject); if (!xrefs.isEmpty()) { key = concatPrimaryIds(xrefs); } else { key = cvObject.getShortLabel(); } } key = cvObject.getClass().getSimpleName() + "__" + key; return new Key(key); }
return keyCache.get(cacheKey); } else if (ao instanceof Institution) { key = keyForInstitution((Institution) ao); } else if (ao instanceof Publication) { key = keyForPublication((Publication) ao); } else if (ao instanceof CvObject) { key = keyForCvObject((CvObject) ao); } else if (ao instanceof Experiment) { key = keyForExperiment((Experiment) ao); } else if (ao instanceof Interaction) { key = keyForInteraction((Interaction) ao); } else if (ao instanceof Interactor) { key = keyForInteractor((Interactor) ao); } else if (ao instanceof BioSource) { key = keyForBioSource((BioSource) ao); } else if (ao instanceof Component) { key = keyForComponent((Component) ao); } else if (ao instanceof Feature) { key = keyForFeature((Feature) ao); } else { throw new IllegalArgumentException("KeyBuilder doesn't build key for: " + ao.getClass().getName());
protected Key keyForInstitution(Institution institution) { final Collection<InstitutionXref> institutionXrefs = XrefUtils.getIdentityXrefs(institution); Key key; if (institutionXrefs.isEmpty()) { key = keyForAnnotatedObject(institution); } else { key = new Key("Institution:" + concatPrimaryIds(institutionXrefs)); } return key; }
public Key keyForAlias(Alias alias) { return new Key(keyFor(alias.getParent()).getUniqueString() + "::" + alias.getName()); }
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(); }
protected Key keyForInteractor(Interactor interactor) { final Collection<InteractorXref> interactorXrefs = XrefUtils.getIdentityXrefs(interactor); Key key; if (interactorXrefs.isEmpty()) { key = keyForAnnotatedObject(interactor); } else { Class normalizedClass = CgLibUtil.removeCglibEnhanced(interactor.getClass()); key = new Key(normalizedClass.getSimpleName() + ":" + concatPrimaryIds(interactorXrefs)); } return key; }
public Key keyForAlias(Alias alias) { return new Key(keyFor(alias.getParent()).getUniqueString() + "::" + alias.getName()); }
protected Key keyForInteractor(Interactor interactor) { final Collection<InteractorXref> interactorXrefs = XrefUtils.getIdentityXrefs(interactor); Key key; if (interactorXrefs.isEmpty()) { key = keyForAnnotatedObject(interactor); } else { Class normalizedClass = CgLibUtil.removeCglibEnhanced(interactor.getClass()); key = new Key(normalizedClass.getSimpleName() + ":" + concatPrimaryIds(interactorXrefs)); } return key; }