use of com.sequenceiq.cloudbreak.domain.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogService method getCloudbreakDefaultImageCatalog.
private ImageCatalog getCloudbreakDefaultImageCatalog() {
ImageCatalog imageCatalog = new ImageCatalog();
imageCatalog.setImageCatalogName(CLOUDBREAK_DEFAULT_CATALOG_NAME);
imageCatalog.setImageCatalogUrl(defaultCatalogUrl);
imageCatalog.setPublicInAccount(true);
return imageCatalog;
}
use of com.sequenceiq.cloudbreak.domain.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogService method getAllPublicInAccount.
public Iterable<ImageCatalog> getAllPublicInAccount() {
IdentityUser cbUser = authenticatedUserService.getCbUser();
List<ImageCatalog> allPublicInAccount = imageCatalogRepository.findAllPublicInAccount(cbUser.getUserId(), cbUser.getAccount());
allPublicInAccount.add(getCloudbreakDefaultImageCatalog());
return allPublicInAccount;
}
use of com.sequenceiq.cloudbreak.domain.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogService method update.
public ImageCatalog update(ImageCatalog source) {
ImageCatalog imageCatalog = imageCatalogRepository.findOne(source.getId());
authorizationService.hasReadPermission(imageCatalog);
checkImageCatalog(imageCatalog, source.getId());
imageCatalog.setImageCatalogName(source.getImageCatalogName());
imageCatalog.setImageCatalogUrl(source.getImageCatalogUrl());
return create(imageCatalog);
}
use of com.sequenceiq.cloudbreak.domain.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogService method get.
public ImageCatalog get(Long id) {
ImageCatalog imageCatalog;
IdentityUser user = authenticatedUserService.getCbUser();
imageCatalog = imageCatalogRepository.findAllPublicInAccount(user.getAccount(), user.getUserId()).isEmpty() ? getCloudbreakDefaultImageCatalog() : imageCatalogRepository.findOne(id);
return imageCatalog;
}
use of com.sequenceiq.cloudbreak.domain.ImageCatalog in project cloudbreak by hortonworks.
the class ImageCatalogService method getImageByCatalogName.
public StatedImage getImageByCatalogName(String imageId, String catalogName) throws CloudbreakImageNotFoundException, CloudbreakImageCatalogException {
StatedImage image;
if (StringUtils.isEmpty(catalogName)) {
image = getImage(imageId);
} else {
ImageCatalog imageCatalog = get(catalogName);
if (imageCatalog != null) {
image = getImage(imageCatalog.getImageCatalogUrl(), imageCatalog.getImageCatalogName(), imageId);
} else {
String msg = String.format("The specified image catalog '%s' could not be found.", catalogName);
LOGGER.error(msg);
throw new CloudbreakImageNotFoundException(msg);
}
}
return image;
}
Aggregations