/** * @param artifactId * to look for * @return found {@link Artifact} */ default Optional<Artifact> getArtifact(final Long artifactId) { return getArtifacts().stream().filter(artifact -> artifact.getId().equals(artifactId)).findAny(); }
/** * @param fileName * to look for * @return found {@link Artifact} */ default Optional<Artifact> getArtifactByFilename(final String fileName) { return getArtifacts().stream().filter(artifact -> artifact.getFilename().equalsIgnoreCase(fileName.trim())) .findAny(); }
static List<DdiArtifact> createArtifacts(final Target target, final SoftwareModule module, final ArtifactUrlHandler artifactUrlHandler, final SystemManagement systemManagement, final HttpRequest request) { return new ResponseList<>(module.getArtifacts().stream() .map(artifact -> createArtifact(target, artifactUrlHandler, artifact, systemManagement, request)) .collect(Collectors.toList())); }
static List<DdiArtifact> createArtifacts(final Target target, final SoftwareModule module, final ArtifactUrlHandler artifactUrlHandler, final SystemManagement systemManagement, final HttpRequest request) { return new ResponseList<>(module.getArtifacts().stream() .map(artifact -> createArtifact(target, artifactUrlHandler, artifact, systemManagement, request)) .collect(Collectors.toList())); }
@Override public ResponseEntity<List<MgmtArtifact>> getArtifacts( @PathVariable("softwareModuleId") final Long softwareModuleId) { final SoftwareModule module = findSoftwareModuleWithExceptionIfNotFound(softwareModuleId, null); return ResponseEntity.ok(MgmtSoftwareModuleMapper.artifactsToResponse(module.getArtifacts())); }
protected boolean isFileAlreadyContainedInSoftwareModule(final FileUploadId newFileUploadId, final SoftwareModule softwareModule) { for (final Artifact artifact : softwareModule.getArtifacts()) { final FileUploadId existingId = new FileUploadId(artifact.getFilename(), softwareModule); if (existingId.equals(newFileUploadId)) { return true; } } return false; }
protected boolean isFileAlreadyContainedInSoftwareModule(final FileUploadId newFileUploadId, final SoftwareModule softwareModule) { for (final Artifact artifact : softwareModule.getArtifacts()) { final FileUploadId existingId = new FileUploadId(artifact.getFilename(), softwareModule); if (existingId.equals(newFileUploadId)) { return true; } } return false; }
private DmfSoftwareModule convertToAmqpSoftwareModule(final Target target, final Entry<SoftwareModule, List<SoftwareModuleMetadata>> entry) { final DmfSoftwareModule amqpSoftwareModule = new DmfSoftwareModule(); amqpSoftwareModule.setModuleId(entry.getKey().getId()); amqpSoftwareModule.setModuleType(entry.getKey().getType().getKey()); amqpSoftwareModule.setModuleVersion(entry.getKey().getVersion()); amqpSoftwareModule.setArtifacts(convertArtifacts(target, entry.getKey().getArtifacts())); if (!CollectionUtils.isEmpty(entry.getValue())) { amqpSoftwareModule.setMetadata(convertMetadata(entry.getValue())); } return amqpSoftwareModule; }