diff --git a/content-api/collection-csv-actors/src/main/scala/org.sunbird/collectioncsv/validator/CollectionCSVValidator.scala b/content-api/collection-csv-actors/src/main/scala/org.sunbird/collectioncsv/validator/CollectionCSVValidator.scala index 7df8c8e179c52dda0fd7b941b74d258c632b9684..e665b21d887704f72406895f476fd04611e4f7e4 100644 --- a/content-api/collection-csv-actors/src/main/scala/org.sunbird/collectioncsv/validator/CollectionCSVValidator.scala +++ b/content-api/collection-csv-actors/src/main/scala/org.sunbird/collectioncsv/validator/CollectionCSVValidator.scala @@ -305,6 +305,16 @@ object CollectionCSVValidator { if (invalidCollectionNodeIDErrorMessage.trim.nonEmpty) throw new ClientException("CSV_INVALID_COLLECTION_NODE_ID", "Following rows have invalid “Folder Identifierâ€. Please correct and upload again: " + invalidCollectionNodeIDErrorMessage) + + val folderIdentifierList = csvRecords.flatMap(csvRecord => { + csvRecord.toMap.asScala.toMap.map(colData => { + if (collectionNodeIdentifierHeader.contains(colData._1) && collectionChildNodes.contains(colData._2.trim)) colData._2.trim else "" + }) + }).filter(msg => msg.nonEmpty) + + if(folderIdentifierList.size>folderIdentifierList.distinct.size) + throw new ClientException("DUPLICATE_FOLDER_IDENTIFIERS", "Duplicate “Folder Identifier†found. Please correct and upload again.") + // validate Folder Identifier column in CSV - END TelemetryManager.log("CollectionCSVActor --> validateCSVRecordsDataAuthenticity --> after validating Folder Identifier column in CSV") }