use of com.artipie.asto.Copy in project maven-adapter by artipie.
the class AstoMaven method moveToTheRepository.
/**
* Moves artifacts from temp location to repository.
* @param upload Upload temp location
* @param target Repository
* @param artifact Artifact repository location
* @return Completion action
*/
private CompletableFuture<Void> moveToTheRepository(final Key upload, final Storage target, final Key artifact) {
final Storage sub = new SubStorage(new Key.From(upload, PutMetadataSlice.SUB_META), this.storage);
final Storage subversion = new SubStorage(upload.parent().get(), this.storage);
return sub.list(Key.ROOT).thenCompose(list -> new Copy(sub, list.stream().filter(key -> key.string().contains(AstoMaven.MAVEN_META)).collect(Collectors.toList())).copy(new SubStorage(artifact, target))).thenCompose(nothing -> subversion.list(Key.ROOT).thenCompose(list -> new Copy(subversion, list.stream().filter(key -> !key.string().contains(String.format("/%s/", PutMetadataSlice.SUB_META))).collect(Collectors.toList())).copy(new SubStorage(artifact, target))));
}
Aggregations