private boolean existsCurationDocument(Project aProject) { boolean curationDocumentExist = false; List<de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument> documents = repository .listSourceDocuments(aProject); for (de.tudarmstadt.ukp.clarin.webanno.model.SourceDocument sourceDocument : documents) { // If the curation document is exist (either finished or in progress if (sourceDocument.getState().equals( SourceDocumentState.CURATION_FINISHED) || sourceDocument.getState().equals( SourceDocumentState.CURATION_IN_PROGRESS)) { curationDocumentExist = true; break; } } return curationDocumentExist; }
@Override public boolean existsCurationDocument(Project aProject) { Validate.notNull(aProject, "Project must be specified"); boolean curationDocumentExist = false; List<SourceDocument> documents = listSourceDocuments(aProject); for (SourceDocument sourceDocument : documents) { // If the curation document is finished if (SourceDocumentState.CURATION_FINISHED.equals(sourceDocument.getState())) { curationDocumentExist = true; break; } } return curationDocumentExist; }
@Override public boolean existsCurationDocument(Project aProject) { Validate.notNull(aProject, "Project must be specified"); boolean curationDocumentExist = false; List<SourceDocument> documents = listSourceDocuments(aProject); for (SourceDocument sourceDocument : documents) { // If the curation document is finished if (SourceDocumentState.CURATION_FINISHED.equals(sourceDocument.getState())) { curationDocumentExist = true; break; } } return curationDocumentExist; }
SourceDocument doc = repository.getSourceDocument(project, value.substring(value.indexOf(":") + 1)); if (doc.getState().equals(CURATION_FINISHED)) { changeSourceDocumentState(doc, user, CURATION_FINISHED_TO_CURATION_IN_PROGRESS); else if (doc.getState().equals(CURATION_IN_PROGRESS)) { changeSourceDocumentState(doc, user, CURATION_IN_PROGRESS_TO_CURATION_FINISHED); else if (doc.getState().equals(ANNOTATION_IN_PROGRESS)) { changeSourceDocumentState(doc, user, ANNOTATION_IN_PROGRESS_TO_CURATION_IN_PROGRESS);
@Override protected void onEvent(AjaxRequestTarget aTarget) { if (!projectService.isCurator(project, user)) { aTarget.appendJavaScript( "alert('the state can only be changed explicitly by the curator')"); return; } SourceDocument doc = documentService.getSourceDocument(project, value.substring(value.indexOf(":") + 1)); if (doc.getState().equals(CURATION_FINISHED)) { documentService.transitionSourceDocumentState(doc, CURATION_FINISHED_TO_CURATION_IN_PROGRESS); } else if (doc.getState().equals(CURATION_IN_PROGRESS)) { documentService.transitionSourceDocumentState(doc, CURATION_IN_PROGRESS_TO_CURATION_FINISHED); } else if (doc.getState().equals(ANNOTATION_IN_PROGRESS)) { documentService.transitionSourceDocumentState(doc, ANNOTATION_IN_PROGRESS_TO_CURATION_IN_PROGRESS); } aTarget.add(aCellItem); updateStats(aTarget, projectSelectionForm.getModelObject()); } });
boolean isAnnotationFinished() { AnnotatorState state = getModelObject(); if (state.getMode().equals(Mode.CURATION)) { return state.getDocument().getState().equals(SourceDocumentState.CURATION_FINISHED); } else { return documentService.isAnnotationFinished(state.getDocument(), state.getUser()); } }
@Override protected void onConfigure() { super.onConfigure(); setEnabled(state.getDocument() != null && !documentService .getSourceDocument(state.getDocument().getProject(), state.getDocument().getName()) .getState().equals(SourceDocumentState.CURATION_FINISHED)); }
@Override protected void onConfigure() { super.onConfigure(); setEnabled(state.getDocument() != null && !documentService .getSourceDocument(state.getDocument().getProject(), state.getDocument().getName()) .getState().equals(SourceDocumentState.CURATION_FINISHED)); }
@Override protected void onConfigure() { super.onConfigure(); AnnotatorState state = CurationPage.this.getModelObject(); setEnabled(state.getProject() != null && state.getDocument() != null && !documentService .getSourceDocument(state.getDocument().getProject(), state.getDocument().getName()) .getState().equals(SourceDocumentState.CURATION_FINISHED)); } });
@Override protected void onConfigure() { super.onConfigure(); AnnotatorState state = CurationPage.this.getModelObject(); setEnabled(state.getProject() != null && state.getDocument() != null && !documentService .getSourceDocument(state.getDocument().getProject(), state.getDocument().getName()) .getState().equals(SourceDocumentState.CURATION_FINISHED)); } });
@Override protected String load() { AnnotatorState state = CurationPage.this.getModelObject(); if (state.getProject() != null && state.getDocument() != null) { if (documentService .getSourceDocument(state.getDocument().getProject(), state.getDocument().getName()).getState() .equals(SourceDocumentState.CURATION_FINISHED)) { return "images/accept.png"; } else { return "images/inprogress.png"; } } else { return "images/inprogress.png"; } } }));
@Override protected String load() { AnnotatorState state = CurationPage.this.getModelObject(); if (state.getProject() != null && state.getDocument() != null) { if (documentService .getSourceDocument(state.getDocument().getProject(), state.getDocument().getName()).getState() .equals(SourceDocumentState.CURATION_FINISHED)) { return "images/accept.png"; } else { return "images/inprogress.png"; } } else { return "images/inprogress.png"; } } }));
public static boolean isDocumentFinished(RepositoryService aRepository, BratAnnotatorModel aBratAnnotatorModel) { // if annotationDocument is finished, disable editing boolean finished = false; try { if (aBratAnnotatorModel.getMode().equals(Mode.CURATION)) { if (aBratAnnotatorModel.getDocument().getState() .equals(SourceDocumentState.CURATION_FINISHED)) { finished = true; } } else if (aRepository .getAnnotationDocument(aBratAnnotatorModel.getDocument(), aBratAnnotatorModel.getUser()).getState() .equals(AnnotationDocumentState.FINISHED)) { finished = true; } } catch (Exception e) { finished = false; } return finished; }
private void actionFinishDocument(AjaxRequestTarget aTarget) { finishDocumentDialog.setConfirmAction((aCallbackTarget) -> { actionValidateDocument(aCallbackTarget, getEditorCas()); AnnotatorState state = getModelObject(); SourceDocument sourceDocument = state.getDocument(); if (SourceDocumentState.CURATION_FINISHED.equals(sourceDocument.getState())) { documentService.transitionSourceDocumentState(sourceDocument, CURATION_FINISHED_TO_CURATION_IN_PROGRESS); } else { documentService.transitionSourceDocumentState(sourceDocument, CURATION_IN_PROGRESS_TO_CURATION_FINISHED); } aCallbackTarget.add(finishDocumentIcon); aCallbackTarget.add(finishDocumentLink); aCallbackTarget.add(curationPanel.getEditor()); aCallbackTarget.add(remergeDocumentLink); }); finishDocumentDialog.show(aTarget); }
public static boolean isDocumentFinished(DocumentService aRepository, AnnotatorState aBratAnnotatorModel) { try { if (aBratAnnotatorModel.getMode().equals(Mode.CURATION)) { // Load document freshly from DB so we get the latest state. The document state // in the annotator state might be stale. SourceDocument doc = aRepository.getSourceDocument( aBratAnnotatorModel.getDocument().getProject().getId(), aBratAnnotatorModel.getDocument().getId()); return doc.getState().equals(SourceDocumentState.CURATION_FINISHED); } else { // if annotationDocument is finished, disable editing AnnotationDocument adoc = aRepository.getAnnotationDocument( aBratAnnotatorModel.getDocument(), aBratAnnotatorModel.getUser()); return adoc.getState().equals(AnnotationDocumentState.FINISHED); } } catch (Exception e) { return false; } }
private void actionFinishDocument(AjaxRequestTarget aTarget) { finishDocumentDialog.setConfirmAction((aCallbackTarget) -> { actionValidateDocument(aCallbackTarget, getEditorCas()); AnnotatorState state = getModelObject(); SourceDocument sourceDocument = state.getDocument(); if (SourceDocumentState.CURATION_FINISHED.equals(sourceDocument.getState())) { documentService.transitionSourceDocumentState(sourceDocument, CURATION_FINISHED_TO_CURATION_IN_PROGRESS); } else { documentService.transitionSourceDocumentState(sourceDocument, CURATION_IN_PROGRESS_TO_CURATION_FINISHED); } aCallbackTarget.add(finishDocumentIcon); aCallbackTarget.add(finishDocumentLink); aCallbackTarget.add(curationPanel.getEditor()); aCallbackTarget.add(remergeDocumentLink); }); finishDocumentDialog.show(aTarget); }
public static boolean isDocumentFinished(DocumentService aRepository, AnnotatorState aBratAnnotatorModel) { try { if (aBratAnnotatorModel.getMode().equals(Mode.CURATION)) { // Load document freshly from DB so we get the latest state. The document state // in the annotator state might be stale. SourceDocument doc = aRepository.getSourceDocument( aBratAnnotatorModel.getDocument().getProject().getId(), aBratAnnotatorModel.getDocument().getId()); return doc.getState().equals(SourceDocumentState.CURATION_FINISHED); } else { // if annotationDocument is finished, disable editing AnnotationDocument adoc = aRepository.getAnnotationDocument( aBratAnnotatorModel.getDocument(), aBratAnnotatorModel.getUser()); return adoc.getState().equals(AnnotationDocumentState.FINISHED); } } catch (Exception e) { return false; } }
if (SourceDocumentState.NEW.equals(state.getDocument().getState())) { documentService.transitionSourceDocumentState(state.getDocument(), NEW_TO_ANNOTATION_IN_PROGRESS);