public CvObjectStatsUnit(CvObject cvObject) { super(cvObject); identifier = CvObjectUtils.getIdentity(cvObject); }
public CvObjectStatsUnit(CvObject cvObject) { super(cvObject); identifier = CvObjectUtils.getIdentity(cvObject); }
private void prepareQuery(CvDatabase database, CvXrefQualifier qualifier, String primaryId, Query query) { query.setParameter("id", primaryId); query.setParameter("dbMi", (database.getIdentifier() != null ? database.getIdentifier() : CvObjectUtils.getIdentity(database))); query.setParameter("qualifierMi", (qualifier.getIdentifier() != null ? qualifier.getIdentifier() : CvObjectUtils.getIdentity(qualifier))); }
private void prepareQuery(CvDatabase database, CvXrefQualifier qualifier, String primaryId, Query query) { query.setParameter("id", primaryId); query.setParameter("dbMi", (database.getIdentifier() != null ? database.getIdentifier() : CvObjectUtils.getIdentity(database))); query.setParameter("qualifierMi", (qualifier.getIdentifier() != null ? qualifier.getIdentifier() : CvObjectUtils.getIdentity(qualifier))); }
public List<T> getByXref(CvDatabase database, String primaryId) { Query query = getEntityManager().createQuery("select distinct(o) from " + getEntityClass().getName() + " o inner join o.xrefs as xref " + "where xref.primaryId = :id " + " and xref.cvDatabase.identifier = :dbMi"); query.setParameter("id", primaryId); query.setParameter("dbMi", (database.getIdentifier() != null ? database.getIdentifier() : CvObjectUtils.getIdentity(database))); return query.getResultList(); }
public List<T> getByXrefLike(CvDatabase database, String primaryId) { Query query = getEntityManager().createQuery("select distinct(o) from " + getEntityClass().getName() + " o inner join o.xrefs as xref " + "where xref.primaryId like :id " + " and xref.cvDatabase.identifier = :dbMi"); query.setParameter("id", primaryId); query.setParameter("dbMi", (database.getIdentifier() != null ? database.getIdentifier() : CvObjectUtils.getIdentity(database))); return query.getResultList(); }
public List<T> getByXref(CvDatabase database, String primaryId) { Query query = getEntityManager().createQuery("select distinct(o) from " + getEntityClass().getName() + " o inner join o.xrefs as xref " + "where xref.primaryId = :id " + " and xref.cvDatabase.identifier = :dbMi"); query.setParameter("id", primaryId); query.setParameter("dbMi", (database.getIdentifier() != null ? database.getIdentifier() : CvObjectUtils.getIdentity(database))); return query.getResultList(); }
public List<T> getByXrefLike(CvDatabase database, String primaryId) { Query query = getEntityManager().createQuery("select distinct(o) from " + getEntityClass().getName() + " o inner join o.xrefs as xref " + "where xref.primaryId like :id " + " and xref.cvDatabase.identifier = :dbMi"); query.setParameter("id", primaryId); query.setParameter("dbMi", (database.getIdentifier() != null ? database.getIdentifier() : CvObjectUtils.getIdentity(database))); return query.getResultList(); }
private void addCvObjectToStatsIfObsolete( CvObject cvObj ) { stats.getObsoleteCvs().put( CvObjectUtils.getIdentity( cvObj ), cvObj.getShortLabel() ); }
/** * The List contains duplicates as the method itselfAndChildrenAsList adds * itself and the children and again the child gets added. * This method removes the dubplicates from the list * * @param allCvs List of all Cvs with duplicates * @return Lists of Uniq Cvs */ protected List<CvDagObject> removeCvsDuplicated( List<CvDagObject> allCvs ) { HashMap<String, CvDagObject> cvHash = new HashMap<String, CvDagObject>(); List<CvDagObject> allUniqCvs = new ArrayList<CvDagObject>(); for ( CvDagObject cvObj : allCvs ) { String id; if (cvObj.getIdentifier() != null){ id = cvObj.getIdentifier(); } else { id = CvObjectUtils.getIdentity( cvObj ); } cvHash.put( id, cvObj ); } for ( String s : cvHash.keySet() ) { CvDagObject cvDagObject = cvHash.get( s ); allUniqCvs.add( cvDagObject ); } return allUniqCvs; }
public int compare( CvObject o1, CvObject o2 ) { String id1; if (o1.getIdentifier() != null){ id1 = o1.getIdentifier(); } else { id1 = CvObjectUtils.getIdentity( o1 ); } String id2; if (o2.getIdentifier() != null){ id2 = o2.getIdentifier(); } else { id2 = CvObjectUtils.getIdentity( o2 ); } return id1.compareTo( id2 ); } } );
protected Map<String, HashSet<CvDagObject>> groupByMis( List<CvDagObject> allCvs ) { Map<String, HashSet<CvDagObject>> cvMapWithParents = new HashMap<String, HashSet<CvDagObject>>(); for ( CvDagObject cvdag : allCvs ) { String id; if (cvdag.getIdentifier() != null){ id = cvdag.getIdentifier(); } else { id = CvObjectUtils.getIdentity( cvdag ); } if ( cvMapWithParents.get( id ) == null ) { cvMapWithParents.put( id, new HashSet<CvDagObject>( cvdag.getParents() ) ); } else { HashSet<CvDagObject> alreadyExisting = cvMapWithParents.get( id ); alreadyExisting.addAll( cvdag.getParents() ); cvMapWithParents.put( id, alreadyExisting ); } } return cvMapWithParents; }
protected Map<String, Class> getMapOfExistingCvs() { Map<String, Class> existingMi2Class = new HashMap<String, Class>(); List<CvObject> allExistingCvs = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao().getAll(); for ( CvObject cvObject : allExistingCvs ) { existingMi2Class.put( CvObjectUtils.getIdentity( cvObject ), cvObject.getClass() ); } return existingMi2Class; }
private List<CvDagObject> dealWithOrphans( List<CvDagObject> allCvs,List<CvDagObject> alreadyExistingObsoleteCvList) { List<CvDagObject> orphanCvList = new ArrayList<CvDagObject>(); for ( CvDagObject cvDag : allCvs ) { if ( !isRootObject( CvObjectUtils.getIdentity( cvDag ) ) ) { if ( cvDag.getParents() == null || cvDag.getParents().isEmpty() ) { addCvObjectToStatsIfObsolete( cvDag ); boolean cvObjectsWithSameId = false; try { cvObjectsWithSameId = checkAndMarkAsObsoleteIfExisted( cvDag, stats ); } catch (Throwable e) { throw new RuntimeException("Problem checking orphan: "+cvDag.getShortLabel()+" ("+cvDag.getIdentifier()+")", e); } if ( cvObjectsWithSameId ) { alreadyExistingObsoleteCvList.add( cvDag ); } else { if ( !CvObjectUtils.getIdentity( cvDag ).equalsIgnoreCase( CvTopic.OBSOLETE_MI_REF ) ) { stats.addOrphanCv( cvDag ); orphanCvList.add( cvDag ); } } }//end of if }//end if }//end for return orphanCvList; }
for ( CvDagObject cvDagObj : allUniqCvs ) { if ( CvObjectUtils.getIdentity( cvDagObj ) == null && cvDagObj.getIdentifier() == null ) { throw new NullPointerException( "No Identifier for the cvObject " + cvDagObj ); if ( log.isTraceEnabled() ) log.trace( counter + " " + CvObjectUtils.getIdentity( cvDagObj ) );
protected boolean checkAndMarkAsObsoleteIfExisted( CvObject orphan, CvUpdaterStatistics stats ) { boolean alreadyExistingCv = false; String id = CvObjectUtils.getIdentity( orphan ); Set<String> existingKeys = getMapOfExistingCvs().keySet(); if ( CvTopic.OBSOLETE_MI_REF.equals( CvObjectUtils.getIdentity( annot.getCvTopic() ) ) ) { alreadyContainsObsolete = true; if ( CvTopic.OBSOLETE_MI_REF.equals( CvObjectUtils.getIdentity( annot.getCvTopic() ) ) ) { annotatedText = annot.getAnnotationText();
public boolean accept(Xref xref) { String dbId = CvObjectUtils.getIdentity(xref.getCvDatabase()); String qualId = CvObjectUtils.getIdentity(xref.getCvXrefQualifier()); if (qualId == null) xref.getCvXrefQualifier().getShortLabel();
public boolean accept(Xref xref) { String dbId = CvObjectUtils.getIdentity(xref.getCvDatabase()); String qualId = CvObjectUtils.getIdentity(xref.getCvXrefQualifier()); if (qualId == null) xref.getCvXrefQualifier().getShortLabel();
protected void updateCVsUsingAnnotationDataset(List<CvDagObject> allCvs, AnnotationInfoDataset annotationInfoDataset, CorePersister corePersister) { for ( CvDagObject cvObject : allCvs ) { final String identity = CvObjectUtils.getIdentity( cvObject ); if ( identity != null && annotationInfoDataset.containsCvAnnotation( identity ) ) { AnnotationInfo annotInfo = annotationInfoDataset.getCvAnnotation( identity ); // check if the topic has already been processed CvTopic topic = createdNonMiTopics.get(annotInfo.getTopicShortLabel()); // if not, try to get it from the database if (topic == null) { topic = IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getCvObjectDao(CvTopic.class).getByShortLabel(CvTopic.class, annotInfo.getTopicShortLabel()); // if it is not in the database, create it and persist it. if (topic == null) { topic = CvObjectUtils.createCvObject( IntactContext.getCurrentInstance().getInstitution(), CvTopic.class, null, annotInfo.getTopicShortLabel() ); corePersister.saveOrUpdate(topic); } // now it has been created createdNonMiTopics.put(annotInfo.getTopicShortLabel(), topic); } // create the corresponding annotation Annotation annotation = new Annotation( IntactContext.getCurrentInstance().getInstitution(), topic, annotInfo.getReason() ); addAnnotation( annotation, cvObject, annotInfo.isApplyToChildren() ); } } }
cvId = CvObjectUtils.getIdentity(dagObj);