private void modifyCurationToken(final MAnnotation annotation, String status) { MAnnotationSet set = _domeo.getAnnotationPersistenceManager().getSetByAnnotationId(annotation.getLocalId()); // Check if there is already a curation token MAnnotation alreadyExisting = null; for (MAnnotation token : annotation.getAnnotatedBy()) { if (token instanceof MCurationToken && token .getCreator() .getUri() .equals(_domeo.getAgentManager().getUserPerson().getUri())) { alreadyExisting = token; } } if (alreadyExisting != null) { annotation.getAnnotatedBy().remove(alreadyExisting); _domeo.getPersistenceManager().removeAnnotation(alreadyExisting); } MCurationToken ann = CurationFactory.createCurationToken( _domeo, _domeo.getAgentManager().getUserPerson(), _domeo.getAgentManager().getSoftware(), annotation, status, ""); _domeo .getAnnotationPersistenceManager() .addAnnotationOfAnnotation( ann, annotation, _domeo.getAnnotationPersistenceManager().getCurrentSet()); _domeo.refreshAnnotationComponents(); }
public List<MAnnotation> search(IDomeo domeo, String accessFilter, String textSearch) { // System.out.println("3**|textSearch:" + textSearch); List<MAnnotation> found = new ArrayList<MAnnotation>(); for (MAnnotation annotation : domeo.getAnnotationPersistenceManager().getAllAnnotations()) { ISearchComponent sc = domeo .getAnnotationSearchManager() .getAnnotationSearchComponent(domeo, annotation.getClass().getName()); if (sc.filterByAccess(annotation, accessFilter)) { if (sc.filterByText(annotation, textSearch)) found.add(annotation); } } return found; }
public List<MAnnotation> search( IDomeo domeo, String accessFilter, Long setLocalId, String typeFilter, String textSearch) { // System.out.println("1**|textSearch:" + textSearch); List<MAnnotation> found = new ArrayList<MAnnotation>(); for (MAnnotation annotation : domeo.getAnnotationPersistenceManager().getAllAnnotations()) { ISearchComponent sc = domeo .getAnnotationSearchManager() .getAnnotationSearchComponent(domeo, annotation.getClass().getName()); // System.out.println("0 |annotation name:" + annotation.getClass().getName()); if (sc.filterBySet(annotation, setLocalId)) { // System.out.println("0 | 1"); if (sc.filterByType(annotation, typeFilter)) { // System.out.println("0 | 2"); if (sc.filterByAccess(annotation, accessFilter)) { // System.out.println("0 | 3"); if (sc.filterByText(annotation, textSearch)) found.add(annotation); } } } } return found; }
@Override public boolean filterBySet(MAnnotation annotation, Long setFilter) { if (setFilter == -1l) return true; return _domeo.getAnnotationPersistenceManager().isAnnotationInSet(annotation, setFilter); }