package com.bayer.edam; import java.io.File; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.ConsoleAppender; import org.apache.log4j.Layout; import org.apache.log4j.Level; import org.apache.log4j.Logger; import org.apache.log4j.PatternLayout; import com.univocity.parsers.csv.CsvParser; import com.univocity.parsers.csv.CsvParserSettings; import com.univocity.parsers.csv.CsvWriter; import com.univocity.parsers.csv.CsvWriterSettings; /** * Generates an import file from a toolbox CSV export. * *
 * SELECT
 * a.AssetId, a.OriginalFileName, a.UserFileName, a.BCSNumber, a.Description, a.AssetStatusID, a.PublishDate,
 * a.CreatedOn, a.CreatedByUserID, a.UpdatedOn, a.UpdatedByUserID, a.CopyClaimFileName
 * ,c.AssetCategoryName
 * ,ai.AssetItemName
 * ,f.FocusItemID
 * ,fi.FocusItemName
 * ,img.OriginalSize
 * ,a.publishDate
 * ,a.archiveDate
 * ,y.AssetCampaignYearName
 * ,p.ProjectName
 * ,a.isConfidential
 * ,u.FirstName
 * ,u.LastName
 * ,u.CompanyName
 * ,ff.FulfillmentCompanyName
 * ,ast.AssetStatusName      -- unused?
 * ,aty.AssetTypeName        -- unused?
 * 
 * FROM Assets a
 * LEFT JOIN AssetCategories c ON a.AssetCategoryID = c.AssetCategoryID
 * LEFT JOIN AssetItems ai ON a.AssetItemID = ai.AssetItemID
 * LEFT JOIN AssetFocusItemMap f ON a.AssetId = f.AssetID
 * LEFT JOIN FocusItems fi ON f.FocusItemID = fi.FocusItemID
 * LEFT JOIN AssetImages img ON a.AssetID = img.AssetID
 * LEFT JOIN AssetCampaignYears y ON a.AssetCampaignYearID = y.AssetCampaignYearID
 * LEFT JOIN Projects p ON a.ProjectID = p.ProjectID
 * LEFT JOIN Users u ON a.CreatedByUserID = u.UserID
 * LEFT JOIN FulfillmentCompanies ff ON a.FulfillmentCompanyID = ff.FulfillmentCompanyID
 * LEFT JOIN AssetStatuses ast ON a.AssetStatusID = ast.AssetStatusID
 * LEFT JOIN AssetTypes aty ON a.AssetTypeID = aty.AssetTypeID
 * 
 * WHERE 
 * a.AssetStatusID != 101
 * AND a.CreatedOn > Convert(datetime, '2012-07-01')
 * AND a.isDeleted = 0
 * AND (a.FocusID IS NULL OR a.FocusID != 3 OR (a.FocusID = 3 AND a.CreatedOn > Convert(datetime, '2016-01-01')))
 * --AND a.AssetID IN (23467,23392,22868,22488,22481,22440,22082,22021,21147,20731,
 * --19557,19048,18447,18446,18445,18444,16853,16171,15882,15313,14918,14400,
 * --13660,13641,13348,13323,13142,13135,12844,12814,12007)
 * 
* * @author GEXCE */ public class ToolboxImportFileGenerator { private static Logger log = Logger.getLogger(ToolboxImportFileGenerator.class); private static String toolboxExportFilePath = "C:\\Temp\\Migration CS - SQL Server\\auszug.csv"; private static String importFilePath = "C:\\Temp\\Migration CS - SQL Server\\importFile.csv"; private static final Map brandMap; private static final Map unitMap; private static final Map categoryMap; private static final Map indicationMap; static { brandMap = new HashMap(); brandMap.put("Bayer/General", "Bayer/General"); brandMap.put("National Tradeshow", "Bayer/General"); brandMap.put("Absolute", "Absolute"); brandMap.put("Absolute Maxx", "Absolute Maxx"); brandMap.put("Accrue", "TEMPORARY"); brandMap.put("Adament", "TEMPORARY"); brandMap.put("Admire Flex 4", "Admire Pro"); brandMap.put("Admire Pro", "Admire Pro"); brandMap.put("Aeris", "Aeris"); brandMap.put("AFD Cotton Seed", "TEMPORARY"); brandMap.put("AG Streptomycin", "TEMPORARY"); brandMap.put("Aliette", "Aliette"); brandMap.put("Alion", "Alion"); brandMap.put("Alion HL", "Alion"); brandMap.put("Allegiance", "Allegiance"); brandMap.put("Argent", "Argent"); brandMap.put("Arize", "TEMPORARY"); brandMap.put("Assail", "TEMPORARY"); brandMap.put("Asulox", "TEMPORARY"); brandMap.put("Atlantis", "TEMPORARY"); brandMap.put("Autumn", "Autumn"); brandMap.put("Autumn Super", "Autumn Super"); brandMap.put("Axiom", "Axiom"); brandMap.put("Aztec", "TEMPORARY"); brandMap.put("Aztec 2.1", "TEMPORARY"); brandMap.put("Aztec 4.67", "TEMPORARY"); brandMap.put("Aztec 4.68", "TEMPORARY"); brandMap.put("Balance Bean", "Balance Bean"); brandMap.put("Balance Flexx", "Balance Flexx"); brandMap.put("Balance GT", "Balance GT"); brandMap.put("Balance Pro", "Balance Pro"); brandMap.put("Ballad Plus", "TEMPORARY"); brandMap.put("Bayer, General", "Bayer/General"); brandMap.put("Bayleton", "TEMPORARY"); brandMap.put("Baytan", "TEMPORARY"); brandMap.put("Baythroid", "Baythroid XL"); brandMap.put("Baythroid XL", "Baythroid XL"); brandMap.put("Belt", "Belt"); brandMap.put("Betamix", "TEMPORARY"); brandMap.put("Betanet", "TEMPORARY"); brandMap.put("Betanex", "TEMPORARY"); brandMap.put("Bollgard", "TEMPORARY"); brandMap.put("Bollgard II", "TEMPORARY"); brandMap.put("Bronate Advanced", "TEMPORARY"); brandMap.put("Buctril", "TEMPORARY"); brandMap.put("Calypso", "Calypso"); brandMap.put("Capreno", "Capreno"); brandMap.put("Celgard", "TEMPORARY"); brandMap.put("Celpass", "TEMPORARY"); brandMap.put("Celpril", "TEMPORARY"); brandMap.put("Certified FiberMax", "FiberMax"); brandMap.put("Cheyenne", "TEMPORARY"); brandMap.put("Contain", "TEMPORARY"); brandMap.put("COPeO Prime", "COPeO Prime"); brandMap.put("Corvus", "Corvus"); brandMap.put("Corvus Complete", "Corvus Complete"); brandMap.put("Cotguard", "TEMPORARY"); brandMap.put("Credenz", "Credenz"); brandMap.put("Cruiser", "TEMPORARY"); brandMap.put("CSI Safener", "TEMPORARY"); brandMap.put("CSI Safener 500FS", "TEMPORARY"); brandMap.put("Decis", "TEMPORARY"); brandMap.put("Delaro", "Delaro"); brandMap.put("Di-Syston", "TEMPORARY"); brandMap.put("DiFlexx", "DiFlexx"); brandMap.put("DiFlexx Duo", "DiFlexx Duo"); brandMap.put("Distinguish", "TEMPORARY"); brandMap.put("Dropp", "TEMPORARY"); brandMap.put("Dropp SC", "TEMPORARY"); brandMap.put("Elite", "TEMPORARY"); brandMap.put("Emesto", "Emesto Silver"); brandMap.put("Emesto Silver", "Emesto Silver"); brandMap.put("Envidor", "Envidor"); brandMap.put("Ethrel", "TEMPORARY"); brandMap.put("EverGol", "EverGol"); brandMap.put("Evolve", "TEMPORARY"); brandMap.put("FiberMax", "FiberMax"); brandMap.put("FiberMax One Ton Club", "FiberMax"); brandMap.put("Finish", "Finish Pro"); brandMap.put("Finish 6 Pro", "Finish Pro"); brandMap.put("Flint", "Flint"); brandMap.put("Fluency Agent", "Fluency Agent"); brandMap.put("Fluency Agent Advanced", "Fluency Agent Advanced"); brandMap.put("Folicur", "TEMPORARY"); brandMap.put("Gaucho", "Gaucho"); brandMap.put("Gaucho Grande", "Gaucho"); brandMap.put("Gaucho MZ", "Gaucho"); brandMap.put("Gaucho XT", "Gaucho"); brandMap.put("Gem", "Gem"); brandMap.put("Ginstar", "Ginstar EC"); brandMap.put("Ginstar EC", "Ginstar EC"); brandMap.put("Glyphomax", "TEMPORARY"); brandMap.put("GlyTol", "GlyTol"); brandMap.put("Grower Dividends", "Grower Dividends"); brandMap.put("Growing Strong", "Bayer/General"); brandMap.put("Gustafson", "TEMPORARY"); brandMap.put("Guthion", "TEMPORARY"); brandMap.put("HBK", "HBK"); brandMap.put("Heads Up", "TEMPORARY"); brandMap.put("Herculex", "TEMPORARY"); brandMap.put("Herculex I", "TEMPORARY"); brandMap.put("Hoegemeyer", "TEMPORARY"); brandMap.put("Hoelon", "TEMPORARY"); brandMap.put("Huskie", "Huskie"); brandMap.put("Huskie Complete", "Huskie Complete"); brandMap.put("ICP - Horticulture", "Bayer/General"); brandMap.put("ICP - Innovation Plus", "Bayer/General"); brandMap.put("ICP - Cereals", "Bayer/General"); brandMap.put("ICP - Corn", "Bayer/General"); brandMap.put("ICP - Multiple", "Bayer/General"); brandMap.put("ICP - Southern Row Crops", "Bayer/General"); brandMap.put("ICP - Soybeans", "Bayer/General"); brandMap.put("Idol", "Idol"); brandMap.put("Ignite", "TEMPORARY"); brandMap.put("Ilevo", "Ilevo"); brandMap.put("Innovation Plus", "Innovation Plus"); brandMap.put("InSeed", "InSeed"); brandMap.put("Intruder", "TEMPORARY"); brandMap.put("InVigor", "InVigor"); brandMap.put("Ipresso", "Ipresso"); brandMap.put("Kodiak", "TEMPORARY"); brandMap.put("Krovar", "TEMPORARY"); brandMap.put("Larvin", "Larvin"); brandMap.put("Laudis", "Laudis"); brandMap.put("Laudis Flexx", "Laudis"); brandMap.put("Leverage", "Leverage 360"); brandMap.put("Leverage 2.7", "Leverage 360"); brandMap.put("Leverage 360", "Leverage 360"); brandMap.put("Liberty", "Liberty"); brandMap.put("LibertyLink", "LibertyLink"); brandMap.put("Luna", "Luna"); brandMap.put("Mocap", "TEMPORARY"); brandMap.put("Monitor", "TEMPORARY"); brandMap.put("Movento", "Movento"); brandMap.put("Movento HL", "Movento HL"); brandMap.put("Nemacur", "TEMPORARY"); brandMap.put("Nortron", "Nortron SC"); brandMap.put("Nutrikote", "TEMPORARY"); brandMap.put("Oberon", "Oberon"); brandMap.put("Olympus", "Olympus"); brandMap.put("Olympus Flex", "Olympus"); brandMap.put("On Demand", "On Demand"); brandMap.put("Option", "TEMPORARY"); brandMap.put("Osprey", "Osprey"); brandMap.put("Phaser", "TEMPORARY"); brandMap.put("Poncho", "Poncho"); brandMap.put("Poncho 1250", "Poncho 1250"); brandMap.put("Poncho 250", "Poncho 1250"); brandMap.put("Poncho 250/1250", "Poncho 1250"); brandMap.put("Poncho 251", "Poncho 1250"); brandMap.put("Poncho 500", "Poncho 1250"); brandMap.put("Poncho Beta", "Poncho Beta"); brandMap.put("Poncho/VOTiVO", "Poncho/VOTiVO"); brandMap.put("Poncho/VOTiVO 2.0", "Poncho/VOTiVO 2.0"); brandMap.put("Prep", "TEMPORARY"); brandMap.put("Prep 6", "TEMPORARY"); brandMap.put("Previcur", "Previcur Flex"); brandMap.put("Previcur Flex", "Previcur Flex"); brandMap.put("Proceed", "TEMPORARY"); brandMap.put("Proceed Concentrate", "TEMPORARY"); brandMap.put("Proceed MD", "TEMPORARY"); brandMap.put("Producer Information Exchange (P.I.E.)", "Producer Information Exchange (P.I.E.)"); brandMap.put("Proline", "Proline"); brandMap.put("Proline 3+3", "Proline"); brandMap.put("ProPulse", "ProPulse"); brandMap.put("Prosaro", "Prosaro"); brandMap.put("Prosper", "Prosper"); brandMap.put("Prosper FX", "Prosper"); brandMap.put("Protech Plus", "TEMPORARY"); brandMap.put("ProTechPlus", "TEMPORARY"); brandMap.put("Prot�g�", "TEMPORARY"); brandMap.put("Prot�g� FL", "TEMPORARY"); brandMap.put("Provado", "TEMPORARY"); brandMap.put("Provost", "Provost"); brandMap.put("Provost Opti", "Provost Opti"); brandMap.put("Puma", "TEMPORARY"); brandMap.put("Radius", "TEMPORARY"); brandMap.put("Raxil", "Raxil"); brandMap.put("Raxil Extra", "Raxil"); brandMap.put("Raxil MD", "Raxil"); brandMap.put("Raxil MD Extra", "Raxil"); brandMap.put("Raxil MD Extra W", "Raxil"); brandMap.put("Raxil MD W", "Raxil"); brandMap.put("Raxil Pro MD", "Raxil Pro MD"); brandMap.put("Raxil Pro Shield", "Raxil Pro Shield"); brandMap.put("Raxil Sure", "Raxil"); brandMap.put("Raxil XT", "Raxil"); brandMap.put("Reason", "Reason"); brandMap.put("Redigo", "Redigo"); brandMap.put("Rely", "Rely 280"); brandMap.put("Rely 200", "Rely 280"); brandMap.put("Rely 280", "Rely 280"); brandMap.put("Renounce", "TEMPORARY"); brandMap.put("Requiem", "Requiem"); brandMap.put("Respect the Rotation", "Respect the Rotation"); brandMap.put("Rhizokote", "TEMPORARY"); brandMap.put("Ricestar", "Ricestar"); brandMap.put("Ricestar HT", "Ricestar"); brandMap.put("Rimfire", "Rimfire Max"); brandMap.put("Rimfire Max", "Rimfire Max"); brandMap.put("Rovral", "TEMPORARY"); brandMap.put("Scala", "Scala"); brandMap.put("Scoparia", "Scoparia"); brandMap.put("SeedGrowth", "Bayer/General"); brandMap.put("Sencor", "TEMPORARY"); brandMap.put("Sensat", "TEMPORARY"); brandMap.put("Sepresto", "Sepresto"); brandMap.put("Serenade", "Serenade"); brandMap.put("Serenade ASO", "Serenade ASO"); brandMap.put("Serenade Opti", "Serenade Optimum"); brandMap.put("Serenade Optimum", "Serenade Optimum"); brandMap.put("Serenade Soil", "Serenade Soil"); brandMap.put("Sevin", "TEMPORARY"); brandMap.put("Silverado", "TEMPORARY"); brandMap.put("Sivanto", "Sivanto"); brandMap.put("Sivanto Prime", "Sivanto Prime"); brandMap.put("Soberan", "TEMPORARY"); brandMap.put("Sonata", "Sonata"); brandMap.put("Spin-Aid", "TEMPORARY"); brandMap.put("Stance", "Stance"); brandMap.put("Stoneville", "Stoneville"); brandMap.put("Storcide II", "TEMPORARY"); brandMap.put("Storicide II", "TEMPORARY"); brandMap.put("Stratego", "Stratego"); brandMap.put("Stratego YLD", "Stratego YLD"); brandMap.put("Synapse", "TEMPORARY"); brandMap.put("Temik", "TEMPORARY"); brandMap.put("Temix", "TEMPORARY"); brandMap.put("Tempo SC Ultra", "TEMPORARY"); brandMap.put("Thiram", "Thiram"); brandMap.put("Tops MZ", "TEMPORARY"); brandMap.put("Tops MZ Gaucho", "TEMPORARY"); brandMap.put("TriKote", "TEMPORARY"); brandMap.put("Trilex", "Trilex"); brandMap.put("Trilex 2000", "Trilex 2000"); brandMap.put("Trilex 5000", "Trilex"); brandMap.put("Trilex 6000", "Trilex"); brandMap.put("Trilex Advanced", "Trilex ADV"); brandMap.put("Trilex AL", "Trilex"); brandMap.put("Trilex ADV", "Trilex ADV"); brandMap.put("Trilex Optimum", "Trilex"); brandMap.put("Trilex Rice Pack", "Trilex"); brandMap.put("TrilexStar", "Trilex"); brandMap.put("Trimax", "TEMPORARY"); brandMap.put("Trimax Pro", "TEMPORARY"); brandMap.put("TwinLink", "TwinLink"); brandMap.put("TwinLink Plus", "TwinLink Plus"); brandMap.put("Ultor", "Ultor"); brandMap.put("Varro", "Varro"); brandMap.put("Velum One", "Velum One"); brandMap.put("Velum Prime", "Velum Prime"); brandMap.put("Velum Total", "Velum Total"); brandMap.put("Vitis", "TEMPORARY"); brandMap.put("Vortex", "Vortex"); brandMap.put("Votivo", "Votivo"); brandMap.put("Whip 360", "TEMPORARY"); brandMap.put("Wolverine", "Wolverine Advanced"); brandMap.put("Wolverine Advanced", "Wolverine Advanced"); brandMap.put("Wolverine PowerPak", "Wolverine Advanced"); brandMap.put("Yield Shield", "TEMPORARY"); // TODO to be checked by business brandMap.put("NULL", "TEMPORARY"); // Bayer/General? brandMap.put("131-Kote", "TEMPORARY"); brandMap.put("Cotgard", "TEMPORARY"); brandMap.put("Fluency Agent/Fluency Agent Advanced", "TEMPORARY"); // --> set both brands via special rule brandMap.put("ICP - Food Chain", "Bayer/General"); brandMap.put("ICP - Fruit", "Bayer/General"); brandMap.put("ICP-Programs", "Bayer/General"); brandMap.put("ICP - Veg/Potato", "Bayer/General"); brandMap.put("Poncho/VOTiVO 2", "TEMPORARY"); // set both 'Poncho' and 'Votivo' via special rule brandMap.put("Poncho 1250/VOTiVO 2", "TEMPORARY"); // set 'Poncho 250/1250' and 'Votivo' via special rule (there is no Votivo 2) brandMap.put("Velum", "Velum One"); brandMap.put("Velum Prime 3", "Velum Prime"); unitMap = new HashMap(); unitMap.put("Bayer/General", "Crop Protection"); unitMap.put("National Tradeshow", "Crop Protection"); unitMap.put("Absolute", "Crop Protection"); unitMap.put("Absolute Maxx", "Crop Protection"); unitMap.put("Accrue", "Crop Protection"); unitMap.put("Adament", "Crop Protection"); unitMap.put("Admire Flex 4", "Crop Protection"); unitMap.put("Admire Pro", "Crop Protection"); unitMap.put("Aeris", "Crop Protection"); unitMap.put("AFD Cotton Seed", "Seeds"); unitMap.put("AG Streptomycin", "Crop Protection"); unitMap.put("Aliette", "Crop Protection"); unitMap.put("Alion", "Crop Protection"); unitMap.put("Alion HL", "Crop Protection"); unitMap.put("Allegiance", "Crop Protection"); unitMap.put("Argent", "Crop Protection"); unitMap.put("Arize", "Seeds"); unitMap.put("Assail", "Crop Protection"); unitMap.put("Asulox", "Crop Protection"); unitMap.put("Atlantis", "Crop Protection"); unitMap.put("Autumn", "Crop Protection"); unitMap.put("Autumn Super", "Crop Protection"); unitMap.put("Axiom", "Crop Protection"); unitMap.put("Aztec", "Crop Protection"); unitMap.put("Aztec 2.1", "Crop Protection"); unitMap.put("Aztec 4.67", "Crop Protection"); unitMap.put("Aztec 4.68", "Crop Protection"); unitMap.put("Balance Bean", "Crop Protection"); unitMap.put("Balance Flexx", "Crop Protection"); unitMap.put("Balance GT", "Crop Protection"); unitMap.put("Balance Pro", "Crop Protection"); unitMap.put("Ballad Plus", "Crop Protection"); unitMap.put("Bayer, General", "Crop Protection"); unitMap.put("Bayleton", "Crop Protection"); unitMap.put("Baytan", "Crop Protection"); unitMap.put("Baythroid", "Crop Protection"); unitMap.put("Baythroid XL", "Crop Protection"); unitMap.put("Belt", "Crop Protection"); unitMap.put("Betamix", "Crop Protection"); unitMap.put("Betanet", "Crop Protection"); unitMap.put("Betanex", "Crop Protection"); unitMap.put("Bollgard", "Seeds"); unitMap.put("Bollgard II", "Seeds"); unitMap.put("Bronate Advanced", "Crop Protection"); unitMap.put("Buctril", "Crop Protection"); unitMap.put("Calypso", "Crop Protection"); unitMap.put("Capreno", "Crop Protection"); unitMap.put("Celgard", "Crop Protection"); unitMap.put("Celpass", "Crop Protection"); unitMap.put("Celpril", "Crop Protection"); unitMap.put("Certified FiberMax", "Seeds"); unitMap.put("Cheyenne", "Crop Protection"); unitMap.put("Contain", "Crop Protection"); unitMap.put("COPeO Prime", "Crop Protection"); unitMap.put("Corvus", "Crop Protection"); unitMap.put("Corvus Complete", "Crop Protection"); unitMap.put("Cotguard", "Crop Protection"); unitMap.put("Credenz", "Seeds"); unitMap.put("Cruiser", "Crop Protection"); unitMap.put("CSI Safener", "Crop Protection"); unitMap.put("CSI Safener 500FS", "Crop Protection"); unitMap.put("Decis", "Crop Protection"); unitMap.put("Delaro", "Crop Protection"); unitMap.put("Di-Syston", "Crop Protection"); unitMap.put("DiFlexx", "Crop Protection"); unitMap.put("DiFlexx Duo", "Crop Protection"); unitMap.put("Distinguish", "Crop Protection"); unitMap.put("Dropp", "Crop Protection"); unitMap.put("Dropp SC", "Crop Protection"); unitMap.put("Elite", "Crop Protection"); unitMap.put("Emesto", "Crop Protection"); unitMap.put("Emesto Silver", "Crop Protection"); unitMap.put("Envidor", "Crop Protection"); unitMap.put("Ethrel", "Crop Protection"); unitMap.put("EverGol", "Crop Protection"); unitMap.put("Evolve", "Crop Protection"); unitMap.put("FiberMax", "Seeds"); unitMap.put("FiberMax One Ton Club", "Seeds"); unitMap.put("Finish", "Crop Protection"); unitMap.put("Finish 6 Pro", "Crop Protection"); unitMap.put("Flint", "Crop Protection"); unitMap.put("Fluency Agent", "Crop Protection"); unitMap.put("Fluency Agent Advanced", "Crop Protection"); unitMap.put("Folicur", "Crop Protection"); unitMap.put("Gaucho", "Crop Protection"); unitMap.put("Gaucho Grande", "Crop Protection"); unitMap.put("Gaucho MZ", "Crop Protection"); unitMap.put("Gaucho XT", "Crop Protection"); unitMap.put("Gem", "Crop Protection"); unitMap.put("Ginstar", "Crop Protection"); unitMap.put("Ginstar EC", "Crop Protection"); unitMap.put("Glyphomax", "Crop Protection"); unitMap.put("GlyTol", "Seeds"); unitMap.put("Grower Dividends", "Crop Protection"); unitMap.put("Growing Strong", "Crop Protection"); unitMap.put("Gustafson", "Crop Protection"); unitMap.put("Guthion", "Crop Protection"); unitMap.put("HBK", "Seeds"); unitMap.put("Heads Up", "Crop Protection"); unitMap.put("Herculex", "Seeds"); unitMap.put("Herculex I", "Seeds"); unitMap.put("Hoegemeyer", "Seeds"); unitMap.put("Hoelon", "Crop Protection"); unitMap.put("Huskie", "Crop Protection"); unitMap.put("Huskie Complete", "Crop Protection"); unitMap.put("ICP - Horticulture", "Crop Protection"); unitMap.put("ICP - Innovation Plus", "Crop Protection"); unitMap.put("ICP - Cereals", "Crop Protection"); unitMap.put("ICP - Corn", "Crop Protection"); unitMap.put("ICP - Multiple", "Crop Protection"); unitMap.put("ICP - Southern Row Crops", "Crop Protection"); unitMap.put("ICP - Soybeans", "Crop Protection"); unitMap.put("Idol", "Crop Protection"); unitMap.put("Ignite", "Crop Protection"); unitMap.put("Ilevo", "Crop Protection"); unitMap.put("Innovation Plus", "Crop Protection"); unitMap.put("InSeed", "Seeds"); unitMap.put("Intruder", "Crop Protection"); unitMap.put("InVigor", "Seeds"); unitMap.put("Ipresso", "Crop Protection"); unitMap.put("Kodiak", "Crop Protection"); unitMap.put("Krovar", "Crop Protection"); unitMap.put("Larvin", "Crop Protection"); unitMap.put("Laudis", "Crop Protection"); unitMap.put("Laudis Flexx", "Crop Protection"); unitMap.put("Leverage", "Crop Protection"); unitMap.put("Leverage 2.7", "Crop Protection"); unitMap.put("Leverage 360", "Crop Protection"); unitMap.put("Liberty", "Crop Protection"); unitMap.put("LibertyLink", "Seeds"); unitMap.put("Luna", "Crop Protection"); unitMap.put("Mocap", "Crop Protection"); unitMap.put("Monitor", "Crop Protection"); unitMap.put("Movento", "Crop Protection"); unitMap.put("Movento HL", "Crop Protection"); unitMap.put("Nemacur", "Crop Protection"); unitMap.put("Nortron", "Crop Protection"); unitMap.put("Nutrikote", "Crop Protection"); unitMap.put("Oberon", "Crop Protection"); unitMap.put("Olympus", "Crop Protection"); unitMap.put("Olympus Flex", "Crop Protection"); unitMap.put("On Demand", "Crop Protection"); unitMap.put("Option", "Crop Protection"); unitMap.put("Osprey", "Crop Protection"); unitMap.put("Phaser", "Crop Protection"); unitMap.put("Poncho", "Crop Protection"); unitMap.put("Poncho 1250", "Crop Protection"); unitMap.put("Poncho 250", "Crop Protection"); unitMap.put("Poncho 250/1250", "Crop Protection"); unitMap.put("Poncho 251", "Crop Protection"); unitMap.put("Poncho 500", "Crop Protection"); unitMap.put("Poncho Beta", "Crop Protection"); unitMap.put("Poncho/VOTiVO", "Crop Protection"); unitMap.put("Poncho/VOTiVO 2.0", "Crop Protection"); unitMap.put("Prep", "Crop Protection"); unitMap.put("Prep 6", "Crop Protection"); unitMap.put("Previcur", "Crop Protection"); unitMap.put("Previcur Flex", "Crop Protection"); unitMap.put("Proceed", "Crop Protection"); unitMap.put("Proceed Concentrate", "Crop Protection"); unitMap.put("Proceed MD", "Crop Protection"); unitMap.put("Producer Information Exchange (P.I.E.)", "Crop Protection"); unitMap.put("Proline", "Crop Protection"); unitMap.put("Proline 3+3", "Crop Protection"); unitMap.put("ProPulse", "Crop Protection"); unitMap.put("Prosaro", "Crop Protection"); unitMap.put("Prosper", "Crop Protection"); unitMap.put("Prosper FX", "Crop Protection"); unitMap.put("Protech Plus", "Crop Protection"); unitMap.put("ProTechPlus", "Crop Protection"); unitMap.put("Prot�g�", "Crop Protection"); unitMap.put("Prot�g� FL", "Crop Protection"); unitMap.put("Provado", "Crop Protection"); unitMap.put("Provost", "Crop Protection"); unitMap.put("Provost Opti", "Crop Protection"); unitMap.put("Puma", "Crop Protection"); unitMap.put("Radius", "Crop Protection"); unitMap.put("Raxil", "Crop Protection"); unitMap.put("Raxil Extra", "Crop Protection"); unitMap.put("Raxil MD", "Crop Protection"); unitMap.put("Raxil MD Extra", "Crop Protection"); unitMap.put("Raxil MD Extra W", "Crop Protection"); unitMap.put("Raxil MD W", "Crop Protection"); unitMap.put("Raxil Pro MD", "Crop Protection"); unitMap.put("Raxil Pro Shield", "Crop Protection"); unitMap.put("Raxil Sure", "Crop Protection"); unitMap.put("Raxil XT", "Crop Protection"); unitMap.put("Reason", "Crop Protection"); unitMap.put("Redigo", "Crop Protection"); unitMap.put("Rely", "Crop Protection"); unitMap.put("Rely 200", "Crop Protection"); unitMap.put("Rely 280", "Crop Protection"); unitMap.put("Renounce", "Crop Protection"); unitMap.put("Requiem", "Crop Protection"); unitMap.put("Respect the Rotation", "Crop Protection"); unitMap.put("Rhizokote", "Crop Protection"); unitMap.put("Ricestar", "Crop Protection"); unitMap.put("Ricestar HT", "Crop Protection"); unitMap.put("Rimfire", "Crop Protection"); unitMap.put("Rimfire Max", "Crop Protection"); unitMap.put("Rovral", "Crop Protection"); unitMap.put("Scala", "Crop Protection"); unitMap.put("Scoparia", "Crop Protection"); unitMap.put("SeedGrowth", "Crop Protection"); unitMap.put("Sencor", "Crop Protection"); unitMap.put("Sensat", "Crop Protection"); unitMap.put("Sepresto", "Crop Protection"); unitMap.put("Serenade", "Crop Protection"); unitMap.put("Serenade ASO", "Crop Protection"); unitMap.put("Serenade Opti", "Crop Protection"); unitMap.put("Serenade Optimum", "Crop Protection"); unitMap.put("Serenade Soil", "Crop Protection"); unitMap.put("Sevin", "Crop Protection"); unitMap.put("Silverado", "Crop Protection"); unitMap.put("Sivanto", "Crop Protection"); unitMap.put("Sivanto Prime", "Crop Protection"); unitMap.put("Soberan", "Crop Protection"); unitMap.put("Sonata", "Crop Protection"); unitMap.put("Spin-Aid", "Crop Protection"); unitMap.put("Stance", "Crop Protection"); unitMap.put("Stoneville", "Seeds"); unitMap.put("Storcide II", "Crop Protection"); unitMap.put("Storicide II", "Crop Protection"); unitMap.put("Stratego", "Crop Protection"); unitMap.put("Stratego YLD", "Crop Protection"); unitMap.put("Synapse", "Crop Protection"); unitMap.put("Temik", "Crop Protection"); unitMap.put("Temix", "Crop Protection"); unitMap.put("Tempo SC Ultra", "Crop Protection"); unitMap.put("Thiram", "Crop Protection"); unitMap.put("Tops MZ", "Crop Protection"); unitMap.put("Tops MZ Gaucho", "Crop Protection"); unitMap.put("TriKote", "Crop Protection"); unitMap.put("Trilex", "Crop Protection"); unitMap.put("Trilex 2000", "Crop Protection"); unitMap.put("Trilex 5000", "Crop Protection"); unitMap.put("Trilex 6000", "Crop Protection"); unitMap.put("Trilex Advanced", "Crop Protection"); unitMap.put("Trilex AL", "Crop Protection"); unitMap.put("Trilex ADV", "Crop Protection"); unitMap.put("Trilex Optimum", "Crop Protection"); unitMap.put("Trilex Rice Pack", "Crop Protection"); unitMap.put("TrilexStar", "Crop Protection"); unitMap.put("Trimax", "Crop Protection"); unitMap.put("Trimax Pro", "Crop Protection"); unitMap.put("TwinLink", "Seeds"); unitMap.put("TwinLink Plus", "Seeds"); unitMap.put("Ultor", "Crop Protection"); unitMap.put("Varro", "Crop Protection"); unitMap.put("Velum One", "Crop Protection"); unitMap.put("Velum Prime", "Crop Protection"); unitMap.put("Velum Total", "Crop Protection"); unitMap.put("Vitis", "Crop Protection"); unitMap.put("Vortex", "Crop Protection"); unitMap.put("Votivo", "Crop Protection"); unitMap.put("Whip 360", "Crop Protection"); unitMap.put("Wolverine", "Crop Protection"); unitMap.put("Wolverine Advanced", "Crop Protection"); unitMap.put("Wolverine PowerPak", "Crop Protection"); unitMap.put("Yield Shield", "Crop Protection"); // TODO to be checked by business unitMap.put("TEMPORARY", "Crop Protection"); unitMap.put("Finish Pro", "Crop Protection"); categoryMap = new HashMap(); categoryMap.put("Bag Tags : Bag Requirements", "Seed Company Materials : Seed Bag Guidelines"); categoryMap.put("Bag Tags : Bag Stencil", "Seed Company Materials : Seed Bag Stencil"); categoryMap.put("Bag Tags : Bag Tag", "Seed Company Materials : Seed Bag Tag"); categoryMap.put("Bag Tags : Bag Tag Guidelines", "Seed Company Materials : Seed Bag Guidelines"); categoryMap.put("ExcellenceinCommAwardEntries : Comm Award Entry", ""); categoryMap.put("ExcellenceinCommAwardEntries : Direct Mail", "Advertising - Print : Direct Mail"); categoryMap.put("ExcellenceinCommAwardEntries : Presentation", "Advertising - PR, Product Publicity : Presentation"); categoryMap.put("ExcellenceinCommAwardEntries : Print Ad", "Advertising - Print : Print Ad"); categoryMap.put("ExcellenceinCommAwardEntries : Radio Spot", "Advertising - Radio/Audio : Radio Produced Spot"); categoryMap.put("ExcellenceinCommAwardEntries : TV Spot", "Advertising - TV : TV Produced Spot"); categoryMap.put("ExcellenceinCommAwardEntries : Website", "Advertising - Digital : Web Content - Article/Copy"); categoryMap.put("Field Signs : Bag Stencil", "Seed Company Materials : Seed Bag Stencil"); categoryMap.put("Field Signs : Bag Tag", "Seed Company Materials : Seed Bag Tag"); categoryMap.put("Field Signs : Decal", "Field Day / Tradeshow / Event Materials : Decal/Sticker"); categoryMap.put("Field Signs : Field Marker", "Field Day / Tradeshow / Event Materials : Field Marker Flag"); categoryMap.put("Field Signs : Plot sign", "Field Day / Tradeshow / Event Materials : Plot/Field Sign"); categoryMap.put("Field Signs : Storyboard", "Field Day / Tradeshow / Event Materials : Storyboard"); categoryMap.put("Literature : Application Card", "Sales Literature / Collateral : Application Card"); categoryMap.put("Literature : Brochure", "Sales Literature / Collateral : Brochure"); categoryMap.put("Literature : Pest ID Card", "Sales Literature / Collateral : Fact/Topic Sheet"); categoryMap.put("Literature : Portfolio Quick Guide", "Sales Literature / Collateral : Portfolio Quick Guide"); categoryMap.put("Literature : Product Bulletin", "Sales Literature / Collateral : Product Bulletin"); categoryMap.put("Literature : Product Information Sheet", "Sales Literature / Collateral : Fact/Topic Sheet"); categoryMap.put("Literature : Product Information Template", "Custom Templates : Sales/Product Sheet Template"); categoryMap.put("Literature : Product Q&A", "Sales Literature / Collateral : FAQ Sheet"); categoryMap.put("Literature : Program Materials", "Program Materials : Program Detailer"); categoryMap.put("Literature : Quick Guide Template", "Custom Templates : Sales/Product Sheet Template"); categoryMap.put("Literature : Technical Bulletin", "Sales Literature / Collateral : Tech Sheet"); categoryMap.put("Literature : Technology Use Manual", "Sales Literature / Collateral : TTUM"); categoryMap.put("LocalCampaignTools : Copy Points", "Advertising - PR, Product Publicity : Talking Points"); categoryMap.put("LocalCampaignTools : Direct Mail", "Advertising - Print : Direct Mail"); categoryMap.put("LocalCampaignTools : Local Live Read Radio", "Advertising - Radio/Audio : Radio Live-Read - Local Rep Use"); categoryMap.put("LocalCampaignTools : Local Print Ad", "Advertising - Print : Print Ad - Local Rep Use"); categoryMap.put("LocalTradeshowsEventTools : Agenda template", "Field Day / Tradeshow / Event Materials : Agenda"); categoryMap.put("LocalTradeshowsEventTools : Banner - 3'X4'", "Field Day / Tradeshow / Event Materials : Banner"); categoryMap.put("LocalTradeshowsEventTools : Banner - 3'X8'", "Field Day / Tradeshow / Event Materials : Banner"); categoryMap.put("LocalTradeshowsEventTools : Bannerup", "Field Day / Tradeshow / Event Materials : Banner Up"); categoryMap.put("LocalTradeshowsEventTools : BannerUp Base (for dual-sided graphics)", "Field Day / Tradeshow / Event Materials : Banner Up"); categoryMap.put("LocalTradeshowsEventTools : BannerUp Base (for single-sided graphics)", "Field Day / Tradeshow / Event Materials : Banner Up"); categoryMap.put("LocalTradeshowsEventTools : BannerUp Graphic Cartridge (Custom) - dual sided", "Field Day / Tradeshow / Event Materials : Banner Up"); categoryMap.put("LocalTradeshowsEventTools : BannerUp Graphic Cartridge (Custom) - single sided", "Field Day / Tradeshow / Event Materials : Banner Up"); categoryMap.put("LocalTradeshowsEventTools : BannerUp Graphic Cartridge (Standard) - dual sided", "Field Day / Tradeshow / Event Materials : Banner Up"); categoryMap.put("LocalTradeshowsEventTools : BannerUp Graphic Cartridge (Standard) - single sided", "Field Day / Tradeshow / Event Materials : Banner Up"); categoryMap.put("LocalTradeshowsEventTools : Canopy tent (10' X 10')", "Field Day / Tradeshow / Event Materials : Tent"); categoryMap.put("LocalTradeshowsEventTools : Display graphic - 12\"X24\" oval", "Field Day / Tradeshow / Event Materials : Popup Graphic"); categoryMap.put("LocalTradeshowsEventTools : Display graphic - 5\"X12\" oval", "Field Day / Tradeshow / Event Materials : Popup Graphic"); categoryMap.put("LocalTradeshowsEventTools : Display graphic package - 10' floor display", "Field Day / Tradeshow / Event Materials : Popup Graphic"); categoryMap.put("LocalTradeshowsEventTools : Display graphic package - tabletop", "Field Day / Tradeshow / Event Materials : Popup Graphic"); categoryMap.put("LocalTradeshowsEventTools : Displays - 10' floor display frame", "Field Day / Tradeshow / Event Materials : Popup Display"); categoryMap.put("LocalTradeshowsEventTools : Displays - tabletop display frame", "Field Day / Tradeshow / Event Materials : Tabletop Display"); categoryMap.put("LocalTradeshowsEventTools : Invitation template", "Field Day / Tradeshow / Event Materials : Invitation"); categoryMap.put("LocalTradeshowsEventTools : Local Show/Event SetUp Suggestions", "Field Day / Tradeshow / Event Materials : Layout/Set Up Guides"); categoryMap.put("LocalTradeshowsEventTools : Outdoor Sign", "Field Day / Tradeshow / Event Materials : Banner"); categoryMap.put("LocalTradeshowsEventTools : Podium Sign", "Field Day / Tradeshow / Event Materials : Podium Sign"); categoryMap.put("LocalTradeshowsEventTools : Tableskirt", "Field Day / Tradeshow / Event Materials : Table Cover"); categoryMap.put("LocalTradeshowsEventTools : LocalTradeShowGraphic", "Field Day / Tradeshow / Event Materials : Popup Graphic"); categoryMap.put("LogosBrandTags : Brand Tag", "Logos / Brand Tags : Brand Tag"); categoryMap.put("LogosBrandTags : Logo", "Logos / Brand Tags : Logo"); categoryMap.put("NationalCampaign : Campaign Summary", "Sales Literature / Collateral : Brand PPT"); categoryMap.put("NationalCampaign : Dealer Point of Purchase", "Point of Sales Materials : POS Display"); categoryMap.put("NationalCampaign : Google Ads", "Advertising - Digital : Search/PPC"); categoryMap.put("NationalCampaign : National Digital/New Media", "Advertising - Digital : Web Content - Article/Copy"); categoryMap.put("NationalCampaign : National Print", "Advertising - Print : Print Ad"); categoryMap.put("NationalCampaign : National Radio", "Advertising - Radio/Audio : Radio Produced Spot"); categoryMap.put("NationalCampaign : National TV", "Advertising - TV : TV Produced Spot"); categoryMap.put("NationalCampaign : Outdoor Billboard", "Advertising - OOH : Billboard"); categoryMap.put("NationalCampaign : PPC (pay per click)", "Advertising - Digital : Search/PPC"); categoryMap.put("NationalCampaign : Text Messaging", "Advertising - Digital : Text Messaging"); categoryMap.put("NationalCampaign : Tweets", "Advertising - Digital : Social"); categoryMap.put("NationalCampaign : Video", "Advertising - Digital : Web Content - Video"); categoryMap.put("NationalCRMDirect : Direct Mail", "Advertising - Print : Direct Mail"); categoryMap.put("NationalCRMDirect : Eblast", "Advertising - Digital : Email"); categoryMap.put("NationalPRCampaign : Audio Release", "Advertising - PR, Product Publicity : News Release"); categoryMap.put("NationalPRCampaign : PR Overview", "Advertising - PR, Product Publicity : Presentation"); categoryMap.put("NationalPRCampaign : PR Results", "Advertising - PR, Product Publicity : Presentation"); categoryMap.put("NationalPRCampaign : Press Kit", "Advertising - PR, Product Publicity : Media Kit"); categoryMap.put("NationalPRCampaign : Press Release", "Advertising - PR, Product Publicity : News Release"); categoryMap.put("NationalPRCampaign : Print Article", "Advertising - Print : Print Advertorial"); categoryMap.put("NationalPRCampaign : Radio Interview", "Advertising - Radio/Audio : Radio Interview"); categoryMap.put("NationalPRCampaign : Talking Points", "Advertising - PR, Product Publicity : Talking Points"); categoryMap.put("NationalPRCampaign : TV Interview", "Advertising - TV : TV Interview"); categoryMap.put("NationalPRCampaign : Video", "Advertising - PR, Product Publicity : Testimonial"); categoryMap.put("NationalProgramsPromotions : Program Ad", "Program Materials : Program Mailing/Ad"); categoryMap.put("NationalProgramsPromotions : Program Mailing", "Program Materials : Program Mailing/Ad"); categoryMap.put("NationalProgramsPromotions : Program Material", "Program Materials : Program Detailer"); categoryMap.put("NationalProgramsPromotions : Program Materials", "Program Materials : Program Detailer"); categoryMap.put("NationalProgramsPromotions : Program Rules", "Program Materials : Program Rules"); categoryMap.put("SalesTools : Premium", "Field Day / Tradeshow / Event Materials : Premiums/Giveaways"); categoryMap.put("SalesTools : Presentation", "Advertising - PR, Product Publicity : Presentation"); categoryMap.put("SalesTools : Presentation template", "Custom Templates : Presentation Template"); categoryMap.put("SalesTools : Talking Points", "Advertising - PR, Product Publicity : Talking Points"); categoryMap.put("SalesTools : Training Module", "Advertising - Digital : Web Content - Tool/Training Module"); categoryMap.put("AgIssues Forum : NTS - Booth Graphics", "Field Day / Tradeshow / Event Materials : Popup Graphic"); categoryMap.put("AgIssues Forum : NTS - Summary/Review", "Advertising - PR, Product Publicity : Presentation"); categoryMap.put("AgIssues Forum : NTS - Talking Points", "Advertising - PR, Product Publicity : Talking Points"); categoryMap.put("AgRetailersAssociation : NTS - Talking Points", "Advertising - PR, Product Publicity : Talking Points"); categoryMap.put("ASFMRA : NTS - Talking Points", "Advertising - PR, Product Publicity : Talking Points"); categoryMap.put("ASTA : NTS - Booth Graphics", "Field Day / Tradeshow / Event Materials : Popup Graphic"); categoryMap.put("ASTA : NTS - PR Results", "Advertising - PR, Product Publicity : Presentation"); categoryMap.put("ASTA : NTS - Talking Points", "Advertising - PR, Product Publicity : Talking Points"); categoryMap.put("Beltwide : NTS - Booth Graphics", "Field Day / Tradeshow / Event Materials : Popup Graphic"); categoryMap.put("CAPCA : NTS - Booth Graphics", "Field Day / Tradeshow / Event Materials : Popup Graphic"); categoryMap.put("CAPCA : NTS - Booth/Event Photos", "Image : Photo - Event"); categoryMap.put("CAPCA : NTS - PR Results", "Advertising - PR, Product Publicity : Presentation"); categoryMap.put("CAPCA : NTS - Talking Points", "Advertising - PR, Product Publicity : Talking Points"); categoryMap.put("CAPCA : NTS - Videos", "Image : Photo - Event"); categoryMap.put("CommodityClassic : NTS - Booth Graphics", "Field Day / Tradeshow / Event Materials : Popup Graphic"); categoryMap.put("Equipment : Product Information Sheet", "Sales Literature / Collateral : Fact/Topic Sheet"); categoryMap.put("FarmProgress : NTS - Booth Graphics", "Field Day / Tradeshow / Event Materials : Popup Graphic"); categoryMap.put("FarmProgress : NTS - PR Results", "Advertising - PR, Product Publicity : Presentation"); categoryMap.put("NationalAerialApplicatorsConvention : NTS - Booth Graphics", "Field Day / Tradeshow / Event Materials : Popup Graphic"); categoryMap.put("NationalPotatoShow : NTS - Booth Graphics", "Field Day / Tradeshow / Event Materials : Popup Graphic"); categoryMap.put("NationalPotatoShow : NTS - PR Results", "Advertising - PR, Product Publicity : Presentation"); categoryMap.put("NationalPotatoShow : NTS - Summary/Review", "Advertising - PR, Product Publicity : Presentation"); categoryMap.put("NationalPotatoShow : NTS - Talking Points", "Advertising - PR, Product Publicity : Talking Points"); categoryMap.put("NationalPotatoShow : NTS - Videos", "Image : Photo - Event"); categoryMap.put("OurCompany : Company Statement", "Advertising - PR, Product Publicity : Presentation"); categoryMap.put("OurCompany : Company Values", "Advertising - PR, Product Publicity : Presentation"); categoryMap.put("ProfitMaximizer : NTS - Booth Graphics", "Field Day / Tradeshow / Event Materials : Popup Graphic"); indicationMap = new HashMap(); // indicationMap.put("Bayer/General", ""); // indicationMap.put("National Tradeshow", ""); indicationMap.put("Absolute", "Fungicides"); indicationMap.put("Absolute Maxx", "Fungicides"); indicationMap.put("Accrue", "Fungicides"); indicationMap.put("Adament", "Fungicides"); indicationMap.put("Admire Flex 4", "Insecticides"); indicationMap.put("Admire Pro", "Insecticides"); indicationMap.put("Aeris", "SeedGrowth"); indicationMap.put("AFD Cotton Seed", "Seeds"); indicationMap.put("AG Streptomycin", "SeedGrowth"); indicationMap.put("Aliette", "Fungicides"); indicationMap.put("Alion", "Herbicides"); indicationMap.put("Alion HL", "Herbicides"); indicationMap.put("Allegiance", "SeedGrowth"); indicationMap.put("Argent", "SeedGrowth"); indicationMap.put("Arize", "Seeds"); indicationMap.put("Assail", "Insecticides"); indicationMap.put("Asulox", "Herbicides"); indicationMap.put("Atlantis", "Herbicides"); indicationMap.put("Autumn", "Herbicides"); indicationMap.put("Autumn Super", "Herbicides"); indicationMap.put("Axiom", "Herbicides"); indicationMap.put("Aztec", "Insecticides"); indicationMap.put("Aztec 2.1", "Insecticides"); indicationMap.put("Aztec 4.67", "Insecticides"); indicationMap.put("Aztec 4.68", "Insecticides"); indicationMap.put("Balance Bean", "Herbicides"); indicationMap.put("Balance Flexx", "Herbicides"); indicationMap.put("Balance GT", "Herbicides"); indicationMap.put("Balance Pro", "Herbicides"); indicationMap.put("Ballad Plus", "Herbicides"); // indicationMap.put("Bayer, General", ""); indicationMap.put("Bayleton", "Fungicides"); indicationMap.put("Baytan", "SeedGrowth"); indicationMap.put("Baythroid", "Insecticides"); indicationMap.put("Baythroid XL", "Insecticides"); indicationMap.put("Belt", "Insecticides"); indicationMap.put("Betamix", "Herbicides"); indicationMap.put("Betanet", "Herbicides"); indicationMap.put("Betanex", "Herbicides"); indicationMap.put("Bollgard", "Traits"); indicationMap.put("Bollgard II", "Traits"); indicationMap.put("Bronate Advanced", "Herbicides"); indicationMap.put("Buctril", "Herbicides"); indicationMap.put("Calypso", "Insecticides"); indicationMap.put("Capreno", "Herbicides"); indicationMap.put("Celgard", "SeedGrowth"); indicationMap.put("Celpass", "SeedGrowth"); indicationMap.put("Celpril", "SeedGrowth"); indicationMap.put("Certified FiberMax", "Seeds"); indicationMap.put("Cheyenne", "Herbicides"); indicationMap.put("Contain", "SeedGrowth"); indicationMap.put("COPeO Prime", "SeedGrowth"); indicationMap.put("Corvus", "Herbicides"); indicationMap.put("Corvus Complete", "Herbicides"); indicationMap.put("Cotguard", "Fungicides"); indicationMap.put("Credenz", "Seeds"); indicationMap.put("Cruiser", "Insecticides"); indicationMap.put("CSI Safener", "SeedGrowth"); indicationMap.put("CSI Safener 500FS", "SeedGrowth"); indicationMap.put("Decis", "Insecticides"); indicationMap.put("Delaro", "Fungicides"); indicationMap.put("Di-Syston", "Insecticides"); indicationMap.put("DiFlexx", "Herbicides"); indicationMap.put("DiFlexx Duo", "Herbicides"); indicationMap.put("Distinguish", "Fungicides"); indicationMap.put("Dropp", "Herbicides"); indicationMap.put("Dropp SC", "Herbicides"); indicationMap.put("Elite", "Fungicides"); indicationMap.put("Emesto", "SeedGrowth"); indicationMap.put("Emesto Silver", "SeedGrowth"); indicationMap.put("Envidor", "Insecticides"); indicationMap.put("Ethrel", "Harvest Aids/PGR"); indicationMap.put("EverGol", "SeedGrowth"); indicationMap.put("Evolve", "SeedGrowth"); indicationMap.put("FiberMax", "Seeds"); indicationMap.put("FiberMax One Ton Club", "Seeds"); indicationMap.put("Finish", "Harvest Aids/PGR"); indicationMap.put("Finish 6 Pro", "Harvest Aids/PGR"); indicationMap.put("Flint", "Fungicides"); indicationMap.put("Fluency Agent", "SeedGrowth"); indicationMap.put("Fluency Agent Advanced", "SeedGrowth"); indicationMap.put("Folicur", "Fungicides"); indicationMap.put("Gaucho", "SeedGrowth"); indicationMap.put("Gaucho Grande", "SeedGrowth"); indicationMap.put("Gaucho MZ", "SeedGrowth"); indicationMap.put("Gaucho XT", "SeedGrowth"); indicationMap.put("Gem", "Fungicides"); indicationMap.put("Ginstar", "Harvest Aids/PGR"); indicationMap.put("Ginstar EC", "Harvest Aids/PGR"); indicationMap.put("Glyphomax", "Herbicides"); indicationMap.put("GlyTol", "Traits"); // indicationMap.put("Grower Dividends", ""); // indicationMap.put("Growing Strong", ""); indicationMap.put("Gustafson", "Equipment"); indicationMap.put("Guthion", "Insecticides"); indicationMap.put("HBK", "Seeds"); indicationMap.put("Heads Up", "SeedGrowth"); indicationMap.put("Herculex", "Traits"); indicationMap.put("Herculex I", "Traits"); indicationMap.put("Hoegemeyer", "Seeds"); indicationMap.put("Hoelon", "Herbicides"); indicationMap.put("Huskie", "Herbicides"); indicationMap.put("Huskie Complete", "Herbicides"); // indicationMap.put("ICP - Horticulture", ""); // indicationMap.put("ICP - Innovation Plus", ""); // indicationMap.put("ICP - Cereals", ""); // indicationMap.put("ICP - Corn", ""); // indicationMap.put("ICP - Multiple", ""); // indicationMap.put("ICP - Southern Row Crops", ""); // indicationMap.put("ICP - Soybeans", ""); indicationMap.put("Idol", "SeedGrowth"); indicationMap.put("Ignite", "Herbicides"); indicationMap.put("Ilevo", "SeedGrowth"); indicationMap.put("Innovation Plus", ""); // indicationMap.put("InSeed", ""); indicationMap.put("Intruder", "Insecticides"); indicationMap.put("InVigor", "Seeds"); indicationMap.put("Ipresso", "SeedGrowth"); indicationMap.put("Kodiak", "Fungicides"); indicationMap.put("Krovar", "Herbicides"); indicationMap.put("Larvin", "Insecticides"); indicationMap.put("Laudis", "Herbicides"); indicationMap.put("Laudis Flexx", "Herbicides"); indicationMap.put("Leverage", "Insecticides"); indicationMap.put("Leverage 2.7", "Insecticides"); indicationMap.put("Leverage 360", "Insecticides"); indicationMap.put("Liberty", "Herbicides"); indicationMap.put("LibertyLink", "Traits"); indicationMap.put("Luna", "Fungicides"); indicationMap.put("Mocap", "Insecticides"); indicationMap.put("Monitor", "Insecticides"); indicationMap.put("Movento", "Insecticides"); indicationMap.put("Movento HL", "Insecticides"); indicationMap.put("Nemacur", "Insecticides"); indicationMap.put("Nortron", "Herbicides"); indicationMap.put("Nutrikote", "SeedGrowth"); indicationMap.put("Oberon", "Insecticides"); indicationMap.put("Olympus", "Herbicides"); indicationMap.put("Olympus Flex", "Herbicides"); indicationMap.put("On Demand", "Equipment"); indicationMap.put("Option", "Herbicides"); indicationMap.put("Osprey", "Herbicides"); indicationMap.put("Phaser", "Insecticides"); indicationMap.put("Poncho", "SeedGrowth"); indicationMap.put("Poncho 1250", "SeedGrowth"); indicationMap.put("Poncho 250", "SeedGrowth"); indicationMap.put("Poncho 250/1250", "SeedGrowth"); indicationMap.put("Poncho 251", "SeedGrowth"); indicationMap.put("Poncho 500", "SeedGrowth"); indicationMap.put("Poncho Beta", "SeedGrowth"); indicationMap.put("Poncho/VOTiVO", "SeedGrowth"); indicationMap.put("Poncho/VOTiVO 2.0", "SeedGrowth"); indicationMap.put("Prep", "Harvest Aids/PGR"); indicationMap.put("Prep 6", "Harvest Aids/PGR"); indicationMap.put("Previcur", "Fungicides"); indicationMap.put("Previcur Flex", "Fungicides"); indicationMap.put("Proceed", "SeedGrowth"); indicationMap.put("Proceed Concentrate", "SeedGrowth"); indicationMap.put("Proceed MD", "SeedGrowth"); // indicationMap.put("Producer Information Exchange (P.I.E.)", ""); indicationMap.put("Proline", "Fungicides"); indicationMap.put("Proline 3+3", "Fungicides"); indicationMap.put("ProPulse", "Fungicides"); indicationMap.put("Prosaro", "Fungicides"); indicationMap.put("Prosper", "SeedGrowth"); indicationMap.put("Prosper FX", "SeedGrowth"); indicationMap.put("Protech Plus", "Insecticides"); indicationMap.put("ProTechPlus", "Insecticides"); indicationMap.put("Protégé", "Fungicides"); indicationMap.put("Protégé FL", "Fungicides"); indicationMap.put("Provado", "Insecticides"); indicationMap.put("Provost", "Fungicides"); indicationMap.put("Provost Opti", "Fungicides"); indicationMap.put("Puma", "Herbicides"); indicationMap.put("Radius", "Herbicides"); indicationMap.put("Raxil", "SeedGrowth"); indicationMap.put("Raxil Extra", "SeedGrowth"); indicationMap.put("Raxil MD", "SeedGrowth"); indicationMap.put("Raxil MD Extra", "SeedGrowth"); indicationMap.put("Raxil MD Extra W", "SeedGrowth"); indicationMap.put("Raxil MD W", "SeedGrowth"); indicationMap.put("Raxil Pro MD", "SeedGrowth"); indicationMap.put("Raxil Pro Shield", "SeedGrowth"); indicationMap.put("Raxil Sure", "SeedGrowth"); indicationMap.put("Raxil XT", "SeedGrowth"); indicationMap.put("Reason", "Fungicides"); indicationMap.put("Redigo", "SeedGrowth"); indicationMap.put("Rely", "Herbicides"); indicationMap.put("Rely 200", "Herbicides"); indicationMap.put("Rely 280", "Herbicides"); indicationMap.put("Renounce", "Insecticides"); indicationMap.put("Requiem", "Insecticides"); indicationMap.put("Respect the Rotation", "Herbicides"); indicationMap.put("Rhizokote", "SeedGrowth"); indicationMap.put("Ricestar", "Herbicides"); indicationMap.put("Ricestar HT", "Herbicides"); indicationMap.put("Rimfire", "Herbicides"); indicationMap.put("Rimfire Max", "Herbicides"); indicationMap.put("Rovral", "Fungicides"); indicationMap.put("Scala", "Fungicides"); indicationMap.put("Scoparia", "Herbicides"); indicationMap.put("SeedGrowth", "SeedGrowth"); indicationMap.put("Sencor", "Herbicides"); indicationMap.put("Sensat", "SeedGrowth"); indicationMap.put("Sepresto", "SeedGrowth"); indicationMap.put("Serenade", "Fungicides"); indicationMap.put("Serenade ASO", "Fungicides"); indicationMap.put("Serenade Opti", "Fungicides"); indicationMap.put("Serenade Optimum", "Fungicides"); indicationMap.put("Serenade Soil", "Fungicides"); indicationMap.put("Sevin", "Insecticides"); indicationMap.put("Silverado", "Herbicides"); indicationMap.put("Sivanto", "Insecticides"); indicationMap.put("Sivanto Prime", "Insecticides"); indicationMap.put("Soberan", "Herbicides"); indicationMap.put("Sonata", "Fungicides"); indicationMap.put("Spin-Aid", "Herbicides"); indicationMap.put("Stance", "Harvest Aids/PGR"); indicationMap.put("Stoneville", "Seeds"); indicationMap.put("Storcide II", "SeedGrowth"); indicationMap.put("Storicide II", "SeedGrowth"); indicationMap.put("Stratego", "Fungicides"); indicationMap.put("Stratego YLD", "Fungicides"); indicationMap.put("Synapse", "Insecticides"); indicationMap.put("Temik", "Insecticides"); indicationMap.put("Temix", "Insecticides"); indicationMap.put("Tempo SC Ultra", "Insecticides"); indicationMap.put("Thiram", "SeedGrowth"); indicationMap.put("Tops MZ", "SeedGrowth"); indicationMap.put("Tops MZ Gaucho", "SeedGrowth"); indicationMap.put("TriKote", "SeedGrowth"); indicationMap.put("Trilex", "SeedGrowth"); indicationMap.put("Trilex 2000", "SeedGrowth"); indicationMap.put("Trilex 5000", "SeedGrowth"); indicationMap.put("Trilex 6000", "SeedGrowth"); indicationMap.put("Trilex Advanced", "SeedGrowth"); indicationMap.put("Trilex AL", "SeedGrowth"); indicationMap.put("Trilex ADV", "SeedGrowth"); indicationMap.put("Trilex Optimum", "SeedGrowth"); indicationMap.put("Trilex Rice Pack", "SeedGrowth"); indicationMap.put("TrilexStar", "SeedGrowth"); indicationMap.put("Trimax", "Insecticides"); indicationMap.put("Trimax Pro", "Insecticides"); indicationMap.put("TwinLink", "Traits"); indicationMap.put("TwinLink Plus", "Traits"); indicationMap.put("Ultor", "Insecticides"); indicationMap.put("Varro", "Herbicides"); indicationMap.put("Velum One", "Insecticides"); indicationMap.put("Velum Prime", "Insecticides"); indicationMap.put("Velum Total", "Insecticides"); indicationMap.put("Vitis", "Insecticides"); indicationMap.put("Vortex", "SeedGrowth"); indicationMap.put("Votivo", "SeedGrowth"); indicationMap.put("Whip 360", "Herbicides"); indicationMap.put("Wolverine", "Herbicides"); indicationMap.put("Wolverine Advanced", "Herbicides"); indicationMap.put("Wolverine PowerPak", "Herbicides"); indicationMap.put("Yield Shield", "Fungicides"); } private List inputRows; private HashMap assets = new HashMap(); private CsvParserSettings parserSettings = new CsvParserSettings(); private SimpleDateFormat inputDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); private SimpleDateFormat outputDateFormat = new SimpleDateFormat("MM/dd/yyyy"); public ToolboxImportFileGenerator() throws Exception { readToolboxExport(); generateAssetDecriptions(); writeImportFile(); } private void generateAssetDecriptions() throws Exception { long processedLines = 0; long assetsIncluded = 0; long originalFilenameNull = 0; long noTargetBrand = 0; long noTargetBusinessUnit = 0; long noAssetType = 0; long internalAssets = 0; for (String[] line : inputRows) { Integer assetId = Integer.parseInt(line[0]); log.debug("Processing AssetID " + assetId); processedLines++; // check exclusion criteria if (line[1].equals("NULL")) { log.warn("Skipping AssetID " + assetId + " - OriginalFilename is 'NULL'"); originalFilenameNull++; continue; } if (brandMap.get(line[15]) == null) { log.warn("Skipping AssetID " + assetId + " - no target brand for '" + line[15] + "'"); noTargetBrand++; continue; } if (unitMap.get(brandMap.get(line[15])) == null) { log.warn("Skipping AssetID " + assetId + " - no target business unit for brand '" + brandMap.get(line[15]) + "'"); noTargetBusinessUnit++; continue; } CropScienceAsset asset = assets.get(assetId); if (asset == null) { // Fields|byr_cs_country assetsIncluded++; asset = new CropScienceAsset(assetId); asset.assetPath = "/Resources/Upload/Toolbox"; asset.filename = line[1]; asset.byr_Title = line[2]; asset.byr_cs_assetApproval = "Approval Required"; if (!line[17].equals("NULL")) asset.byr_cs_releaseDate = outputDateFormat.format(inputDateFormat.parse(line[17])); if (!line[18].equals("NULL")) asset.byr_cs_retireDate = outputDateFormat.format(inputDateFormat.parse(line[18])); asset.byr_cs_license_classification = "N/A"; if (line[25] != null && line[25].equals("HH Global")) asset.byr_cs_warehouseAvailable = "Yes"; else asset.byr_cs_warehouseAvailable = "No"; asset.byr_cs_description = ""; if (line[4] != null) asset.byr_cs_description = line[4] + "\n\n"; asset.byr_cs_description += "[Asset imported from Toolbox (ID " + asset.toolboxAssetId + "), created " + outputDateFormat.format(inputDateFormat.parse(line[7])) + " by " + line[22] + " " + line[23] + " (" + line[24] + ")]"; asset.byr_cs_keywords_tl = "toolbox import"; asset.byr_MarketingId = line[3]; asset.byr_campaignYearLabel = line[19]; if (!line[20].equals("NULL")) asset.byr_campaignTitle = line[20]; if (line[21].equals("0")) { // "Internal" asset.byr_cs_IsShouldBePublished = "No"; } else { internalAssets++; asset.byr_cs_IsShouldBePublished = "Yes"; } asset.appendClassification = "/Definitions/Agencies/Bayer/Bayer CS\n" + "/Definitions/Common/Status/Released"; // determine asset type (from Toolbox "category") String assetCategory = line[12] + " : " + line[13]; String targetType = categoryMap.get(assetCategory); if (targetType != null) { asset.appendClassification = asset.appendClassification + "\n/Bayer/Crop Science/Categroy\\/Item/" + targetType.substring(0, targetType.indexOf(" : ")) + "\n/Bayer/Crop Science/Categroy\\/Item/" + targetType.substring(targetType.indexOf(" : ") + 3); } else { noAssetType++; log.info(asset.toolboxAssetId + ": Could not map category '" + assetCategory + "' to any asset type"); } asset.fileSize = Long.parseLong(line[16]); assets.put(assetId, asset); } if (asset.byr_cs_brand == null) { asset.byr_cs_brand = brandMap.get(line[15]); asset.byr_cs_businessUnit = unitMap.get(asset.byr_cs_brand); } else { asset.byr_cs_brand = asset.byr_cs_brand + "\n" + line[15]; } if (indicationMap.get(line[15]) != null) asset.indications.add(indicationMap.get(line[15])); } log.info("Processed lines: " + processedLines); log.info("Assets included: " + assetsIncluded); log.info("Skipped: Original filname NULL: " + originalFilenameNull); log.info("Skipped: No target brand: " + noTargetBrand); log.info("Skipped: No target business unit: " + noTargetBusinessUnit); log.info("No asset type: " + noAssetType); log.info("Internal assets: " + internalAssets); } private void readToolboxExport() { parserSettings.getFormat().setLineSeparator("\r\n"); parserSettings.getFormat().setDelimiter(';'); parserSettings.getFormat().setCharToEscapeQuoteEscaping('"'); parserSettings.setHeaderExtractionEnabled(false); CsvParser parser = new CsvParser(parserSettings); inputRows = parser.parseAll(new File(toolboxExportFilePath)); } private void writeImportFile() { List csvOutputList = new ArrayList(); for (CropScienceAsset asset : assets.values()) { String[] csvLine = new String[] { asset.assetPath, asset.filename, asset.appendClassification, asset.byr_Title, asset.byr_MarketingId, asset.byr_cs_assetApproval, asset.byr_cs_license_classification, asset.byr_cs_brand, asset.byr_cs_businessUnit, asset.byr_cs_releaseDate, asset.byr_cs_retireDate, asset.byr_cs_description, asset.byr_cs_keywords_tl, asset.byr_campaignYearLabel, asset.byr_campaignTitle, asset.byr_cs_IsShouldBePublished, asset.byr_cs_warehouseAvailable }; csvOutputList.add(csvLine); } CsvWriterSettings writerSettings = new CsvWriterSettings(); writerSettings.setFormat(parserSettings.getFormat()); CsvWriter writer = new CsvWriter(new File(importFilePath), writerSettings); writer.writeHeaders("assetpath", "filename", "append classification", "fields|byr_title", "fields|byr_MarketingId", "fields|byr_cs_assetApproval", "fields|byr_cs_license_classification", "fields|byr_cs_brand", "fields|byr_cs_businessUnit", "fields|byr_cs_releaseDate", "fields|byr_cs_retireDate", "fields|byr_cs_Description", "fields|byr_cs_keywords_tl", "fields|byr_campaignYearLabel", "fields|byr_campaignTitle", "fields|byr_cs_IsShouldBePublished", "fields|byr_cs_warehouseAvailable"); writer.writeRowsAndClose(csvOutputList); } public static void main(String[] args) { try { Layout layout = new PatternLayout("%p %m%n"); // "%d{ISO8601} - %p %m%n" BasicConfigurator.configure(new ConsoleAppender(layout)); // BasicConfigurator.configure(new RollingFileAppender(layout, "ToolboxImportFileGenerator.log", true)); log.setLevel(Level.INFO); new ToolboxImportFileGenerator(); } catch (Exception e) { e.printStackTrace(); } } }