This commit is contained in:
qvalentin 2022-05-27 09:54:06 +02:00
parent 7fbc3f722c
commit 22a9368697
Signed by: qvalentin
GPG key ID: C979FA1EAFCABF1C
12 changed files with 228 additions and 144 deletions

View file

@ -7,6 +7,7 @@ import link.LinkUseCase;
import tag.TagName;
import user.Username;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
@ -39,4 +40,8 @@ public class LinkCliAdapter {
public Set<String> getLinksForUser(String userName) {
return linkUseCase.getLinksForUser(new Username(userName)).stream().map(LinkDto::toString).collect(Collectors.toSet());
}
public List<String> groupByHosts() {
return linkUseCase.groupByHosts().stream().map(LinkDto::toString).collect(Collectors.toList());
}
}

View file

@ -33,13 +33,13 @@ public class LinkEntity implements CSVSerializable {
this.id = Integer.parseInt(fields[0]);
this.creator = fields[1];
this.url = fields[2];
this.categoryIds =
this.categoryIds = fields.length > 3 ?
(Arrays.stream(fields[3].split(CSVSerializable.listSeperator)).map(Integer::parseInt)).collect(
Collectors.toSet());
Collectors.toSet()) : Set.of();
this.tags = (Arrays
this.tags = fields.length > 4 ? (Arrays
.stream(fields[4].split(CSVSerializable.listSeperator))
.map(TagEntity::new)).collect(Collectors.toSet());
.map(TagEntity::new)).collect(Collectors.toSet()) : Set.of();
}
public LinkEntity(Link link) {