public Annotation createAnnotation(String annotationText, CvTopic cvTopic) { Annotation annotation = new Annotation(institution, cvTopic); annotation.setAnnotationText(annotationText); return annotation; }
public Annotation createAnnotation(String annotationText, CvTopic cvTopic) { Annotation annotation = new Annotation(institution, cvTopic); annotation.setAnnotationText(annotationText); return annotation; }
public Annotation createAnnotation(String annotationText, CvTopic cvTopic) { Annotation annotation = new Annotation(institution, cvTopic); annotation.setAnnotationText(annotationText); return annotation; }
private void markAsHidden(CvObject cv, CvTopic hidden) { final Annotation hiddenAnnotation = new Annotation(hidden, null); cv.addAnnotation(hiddenAnnotation); corePersister.saveOrUpdate(cv); }
private void addUsedInClass(CvObject cv, CvTopic usedInClass, String classes) { final Annotation hiddenAnnotation = new Annotation(usedInClass, classes); cv.addAnnotation(hiddenAnnotation); corePersister.saveOrUpdate(cv); }
private void markAsHidden(CvObject cv, CvTopic hidden) { final Annotation hiddenAnnotation = new Annotation(hidden, null); cv.addAnnotation(hiddenAnnotation); corePersister.saveOrUpdate(cv); }
private void addUsedInClass(CvObject cv, CvTopic usedInClass, String classes) { final Annotation hiddenAnnotation = new Annotation(usedInClass, classes); cv.addAnnotation(hiddenAnnotation); corePersister.saveOrUpdate(cv); }
private void addObsoleteAnnotation( CvObject existingCv, String obsoleteMessage ) { obsoleteTopic.addAnnotation( new Annotation( existingCv.getOwner(), obsoleteTopic, obsoleteMessage ) ); }
/** * Adds the 'on-hold' to a publication. * * @param intactContext The IntactContext as accessing data is necessary * @param publication the publication to hold * @param reason the reason for the 'on-hold' status * @since 2.5.0 */ public static void markAsOnHold(IntactContext intactContext, Publication publication, String reason) { CvTopic onholdTopic = intactContext.getDaoFactory().getCvObjectDao(CvTopic.class).getByShortLabel(CvTopic.ON_HOLD); if (onholdTopic == null) throw new IllegalStateException("CvTopic on-hold was not found in the database"); Annotation annotation = new Annotation(onholdTopic, reason); publication.addAnnotation(annotation); }
/** * Adds the 'on-hold' to a publication. * * @param intactContext The IntactContext as accessing data is necessary * @param publication the publication to hold * @param reason the reason for the 'on-hold' status * @since 2.5.0 */ public static void markAsOnHold(IntactContext intactContext, Publication publication, String reason) { CvTopic onholdTopic = intactContext.getDaoFactory().getCvObjectDao(CvTopic.class).getByShortLabel(CvTopic.ON_HOLD); if (onholdTopic == null) throw new IllegalStateException("CvTopic on-hold was not found in the database"); Annotation annotation = new Annotation(onholdTopic, reason); publication.addAnnotation(annotation); }
protected Annotation toAnnotation( String cvTopic, String annotation ) { Institution owner = IntactContext.getCurrentInstance().getInstitution(); CvTopic topic = getCvObjectByLabel( CvTopic.class, cvTopic ); if ( topic == null ) { if ( CvTopic.URL.equalsIgnoreCase( cvTopic ) ) { topic = CvObjectUtils.createCvObject( owner, CvTopic.class, CvTopic.URL_MI_REF, CvTopic.URL ); } else if ( CvTopic.SEARCH_URL.equalsIgnoreCase( cvTopic ) ) { topic = CvObjectUtils.createCvObject( owner, CvTopic.class, CvTopic.SEARCH_URL_MI_REF, CvTopic.SEARCH_URL ); } else if ( CvTopic.XREF_VALIDATION_REGEXP.equalsIgnoreCase( cvTopic ) ) { topic = CvObjectUtils.createCvObject( owner, CvTopic.class, CvTopic.XREF_VALIDATION_REGEXP_MI_REF, CvTopic.XREF_VALIDATION_REGEXP ); } else if ( CvTopic.COMMENT.equalsIgnoreCase( cvTopic ) ) { topic = CvObjectUtils.createCvObject( owner, CvTopic.class, CvTopic.COMMENT_MI_REF, CvTopic.COMMENT ); } else if ( CvTopic.OBSOLETE.equalsIgnoreCase( cvTopic ) ) { topic = CvObjectUtils.createCvObject( owner, CvTopic.class, CvTopic.OBSOLETE_MI_REF, CvTopic.OBSOLETE ); topic.setFullName( CvTopic.OBSOLETE ); } else { log.error( "Unexpected topic found on annotation: " + cvTopic ); return null; } } if ( log.isTraceEnabled() ) log.debug( "Returning from toAnnotation: owner: " + owner + " topic: " + topic + " annotation " + annotation ); return new Annotation( owner, topic, annotation ); }
protected Annotation cloneAnnotation(Annotation annotation) throws IntactClonerException { if (annotation == null) return null; Annotation clone = new Annotation(); clonerManager.addClone(annotation, clone); clone.setCvTopic(clone(annotation.getCvTopic())); clone.setAnnotationText(annotation.getAnnotationText()); return clone; }
protected Annotation cloneAnnotation(Annotation annotation) throws IntactClonerException { if (annotation == null) return null; Annotation clone = new Annotation(); clonerManager.addClone(annotation, clone); clone.setCvTopic(clone(annotation.getCvTopic())); clone.setAnnotationText(annotation.getAnnotationText()); return clone; }
Annotation a = new Annotation( owner, topic, text );
/** * * @return a new Dataset annotation with the dataset value contained in the DatasetSelector of this object */ private Annotation createNewDataset() throws DatasetException { CvTopic dataset = IntactContext.getCurrentInstance().getDataContext().getDaoFactory().getCvObjectDao( CvTopic.class ).getByPsiMiRef( CvTopic.DATASET_MI_REF ); if (dataset == null){ throw new DatasetException("The CVTopic " + CvTopic.DATASET_MI_REF + " : " + CvTopic.DATASET + "doesn't exist in the database."); } Annotation annotation = new Annotation(dataset, this.selector.getDatasetValueToAdd()); return annotation; }
public static Annotation hideTerm(CvObject c, String message){ DaoFactory factory = IntactContext.getCurrentInstance().getDaoFactory(); CvTopic topicFromDb = factory.getCvObjectDao(CvTopic.class).getByShortLabel(CvTopic.HIDDEN); if (topicFromDb == null){ topicFromDb = CvObjectUtils.createCvObject(IntactContext.getCurrentInstance().getInstitution(), CvTopic.class, null, CvTopic.HIDDEN); IntactContext.getCurrentInstance().getCorePersister().saveOrUpdate(topicFromDb); } Annotation newAnnotation = new Annotation(topicFromDb, message); c.addAnnotation(newAnnotation); return newAnnotation; }
public Annotation psiToIntact(Attribute psiObject) { psiStartConversion(psiObject); CvTopic cvTopic = new CvTopic(getInstitution(), psiObject.getName()); // all name Acs should be from psi mi controlled vocabularies if (psiObject.getNameAc() != null) { cvTopic.setIdentifier(psiObject.getNameAc()); psiMiPopulator.populateWithPsiMi(cvTopic, psiObject.getNameAc()); } Annotation annotation = new Annotation(getInstitution(), cvTopic, psiObject.getValue()); psiEndConversion(psiObject); return annotation; }
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() ); } } }
CvTopic cvAddress = new CvTopic("postaladdress"); Annotation annotation = new Annotation( cvAddress, address); institution.addAnnotation(annotation);
CvTopic cvAddress = new CvTopic("postaladdress"); Annotation annotation = new Annotation( cvAddress, address); institution.addAnnotation(annotation);