add cli adapters for custom tags and link
This commit is contained in:
parent
fa8b6a4377
commit
4e74f8b10e
24
1-Adapter/src/main/java/cli/link/LinkCliAdapter.java
Normal file
24
1-Adapter/src/main/java/cli/link/LinkCliAdapter.java
Normal 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));
|
||||
}
|
||||
}
|
20
1-Adapter/src/main/java/cli/tag/CustomTagsCliAdapter.java
Normal file
20
1-Adapter/src/main/java/cli/tag/CustomTagsCliAdapter.java
Normal 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));
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue