@Override public String convertToString(Institution obj) { if (obj == null) return null; return obj.getShortLabel(); }
public Institution createInstitution(String miRef, String shortLabel) { this.cvBuilder = new CvObjectBuilder(); institution = new Institution(shortLabel); InstitutionXref xref = createIdentityXrefPsiMi(institution, miRef); institution.addXref(xref); return institution; }
public static void setInstitution(User user, Institution institution) { user.addOrUpdatePreference(Preference.KEY_INSTITUTION_AC, institution.getAc()); user.addOrUpdatePreference(Preference.KEY_INSTITUTION_NAME, institution.getShortLabel()); }
protected void indexComplexSource(InteractionImpl complex, SolrInputDocument solrDocument) throws Exception { if (complex.getOwner() != null){ Institution owner = complex.getOwner(); // short name solrDocument.addField ( ComplexFieldNames.SOURCE, owner.getShortLabel ( ) ) ; // facet field solrDocument.addField ( ComplexFieldNames.SOURCE_F, owner.getShortLabel() ) ; // full name solrDocument.addField ( ComplexFieldNames.SOURCE, owner.getFullName ( ) ) ; } }
institution = new Institution( institutionLabel ); institution.addXref(xref); institution.addAlias(alias); institution.addXref(xref); institution.setFullName( fullName ); institution.setPostalAddress( postalAddress ); institution.setUrl( url ); log.debug( "Institution: " + institution.getShortLabel() );
@Override protected Institution fetchFromDataSource(Institution intactObject) { InstitutionXref idXref = null; for (InstitutionXref xref : intactObject.getXrefs()) { if (CvObjectUtils.getPsiMiIdentityXref(xref.getCvDatabase()).getPrimaryId() .equals(CvDatabase.PSI_MI_MI_REF)) { idXref = xref; } } if (idXref != null) { return IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getInstitutionDao().getByXref(idXref.getPrimaryId()); } return IntactContext.getCurrentInstance().getDataContext().getDaoFactory() .getInstitutionDao().getByShortLabel(intactObject.getShortLabel()); }
Institution institution = new Institution(name); institution.setFullName(description); institution.addXref(idXref); CvDatabase cvPubmed = mockBuilder.createCvObject(CvDatabase.class, CvDatabase.PUBMED_MI_REF, CvDatabase.PUBMED); InstitutionXref pubmedXref = mockBuilder.createIdentityXref(institution, pubmed, cvPubmed); institution.addXref(pubmedXref); institution.addAnnotation(annotation); institution.addAnnotation(annotation); institution.addAnnotation(annotation); institution.addAlias(alias);
if (institution.getUrl() != null && !"".equals(institution.getUrl().trim())) { info.put("url", institution.getUrl()); if (institution.getPostalAddress() != null && !"".equals(institution.getPostalAddress().trim())) { info.put("postalAddress", institution.getPostalAddress()); if (institution.getShortLabel() != null) { Element names = document.createElement("names"); source.appendChild(names); .createElement("shortLabel"); Text shortlabelText = document.createTextNode(institution .getShortLabel()); shortlabelElement.appendChild(shortlabelText); names.appendChild(shortlabelElement); if (institution.getFullName() != null) { Element fullNameElement = document .createElement("fullName"); Text fullNameText = document.createTextNode(institution .getFullName()); fullNameElement.appendChild(fullNameText); names.appendChild(fullNameElement);
institution = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getInstitutionDao().getByShortLabel(intactObject.getShortLabel()); for (InstitutionXref xref : intactObject.getXrefs()) { if (log.isDebugEnabled()) log.debug("\tSaving database: "+xref.getCvDatabase().getShortLabel()); try { for (InstitutionAlias alias : intactObject.getAliases()) { CvAliasType aliasType = alias.getCvAliasType(); if (aliasType != null) { for (Annotation annotation : intactObject.getAnnotations()) { CvTopic topic = annotation.getCvTopic(); if (topic != null) {
private static void persistInstitution(IntactContext context) throws IntactTransactionException { Institution institution = context.getConfig().getInstitution(); if (institution == null) { throw new NullPointerException("Institution is null. Set an institution to the RuntimeConfig first"); } // remove ac, it should not have one at this point to be persisted correctly if (institution.getAc() != null) institution.setAc(null); log.debug("Persisting institution: " + institution.getShortLabel()); DaoFactory daoFactory = getDefaultDaoFactory(context); daoFactory.beginTransaction(); daoFactory.getInstitutionDao().persist(institution); context.getDataContext().commitTransaction(); }
@Override public String toString() { return super.toString() + "; owner=" + owner.getAc(); } }
public InstitutionConverter() { super(new Institution("Unknown"), Institution.class, Source.class); }
if ( institution.getUrl() != null && !"".equals( institution.getUrl().trim() ) ) { info.put( "url", institution.getUrl() ); if ( institution.getPostalAddress() != null && !"".equals( institution.getPostalAddress().trim() ) ) { info.put( "postalAddress", institution.getPostalAddress() );
/** * * @param xref the xref to check * @return */ private boolean xrefPointsToOwnAc(Xref xref) { if (xref.getPrimaryId().startsWith(config.getAcPrefix())) { return true; } else { for (InstitutionXref institutionXref : IntactContext.getCurrentInstance().getInstitution().getXrefs()) { if (institutionXref.getPrimaryId().equals(xref.getCvDatabase().getIdentifier())) { return true; } } return false; } }
@Override public boolean equals( Object o ) { if ( this == o ) return true; if ( !( o instanceof Person ) ) return false; final Person person = ( Person ) o; if ( email != null ? !email.equals( person.email ) : person.email != null ) return false; if ( firstNames != null ? !firstNames.equals( person.firstNames ) : person.firstNames != null ) return false; if ( institution != null ? !institution.equals( person.institution ) : person.institution != null ) return false; if ( surName != null ? !surName.equals( person.surName ) : person.surName != null ) return false; if ( telephone != null ? !telephone.equals( person.telephone ) : person.telephone != null ) return false; return true; }
Collection<InstitutionXref> ownerRefs = institution.getXrefs(); if (identityRef == null && institution.getShortLabel() != null){ identityRef = new CrossReferenceImpl(); identityRef.setIdentifier(institution.getShortLabel()); identityRef.setText(institution.getShortLabel()); else if (institution.getShortLabel() != null){ identityRef.setText(institution.getShortLabel());
Institution institution = new Institution(name); institution.setFullName(description); institution.addXref(idXref); CvDatabase cvPubmed = mockBuilder.createCvObject(CvDatabase.class, CvDatabase.PUBMED_MI_REF, CvDatabase.PUBMED); InstitutionXref pubmedXref = mockBuilder.createIdentityXref(institution, pubmed, cvPubmed); institution.addXref(pubmedXref); institution.addAnnotation(annotation); institution.addAnnotation(annotation); institution.addAnnotation(annotation); institution.addAlias(alias);
@Override public int replaceInstitution(Institution sourceInstitution, Institution destinationInstitution) { verifyOwnable(); if (sourceInstitution.getAc() == null) { throw new IllegalArgumentException("Source institution needs to be present in the database. Supplied institution does not have an AC: " + destinationInstitution); } if (destinationInstitution.getAc() == null) { throw new IllegalArgumentException("Destination institution needs to be present in the database. Supplied institution does not have an AC: " + destinationInstitution); } return getEntityManager().createQuery("update " + getEntityClass().getName() + " ao " + "set ao.owner = :destInstitution " + "where ao.owner.ac = :sourceInstitutionAc " + "and ao.owner.ac <> :destInstitutionAc") .setParameter("sourceInstitutionAc", sourceInstitution.getAc()) .setParameter("destInstitution", destinationInstitution) .setParameter("destInstitutionAc", destinationInstitution.getAc()) .executeUpdate(); }
public Institution cloneInstitution(Institution institution) throws IntactClonerException { if (institution == null) return null; if (clonerManager.isAlreadyCloned(institution)) { return (Institution) clonerManager.getClonedObject(institution); } Institution clone = new Institution(); clonerManager.addClone(institution, clone); return clone; }