Search in sources :

Example 21 with IDGenerator

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);
    }
}
Also used : TagsetDefinition(de.catma.tag.TagsetDefinition) Version(de.catma.tag.Version) SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) IDGenerator(de.catma.util.IDGenerator)

Example 22 with IDGenerator

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;
}
Also used : InputStream(java.io.InputStream) FileOutputStream(java.io.FileOutputStream) IDGenerator(de.catma.util.IDGenerator) File(java.io.File)

Example 23 with IDGenerator

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();
}
Also used : TagsetDefinition(de.catma.tag.TagsetDefinition) Version(de.catma.tag.Version) SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) IDGenerator(de.catma.util.IDGenerator)

Example 24 with IDGenerator

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);
    }
}
Also used : User(de.catma.user.User) ClientCommentReply(de.catma.ui.client.ui.tagger.shared.ClientCommentReply) Reply(de.catma.document.comment.Reply) IOException(java.io.IOException) IDGenerator(de.catma.util.IDGenerator)

Example 25 with IDGenerator

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();
}
Also used : TagsetDefinition(de.catma.tag.TagsetDefinition) Version(de.catma.tag.Version) SingleTextInputDialog(de.catma.ui.dialog.SingleTextInputDialog) IDGenerator(de.catma.util.IDGenerator)

Aggregations

IDGenerator (de.catma.util.IDGenerator)25 File (java.io.File)12 TagsetDefinition (de.catma.tag.TagsetDefinition)11 FileInputStream (java.io.FileInputStream)10 Version (de.catma.tag.Version)8 ContentInfoSet (de.catma.document.source.ContentInfoSet)6 SourceDocumentInfo (de.catma.document.source.SourceDocumentInfo)6 SingleTextInputDialog (de.catma.ui.dialog.SingleTextInputDialog)6 ArrayList (java.util.ArrayList)6 EventBus (com.google.common.eventbus.EventBus)5 UI (com.vaadin.ui.UI)5 BackgroundService (de.catma.backgroundservice.BackgroundService)5 IndexInfoSet (de.catma.document.source.IndexInfoSet)5 SourceDocument (de.catma.document.source.SourceDocument)5 TechInfoSet (de.catma.document.source.TechInfoSet)5 Project (de.catma.project.Project)5 TagDefinition (de.catma.tag.TagDefinition)5 JGitRepoManager (de.catma.repository.git.managers.JGitRepoManager)4 TagLibrary (de.catma.tag.TagLibrary)4 TagManager (de.catma.tag.TagManager)4