FileStorageAPI#fileExists method #PL-4817

This commit is contained in:
Gleb Gorelov 2015-02-09 11:51:17 +00:00
parent cb41cea6be
commit f20b8719bd

View File

@ -1,14 +1,15 @@
/*
* Copyright (c) 2008-2013 Haulmont. All rights reserved.
* Copyright (c) 2008-2015 Haulmont. All rights reserved.
* Use is subject to license terms, see http://www.cuba-platform.com/license for details.
*/
package com.haulmont.cuba.core.app;
import com.haulmont.cuba.core.Locator;
import com.haulmont.cuba.core.entity.FileDescriptor;
import com.haulmont.cuba.core.global.FileStorageException;
import org.springframework.stereotype.Service;
import javax.inject.Inject;
/**
* @author krivopustov
* @version $Id$
@ -16,27 +17,26 @@ import org.springframework.stereotype.Service;
@Service(FileStorageService.NAME)
public class FileStorageServiceBean implements FileStorageService {
@Inject
FileStorageAPI fileStorageAPI;
@Override
public void saveFile(FileDescriptor fileDescr, byte[] data) throws FileStorageException {
FileStorageAPI mbean = Locator.lookup(FileStorageAPI.NAME);
mbean.saveFile(fileDescr, data);
fileStorageAPI.saveFile(fileDescr, data);
}
@Override
public void removeFile(FileDescriptor fileDescr) throws FileStorageException {
FileStorageAPI mbean = Locator.lookup(FileStorageAPI.NAME);
mbean.removeFile(fileDescr);
fileStorageAPI.removeFile(fileDescr);
}
@Override
public byte[] loadFile(FileDescriptor fileDescr) throws FileStorageException {
FileStorageAPI mbean = Locator.lookup(FileStorageAPI.NAME);
return mbean.loadFile(fileDescr);
return fileStorageAPI.loadFile(fileDescr);
}
@Override
public boolean fileExists(FileDescriptor fileDescr) {
FileStorageAPI mbean = Locator.lookup(FileStorageAPI.NAME);
return mbean.fileExists(fileDescr);
return fileStorageAPI.fileExists(fileDescr);
}
}