@Component(value="blAssetImportProcessor") public class AssetImportProcessor extends Object implements FileImportProcessor
Modifier and Type | Field and Description |
---|---|
protected String |
allowedFileExtensions |
static long |
BASE_FOLDER_ID |
static String[] |
EXCLUDED_FILE_NAMES |
static FilenameFilter |
EXCLUDED_FILE_NAMES_FILTER |
protected org.broadleafcommerce.common.file.service.BroadleafFileService |
fileService |
protected AssetFolderCreator |
folderCreator |
protected com.broadleafcommerce.process.manager.ProcessStateManager |
processStateManager |
protected org.broadleafcommerce.cms.file.service.StaticAssetService |
staticAssetService |
protected org.broadleafcommerce.cms.file.service.StaticAssetStorageService |
staticAssetStorageService |
Constructor and Description |
---|
AssetImportProcessor() |
Modifier and Type | Method and Description |
---|---|
int |
calculateTotalRecords(File uploadedFile)
Given an InputStream, the implementation should calculate the total number of records to be processed.
|
protected int |
calculateTotalRecordsHelper(File[] files) |
boolean |
canHandle(File uploadedFile,
ImportSpecification importSpecification,
ImportType importType)
Whether or not this can handle the given input according to the
ImportSpecification |
protected FilenameFilter |
getExcludedFilenamesFilter() |
protected long |
importAssets(File[] files,
Long processId,
String basePath,
Long baseFolderId) |
void |
processFile(File uploadedFile,
Long processId,
ImportContext context)
This is designed to process and parse out a given uploadedFile and persist the records to the database.
|
protected File |
unzipFile(File uploaded)
Unzips a file and returns a file object that represents the root directory that everything was unzipped to
|
@Value(value="${import.server.uploadable.file.allowed.extension}") protected String allowedFileExtensions
public static final String[] EXCLUDED_FILE_NAMES
public static final long BASE_FOLDER_ID
public static final FilenameFilter EXCLUDED_FILE_NAMES_FILTER
protected org.broadleafcommerce.common.file.service.BroadleafFileService fileService
protected org.broadleafcommerce.cms.file.service.StaticAssetService staticAssetService
protected org.broadleafcommerce.cms.file.service.StaticAssetStorageService staticAssetStorageService
protected com.broadleafcommerce.process.manager.ProcessStateManager processStateManager
@Autowired(required=false) protected AssetFolderCreator folderCreator
public boolean canHandle(File uploadedFile, ImportSpecification importSpecification, ImportType importType)
FileImportProcessor
ImportSpecification
canHandle
in interface FileImportProcessor
uploadedFile
- the file that was uploaded by the userimportSpecification
- the metadata about uploadedFile in order to determine if it should be processedpublic int calculateTotalRecords(File uploadedFile) throws ImportException
FileImportProcessor
calculateTotalRecords
in interface FileImportProcessor
ImportException
- if there was a problem in processing the uploadedFileprotected int calculateTotalRecordsHelper(File[] files)
public void processFile(File uploadedFile, Long processId, ImportContext context) throws ImportException
FileImportProcessor
processFile
in interface FileImportProcessor
uploadedFile
- the original file that was uploaded by the userImportException
- if there was a problem in processing the inputStreamprotected File unzipFile(File uploaded) throws net.lingala.zip4j.exception.ZipException, ImportException
uploaded
- net.lingala.zip4j.exception.ZipException
ImportException
protected long importAssets(File[] files, Long processId, String basePath, Long baseFolderId) throws FileNotFoundException, IOException
FileNotFoundException
IOException
protected FilenameFilter getExcludedFilenamesFilter()
Copyright © 2020. All rights reserved.