/** * Set the dependencies of a given csar to the provided set. * <p> * This method will remove ,if present, the provided <b>csar</b> from the provided set of <b>dependencies</b>, to avoid cyclic dependencies on itself. * </p> * Note that no saving operation is perform here * * @param csar: The csar we want to set the dependencies * @param dependencies The provided dependencies to use. */ public void setDependencies(Csar csar, Set<CSARDependency> dependencies) { csar.setDependencies(remove(csar, dependencies)); save(csar); }
@ApiOperation(value = "Add dependency to the csar with given id.") @RequestMapping(value = "/{csarId:.+?}/dependencies", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) @PreAuthorize("isAuthenticated()") @Audit @Deprecated public RestResponse<Boolean> addDependency(@PathVariable String csarId, @Valid @RequestBody CSARDependency dependency) { Csar csar = csarService.getOrFail(csarId); csarAuthorizationFilter.checkWriteAccess(csar); Set<CSARDependency> existingDependencies = csar.getDependencies(); if (existingDependencies == null) { existingDependencies = Sets.newHashSet(); csar.setDependencies(existingDependencies); } boolean couldBeSaved = existingDependencies.add(dependency); csarDAO.save(csar); return RestResponseBuilder.<Boolean> builder().data(couldBeSaved).build(); }
if (dependencies == null) { dependencies = new HashSet<>(); archiveRoot.getArchive().setDependencies(dependencies);
archiveRoot.getArchive().setDependencies(mergedDependencies);
csar.setDependencies(topology.getDependencies());
csar.setDependencies(Sets.newHashSet());