1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package dev.aherscu.qa.s3.publisher.maven.plugin.config;
18
19 import java.io.*;
20 import java.util.*;
21
22 public class ConstrainedFilesListBuilder extends AbstractFilesListBuilder {
23
24 public ConstrainedFilesListBuilder(final File inputDirectory,
25 final List<String> excludes, final List<Metadata> metadatas) {
26 super(inputDirectory, excludes, metadatas);
27 }
28
29 public List<ManagedFile> build(final Include include) throws IOException {
30 List<ManagedFile> managedFiles;
31 if (include.getContraints() == null) {
32 managedFiles = Collections.emptyList();
33 } else {
34 for (final Bind constraint : include.getContraints()) {
35 final List<String> constrainedFileNames =
36 getMatchingFilesNames(constraint.getPattern());
37 for (final String fileName : constrainedFileNames) {
38 final ManagedFile managedFile =
39 new ManagedFile(fileName, getMetadata(constraint));
40 fileMap.put(fileName, managedFile);
41 }
42 }
43 managedFiles = new ArrayList<>(fileMap.values());
44 }
45 return managedFiles;
46 }
47 }