protected TableDefinition getFicstarTableDefinition(DataFile dataFile) throws IOException { RetailerSite retailerSite = dataFile.getRetailerSite(); File schemaFile = this.getFicstarSchemaFile(); DataImportConfig dataImportConfig = applicationContext.getBean("dataImportConfig", DataImportConfig.class); dataImportConfig.setConfigFilePath(schemaFile.getAbsolutePath()); dataImportConfig.afterPropertiesSet(); // now the config is ready. Schema schema = dataImportConfig.getSchema(); TableDefinition tableDefinition = schema.getDefinitionByDestination(dataFile.getImportType()); Assert.notNull( tableDefinition, "cannot find tableDefinition for :=" + dataFile.getImportType() + " in schema :=" + schemaFile.getAbsolutePath()); String csvFilePath = FilenameUtils.normalize( configurationService.getFileSystem().getFileSystemAsString() + "/" + dataFile.getFilePath()); tableDefinition.setProperty("path", csvFilePath); tableDefinition.setProperty("relativePath", dataFile.getFilePath()); tableDefinition.setProperty("isPathAbsolute", "true"); // some feeds like google dont have siteName == RetailerSiteName tableDefinition.setProperty("columns.siteName.defaultValue", retailerSite.getSiteName()); return tableDefinition; }
/** {@inheritDoc} */ @Override public Long getSequenceId(String tableName, ColumnDefinition definition) { return getSequenceId(dataImportConfig.getTableDefinition(tableName), definition); }