public UpdatedAnnotation(Annotation annotation, UpdateStatus status){ super(); if (annotation != null){ topic = annotation.getCvTopic() != null ? annotation.getCvTopic().getAc() : null; this.text = annotation.getAnnotationText(); } else { this.topic = null; this.text = null; } this.status = status != null ? status : UpdateStatus.none; this.parent = null; }
public Collection<Field> fieldsForAnnotation(Annotation annotation) { Collection<Field> fields = new ArrayList<Field>(); if (annotation.getCvTopic() != null) { Field topicField = new Field(); topicField.setName("CvTopic AC"); topicField.setValue(annotation.getCvTopic().getAc()); fields.add(topicField); } Field annotTextField = new Field(); annotTextField.setName("Annotation text"); annotTextField.setValue(annotation.getAnnotationText()); fields.add(annotTextField); return fields; }
private CvTopic createCvTopicObsolete() { final DaoFactory daoFactory = IntactContext.getCurrentInstance().getDataContext().getDaoFactory(); if ( obsoleteTopic != null ) { if (daoFactory.getBaseDao().isTransient(obsoleteTopic) && obsoleteTopic.getAc() != null) { obsoleteTopic = daoFactory.getCvObjectDao( CvTopic.class ).getByAc( obsoleteTopic.getAc() ); } } else { obsoleteTopic = daoFactory.getCvObjectDao( CvTopic.class ).getByPsiMiRef( CvTopic.OBSOLETE_MI_REF ); } if ( obsoleteTopic == null ) { // create the obsolete term (which is obsolete too!) obsoleteTopic = CvObjectUtils.createCvObject( IntactContext.getCurrentInstance().getInstitution(), CvTopic.class, CvTopic.OBSOLETE_MI_REF, CvTopic.OBSOLETE ); obsoleteTopic.setFullName( "obsolete term" ); addObsoleteAnnotation( obsoleteTopic, "Deprecated CV term that should not be used to annotate entries" ); } return obsoleteTopic; }
stats.addUpdatedCv( existingCv ); if (obsoleteTopic.getAc() == null) { try { persisterHelper.save( obsoleteTopic );