Import Sellers (SL) and Seller Extensions (SX)
Overview
Import seller (sales representative) data into Pricefx Sellers (object type SL) and Seller Extensions (object type SX). Sellers represent the sales team members who create quotes and manage customer relationships.
Seller Import (SL)
routes/import-sellers.xml
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="import-sellers">
<from uri="file:{{import.sellers.directory}}?{{archive.file}}&{{read.lock}}"/>
<log message="Starting seller import: ${header.CamelFileNameOnly}" loggingLevel="INFO"/>
<to uri="pfx-csv:streamingUnmarshal?skipHeaderRecord=true&useReusableParser=true"/>
<to uri="pfx-api:loaddataFile?objectType=SL&mapper=import-sellers.mapper&batchSize=200000"/>
<log message="Seller import completed: ${header.CamelFileNameOnly}" loggingLevel="INFO"/>
</route>
</routes>
mappers/import-sellers.mapper.xml
<mappers>
<loadMapper id="import-sellers.mapper">
<body in="sellerId" out="sellerId"/>
<body in="sellerName" out="label"/>
<body in="email" out="attribute1"/>
<body in="region" out="attribute2"/>
<body in="territory" out="attribute3"/>
<body in="managerId" out="attribute4"/>
<body in="department" out="attribute5"/>
</loadMapper>
</mappers>
Test CSV: test-data/sellers.csv
sellerId,sellerName,email,region,territory,managerId,department
SELLER-001,John Smith,john.smith@example.com,EMEA,Western Europe,MGR-001,Enterprise Sales
SELLER-002,Jane Doe,jane.doe@example.com,NA,East Coast,MGR-002,SMB Sales
SELLER-003,Bob Wilson,bob.wilson@example.com,APAC,Australia,MGR-001,Enterprise Sales
Seller Extension Import (SX)
routes/import-seller-extensions.xml
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="import-seller-extensions">
<from uri="file:{{import.sx.directory}}?{{archive.file}}&{{read.lock}}"/>
<log message="Starting seller extension import: ${header.CamelFileNameOnly}" loggingLevel="INFO"/>
<to uri="pfx-csv:streamingUnmarshal?skipHeaderRecord=true&useReusableParser=true"/>
<to uri="pfx-api:loaddataFile?objectType=SX&mapper=import-seller-extensions.mapper&batchSize=200000"/>
<log message="Seller extension import completed: ${header.CamelFileNameOnly}" loggingLevel="INFO"/>
</route>
</routes>
mappers/import-seller-extensions.mapper.xml
<mappers>
<loadMapper id="import-seller-extensions.mapper">
<constant expression="Targets" out="name"/>
<body in="sellerId" out="sellerId"/>
<body in="quarter" out="attribute1"/>
<body in="salesTarget" out="attribute2" converterExpression="stringToDecimal"/>
<body in="commissionRate" out="attribute3" converterExpression="stringToDecimal"/>
<body in="territory" out="attribute4"/>
</loadMapper>
</mappers>
Key Differences from Products/Customers
|
Aspect |
SL (Seller) |
SX (Seller Extension) |
|---|---|---|
|
Key field |
|
|
|
Table name in mapper |
Not needed |
|
|
Object type |
|
|
|
Attributes |
|
|
config/application.properties
# Seller import directories
import.sellers.directory=/data/imports/sellers
import.sx.directory=/data/imports/seller-extensions
How It Works
-
File Pickup:
file:monitors the configured directory.{{archive.file}}archives processed files.{{read.lock}}ensures files are fully written. -
Streaming Parse:
pfx-csv:streamingUnmarshalparses CSV without loading the full file. -
Upload:
pfx-api:loaddataFilestreams data to Pricefx.objectType=SLfor sellers,objectType=SXfor seller extensions. -
SX Table Name: Like PX/CX, seller extensions require
<constant expression="TableName" out="name"/>in the mapper.
Common Pitfalls
-
sellerIdis the key field: NotskuorcustomerId. Sellers have their own unique identifier. -
SX requires table name constant: Same as PX/CX -- the mapper MUST include
<constant expression="TableName" out="name"/>. -
Seller must exist for SX: Seller extension records reference an existing seller by
sellerId. Import sellers (SL) before their extensions (SX). -
No
businessKeysfor SL: Unlike Products, Seller imports do not typically usebusinessKeys. ThesellerIdfield is the natural key handled by Pricefx internally.