Package org.apache.ofbiz.pricat.sample
Class SamplePricatParser
java.lang.Object
org.apache.ofbiz.pricat.AbstractPricatParser
org.apache.ofbiz.pricat.sample.SamplePricatParser
- All Implemented Interfaces:
InterfacePricatParser
Sample pricat excel parser.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Fields inherited from interface org.apache.ofbiz.pricat.InterfacePricatParser
CONFIRM, DEFAULT_CAT_NAME, DEFAULT_COL_NAME, DEFAULT_DIM_NAME, DEFAULT_PRICAT_TYPE, EXCEL_TEMPLATE_TYPE, FACILITY_ID, FILE_DATETIME_PATTERN, HISTORY_MAX_FILENUMBER, MESSAGE_LABELS, MESSAGES, PARSE_EXCEL, PRICAT_FILE, PRICAT_TYPE_LABELS, RESOURCE, TEMP_FILES_FOLDER
-
Constructor Summary
ConstructorDescriptionSamplePricatParser
(LocalDispatcher dispatcher, Delegator delegator, Locale locale, InterfaceReport report, Map<String, String[]> facilities, File pricatFile, GenericValue userLogin) -
Method Summary
Modifier and TypeMethodDescriptionboolean
containsDataRows
(org.apache.poi.xssf.usermodel.XSSFSheet sheet) boolean
existsCurrencyId
(org.apache.poi.xssf.usermodel.XSSFSheet sheet) exists currency idgetCellContent
(List<Object> cellContents, String colName) getCellContents
(org.apache.poi.xssf.usermodel.XSSFRow row, List<Object[]> colNames, int size) Get data by version definition.protected int
getProductCategoryId
(List<Object> cellContents, String ownerPartyId) getProductId
(org.apache.poi.xssf.usermodel.XSSFRow row, String brandId, String modelName, String productName, String productCategoryId, String ownerPartyId, BigDecimal listPrice) get product idboolean
isFacilityOk
(org.apache.poi.xssf.usermodel.XSSFRow row, String facilityName, String facilityId) boolean
isTableHeaderMatched
(org.apache.poi.xssf.usermodel.XSSFSheet sheet) boolean
isVersionSupported
(org.apache.poi.xssf.usermodel.XSSFSheet sheet) boolean
parseCellContentsAndStore
(org.apache.poi.xssf.usermodel.XSSFRow row, List<Object> cellContents) Check data according to business logic.void
void
parsePricatExcel
(boolean writeFile) Parse pricat excel file in xlsx format.void
parseRowByRow
(org.apache.poi.xssf.usermodel.XSSFSheet sheet) parse row by rowupdateSku
(org.apache.poi.xssf.usermodel.XSSFRow row, String productId, String ownerPartyId, String facilityId, String barcode, BigDecimal inventory, String colorId, String color, String dimensionId, String dimension, BigDecimal listPrice, BigDecimal averageCost) update skuMethods inherited from class org.apache.ofbiz.pricat.AbstractPricatParser
cleanupLogAndCommentedExcel, endExcelImportHistory, getBrandId, getColorIds, getCurrencyId, getDelegator, getDimensionIds, getErrorMessages, getFacilities, getFileItems, getFormatter, getLocale, getPricatFile, getPricatFileVersion, getReport, getSequenceNum, hasErrorMessages, initBasicConds, isCommentedExcelExists, isEmptyRow, isNumOfSheetsOK, setCurrencyId, setDelegator, setErrorMessages, setFacilities, setFacilityId, setFileItems, setFormatter, setPricatFile, setReport, setSequenceNum, updateColorAndDimension, updateSkuPrice, writeCommentsToFile
-
Field Details
-
COL_NAMES_LIST
-
HEADER_ROW_NO
public static final int HEADER_ROW_NO- See Also:
-
-
Constructor Details
-
SamplePricatParser
public SamplePricatParser(LocalDispatcher dispatcher, Delegator delegator, Locale locale, InterfaceReport report, Map<String, String[]> facilities, File pricatFile, GenericValue userLogin)
-
-
Method Details
-
parsePricatExcel
public void parsePricatExcel(boolean writeFile) Parse pricat excel file in xlsx format. -
existsCurrencyId
public boolean existsCurrencyId(org.apache.poi.xssf.usermodel.XSSFSheet sheet) exists currency id -
parseRowByRow
public void parseRowByRow(org.apache.poi.xssf.usermodel.XSSFSheet sheet) parse row by row -
parseCellContentsAndStore
public boolean parseCellContentsAndStore(org.apache.poi.xssf.usermodel.XSSFRow row, List<Object> cellContents) throws GenericTransactionException Check data according to business logic. If data is ok, store it.- Parameters:
row
-cellContents
-- Returns:
- Throws:
GenericTransactionException
-
updateSku
public String updateSku(org.apache.poi.xssf.usermodel.XSSFRow row, String productId, String ownerPartyId, String facilityId, String barcode, BigDecimal inventory, String colorId, String color, String dimensionId, String dimension, BigDecimal listPrice, BigDecimal averageCost) update sku -
getProductId
public String getProductId(org.apache.poi.xssf.usermodel.XSSFRow row, String brandId, String modelName, String productName, String productCategoryId, String ownerPartyId, BigDecimal listPrice) get product id -
getCellContent
-
getProductCategoryId
-
isFacilityOk
-
isTableHeaderMatched
public boolean isTableHeaderMatched(org.apache.poi.xssf.usermodel.XSSFSheet sheet) -
isVersionSupported
public boolean isVersionSupported(org.apache.poi.xssf.usermodel.XSSFSheet sheet) -
containsDataRows
public boolean containsDataRows(org.apache.poi.xssf.usermodel.XSSFSheet sheet) -
parsePricatExcel
public void parsePricatExcel() -
getCellContents
public List<Object> getCellContents(org.apache.poi.xssf.usermodel.XSSFRow row, List<Object[]> colNames, int size) Get data by version definition.- Specified by:
getCellContents
in interfaceInterfacePricatParser
- Overrides:
getCellContents
in classAbstractPricatParser
- Parameters:
row
-colNames
-size
-- Returns:
-
getHeaderRowNo
protected int getHeaderRowNo()- Specified by:
getHeaderRowNo
in classAbstractPricatParser
-