public static CvObjectXref getPsiMiIdentityXref(CvObject cvObject) { return XrefUtils.getPsiMiIdentityXref(cvObject); }
/** * @deprecated To get the PSI-MI identifier, just invoke CvObject.getMiIdentifier() */ @Deprecated public static CvObjectXref getPsiMiIdentityXref(CvObject cvObject) { return XrefUtils.getPsiMiIdentityXref(cvObject); }
/** * @deprecated To get the PSI-MI identifier, just invoke CvObject.getMiIdentifier() */ @Deprecated public static CvObjectXref getPsiMiIdentityXref(CvObject cvObject) { return XrefUtils.getPsiMiIdentityXref(cvObject); }
public String calculateInstitutionPrimaryId(Institution institution) { String institutionPrimaryId = null; if (institution != null) { InstitutionXref xref = XrefUtils.getPsiMiIdentityXref(institution); if (xref != null) { institutionPrimaryId = xref.getPrimaryId(); } } return institutionPrimaryId; }
/** * Collect all children psi-mi identity identifier including the given root term's. * * @param root term from which we start traversing children. * @param collectedMIs non null collection in which we store collected MIs (if giving a List, you may have * duplicated in case some terms have multiple parents). */ public static void getChildrenMIs(CvDagObject root, Collection<String> collectedMIs) { if (root == null) { throw new IllegalArgumentException("You must give a non null root term"); } if (collectedMIs == null) { throw new IllegalArgumentException("The given collection must not be null"); } // 1. Add the current term final CvObjectXref xref = XrefUtils.getPsiMiIdentityXref(root); if (xref != null) { collectedMIs.add(xref.getPrimaryId()); } // 2. Add children recursively for (CvDagObject child : root.getChildren()) { getChildrenMIs(child, collectedMIs); } }
/** * Collect all children psi-mi identity identifier including the given root term's. * * @param root term from which we start traversing children. * @param collectedMIs non null collection in which we store collected MIs (if giving a List, you may have * duplicated in case some terms have multiple parents). */ public static void getChildrenMIs(CvDagObject root, Collection<String> collectedMIs) { if (root == null) { throw new IllegalArgumentException("You must give a non null root term"); } if (collectedMIs == null) { throw new IllegalArgumentException("The given collection must not be null"); } // 1. Add the current term final CvObjectXref xref = XrefUtils.getPsiMiIdentityXref(root); if (xref != null) { collectedMIs.add(xref.getPrimaryId()); } // 2. Add children recursively for (CvDagObject child : root.getChildren()) { getChildrenMIs(child, collectedMIs); } }
public Institution getDefaultInstitutionForAcs() { if (defaultInstitutionForAcs == null && IntactContext.currentInstanceExists()) { defaultInstitutionForAcs = IntactContext.getCurrentInstance().getInstitution(); if (defaultInstitutionForAcs != null) { InstitutionXref xref = XrefUtils.getPsiMiIdentityXref(defaultInstitutionForAcs); if (xref != null) { defaultInstitutionPrimaryIdForAcs = xref.getPrimaryId(); } } } return defaultInstitutionForAcs; }
/** * Finds an institution based on its properties. * * @param institution the object we are searching an AC for. * @return an AC or null if it couldn't be found. */ protected String findAcForInstitution( Institution institution ) { String ac = null; // try to fetch it first using the xref. If not, use the shortlabel Xref institutionXref = XrefUtils.getPsiMiIdentityXref( institution ); if ( institutionXref != null ) { Query query = getEntityManager().createQuery( "select distinct institution.ac from Institution institution " + "left join institution.xrefs as xref " + "where xref.primaryId = :primaryId" ); query.setParameter( "primaryId", institutionXref.getPrimaryId() ); ac = getFirstAcForQuery( query, institution ); } if ( ac == null ) { Institution fetchedInstitution = getDaoFactory().getInstitutionDao().getByShortLabel( institution.getShortLabel() ); if ( fetchedInstitution != null ) { ac = fetchedInstitution.getAc(); } } return ac; }
/** * Finds an institution based on its properties. * * @param institution the object we are searching an AC for. * @return an AC or null if it couldn't be found. */ protected String findAcForInstitution( Institution institution ) { String ac = null; // try to fetch it first using the xref. If not, use the shortlabel Xref institutionXref = XrefUtils.getPsiMiIdentityXref( institution ); if ( institutionXref != null ) { Query query = getEntityManager().createQuery( "select distinct institution.ac from Institution institution " + "left join institution.xrefs as xref " + "where xref.primaryId = :primaryId" ); query.setParameter( "primaryId", institutionXref.getPrimaryId() ); ac = getFirstAcForQuery( query, institution ); } if ( ac == null ) { Institution fetchedInstitution = getDaoFactory().getInstitutionDao().getByShortLabel( institution.getShortLabel() ); if ( fetchedInstitution != null ) { ac = fetchedInstitution.getAc(); } } return ac; }
/** * Fetches the corresponding CvDatabase for a specific institution. * * @param context The IntactContext to run the queries to the database * @param institution The institution to find a CvDatabase for * @param defaultDatabaseIdentifier If the passed institution does not have a PSI-MI identifier, the default identifier to use. * @return */ public static CvDatabase retrieveCvDatabase(IntactContext context, Institution institution, String defaultDatabaseIdentifier) { InstitutionXref identityXref = XrefUtils.getPsiMiIdentityXref(institution); if (identityXref == null) return null; CvDatabase cvDatabase = context.getDaoFactory().getCvObjectDao(CvDatabase.class).getByIdentifier(identityXref.getPrimaryId()); if (cvDatabase == null && defaultDatabaseIdentifier != null) { cvDatabase = context.getDaoFactory().getCvObjectDao(CvDatabase.class).getByIdentifier(defaultDatabaseIdentifier); } return cvDatabase; }
/** * Fetches the corresponding CvDatabase for a specific institution. * * @param context The IntactContext to run the queries to the database * @param institution The institution to find a CvDatabase for * @param defaultDatabaseIdentifier If the passed institution does not have a PSI-MI identifier, the default identifier to use. * @return */ public static CvDatabase retrieveCvDatabase(IntactContext context, Institution institution, String defaultDatabaseIdentifier) { InstitutionXref identityXref = XrefUtils.getPsiMiIdentityXref(institution); if (identityXref == null) return null; CvDatabase cvDatabase = context.getDaoFactory().getCvObjectDao(CvDatabase.class).getByIdentifier(identityXref.getPrimaryId()); if (cvDatabase == null && defaultDatabaseIdentifier != null) { cvDatabase = context.getDaoFactory().getCvObjectDao(CvDatabase.class).getByIdentifier(defaultDatabaseIdentifier); } return cvDatabase; }