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(); }
private Map<String, Integer> countCurationToken(final MAnnotation annotation) { Map<String, Integer> tokens = new HashMap<String, Integer>(); for (MAnnotation token : annotation.getAnnotatedBy()) { if (token instanceof MCurationToken && !token .getCreator() .getUri() .equals(_domeo.getAgentManager().getUserPerson().getUri())) { String status = ((MCurationToken) token).getStatus(); if (tokens.containsKey(status)) { Integer count = tokens.get(status); count++; tokens.put(status, count); } else { tokens.put(status, 1); } } } return tokens; }