use of edu.stanford.bmir.protege.web.shared.csv.DocumentId in project webprotege by protegeproject.
the class FileUploadResponse method getDocumentId.
/**
* For an upload that was accepted ({@link #wasUploadAccepted()} returns <code>true</code>) this method gets
* the documentId of the upload.
* @return The document Id
*/
public DocumentId getDocumentId() {
if (jsonObject == null) {
return new DocumentId("");
}
if (!wasUploadAccepted()) {
return new DocumentId("");
}
JSONValue value = jsonObject.get(FileUploadResponseAttributes.UPLOAD_FILE_ID.name());
if (value == null) {
return new DocumentId("");
}
JSONString string = value.isString();
if (string == null) {
return new DocumentId("");
}
return new DocumentId(string.stringValue().trim());
}
use of edu.stanford.bmir.protege.web.shared.csv.DocumentId in project webprotege by protegeproject.
the class GetCSVGridActionHandler method execute.
@Nonnull
@Override
public GetCSVGridResult execute(@Nonnull GetCSVGridAction action, @Nonnull ExecutionContext executionContext) {
DocumentId documentId = action.getCSVDocumentId();
File file = new File(uploadsDirectory, documentId.getDocumentId());
if (!file.exists()) {
throw new RuntimeException("CSV file does not exist");
}
CSVGrid grid = getCSVGrid(file, action.getRowLimit());
return new GetCSVGridResult(grid);
}
use of edu.stanford.bmir.protege.web.shared.csv.DocumentId in project webprotege by protegeproject.
the class UploadAndMergeProjectWorkflow method uploadProject.
private void uploadProject(final ProjectId projectId) {
UploadFileDialogController uploadFileDialogController = new UploadFileDialogController("Upload ontologies", new UploadFileResultHandler() {
@Override
public void handleFileUploaded(DocumentId fileDocumentId) {
startMergeWorkflow(projectId, fileDocumentId);
}
@Override
public void handleFileUploadFailed(String errorMessage) {
GWT.log("Upload failed");
}
});
WebProtegeDialog.showDialog(uploadFileDialogController);
}
use of edu.stanford.bmir.protege.web.shared.csv.DocumentId in project webprotege by protegeproject.
the class CsvImportPresenter method startImport.
public void startImport() {
UploadFileResultHandler uploadResultHandler = new UploadFileResultHandler() {
@Override
public void handleFileUploaded(final DocumentId fileDocumentId) {
WebProtegeDialog<CSVImportDescriptor> csvImportDialog = new WebProtegeDialog<>(new CSVImportDialogController(projectId, fileDocumentId, baseClass, dispatchServiceManager, new CSVImportViewImpl(primitiveDataEditorProvider)));
csvImportDialog.setVisible(true);
}
@Override
public void handleFileUploadFailed(String errorMessage) {
ProgressMonitor.get().hideProgressMonitor();
MessageBox.showAlert("Error uploading CSV file", errorMessage);
}
};
UploadFileDialogController controller = new UploadFileDialogController("Upload CSV", uploadResultHandler);
WebProtegeDialog.showDialog(controller);
}
use of edu.stanford.bmir.protege.web.shared.csv.DocumentId in project webprotege by protegeproject.
the class CreateNewProjectPresenter method handleSourcesUploadComplete.
private void handleSourcesUploadComplete(FormPanel.SubmitCompleteEvent event, ProjectCreatedHandler projectCreatedHandler) {
FileUploadResponse response = new FileUploadResponse(event.getResults());
if (response.wasUploadAccepted()) {
DocumentId documentId = response.getDocumentId();
NewProjectSettings newProjectSettings = new NewProjectSettings(loggedInUserManager.getLoggedInUserId(), view.getProjectName(), view.getProjectDescription(), documentId);
submitCreateNewProjectRequest(newProjectSettings, projectCreatedHandler);
} else {
MessageBox.showAlert("Upload Failed", response.getUploadRejectedMessage());
}
}
Aggregations