private Map<String, Integer> getFinishedDocumentsPerUser(Project aProject) { Map<String, Integer> annotatorsProgress = new HashMap<String, Integer>(); if (aProject != null) { for (User user : repository.listProjectUsersWithPermissions(aProject, PermissionLevel.USER)) { for (SourceDocument document : repository.listSourceDocuments(aProject)) { if (repository.isAnnotationFinished(document, user)) { if (annotatorsProgress.get(user.getUsername()) == null) { annotatorsProgress.put(user.getUsername(), 1); } else { int previousValue = annotatorsProgress.get(user.getUsername()); annotatorsProgress.put(user.getUsername(), previousValue + 1); } } } if (annotatorsProgress.get(user.getUsername()) == null) { annotatorsProgress.put(user.getUsername(), 0); } } } return annotatorsProgress; }
@Override protected List<User> load() { List<User> allUSers = projectRepository.listUsers(); allUSers.removeAll(projectRepository .listProjectUsersWithPermissions(selectedProject.getObject())); // add this User in the List that can be used as virtual user for // crowdsource if (userRepository.get(CROWD_USER) == null) { User crowdUser = new User(); crowdUser.setUsername(CROWD_USER); crowdUser.setPassword(""); crowdUser.setEnabled(false); userRepository.create(crowdUser); allUSers.add(crowdUser); } return allUSers; } }, new ChoiceRenderer<User>("username", "username")));
public void setPassword(String aPassword) { password = encodePassword(aPassword); }
public Map<String, JCas> listJcasesforCorrection(AnnotationDocument randomAnnotationDocument, SourceDocument aDocument, Mode aMode) throws UIMAException, ClassNotFoundException, IOException { Map<String, JCas> jCases = new HashMap<String, JCas>(); User user = repository.getUser(SecurityContextHolder.getContext().getAuthentication() .getName()); randomAnnotationDocument = repository.getAnnotationDocument(aDocument, user); // Upgrading should be an explicit action during the opening of a document at the end // of the open dialog - it must not happen during editing because the CAS addresses // are used as IDs in the UI //repository.upgradeCasAndSave(aDocument, aMode, user.getUsername()); JCas jCas = repository.getAnnotationDocumentContent(randomAnnotationDocument); jCases.put(user.getUsername(), jCas); return jCases; }
annotatorsProgress.put(user.getUsername(), (int) Math.round((double) (finished * 100) / (totalDocs - ignored)));
documentListAsColumnHeader.add(user.getUsername()); if (repository.existsProjectTimeStamp(projectSelectionModel.project, user.getUsername())) { projectTimeStamp.add(LAST_ACCESS + new SimpleDateFormat("dd/MM/yyyy HH:mm:ss").format(repository .getProjectTimeStamp(projectSelectionModel.project, user.getUsername()))); userAnnotationDocuments.add(user.getUsername() + "-" + DOCUMENT + document.getName());
/** * Set different attributes for {@link BratAnnotatorModel} that will be used for the * {@link CurationViewForSourceDocument} */ public static BratAnnotatorModel setBratAnnotatorModel(SourceDocument aSourceDocument, RepositoryService aRepository, CurationViewForSourceDocument aCurationSegment, AnnotationService aAnnotationService) throws BeansException, FileNotFoundException, IOException { User userLoggedIn = aRepository.getUser(SecurityContextHolder.getContext() .getAuthentication().getName()); BratAnnotatorModel bratAnnotatorModel = new BratAnnotatorModel();// .getModelObject(); bratAnnotatorModel.setDocument(aSourceDocument); bratAnnotatorModel.setProject(aSourceDocument.getProject()); bratAnnotatorModel.setUser(userLoggedIn); bratAnnotatorModel.setFirstSentenceAddress(aCurationSegment.getSentenceAddress().get( CURATION_USER)); bratAnnotatorModel.setLastSentenceAddress(aCurationSegment.getSentenceAddress().get( CURATION_USER)); bratAnnotatorModel.setSentenceAddress(aCurationSegment.getSentenceAddress().get( CURATION_USER)); bratAnnotatorModel.setSentenceBeginOffset(aCurationSegment.getBegin()); bratAnnotatorModel.setSentenceEndOffset(aCurationSegment.getEnd()); bratAnnotatorModel.setMode(Mode.CURATION); ProjectUtil.setAnnotationPreference(userLoggedIn.getUsername(), aRepository, aAnnotationService, bratAnnotatorModel, Mode.CURATION); return bratAnnotatorModel; }
annotationDocument.setName(document.getName()); annotationDocument.setProject(project); annotationDocument.setUser(user.getUsername()); annotationDocument.setState(AnnotationDocumentStateTransition .transition(NEW_TO_ANNOTATION_IN_PROGRESS));
cachedCASes.put(user.getUsername(), cases);
annotationDocument.setName(document.getName()); annotationDocument.setProject(project); annotationDocument.setUser(annotator.getUsername()); annotationDocument.setState(state); try {
ProjectPermission projectPermission = new ProjectPermission(); projectPermission.setProject(selectedProject.getObject()); projectPermission.setUser(user.getUsername()); projectPermission.setLevel(PermissionLevel.USER); try {
AnnotationDocument annotationDocument = aRepository.getAnnotationDocument( sourceDocument, user); jCases.put(user.getUsername(), aRepository.getAnnotationDocumentContent(annotationDocument)); aAnnotationSelectionByUsernameAndAddress.put(CURATION_USER,
ProjectPermission permissionToExport = new ProjectPermission(); permissionToExport.setLevel(permission.getLevel()); permissionToExport.setUser(user.getUsername()); projectPermissions.add(permissionToExport);
ProjectPermission projectPermission = new ProjectPermission(); projectPermission.setLevel(level); projectPermission.setUser(selectedUser.getUsername()); projectPermission.setProject(selectedProject.getObject()); try {