Class CompleteProductImportSpecification
- All Implemented Interfaces:
GlobalImportSpecification
,ImportSpecification
UpdatePricesSpecification
) would.
This specification and its corresponding resource-tier handler do support 'updates', but mainly for simple use-cases. Consumers with more complex update use-cases should opt to create separate specifications/batch-handlers for those purposes.
- Author:
- Kelly Tisdell (ktisdell)
-
Field Summary
Fields inherited from class com.broadleafcommerce.dataimport.processor.specification.DefaultSpecification
dependencyMappings, fieldConfigMap
Fields inherited from interface com.broadleafcommerce.dataimport.processor.specification.ImportSpecification
ROW_DETERMINATION_COLUMN
-
Constructor Summary
ConstructorDescriptionCompleteProductImportSpecification
(String importType, List<ImportDataNormalizer> importDataNormalizers, List<String> requiredAuthorities, List<String> requiredScopes, String specName) CompleteProductImportSpecification
(List<ImportDataNormalizer> importDataNormalizers, List<String> requiredAuthorities, List<String> requiredScopes, String specName) -
Method Summary
Modifier and TypeMethodDescriptionboolean
Whether or not this specification can actually handle the given import.The list ofImportDataNormalizer
that will be executed to pre-process the data parsed out from the file.protected ImportFieldValidator
protected ImportFieldValidator
protected ImportFieldValidator
protected ImportFieldValidator
protected ImportFieldValidator
protected void
boolean
Whether or not the entity is catalog discriminated.boolean
Whether or not the entity is sandbox discriminated.protected void
populateDynamicHeaderMappingsByRowType
(Map<String, List<DynamicHeaderFieldMapping>> dynamicHeaderMappingConfigsByRowType) This method is always invoked in the constructor - seeDefaultSpecification.createUnmodifiableDynamicHeaderMappingsByRowType()
.protected void
populateHeaderFieldConfigsByRowType
(Map<String, Map<String, ImportFieldConfig>> headerFieldConfigsByRowType) This method is always invoked in the constructor - seeDefaultSpecification.createUnmodifiableHeaderFieldConfigsByRowType()
.boolean
shouldAllowUnmappedHeaders
(String rowType) This method describes whether imports processed with this specification should allow passthrough of headers with no explicit mapping.boolean
This method describes whether imports processed with this specification should have theBatchRecord.getOperation()
eagerly auto-generated by the import service for each record if not explicitly supplied in the input file.boolean
This method describes whether imports processed with this specification should haveBatchRecord.getResourceTierIdentifier()
eagerly auto-generated by the import service for each record if not explicitly supplied in the input file.Methods inherited from class com.broadleafcommerce.dataimport.processor.specification.DefaultSpecification
getDependencyMappings, getDynamicHeaderMappingConfigsByRowType, getFieldConfigMap, getHeaderFieldConfigsByRowType, getImportType, getName, getRequiredAuthorities, getRequiredHeaders, getRequiredHeaders, getRequiredScopes, isRequiresRowTypeHeader, mapDynamicFieldToHeader, mapDynamicHeaderToField
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.broadleafcommerce.dataimport.processor.specification.GlobalImportSpecification
getParentEntityIdHeader, hasParentEntity
Methods inherited from interface com.broadleafcommerce.dataimport.processor.specification.ImportSpecification
getDependencyMappings, getFieldConfigMap, getHeaderFieldConfigsByRowType, getImportType, getMainRecordType, getName, getRequiredAuthorities, getRequiredHeaders, getRequiredHeaders, getRequiredScopes, isRequiresRowTypeHeader, mapDynamicFieldToHeader, mapDynamicHeaderToField, parentEntityIdRequiredInRequest, resolveAndRemoveRecordType, resolveRecordTypeBeforePropertyMapping
-
Field Details
-
DEFAULT_COMPLETE_PRODUCT_IMPORT_SPECIFICATION_NAME
- See Also:
-
-
Constructor Details
-
CompleteProductImportSpecification
-
CompleteProductImportSpecification
-
-
Method Details
-
canHandle
Description copied from interface:ImportSpecification
Whether or not this specification can actually handle the given import. Checks will generally be based on the import type.- Specified by:
canHandle
in interfaceImportSpecification
- Overrides:
canHandle
in classDefaultSpecification
- Returns:
- whether or not this specification can actually handle the given import
-
isCatalogDiscriminated
public boolean isCatalogDiscriminated()Description copied from interface:ImportSpecification
Whether or not the entity is catalog discriminated.- Specified by:
isCatalogDiscriminated
in interfaceImportSpecification
- Returns:
- true if the entity is catalog discriminated or false otherwise
-
isSandboxDiscriminated
public boolean isSandboxDiscriminated()Description copied from interface:ImportSpecification
Whether or not the entity is sandbox discriminated.- Specified by:
isSandboxDiscriminated
in interfaceImportSpecification
- Returns:
- true if the entity is sandbox discriminated or false otherwise
-
shouldAutoGenerateOperationTypeForEachRecord
Description copied from interface:ImportSpecification
This method describes whether imports processed with this specification should have theBatchRecord.getOperation()
eagerly auto-generated by the import service for each record if not explicitly supplied in the input file.In situations where the resource tier import handler is expected to automatically recognize which records represent updates and which records represent creates, it makes sense for this method to just return
false
.If this method returns
true
, then the import service will eagerly guess and set the operation type for each record that does not explicitly provide one. SeeOperationResolver
.- Specified by:
shouldAutoGenerateOperationTypeForEachRecord
in interfaceImportSpecification
- Parameters:
rowType
- the row type for which this method should return a preference. Allows for different behavior for different row types within an import- Returns:
- whether operation type should be eagerly auto-generated by the import service if not explicitly requested for each record processed for this specification
-
shouldAutoGenerateResourceTierIdForEachRecord
Description copied from interface:ImportSpecification
This method describes whether imports processed with this specification should haveBatchRecord.getResourceTierIdentifier()
eagerly auto-generated by the import service for each record if not explicitly supplied in the input file.It's possible that an import type has heavy reliance on resource-tier identifiers for entities it imports and expects to deal with those values in the files it accepts. For example, an import may have records creating certain entities, and additional records that reference those entities by resource tier ID. Such a situation is a great candidate for use of correlation IDs, where the input file only provides and references correlation IDs which the import service will eagerly resolve into resource tier identifier values. However, in order to do this, the import service needs to be able to eagerly generate those resource tier IDs (assuming the input file is not expected to provide those directly). For such situations, this method should return
true
. SeeIdResolver
.Conversely, some import types may not expect files to provide resource-tier identifiers or correlation IDs to identify or reference records. They may use a different approach altogether and entirely delegate all ID-related behavior to the resource tier import handler instead. In those cases, eager generation of resource tier IDs by the import service would be undesirable. For such situations, this method should return
false
.- Specified by:
shouldAutoGenerateResourceTierIdForEachRecord
in interfaceImportSpecification
- Parameters:
rowType
- the row type for which this method should return a preference. Allows for different behavior for different row types within an import- Returns:
- whether resource tier IDs should be eagerly auto-generated by the import service if not explicitly requested for each record processed for this specification
-
shouldAllowUnmappedHeaders
Description copied from interface:ImportSpecification
This method describes whether imports processed with this specification should allow passthrough of headers with no explicit mapping.Essentially, when a record is being processed, if there is no explicit header-to-field mapping possible for a given input via
ImportSpecification.getHeaderFieldConfigsByRowType()
, or viaImportSpecification.mapDynamicHeaderToField(String, String)
, this method describes the behavior that should be used.Some import types may choose to allow such 'unmapped' fields to be passed through with just the raw unmapped header and its corresponding value. For those situations, this method should return
true
. Other import types may want to intentionally ignore any unmappable headers and exclude them to force strict adherence to the specification. For those, this method should returnfalse
.Note that 'meta' headers/fields such as
DefaultImportProcessor.OPERATION_COLUMN
have special meaning and thus may not be affected by this setting. SeeDefaultImportProcessor
to understand how such fields are processed.- Specified by:
shouldAllowUnmappedHeaders
in interfaceImportSpecification
- Parameters:
rowType
- the row type for which this method should return a preference. Allows for different behavior for different row types within an import- Returns:
true
if unmapped headers should be allowed, elsefalse
-
populateHeaderFieldConfigsByRowType
protected void populateHeaderFieldConfigsByRowType(Map<String, Map<String, ImportFieldConfig>> headerFieldConfigsByRowType) Description copied from class:DefaultSpecification
This method is always invoked in the constructor - seeDefaultSpecification.createUnmodifiableHeaderFieldConfigsByRowType()
.Extensions of this class should override this method and use it to populate the values that they want to ultimately be in
DefaultSpecification.getHeaderFieldConfigsByRowType()
.- Overrides:
populateHeaderFieldConfigsByRowType
in classDefaultSpecification
- Parameters:
headerFieldConfigsByRowType
- a special, mutable map instance which implementations should populate with field configurations. This map will ultimately be copied into an unmodifiable separate instance that will actually be used forDefaultSpecification.getHeaderFieldConfigsByRowType()
.
-
initializeDependencyMappings
protected void initializeDependencyMappings() -
getInventoryTypeValidator
-
getInventoryCheckStrategyValidator
-
getInventoryReservationStrategyValidator
-
getMergingTypeValidator
-
getMoneyValidator
-
populateDynamicHeaderMappingsByRowType
protected void populateDynamicHeaderMappingsByRowType(Map<String, List<DynamicHeaderFieldMapping>> dynamicHeaderMappingConfigsByRowType) Description copied from class:DefaultSpecification
This method is always invoked in the constructor - seeDefaultSpecification.createUnmodifiableDynamicHeaderMappingsByRowType()
.Extensions of this class should override this method and use it to populate the values that they want to ultimately be in
DefaultSpecification.getDynamicHeaderMappingConfigsByRowType()
.- Overrides:
populateDynamicHeaderMappingsByRowType
in classDefaultSpecification
- Parameters:
dynamicHeaderMappingConfigsByRowType
- a special, mutable map instance which implementations should populate with dynamic header mappings. This map will ultimately be copied into an unmodifiable separate instance that will actually be used forDefaultSpecification.getDynamicHeaderMappingConfigsByRowType()
.
-
getImportDataNormalizers
Description copied from interface:ImportSpecification
The list ofImportDataNormalizer
that will be executed to pre-process the data parsed out from the file.- Specified by:
getImportDataNormalizers
in interfaceImportSpecification
- Returns:
- the list of
ImportDataNormalizer
-