add cli adapters for custom tags and link

This commit is contained in:
qvalentin 2022-05-15 13:18:38 +02:00
parent fa8b6a4377
commit 4e74f8b10e
Signed by: qvalentin
GPG Key ID: C979FA1EAFCABF1C
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,24 @@
package cli.link;
import category.CategoryName;
import link.LinkUrl;
import link.LinkUseCase;
import user.Username;
import java.util.Set;
import java.util.stream.Collectors;
public class LinkCliAdapter {
private final LinkUseCase linkUseCase;
public LinkCliAdapter(LinkUseCase linkUseCase) {
this.linkUseCase = linkUseCase;
}
public void addLink(String url, Set<String> categoryNames, String creator) {
linkUseCase.addLink(new LinkUrl(url),
categoryNames.stream().map(CategoryName::new).collect(Collectors.toSet()),
new Username(creator));
}
}

View File

@ -0,0 +1,20 @@
package cli.tag;
import tag.CustomTagsUseCase;
import tag.TagName;
import tag.matcherImplementations.CustomTagMatcher;
public class CustomTagsCliAdapter {
private final CustomTagsUseCase customTagsUseCase;
public CustomTagsCliAdapter(CustomTagsUseCase customTagsUseCase) {
this.customTagsUseCase = customTagsUseCase;
}
public void addCustomTagMatcher(String name, String regexString) {
customTagsUseCase.addCustomTagMatcher(new CustomTagMatcher(new TagName(name), regexString));
}
}