Photo Gallery migration
This commit is contained in:
+4273
File diff suppressed because it is too large
Load Diff
@@ -28,6 +28,10 @@ public class CropScienceAsset {
|
|||||||
String byr_licenseOwner;
|
String byr_licenseOwner;
|
||||||
String byr_licenseInformation = "";
|
String byr_licenseInformation = "";
|
||||||
|
|
||||||
|
// Photo Gallery
|
||||||
|
String byr_cs_location;
|
||||||
|
String byr_cropYear;
|
||||||
|
|
||||||
HashSet<String> brands = new HashSet<String>();
|
HashSet<String> brands = new HashSet<String>();
|
||||||
HashSet<String> indications = new HashSet<String>();
|
HashSet<String> indications = new HashSet<String>();
|
||||||
HashSet<String> licenseRecords = new HashSet<String>();
|
HashSet<String> licenseRecords = new HashSet<String>();
|
||||||
|
|||||||
@@ -31,18 +31,19 @@ public class ToolboxImportFileGenerator {
|
|||||||
|
|
||||||
private static Logger log = Logger.getLogger(ToolboxImportFileGenerator.class);
|
private static Logger log = Logger.getLogger(ToolboxImportFileGenerator.class);
|
||||||
|
|
||||||
private static String toolboxExportFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\all imported IDs - toolbox export.csvXXX";
|
private static String toolboxExportFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\2017-12-12 example photo 5531.csv";
|
||||||
private static String logfilePath = "C:\\Temp\\Migration CS - PhotoGallery\\all imported IDs - toolbox export.problem with type import.generator.XXX.log";
|
private static String logfilePath = "C:\\Temp\\Migration CS - PhotoGallery\\2017-12-12 example photo 5531.csv.generator.log";
|
||||||
private static String licenseGuidsFilePath = "C:\\Temp\\Migration CS - SQL Server\\Release_GUIDs.csv";
|
private static String licenseGuidsFilePath = "C:\\Temp\\Migration CS - SQL Server\\Release_GUIDs.csv";
|
||||||
|
|
||||||
// XXX Spreadsheet needs be be named "Records" in Excel for the importer
|
// XXX Spreadsheet needs be be named "Records" in Excel for the importer
|
||||||
private static String importFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\all imported IDs - toolbox export.problem with type import.generator.csv";
|
private static String importFilePath = "C:\\Temp\\Migration CS - PhotoGallery\\2017-12-12 example photo 5531.generator.csv";
|
||||||
private static String uploadPath = "/Resources/Upload/ToolboxMigration";
|
private static String uploadPath = "/Resources/Upload/ToolboxPhotoGallery";
|
||||||
|
|
||||||
private static final Map<String, String> brandMap;
|
private static final Map<String, String> brandMap;
|
||||||
private static final Map<String, String> unitMap;
|
private static final Map<String, String> unitMap;
|
||||||
private static final Map<String, String> categoryMap;
|
private static final Map<String, String> categoryMap;
|
||||||
private static final Map<String, String> indicationMap;
|
private static final Map<String, String> indicationMap;
|
||||||
|
private static final Map<String, String> cropMap;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
brandMap = new HashMap<String, String>();
|
brandMap = new HashMap<String, String>();
|
||||||
@@ -709,6 +710,12 @@ public class ToolboxImportFileGenerator {
|
|||||||
categoryMap.put("OurCompany : Company Statement", "Advertising - PR, Product Publicity : Presentation");
|
categoryMap.put("OurCompany : Company Statement", "Advertising - PR, Product Publicity : Presentation");
|
||||||
categoryMap.put("OurCompany : Company Values", "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");
|
categoryMap.put("ProfitMaximizer : NTS - Booth Graphics", "Field Day - Tradeshow - Event Materials : Popup Graphic");
|
||||||
|
categoryMap.put("PHOTO GALLERY : Crop", "Image : Photo - Crop");
|
||||||
|
categoryMap.put("PHOTO GALLERY : Equipment", "Image : Photo - Equipment");
|
||||||
|
categoryMap.put("PHOTO GALLERY : Event", "Image : Photo - Event");
|
||||||
|
categoryMap.put("PHOTO GALLERY : Farmstead", "Image : Photo - Farmstead");
|
||||||
|
categoryMap.put("PHOTO GALLERY : Person", "Image : Photo - Person");
|
||||||
|
categoryMap.put("PHOTO GALLERY : Pest", "Image : Photo - Pest");
|
||||||
|
|
||||||
|
|
||||||
indicationMap = new HashMap<String, String>();
|
indicationMap = new HashMap<String, String>();
|
||||||
@@ -973,6 +980,42 @@ public class ToolboxImportFileGenerator {
|
|||||||
indicationMap.put("Wolverine PowerPak", "Herbicides");
|
indicationMap.put("Wolverine PowerPak", "Herbicides");
|
||||||
indicationMap.put("Yield Shield", "Fungicides");
|
indicationMap.put("Yield Shield", "Fungicides");
|
||||||
|
|
||||||
|
cropMap = new HashMap<String, String>();
|
||||||
|
cropMap.put("Berries", "Berries");
|
||||||
|
cropMap.put("Brassica Vegetables", "Vegetable, Brassica");
|
||||||
|
cropMap.put("Bulb Vegetables", "Vegetable, Bulb");
|
||||||
|
cropMap.put("Cereals", "Cereals");
|
||||||
|
cropMap.put("Citrus", "Citrus");
|
||||||
|
cropMap.put("Corn", "Corn");
|
||||||
|
cropMap.put("Cotton", "Cotton");
|
||||||
|
cropMap.put("Cucurbits", "Cucurbits");
|
||||||
|
cropMap.put("Fruiting Vegetables", "Vegetable, Fruiting");
|
||||||
|
cropMap.put("Grapes", "Grapes");
|
||||||
|
cropMap.put("Leafy Vegetables", "Vegetable, Leafy");
|
||||||
|
cropMap.put("Legume Vegetables", "Vegetable, Legume");
|
||||||
|
cropMap.put("Peanuts", "Peanuts");
|
||||||
|
cropMap.put("Pome Fruit", "Fruit, Pome");
|
||||||
|
cropMap.put("Rice", "Rice");
|
||||||
|
cropMap.put("Root And Tuber Vegetables", "Vegetable, Root and Tuber");
|
||||||
|
cropMap.put("Soybeans", "Soybeans");
|
||||||
|
cropMap.put("Stone Fruit", "Fruit, Stone");
|
||||||
|
cropMap.put("Sugarbeets", "Sugarbeets");
|
||||||
|
cropMap.put("Tobacco", "Tobacco");
|
||||||
|
cropMap.put("Tree Nuts", "Tree Nuts");
|
||||||
|
cropMap.put("Tropical Fruits", "Fruit, Other");
|
||||||
|
cropMap.put("Potatoes", "Potatoes");
|
||||||
|
cropMap.put("Canola", "Canola");
|
||||||
|
cropMap.put("Cereal", "Cereals");
|
||||||
|
cropMap.put("Fruit Other", "Fruit, Other");
|
||||||
|
cropMap.put("Fruit Pome", "Fruit, Pome");
|
||||||
|
cropMap.put("Fruit Stone", "Fruit, Stone");
|
||||||
|
cropMap.put("Grape", "Grapes");
|
||||||
|
cropMap.put("Peanut", "Peanuts");
|
||||||
|
cropMap.put("Potato", "Potatoes");
|
||||||
|
cropMap.put("Sorghum", "Sorghum");
|
||||||
|
cropMap.put("Soybean", "Soybeans");
|
||||||
|
cropMap.put("Sugarbeet", "Sugarbeets");
|
||||||
|
cropMap.put("Vegetable", "Vegetable, Other");
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<String[]> inputRows;
|
private List<String[]> inputRows;
|
||||||
@@ -1029,6 +1072,10 @@ public class ToolboxImportFileGenerator {
|
|||||||
log.debug("Processing AssetID " + assetId);
|
log.debug("Processing AssetID " + assetId);
|
||||||
lineNo++;
|
lineNo++;
|
||||||
processedAssetIDs.add(assetId);
|
processedAssetIDs.add(assetId);
|
||||||
|
|
||||||
|
boolean photoGalleryItem = false;
|
||||||
|
if (line.length > 52 && line[52].equals("3"))
|
||||||
|
photoGalleryItem = true;
|
||||||
|
|
||||||
// check exclusion criteria
|
// check exclusion criteria
|
||||||
if (line[1].equals("NULL")) {
|
if (line[1].equals("NULL")) {
|
||||||
@@ -1054,8 +1101,17 @@ public class ToolboxImportFileGenerator {
|
|||||||
statusSkipped++;
|
statusSkipped++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line[26].equals("NULL")) {
|
if (photoGalleryItem) {
|
||||||
|
// Photo Gallery: Copy "KeyElementName" to "AssetItemName" in order to map category
|
||||||
|
if (!line[11].equals("NULL")) {
|
||||||
|
log.error("line[11] 'AssetCategoryName' should be empty for Photo Gallery asset!");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
line[11] = "PHOTO GALLERY";
|
||||||
|
line[12] = line[42];
|
||||||
|
}
|
||||||
|
else if (line[26].equals("NULL")) {
|
||||||
log.warn("Skipping AssetID " + assetId + ", line " + lineNo + " - asset type is " + line[26]);
|
log.warn("Skipping AssetID " + assetId + ", line " + lineNo + " - asset type is " + line[26]);
|
||||||
assetTypeNull++;
|
assetTypeNull++;
|
||||||
continue;
|
continue;
|
||||||
@@ -1094,7 +1150,8 @@ public class ToolboxImportFileGenerator {
|
|||||||
if (!line[17].equals("NULL"))
|
if (!line[17].equals("NULL"))
|
||||||
asset.byr_cs_retireDate = outputDateFormat.format(inputDateFormat.parse(line[17]));
|
asset.byr_cs_retireDate = outputDateFormat.format(inputDateFormat.parse(line[17]));
|
||||||
|
|
||||||
asset.byr_campaignYearLabel = line[18];
|
if (!photoGalleryItem)
|
||||||
|
asset.byr_campaignYearLabel = line[18];
|
||||||
|
|
||||||
if (!line[19].equals("NULL"))
|
if (!line[19].equals("NULL"))
|
||||||
asset.byr_campaignTitle = line[19];
|
asset.byr_campaignTitle = line[19];
|
||||||
@@ -1118,13 +1175,22 @@ public class ToolboxImportFileGenerator {
|
|||||||
|
|
||||||
asset.byr_cs_description = "";
|
asset.byr_cs_description = "";
|
||||||
if (line[4] != null)
|
if (line[4] != null)
|
||||||
asset.byr_cs_description = line[4] + "\n\n";
|
asset.byr_cs_description = line[4] + "\n\n\n";
|
||||||
asset.byr_cs_description += "[Asset imported from Toolbox (ID " + asset.toolboxAssetId + "), created "
|
asset.byr_cs_description += "[Asset imported from Toolbox (ID " + asset.toolboxAssetId + "), created "
|
||||||
+ outputDateFormat.format(inputDateFormat.parse(line[6])) + " by " + line[21] + " " + line[22] + " (" + line[23]
|
+ outputDateFormat.format(inputDateFormat.parse(line[6])) + " by " + line[21] + " " + line[22] + " (" + line[23]
|
||||||
+ ")]";
|
+ ")]";
|
||||||
|
|
||||||
|
if (photoGalleryItem) {
|
||||||
|
if (!line[41].equals("NULL") && line[40].length() > 0);
|
||||||
|
injectDescription(asset, "Geographic Information: " + line[41]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
asset.byr_cs_keywords_tl = "toolbox import";
|
asset.byr_cs_keywords_tl = "toolbox import";
|
||||||
|
|
||||||
|
if (photoGalleryItem && !line[44].equals("NULL") && line[44].length() > 0)
|
||||||
|
asset.byr_cs_keywords_tl += "\n" + line[44];
|
||||||
|
|
||||||
asset.appendClassification = "/Definitions/Agencies/Bayer/Bayer CS";
|
asset.appendClassification = "/Definitions/Agencies/Bayer/Bayer CS";
|
||||||
|
|
||||||
if (line[25].equals("Publish"))
|
if (line[25].equals("Publish"))
|
||||||
@@ -1132,29 +1198,69 @@ public class ToolboxImportFileGenerator {
|
|||||||
else // "Archive"
|
else // "Archive"
|
||||||
asset.appendClassification += "\n/Definitions/Common/Status/Retired";
|
asset.appendClassification += "\n/Definitions/Common/Status/Retired";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// determine asset type (from Toolbox "category")
|
|
||||||
String assetCategory = line[11] + " : " + line[12];
|
|
||||||
String targetType = categoryMap.get(assetCategory);
|
|
||||||
if (targetType != null) {
|
|
||||||
String categoryClassification = targetType.substring(0, targetType.indexOf(" : "));
|
|
||||||
String subCategoryClassification = targetType.substring(targetType.indexOf(" : ") + 3);
|
|
||||||
|
|
||||||
asset.appendClassification = "/Bayer/Crop Science/CategoryItem/" + categoryClassification
|
|
||||||
+ "\n/Bayer/Crop Science/CategoryItem/" + categoryClassification + "/" + subCategoryClassification;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
noAssetType++;
|
|
||||||
log.warn(asset.toolboxAssetId + ", line " + lineNo + ": Could not map category '" + assetCategory + "' to any asset type");
|
|
||||||
}
|
|
||||||
|
|
||||||
asset.byr_licenseScope = "US";
|
asset.byr_licenseScope = "US";
|
||||||
asset.byr_licenseOwner = "Bayer CropScience LP";
|
asset.byr_licenseOwner = "Bayer CropScience LP";
|
||||||
|
|
||||||
|
|
||||||
|
// Photo Gallery
|
||||||
|
if (photoGalleryItem) {
|
||||||
|
|
||||||
|
asset.byr_cropYear = line[18];
|
||||||
|
|
||||||
|
if (!line[40].equals("NULL") && line[40].length() > 0)
|
||||||
|
asset.byr_cs_location = line[40];
|
||||||
|
|
||||||
|
if (!line[49].equals("NULL") && line[49].length() > 0) {
|
||||||
|
String event = line[49];
|
||||||
|
if (!line[50].equals("NULL") && line[50].length() > 0)
|
||||||
|
event += ": " + line[50];
|
||||||
|
injectDescription(asset, event);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!line[51].equals("NULL") && line[51].length() > 0) {
|
||||||
|
injectDescription(asset, "Names of persons in photograph: " + line[51]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
assets.put(assetId, asset);
|
assets.put(assetId, asset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// determine asset type (from Toolbox "category")
|
||||||
|
String assetCategory = line[11] + " : " + line[12];
|
||||||
|
String targetType = categoryMap.get(assetCategory);
|
||||||
|
if (targetType != null) {
|
||||||
|
String categoryClassification = targetType.substring(0, targetType.indexOf(" : "));
|
||||||
|
String subCategoryClassification = targetType.substring(targetType.indexOf(" : ") + 3);
|
||||||
|
|
||||||
|
appendClassification(asset, "/Bayer/Crop Science/CategoryItem/" + categoryClassification);
|
||||||
|
appendClassification(asset, "/Bayer/Crop Science/CategoryItem/" + categoryClassification + "/" + subCategoryClassification);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
noAssetType++;
|
||||||
|
log.warn(asset.toolboxAssetId + ", line " + lineNo + ": Could not map category '" + assetCategory + "' to any asset type");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (photoGalleryItem) {
|
||||||
|
if (cropMap.get(line[43]) != null) {
|
||||||
|
appendClassification(asset, "/Bayer/Crop Science/Crops/" + cropMap.get(line[43]));
|
||||||
|
}
|
||||||
|
if (cropMap.get(line[45]) != null) {
|
||||||
|
if (appendClassification(asset, "/Bayer/Crop Science/Crops/" + cropMap.get(line[45]))) {
|
||||||
|
if (line[46] != null && !line[46].equals("NULL") && line[46].length() > 0) {
|
||||||
|
injectDescription(asset, line[45] + " in stage " + line[46]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!line[47].equals("NULL") && line[47].length() > 0) {
|
||||||
|
String pest = line[47];
|
||||||
|
if (!line[48].equals("NULL") && line[48].length() > 0)
|
||||||
|
pest += ": " + line[48];
|
||||||
|
injectDescription(asset, pest);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Special rules for brands
|
// Special rules for brands
|
||||||
if (line[14].equals("Fluency Agent/Fluency Agent Advanced")) {
|
if (line[14].equals("Fluency Agent/Fluency Agent Advanced")) {
|
||||||
asset.brands.add(brandMap.get("Fluency Agent"));
|
asset.brands.add(brandMap.get("Fluency Agent"));
|
||||||
@@ -1240,6 +1346,47 @@ public class ToolboxImportFileGenerator {
|
|||||||
log.info("No asset type: " + noAssetType);
|
log.info("No asset type: " + noAssetType);
|
||||||
log.info("Internal assets: " + internalAssets);
|
log.info("Internal assets: " + internalAssets);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean injectDescription(CropScienceAsset asset, String desciption) {
|
||||||
|
if (asset.byr_cs_description == null || asset.byr_cs_description.length() == 0) {
|
||||||
|
asset.byr_cs_description = desciption;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] descLines = asset.byr_cs_description.split("\n");
|
||||||
|
for (int i = 0; i < descLines.length; i++) {
|
||||||
|
if (descLines[i].equals(desciption))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int position = asset.byr_cs_description.indexOf("\n\n[Asset imported from Toolbox");
|
||||||
|
|
||||||
|
if (position < 0) {
|
||||||
|
log.warn("No import description found");
|
||||||
|
asset.byr_cs_description += "\n" + desciption;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
asset.byr_cs_description = asset.byr_cs_description.substring(0, position) + "\n" + desciption + asset.byr_cs_description.substring(position);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean appendClassification(CropScienceAsset asset, String classification) {
|
||||||
|
if (asset.appendClassification == null || asset.appendClassification.length() == 0) {
|
||||||
|
asset.appendClassification = classification;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String[] setClassifications = asset.appendClassification.split("\n");
|
||||||
|
|
||||||
|
for (int i = 0; i < setClassifications.length; i++) {
|
||||||
|
if (setClassifications[i].equals(classification))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
asset.appendClassification += "\n" + classification;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void writeImportFile() {
|
private void writeImportFile() {
|
||||||
List<Object[]> csvOutputList = new ArrayList<Object[]>();
|
List<Object[]> csvOutputList = new ArrayList<Object[]>();
|
||||||
@@ -1298,7 +1445,7 @@ public class ToolboxImportFileGenerator {
|
|||||||
brands, asset.byr_cs_releaseDate, asset.byr_cs_retireDate, asset.byr_cs_description, asset.byr_cs_keywords_tl,
|
brands, 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,
|
asset.byr_campaignYearLabel, asset.byr_campaignTitle, asset.byr_cs_IsShouldBePublished, asset.byr_cs_warehouseAvailable,
|
||||||
asset.byr_cs_country, licenseRecords, licenseTypes, asset.byr_licenseScope, asset.byr_licenseOwner,
|
asset.byr_cs_country, licenseRecords, licenseTypes, asset.byr_licenseScope, asset.byr_licenseOwner,
|
||||||
asset.byr_licenseInformation };
|
asset.byr_licenseInformation, asset.byr_cs_location, asset.byr_cropYear };
|
||||||
|
|
||||||
csvOutputList.add(csvLine);
|
csvOutputList.add(csvLine);
|
||||||
}
|
}
|
||||||
@@ -1308,11 +1455,11 @@ public class ToolboxImportFileGenerator {
|
|||||||
|
|
||||||
CsvWriter writer = new CsvWriter(new File(importFilePath), writerSettings);
|
CsvWriter writer = new CsvWriter(new File(importFilePath), writerSettings);
|
||||||
writer.writeHeaders("Assetpath", "Filename", "Append Classification", "fields|byr_Title", "fields|byr_MarketingId",
|
writer.writeHeaders("Assetpath", "Filename", "Append Classification", "fields|byr_Title", "fields|byr_MarketingId",
|
||||||
"fields|byr_cs_assetApproval", "fields|byr_cs_businessUnit", "fields|byr_cs_brand",
|
"fields|byr_cs_assetApproval", "fields|byr_cs_businessUnit", "fields|byr_cs_brand", "fields|byr_cs_releaseDate",
|
||||||
"fields|byr_cs_releaseDate", "fields|byr_cs_retireDate", "fields|byr_cs_Description", "fields|byr_cs_keywords_tl",
|
"fields|byr_cs_retireDate", "fields|byr_cs_Description", "fields|byr_cs_keywords_tl", "fields|byr_campaignYearLabel",
|
||||||
"fields|byr_campaignYearLabel", "fields|byr_campaignTitleLabel", "fields|byr_cs_IsShouldBePublished",
|
"fields|byr_campaignTitleLabel", "fields|byr_cs_IsShouldBePublished", "fields|byr_cs_warehouseAvailable",
|
||||||
"fields|byr_cs_warehouseAvailable", "fields|byr_cs_country", "fields|byr_cs_licenseRecord", "fields|byr_cs_licenseType",
|
"fields|byr_cs_country", "fields|byr_cs_licenseRecord", "fields|byr_cs_licenseType", "fields|byr_licenseScope",
|
||||||
"fields|byr_licenseScope", "fields|byr_licenseOwner", "fields|byr_licenseInformation");
|
"fields|byr_licenseOwner", "fields|byr_licenseInformation", "fields|byr_cs_location", "fields|byr_cropYear");
|
||||||
writer.writeRowsAndClose(csvOutputList);
|
writer.writeRowsAndClose(csvOutputList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,97 @@
|
|||||||
|
SELECT DISTINCT
|
||||||
|
a.AssetId, a.OriginalFileName, a.UserFileName, a.BCSNumber, a.Description, a.AssetStatusID,
|
||||||
|
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
|
||||||
|
,aty.AssetTypeName
|
||||||
|
,org.OrganizationName
|
||||||
|
,rel.ReleaseID
|
||||||
|
,rel.ReleaseName
|
||||||
|
,rel.ReleaseTypeID
|
||||||
|
,rel.ReleaseStatusID
|
||||||
|
,rel.Licensor
|
||||||
|
,rel.CreatedDate
|
||||||
|
,rel.FileName
|
||||||
|
,rel.FilePath
|
||||||
|
,relUsr.FirstName
|
||||||
|
,relUsr.LastName
|
||||||
|
,relUsr.CompanyName
|
||||||
|
-- PhotoGallery:
|
||||||
|
,a.StateID
|
||||||
|
,sta.StateName
|
||||||
|
,a.GeographicInformation
|
||||||
|
,kelem.KeyElementName
|
||||||
|
,cgr.CropGroupName
|
||||||
|
,cfi.CropFieldName
|
||||||
|
,crop.CropName
|
||||||
|
,acrm.CropStage
|
||||||
|
,pety.PestTypeName
|
||||||
|
,pmap.Pest
|
||||||
|
,evty.EventTypeName
|
||||||
|
,aeve.Event
|
||||||
|
,a.NameOfPerson
|
||||||
|
,a.FamilyID
|
||||||
|
|
||||||
|
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
|
||||||
|
LEFT JOIN States sta ON a.StateID = sta.StateID
|
||||||
|
LEFT JOIN AssetKeyElementMap akem ON a.AssetID = akem.AssetID
|
||||||
|
LEFT JOIN KeyElement kelem ON akem.KeyElementID = kelem.KeyElementID
|
||||||
|
LEFT JOIN CropGroups cgr ON a.CropGroupID = cgr.CropGroupID
|
||||||
|
LEFT JOIN CropFields cfi ON a.CropFieldID = cfi.CropFieldID
|
||||||
|
LEFT JOIN AssetCropMap acrm ON a.AssetID = acrm.AssetID
|
||||||
|
LEFT JOIN Crop crop ON acrm.CropID = crop.CropID
|
||||||
|
LEFT JOIN AssetPetsMap pmap ON a.AssetID = pmap.AssetID
|
||||||
|
LEFT JOIN PestType pety ON pmap.PestTypeID = pety.PestTypeID
|
||||||
|
LEFT JOIN AssetEventMap aeve ON a.AssetID = aeve.AssetID
|
||||||
|
LEFT JOIN EventType evty ON aeve.EventTypeID = evty.EventTypeID
|
||||||
|
|
||||||
|
|
||||||
|
-- all these joins only to get the "Available to" matrix
|
||||||
|
LEFT JOIN AssetGroupSecurityFunctionMap agsfm ON a.AssetID = agsfm.AssetID
|
||||||
|
LEFT JOIN Organizations org ON org.OrganizationID = agsfm.OrganizationID
|
||||||
|
LEFT JOIN Groups grp ON grp.GroupID = agsfm.GroupID
|
||||||
|
--LEFT JOIN SecurityFunctions sf ON sf.SecurityFunctionID = agsfm.SecurityFunctionID
|
||||||
|
LEFT JOIN AssetRelease arel ON a.AssetID = arel.AssetID
|
||||||
|
LEFT JOIN Release rel ON arel.ReleaseID = rel.ReleaseID
|
||||||
|
LEFT JOIN Users relUsr ON rel.CreatedByUserID = relUsr.UserID
|
||||||
|
|
||||||
|
|
||||||
|
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 grp.GroupName != 'Administrator'
|
||||||
|
|
||||||
|
-- Photo Gallery
|
||||||
|
AND a.FamilyID = 3
|
||||||
|
|
||||||
|
-- Logos & Brand Tags
|
||||||
|
--AND (a.AssetItemID = 46 OR a.AssetItemID = 67)
|
||||||
|
|
||||||
|
|
||||||
|
--AND a.AssetID = 5531
|
||||||
Reference in New Issue
Block a user