@Component(value="blMediaParsingCellProcessor") public class MediaParsingCellProcessor extends BroadleafCellProcessorAdaptor
Parses a value of the form primary:/cmsstatic/val1.png|alt1:/cmsstatic/val2.png|alt2:/cmsstatic/val3.png|alt3:/cmsstatic/val4.png into unique media items.
In the above example, that would be parsed into individual medai tiems like:
[
{ "key": "primary", "url":"/cmsstatic/val1.png"},
{ "key": "alt1", "url":"/cmsstatic/val2.png"},
{ "key": "alt2", "url":"/cmsstatic/val3.png"},
{ "key": "alt3", "url":"/cmsstatic/val4.png"}
]
Modifier and Type | Field and Description |
---|---|
static String |
CATEGORY_MEDIA_FIELD_NAME |
protected DynamicEntityDaoProvider |
entityDaoProvider |
protected org.broadleafcommerce.openadmin.server.factory.PersistencePackageFactory |
persistencePackageFactory |
static String |
PRODUCT_MEDIA_FIELD_NAME |
Constructor and Description |
---|
MediaParsingCellProcessor() |
Modifier and Type | Method and Description |
---|---|
boolean |
canHandle(String header,
ImportType importType)
Determines if this processor can be used to handle the given header within the context of an import of the
given importingClass
|
protected List<org.broadleafcommerce.openadmin.server.domain.PersistencePackageRequest> |
createPersistenceRequests(List<MediaResult> media,
BroadleafCsvContext context) |
ColumnParseResult |
execute(String value,
BroadleafCsvContext context)
Parses out the String value that appears in the CSV file.
|
String |
getMediaField(String header,
ImportType importType) |
protected List<MediaResult> |
parseMediaString(String media)
1-element will be treated as just the value without a key.
|
execute, getOrder
public static final String PRODUCT_MEDIA_FIELD_NAME
public static final String CATEGORY_MEDIA_FIELD_NAME
protected DynamicEntityDaoProvider entityDaoProvider
protected org.broadleafcommerce.openadmin.server.factory.PersistencePackageFactory persistencePackageFactory
public boolean canHandle(String header, ImportType importType)
BroadleafCellProcessor
header
- the header that appears in the CSVimportType
- the type of importpublic ColumnParseResult execute(String value, BroadleafCsvContext context)
BroadleafCellProcessor
ColumnParseResult
. The ColumnParseResult.getVal()
could be
null.value
- the raw value that was parsed out of the CSV row, could be null if the value was ommittedcontext
- the context that the value appears in in relation to the rest of the lineColumnParseResult
indicating either the parsed value or sub-persistence packages that
should be executedprotected List<org.broadleafcommerce.openadmin.server.domain.PersistencePackageRequest> createPersistenceRequests(List<MediaResult> media, BroadleafCsvContext context)
public String getMediaField(String header, ImportType importType)
protected List<MediaResult> parseMediaString(String media)
media
- Copyright © 2020. All rights reserved.