use of de.catma.util.IDGenerator in project catma by forTEXT.
the class TagsView method handleAddTagsetRequest.
private void handleAddTagsetRequest() {
if (project.isAuthorizedOnProject(RBACPermission.TAGSET_CREATE_OR_UPLOAD)) {
SingleTextInputDialog tagsetNameDlg = new SingleTextInputDialog("Add Tagset", "Please enter the Tagset name:", new SaveCancelListener<String>() {
@Override
public void savePressed(String result) {
IDGenerator idGenerator = new IDGenerator();
project.getTagManager().addTagsetDefinition(new TagsetDefinition(idGenerator.generateTagsetId(), result, new Version()));
}
});
tagsetNameDlg.show();
} else {
Notification.show("Info", "You do not have the permission to create Tagsets! " + "Please contact the Project maintainer for changes!", Type.HUMANIZED_MESSAGE);
}
}
use of de.catma.util.IDGenerator in project catma by forTEXT.
the class CorpusImportDialog method getCorpusFile.
protected File getCorpusFile(CorpusImportMetadata corpusMetadata) throws Exception {
IDGenerator idGenerator = new IDGenerator();
File tempFile = new File(new File(tempDir), idGenerator.generate());
if (tempFile.exists()) {
tempFile.delete();
}
try (InputStream is = getAPIInputStream("corpus/get?cid=" + corpusMetadata.getID() + "&format=xml,tei")) {
try (FileOutputStream fos = new FileOutputStream(tempFile)) {
IOUtils.copy(is, fos);
}
}
return tempFile;
}
use of de.catma.util.IDGenerator in project catma by forTEXT.
the class TagResourcePanel method handleAddTagsetRequest.
private void handleAddTagsetRequest() {
SingleTextInputDialog tagsetNameDlg = new SingleTextInputDialog("Add Tagset", "Please enter the Tagset name:", new SaveCancelListener<String>() {
@Override
public void savePressed(String result) {
IDGenerator idGenerator = new IDGenerator();
project.getTagManager().addTagsetDefinition(new TagsetDefinition(idGenerator.generateTagsetId(), result, new Version()));
}
});
tagsetNameDlg.show();
}
use of de.catma.util.IDGenerator in project catma by forTEXT.
the class TaggerView method replyToComment.
@Override
public void replyToComment(Optional<Comment> optionalComment, int x, int y) {
if (optionalComment.isPresent()) {
User user = project.getUser();
IDGenerator idGenerator = new IDGenerator();
CommentDialog commentDialog = new CommentDialog(true, replyBody -> {
try {
project.addReply(optionalComment.get(), new Reply(idGenerator.generate(), replyBody, user.getName(), user.getUserId(), optionalComment.get().getUuid()));
} catch (IOException e) {
errorHandler.showAndLogError("Error adding Reply!", e);
}
});
commentDialog.show(x, y);
} else {
Notification.show("Info", "Couldn't find a Comment to reply to!", Type.HUMANIZED_MESSAGE);
}
}
use of de.catma.util.IDGenerator in project catma by forTEXT.
the class AnnotateResourcePanel method handleAddTagsetRequest.
private void handleAddTagsetRequest() {
SingleTextInputDialog tagsetNameDlg = new SingleTextInputDialog("Add Tagset", "Please enter the Tagset name:", new SaveCancelListener<String>() {
@Override
public void savePressed(String result) {
IDGenerator idGenerator = new IDGenerator();
project.getTagManager().addTagsetDefinition(new TagsetDefinition(idGenerator.generateTagsetId(), result, new Version()));
}
});
tagsetNameDlg.show();
}
Aggregations