From f6190db4b3ae9889269d17c1f2e6065d38238194 Mon Sep 17 00:00:00 2001 From: gexce Date: Mon, 14 Aug 2017 19:20:33 +0200 Subject: [PATCH] SQL --- .../src/com/bayer/edam/CropScienceAsset.java | 1 + .../bayer/edam/ToolboxImportFileGenerator.java | 18 +++++++++++++++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Toolbox Migration/src/com/bayer/edam/CropScienceAsset.java b/Toolbox Migration/src/com/bayer/edam/CropScienceAsset.java index 2da72dd..2ed8de2 100644 --- a/Toolbox Migration/src/com/bayer/edam/CropScienceAsset.java +++ b/Toolbox Migration/src/com/bayer/edam/CropScienceAsset.java @@ -23,6 +23,7 @@ public class CropScienceAsset { String byr_campaignYearLabel; // TODO needs to be verified with Delaware String byr_campaignTitle; String byr_cs_IsShouldBePublished; + String byr_cs_warehouseAvailable; HashSet indications = new HashSet(); diff --git a/Toolbox Migration/src/com/bayer/edam/ToolboxImportFileGenerator.java b/Toolbox Migration/src/com/bayer/edam/ToolboxImportFileGenerator.java index 4532401..7c7afd4 100644 --- a/Toolbox Migration/src/com/bayer/edam/ToolboxImportFileGenerator.java +++ b/Toolbox Migration/src/com/bayer/edam/ToolboxImportFileGenerator.java @@ -39,6 +39,9 @@ import com.univocity.parsers.csv.CsvWriterSettings; * ,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 @@ -49,6 +52,9 @@ import com.univocity.parsers.csv.CsvWriterSettings; * 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 @@ -1070,6 +1076,11 @@ public class ToolboxImportFileGenerator { 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"; @@ -1086,7 +1097,7 @@ public class ToolboxImportFileGenerator { if (!line[20].equals("NULL")) asset.byr_campaignTitle = line[20]; - if (line[21].equals("0")) { + if (line[21].equals("0")) { // "Internal" asset.byr_cs_IsShouldBePublished = "No"; } else { @@ -1152,7 +1163,7 @@ public class ToolboxImportFileGenerator { 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_keywords_tl, asset.byr_campaignYearLabel, asset.byr_campaignTitle, asset.byr_cs_IsShouldBePublished, asset.byr_cs_warehouseAvailable }; csvOutputList.add(csvLine); } @@ -1163,7 +1174,8 @@ public class ToolboxImportFileGenerator { 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", "field|byr_cs_IsShouldBePublished"); + "fields|byr_campaignYearLabel", "fields|byr_campaignTitle", "fields|byr_cs_IsShouldBePublished", + "fields|byr_cs_warehouseAvailable"); writer.writeRowsAndClose(csvOutputList); }