last version logs added
@@ -66,11 +66,13 @@ class ArtifactEntryServiceImpl extends AbstractArtifactEntryService
tagSet.add(lastVersionTag);
ArtifactCoordinates coordinates = entity.getArtifactCoordinates();
- if (coordinates != null)
+ if (coordinates == null)
{
+ return super.save(entity);
+ }
+
Map<String, String> coordinatesMap = new HashMap<>(coordinates.getCoordinates());
coordinatesMap.remove("version");
-
List<ArtifactEntry> lastVersionArtifactList = findArtifactList(entity.getStorageId(),
entity.getRepositoryId(),
coordinatesMap, tagSet,
@@ -81,20 +83,26 @@ class ArtifactEntryServiceImpl extends AbstractArtifactEntryService
true))
.collect(Collectors.toList());
ArtifactEntry lastVersionEntry = lastVersionArtifactList.stream().findFirst().orElse(entity);
-
+ Optional<ArtifactCoordinates> lastVersionCoordinates = Optional.ofNullable(lastVersionEntry.getArtifactCoordinates());
if (lastVersionEntry.equals(entity))
{
+ logger.debug(String.format("Set [%s] last version to [%s]", entity.getArtifactPath(),
+ coordinates.getVersion()));
entity.getTagSet().add(lastVersionTag);
}
else if (entity.getArtifactCoordinates().compareTo(lastVersionEntry.getArtifactCoordinates()) >= 0)
{
+ logger.debug(String.format("Update [%s] last version from [%s] to [%s]", entity.getArtifactPath(),
+ lastVersionCoordinates.map(c -> c.getVersion()).orElse("undefined"),
+ coordinates.getVersion()));
entity.getTagSet().add(lastVersionTag);
-
lastVersionEntry.getTagSet().remove(lastVersionTag);
super.save(lastVersionEntry);
}
-
- return super.save(entity);
+ else
+ {
+ logger.debug(String.format("Keep [%s] last version [%s]", entity.getArtifactPath(),
+ lastVersionCoordinates.map(c -> c.getVersion()).orElse("undefined")));
}
return super.save(entity);
