@Transactional(propagation = Propagation.REQUIRED) public void updateChildrenHavingMissingParent(String child, String parent) { CvObjectDao<CvDagObject> cvDao = IntactContext.getCurrentInstance().getDaoFactory().getCvObjectDao(CvDagObject.class); CvDagObject reloadedChild = cvDao.getByAc(child); CvDagObject reloadedParent = cvDao.getByAc(parent); if (reloadedChild != null){ reloadedChild.addParent(reloadedParent); IntactContext.getCurrentInstance().getCorePersister().saveOrUpdate(reloadedChild); } else { log.warn("Cv object " + child + " cannot be updated because does not exist anymore"); } }
@Transactional(propagation = Propagation.REQUIRES_NEW) /** * Updated a cv object given its intact accession. This method will not create any missing parents */ public void updateCv(String cvObjectAc, String ontologyId) throws CvUpdateException { DaoFactory factory = IntactContext.getCurrentInstance().getDaoFactory(); CvDagObject cvObject = factory.getCvObjectDao(CvDagObject.class).getByAc(cvObjectAc); if (cvObject != null){ updateCv(cvObject, ontologyId); } // fire an error because term ac cannot be found in the database else { CvUpdateError error = errorFactory.createCvUpdateError(UpdateError.not_found_intact_ac, "Intact Ac does not match any Cv term in the database", null, cvObject.getAc(), null); UpdateErrorEvent evt = new UpdateErrorEvent(this, error); fireOnUpdateError(evt); } }
@Transactional(propagation = Propagation.REQUIRES_NEW) /** * Updated a IntAct cv object given its intact accession. This method will not create missing parents but will re-attach to existing parents when needed */ public void updateIntactCv(String cvObjectAc, String ontologyId) throws CvUpdateException { DaoFactory factory = IntactContext.getCurrentInstance().getDaoFactory(); CvDagObject cvObject = factory.getCvObjectDao(CvDagObject.class).getByAc(cvObjectAc); if (cvObject != null){ updateIntactCv(cvObject, ontologyId); } // fire an error because term ac cannot be found in the database else { CvUpdateError error = errorFactory.createCvUpdateError(UpdateError.not_found_intact_ac, "Intact Ac does not match any Cv term in the database", null, cvObject.getAc(), null); UpdateErrorEvent evt = new UpdateErrorEvent(this, error); fireOnUpdateError(evt); } }
.getCvObjectDao().getByAc(cv.getAc());
.getCvObjectDao().getByAc(cv.getAc());
private CvTopic createCvTopicObsolete() { final DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); if ( obsoleteTopic != null ) { if (daoFactory.getBaseDao().isTransient(obsoleteTopic) && obsoleteTopic.getAc() != null) { obsoleteTopic = daoFactory.getCvObjectDao( CvTopic.class ).getByAc( obsoleteTopic.getAc() ); } } else { obsoleteTopic = daoFactory.getCvObjectDao( CvTopic.class ).getByPsiMiRef( CvTopic.OBSOLETE_MI_REF ); } if ( obsoleteTopic == null ) { // create the obsolete term (which is obsolete too!) obsoleteTopic = CvObjectUtils.createCvObject( IntactContext.getCurrentInstance().getInstitution(), CvTopic.class, CvTopic.OBSOLETE_MI_REF, CvTopic.OBSOLETE ); obsoleteTopic.setFullName( "obsolete term" ); addObsoleteAnnotation( obsoleteTopic, "Deprecated CV term that should not be used to annotate entries" ); } return obsoleteTopic; }