}
}
for (Iterator iter = artifacts.iterator(); iter.hasNext();) {
ArtifactDownloadReport adr = (ArtifactDownloadReport) iter.next();
Artifact artifact = adr.getArtifact();
String ext = artifact.getExt();
if (adr.getUnpackedLocalFile() != null) {
ext = "";
}
String destPattern = "ivy".equals(adr.getType()) ? destIvyPattern : destFilePattern;
if (!"ivy".equals(adr.getType())
&& !options.getArtifactFilter().accept(adr.getArtifact())) {
continue; // skip this artifact, the filter didn't accept it!
}
ModuleRevisionId aMrid = artifact.getModuleRevisionId();
String destFileName = IvyPatternHelper.substitute(destPattern,
aMrid.getOrganisation(), aMrid.getName(), aMrid.getBranch(),
aMrid.getRevision(), artifact.getName(), artifact.getType(), ext, conf,
adr.getArtifactOrigin(), aMrid.getQualifiedExtraAttributes(),
artifact.getQualifiedExtraAttributes());
Set dest = (Set) artifactsToCopy.get(adr);
if (dest == null) {
dest = new HashSet();
artifactsToCopy.put(adr, dest);
}
String copyDest = settings.resolveFile(destFileName).getAbsolutePath();
String[] destinations = new String[] {copyDest};
if (options.getMapper() != null) {
destinations = options.getMapper().mapFileName(copyDest);
}
for (int j = 0; j < destinations.length; j++) {
dest.add(destinations[j]);
Set conflicts = (Set) conflictsMap.get(destinations[j]);
Set conflictsReports = (Set) conflictsReportsMap.get(destinations[j]);
Set conflictsConf = (Set) conflictsConfMap.get(destinations[j]);
if (conflicts == null) {
conflicts = new HashSet();
conflictsMap.put(destinations[j], conflicts);
}
if (conflictsReports == null) {
conflictsReports = new HashSet();
conflictsReportsMap.put(destinations[j], conflictsReports);
}
if (conflictsConf == null) {
conflictsConf = new HashSet();
conflictsConfMap.put(destinations[j], conflictsConf);
}
if (conflicts.add(artifact.getId())) {
conflictsReports.add(adr);
conflictsConf.add(conf);
}
}
}