@Service(value="blImportService") public class ImportServiceImpl extends Object implements ImportService
FileImportProcessor
s can be injected and used.
If a registered processor can handle a given ImportSpecification
and the passed in InputStream
is valid (e.g. a valid CSV file) it will go ahead and process the file.
The processing is handled by the Scheduled Jobs and Events framework and will issue an event to be processed immediately.Modifier and Type | Field and Description |
---|---|
protected org.broadleafcommerce.common.file.service.BroadleafFileService |
broadleafFileService |
protected int |
fileBufferSize |
protected long |
maxUploadableFileSize |
protected com.broadleafcommerce.process.manager.ProcessActionManager |
processActionManager |
protected com.broadleafcommerce.process.manager.ProcessRegistrationManager |
processRegistrationManager |
protected com.broadleafcommerce.process.service.ProcessService |
processService |
protected com.broadleafcommerce.process.manager.ProcessStateManager |
processStateManager |
protected List<FileImportProcessor> |
registeredProcessors |
Constructor and Description |
---|
ImportServiceImpl() |
Modifier and Type | Method and Description |
---|---|
List<FileImportProcessor> |
getRegisteredProcessors() |
protected void |
populateProcessContext(Map<String,String> processParameters,
ImportScheduleDefinition scheduleDefinition,
Long adminUserId)
Saves off various parts of the
BroadleafRequestContext so that the job consumer can re-initialize things like
timezone, locale and admin user security to properly save process the import in the background thread |
com.broadleafcommerce.process.domain.Process |
scheduleImport(InputStream input,
ImportScheduleDefinition def)
Schedules an import to be processed as a background event to be picked up via the
ImportProcessExecutor . |
com.broadleafcommerce.process.domain.Process |
scheduleImport(InputStream input,
ImportScheduleDefinition def,
Map<String,String> additionalEventDetails) |
void |
setRegisteredProcessors(List<FileImportProcessor> registeredProcessors) |
@Value(value="${import.server.max.uploadable.file.size}") protected long maxUploadableFileSize
@Value(value="${import.server.file.buffer.size}") protected int fileBufferSize
protected org.broadleafcommerce.common.file.service.BroadleafFileService broadleafFileService
protected com.broadleafcommerce.process.service.ProcessService processService
protected com.broadleafcommerce.process.manager.ProcessRegistrationManager processRegistrationManager
protected com.broadleafcommerce.process.manager.ProcessActionManager processActionManager
protected com.broadleafcommerce.process.manager.ProcessStateManager processStateManager
protected List<FileImportProcessor> registeredProcessors
public com.broadleafcommerce.process.domain.Process scheduleImport(InputStream input, ImportScheduleDefinition def) throws ImportException, IOException
ImportProcessExecutor
. This will first take the
given input and save it off into a file. Once the file has been saved to the persistent file store via BroadleafFileService
the import event is scheduled and a handle to the Process
is returned that can be used to poll.scheduleImport
in interface ImportService
input
- stream-based input of the data to importdef
- various toggles for how to process the given inputImportException
- if ther was a problem in the importIOException
- if there was a problem reading or processing the given file, or if the file exceeds import.server.max.uploadable.file.size
FileImportProcessor}
public com.broadleafcommerce.process.domain.Process scheduleImport(InputStream input, ImportScheduleDefinition def, Map<String,String> additionalEventDetails) throws ImportException, IOException
scheduleImport
in interface ImportService
ImportException
IOException
public List<FileImportProcessor> getRegisteredProcessors()
public void setRegisteredProcessors(List<FileImportProcessor> registeredProcessors)
protected void populateProcessContext(Map<String,String> processParameters, ImportScheduleDefinition scheduleDefinition, Long adminUserId)
BroadleafRequestContext
so that the job consumer can re-initialize things like
timezone, locale and admin user security to properly save process the import in the background threadCopyright © 2020. All rights reserved.