Commit a9dbfa04 authored by Matija Obreza's avatar Matija Obreza Committed by Maxym Borodenko

Updates for file-repository changes

parent a9a04d42
......@@ -29,7 +29,6 @@ import org.genesys.blocks.security.SecurityContextUtil;
import org.genesys.filerepository.NoSuchRepositoryFileException;
import org.genesys.filerepository.model.RepositoryFile;
import org.genesys.filerepository.service.BytesStorageService;
import org.genesys.filerepository.service.ImageGalleryService;
import org.genesys.filerepository.service.RepositoryService;
import org.gringlobal.api.NotFoundElement;
import org.slf4j.Logger;
......@@ -71,7 +70,7 @@ public class RepositoryDownloadController {
boolean noCache = "no-cache".equalsIgnoreCase(request.getHeader(HttpHeaders.CACHE_CONTROL))
|| "no-cache".equalsIgnoreCase(request.getHeader(HttpHeaders.PRAGMA));
if (path.startsWith(ImageGalleryService.THUMB_PATH) && ext.equals(ImageGalleryService.THUMB_EXT)) {
if (path.startsWith(RepositoryService.THUMB_PATH) && ext.equals(RepositoryService.THUMB_EXT)) {
final String filename = name + ext;
if (LOG.isDebugEnabled()) {
LOG.debug("_thumb path={} filename={}", path, filename);
......@@ -93,7 +92,7 @@ public class RepositoryDownloadController {
response.setDateHeader(HttpHeaders.LAST_MODIFIED, repositoryFile.getLastModifiedDate().getTime());
response.setHeader(HttpHeaders.ETAG, repositoryFile.getSha1Sum());
response.setContentType(ImageGalleryService.THUMB_CONTENT_TYPE);
response.setContentType(RepositoryService.THUMB_CONTENT_TYPE);
// Cache longer for public files
if (SecurityContextUtil.anyoneHasPermission(repositoryFile, "READ")) {
......
......@@ -87,7 +87,9 @@ public class FileRepositoryConfig implements InitializingBean {
*/
@Bean
public RepositoryService fileRepositoryService() {
return new RepositoryServiceImpl();
var repositoryService = new RepositoryServiceImpl();
repositoryService.setThumbnailSizes(this.thumbnailSizes);
return repositoryService;
}
@Bean(name = "fileSystemStorage")
......@@ -132,9 +134,7 @@ public class FileRepositoryConfig implements InitializingBean {
*/
@Bean
public ImageGalleryService imageGalleryService() {
ImageGalleryServiceImpl galleryService = new ImageGalleryServiceImpl();
galleryService.setThumbnailSizes(this.thumbnailSizes);
return galleryService;
return new ImageGalleryServiceImpl();
}
/**
......
......@@ -28,7 +28,7 @@ import org.genesys.filerepository.model.RepositoryImage;
import org.genesys.filerepository.service.BytesStorageService;
import org.genesys.filerepository.service.ImageGalleryService;
import org.genesys.filerepository.service.RepositoryService;
import org.genesys.filerepository.service.impl.ImageGalleryServiceImpl;
import org.genesys.filerepository.service.impl.RepositoryServiceImpl;
import org.gringlobal.compatibility.service.FilesService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -116,7 +116,7 @@ public class FilesServiceImpl implements FilesService {
LOG.warn("Thumb path {}", imagePath.toAbsolutePath());
RepositoryFile repositoryImage = repositoryService.getFile(imagePath.getParent(), imagePath.getFileName().toString());
if (repositoryImage instanceof RepositoryImage) {
Path thumbPath = ImageGalleryServiceImpl.getFullThumbnailsPath((RepositoryImage) repositoryImage);
Path thumbPath = RepositoryServiceImpl.getFullThumbnailsPath((RepositoryImage) repositoryImage);
// Take the middle-sized thumbnail :-)
Path thumbFile = Paths.get(thumbPath.toString(), thumbnailSizes[thumbnailSizes.length/2] + "x" + thumbnailSizes[thumbnailSizes.length/2] + ".jpg");
return byteStorageService.get(thumbFile);
......
......@@ -91,7 +91,9 @@ public class TestFileRepositoryConfig implements InitializingBean, DisposableBea
*/
@Bean
public RepositoryService fileRepositoryService() {
return new RepositoryServiceImpl();
var repositoryService = new RepositoryServiceImpl();
repositoryService.setThumbnailSizes(this.thumbnailSizes);
return repositoryService;
}
@Bean(name = "fileSystemStorage")
......@@ -129,9 +131,7 @@ public class TestFileRepositoryConfig implements InitializingBean, DisposableBea
*/
@Bean
public ImageGalleryService imageGalleryService() {
ImageGalleryServiceImpl galleryService = new ImageGalleryServiceImpl();
galleryService.setThumbnailSizes(this.thumbnailSizes);
return galleryService;
return new ImageGalleryServiceImpl();
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment