private boolean hasUniprotDrExportAnnotation(CvObject cvObject ) { Collection<Annotation> annotations = cvObject.getAnnotations(); for(Annotation annotation : annotations){ if(CvTopic.UNIPROT_DR_EXPORT.equals(annotation.getCvTopic().getShortLabel())){ return true; } } return false; } }
public C psiToIntact(T psiObject) { psiStartConversion(psiObject); C cv = super.psiToIntact(psiObject); if (!psiObject.getAttributes().isEmpty()) { for (Attribute attribute : psiObject.getAttributes()) { Annotation annotation = annotationConverter.psiToIntact(attribute); annotation.setOwner(getInstitution()); if (!cv.getAnnotations().contains(annotation)) { cv.getAnnotations().add(annotation); } } } psiEndConversion(psiObject); return cv; }
@Transactional(propagation = Propagation.REQUIRES_NEW) /** * Delete hidden annotations for each cv given in the collection */ public void removeHiddenFrom(Collection<CvObject> cvs){ DaoFactory factory = IntactContext.getCurrentInstance().getDaoFactory(); AnnotationDao annDao = factory.getAnnotationDao(); for (CvObject cv : cvs){ cv = factory.getEntityManager().merge(cv); Collection<Annotation> annotations = new ArrayList<Annotation>(cv.getAnnotations()); for (Annotation annotation : annotations){ if (annotation.getCvTopic() != null && CvTopic.HIDDEN.equalsIgnoreCase(annotation.getCvTopic().getShortLabel())){ cv.removeAnnotation(annotation); annDao.delete(annotation); } } } }
@Transactional(propagation = Propagation.REQUIRES_NEW) /** * Hide all the given cvs with the given message */ public void hideTerms(Collection<CvObject> cvs, String message){ DaoFactory factory = IntactContext.getCurrentInstance().getDaoFactory(); AnnotationDao annDao = factory.getAnnotationDao(); for (CvObject cv : cvs){ cv = factory.getEntityManager().merge(cv); boolean hasHidden = false; for (Annotation annotation : cv.getAnnotations()){ if (annotation.getCvTopic() != null && CvTopic.HIDDEN.equalsIgnoreCase(annotation.getCvTopic().getShortLabel())){ hasHidden = true; } } if (!hasHidden){ annDao.persist(CvUpdateUtils.hideTerm(cv, message)); } } }
boolean alreadyContainsObsolete = false; for ( Annotation annot : existingCv.getAnnotations() ) { if ( CvTopic.OBSOLETE_MI_REF.equals( CvObjectUtils.getIdentity( annot.getCvTopic() ) ) ) { alreadyContainsObsolete = true; for ( Annotation annot : orphan.getAnnotations() ) { if ( CvTopic.OBSOLETE_MI_REF.equals( CvObjectUtils.getIdentity( annot.getCvTopic() ) ) ) { annotatedText = annot.getAnnotationText();
public T intactToPsi(C intactObject) { intactStartConversation(intactObject); T cvType = (T) ConversionCache.getElement(elementKey(intactObject)); if (cvType != null) { return cvType; } cvType = newCvInstance(psiCvClass); // Set id, annotations, xrefs and aliases PsiConverterUtils.populateNames(intactObject, cvType, aliasConverter); PsiConverterUtils.populateXref(intactObject, cvType, xrefConverter); AnnotationConverterConfig configAnnotation = ConverterContext.getInstance().getAnnotationConfig(); Collection<Annotation> annotations; if (annotationConverter.isCheckInitializedCollections()){ annotations = IntactCore.ensureInitializedAnnotations(intactObject); } else { annotations = intactObject.getAnnotations(); } for ( Annotation annotation : annotations ) { if (!configAnnotation.isExcluded(annotation.getCvTopic())) { Attribute attribute = annotationConverter.intactToPsi( annotation ); if (!cvType.getAttributes().contains( attribute )) { cvType.getAttributes().add( attribute ); } } } ConversionCache.putElement(elementKey(intactObject), cvType); intactEndConversion(intactObject); return cvType; }