Class DefaultImportCockpitMediaService
- java.lang.Object
-
- de.hybris.platform.servicelayer.internal.service.AbstractService
-
- de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
-
- de.hybris.platform.importcockpit.services.media.impl.DefaultImportCockpitMediaService
-
- All Implemented Interfaces:
ImportCockpitMediaService,java.io.Serializable,org.springframework.beans.factory.Aware,org.springframework.beans.factory.BeanNameAware,org.springframework.beans.factory.InitializingBean
public class DefaultImportCockpitMediaService extends AbstractBusinessService implements ImportCockpitMediaService
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
AbstractService.SerializableDTO
-
-
Field Summary
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
modelService, sessionService, txManager
-
Fields inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
tenant
-
-
Constructor Summary
Constructors Constructor Description DefaultImportCockpitMediaService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected CSVReadercreateCSVReader(ImportCockpitInputMediaModel media)protected ImpExImportCockpitMediaModelcreateImpExImportCockpitMedia(java.lang.String code)ImpExMediaModelcreateMediaFromFile(java.lang.String filePackageName)Give the supplied filename (full file path), this method will create and return anImpExMediaModel.CSVReadercreateMediaReader(ImportCockpitInputMediaModel media)Creates a media reader for the source file.protected MediaServicegetMediaService()java.util.List<SourceColumnModel>getSourceColumnData(ImportCockpitCronJobModel icCronJobModel)Given the suppliedImportCockpitCronJobModel, this method will return all the the data for each field(column) as a List ofSourceColumnModel.java.util.List<java.lang.String>getSourceColumnNames(ImportCockpitInputMediaModel media)Retrieves the source column names/labels of the uploaded source file.voidsetMediaService(MediaService mediaService)booleanvalidateInputFile(ImportCockpitInputMediaModel inputMedia)Validates theImportCockpitInputMediaModel(CSV format) that is to be assigned to anImportCockpitCronJobModel.-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractBusinessService
getModelService, getSessionService, getTxManager, setModelService, setSessionService, setTxManager
-
Methods inherited from class de.hybris.platform.servicelayer.internal.service.AbstractService
afterPropertiesSet, getCurrentTenant, setBeanName, setCurrentTenant, writeReplace
-
-
-
-
Method Detail
-
getMediaService
protected MediaService getMediaService()
-
setMediaService
public void setMediaService(MediaService mediaService)
-
createMediaReader
public CSVReader createMediaReader(ImportCockpitInputMediaModel media) throws JaloBusinessException, java.io.UnsupportedEncodingException
Description copied from interface:ImportCockpitMediaServiceCreates a media reader for the source file.- Specified by:
createMediaReaderin interfaceImportCockpitMediaService- Parameters:
media- CSV source file uploaded to the cron job- Returns:
- reader for CSV files
- Throws:
JaloBusinessExceptionjava.io.UnsupportedEncodingException
-
createCSVReader
protected CSVReader createCSVReader(ImportCockpitInputMediaModel media) throws NoDataAvailableException, java.io.UnsupportedEncodingException, java.lang.IllegalArgumentException
- Throws:
NoDataAvailableExceptionjava.io.UnsupportedEncodingExceptionjava.lang.IllegalArgumentException
-
validateInputFile
public boolean validateInputFile(ImportCockpitInputMediaModel inputMedia)
Description copied from interface:ImportCockpitMediaServiceValidates theImportCockpitInputMediaModel(CSV format) that is to be assigned to anImportCockpitCronJobModel.- Specified by:
validateInputFilein interfaceImportCockpitMediaService- Parameters:
inputMedia- -ImportCockpitInputMediaModel- Returns:
- true if the
ImportCockpitInputMediaModelis valid false otherwise.
-
getSourceColumnNames
public java.util.List<java.lang.String> getSourceColumnNames(ImportCockpitInputMediaModel media)
Description copied from interface:ImportCockpitMediaServiceRetrieves the source column names/labels of the uploaded source file.- Specified by:
getSourceColumnNamesin interfaceImportCockpitMediaService- Parameters:
media- of typeImportCockpitInputMediaModel.- Returns:
- list of column names/labels (String).
-
getSourceColumnData
public java.util.List<SourceColumnModel> getSourceColumnData(ImportCockpitCronJobModel icCronJobModel)
Description copied from interface:ImportCockpitMediaServiceGiven the suppliedImportCockpitCronJobModel, this method will return all the the data for each field(column) as a List ofSourceColumnModel.- Specified by:
getSourceColumnDatain interfaceImportCockpitMediaService- Parameters:
icCronJobModel- the cron job of typeImportCockpitCronJobModelto retrieve the the source column data from.- Returns:
- srcColumnModelList - List of
SourceColumnModels that represents the data stored in the source used for mapping.
-
createMediaFromFile
public ImpExMediaModel createMediaFromFile(java.lang.String filePackageName) throws java.io.FileNotFoundException
Description copied from interface:ImportCockpitMediaServiceGive the supplied filename (full file path), this method will create and return anImpExMediaModel.- Specified by:
createMediaFromFilein interfaceImportCockpitMediaService- Parameters:
filePackageName- - A String representing the location of the file that will be used to create anImpExMediaModel.- Returns:
- impExMediaModel an
ImpExMediaModel - Throws:
java.io.FileNotFoundException- - Occurs when the file (as per filename) is not found.
-
createImpExImportCockpitMedia
protected ImpExImportCockpitMediaModel createImpExImportCockpitMedia(java.lang.String code)
- Parameters:
code-- Returns:
- icMediaModel
-
-