class ImageCatalogService extends AbstractWorkspaceAwareResourceService<ImageCatalog> implements ResourceBasedCrnProvider {

    public Images getImagesByCatalogName(Long workspaceId, String catalogName, String stackName, String platform) throws CloudbreakImageCatalogException {
        if (isNotEmpty(platform) && isNotEmpty(stackName)) {
            throw new BadRequestException("Both platform and existing stack name could not be present in the request.");
        }
        if (isNotEmpty(platform)) {
            return getImages(workspaceId, catalogName, platform).getImages();
        } else if (isNotEmpty(stackName)) {
            return stackImageFilterService.getApplicableImages(workspaceId, catalogName, stackName);
        } else {
            throw new BadRequestException("Either platform or stack name must be present in the request.");
        }
    }

}