-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1333 from nationalarchives/TDRD-502-add-consignme…
…nt-type-override Tdrd 502 add consignment type override
- Loading branch information
Showing
17 changed files
with
410 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
bagit-export/src/main/scala/uk/gov/nationalarchives/consignmentexport/Overrides.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package uk.gov.nationalarchives.consignmentexport | ||
|
||
import graphql.codegen.GetConsignmentExport.getConsignmentForExport.GetConsignment | ||
import uk.gov.nationalarchives.consignmentexport.Config.ConsignmentTypeOverride | ||
|
||
object Overrides { | ||
def consignmentTypeMessageOverride(originalConsignmentType: String, consignmentData: GetConsignment, consignmentTypeOverride: ConsignmentTypeOverride): String = { | ||
originalConsignmentType.toLowerCase match { | ||
case "standard" if | ||
historicalTribunalTransfer(consignmentTypeOverride, consignmentData) => "historicalTribunal" | ||
case _ => originalConsignmentType | ||
} | ||
} | ||
|
||
private def historicalTribunalTransfer(consignmentTypeOverride: ConsignmentTypeOverride, consignmentData: GetConsignment): Boolean = { | ||
consignmentTypeOverride.transferringBodies.contains(consignmentData.transferringBodyName.get) && | ||
consignmentTypeOverride.judgmentSeries.contains(consignmentData.seriesName.get) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
...-export/src/test/resources/json/get_override_consignment_type_consignment_for_export.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
"data": { | ||
"getConsignment": { | ||
"seriesName": "override-series", | ||
"exportDatetime": "2021-01-27T13:35:15Z", | ||
"createdDatetime": "2021-01-15T07:47:19Z", | ||
"transferInitiatedDatetime": "2021-01-15T07:47:19Z", | ||
"userid": "b2657adf-6e93-424f-b0f1-aadd26762a96", | ||
"consignmentReference": "consignmentReference-1234", | ||
"consignmentType": "standard", | ||
"includeTopLevelFolder": false, | ||
"transferringBodyName": "override-body", | ||
"files": [ | ||
{ | ||
"fileId": "7b19b272-d4d1-4d77-bf25-511dc6489d12", | ||
"fileName": "name", | ||
"fileType": "File", | ||
"originalFilePath": "/original/file/path", | ||
"fileMetadata": [ | ||
{ | ||
"name": "ClientSideOriginalFilepath", | ||
"value": "originalPath" | ||
}, | ||
{ | ||
"name": "LegalStatus", | ||
"value": "Public Record" | ||
}, | ||
{ | ||
"name": "ClientSideFileSize", | ||
"value": "1024" | ||
}, | ||
{ | ||
"name": "ClientSideLastModifiedDate", | ||
"value": "2021-01-26T17:10:58.04" | ||
}, | ||
{ | ||
"name": "RightsCopyright", | ||
"value": "Crown Copyright" | ||
}, | ||
{ | ||
"name": "HeldBy", | ||
"value": "TNA" | ||
}, | ||
{ | ||
"name": "FoiExemptionCode", | ||
"value": "open" | ||
}, | ||
{ | ||
"name": "Language", | ||
"value": "English" | ||
}, | ||
{ | ||
"name": "SHA256ClientSideChecksum", | ||
"value": "cd0aa9856147b6c5b4ff2b7dfee5da20aa38253099ef1b4a64aced233c9afe29" | ||
} | ||
], | ||
"ffidMetadata": { | ||
"method": "pronom", | ||
"softwareVersion": "6.5", | ||
"datetime": 1617704135359, | ||
"software": "Droid", | ||
"matches": [ | ||
{ | ||
"extension": null, | ||
"identificationBasis": "", | ||
"puid": null, | ||
"fileExtensionMismatch": false, | ||
"formatName": "" | ||
} | ||
], | ||
"containerSignatureFileVersion": "DROID_SignatureFile_V96.xml", | ||
"binarySignatureFileVersion": "container-signature-20200121.xml" | ||
}, | ||
"antivirusMetadata": { | ||
"software": "software", | ||
"softwareVersion": "softwareVersion" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
...sources/json/get_override_consignment_type_consignment_for_export_different_checksum.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
{ | ||
"data": { | ||
"getConsignment": { | ||
"seriesName": "override-series", | ||
"exportDatetime": "2021-01-27T13:35:15Z", | ||
"createdDatetime": "2021-01-15T07:47:19Z", | ||
"transferInitiatedDatetime": "2021-01-15T07:47:19Z", | ||
"userid": "b2657adf-6e93-424f-b0f1-aadd26762a96", | ||
"consignmentReference": "consignmentReference-1234", | ||
"consignmentType": "standard", | ||
"includeTopLevelFolder": false, | ||
"transferringBodyName": "override-body", | ||
"files": [ | ||
{ | ||
"fileId": "7b19b272-d4d1-4d77-bf25-511dc6489d12", | ||
"fileName": "name", | ||
"fileType": "File", | ||
"fileMetadata": [ | ||
{ | ||
"name": "ClientSideOriginalFilepath", | ||
"value": "originalPath" | ||
}, | ||
{ | ||
"name": "LegalStatus", | ||
"value": "Public Record" | ||
}, | ||
{ | ||
"name": "ClientSideFileSize", | ||
"value": "1024" | ||
}, | ||
{ | ||
"name": "ClientSideLastModifiedDate", | ||
"value": "2021-01-26 17:10:58.042" | ||
}, | ||
{ | ||
"name": "RightsCopyright", | ||
"value": "Crown Copyright" | ||
}, | ||
{ | ||
"name": "HeldBy", | ||
"value": "TNA" | ||
}, | ||
{ | ||
"name": "FoiExemptionCode", | ||
"value": "open" | ||
}, | ||
{ | ||
"name": "Language", | ||
"value": "English" | ||
}, | ||
{ | ||
"name": "SHA256ClientSideChecksum", | ||
"value": "differentChecksum" | ||
} | ||
], | ||
"ffidMetadata": { | ||
"method": "pronom", | ||
"softwareVersion": "6.5", | ||
"datetime": 1617704135359, | ||
"software": "Droid", | ||
"matches": [ | ||
{ | ||
"extension": null, | ||
"identificationBasis": "", | ||
"puid": null, | ||
"fileExtensionMismatch": false, | ||
"formatName": "" | ||
} | ||
], | ||
"containerSignatureFileVersion": "DROID_SignatureFile_V96.xml", | ||
"binarySignatureFileVersion": "container-signature-20200121.xml" | ||
}, | ||
"antivirusMetadata": { | ||
"software": "software", | ||
"softwareVersion": "softwareVersion" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...rc/test/resources/json/get_override_consignment_type_consignment_incomplete_metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"data": { | ||
"getConsignment": { | ||
"seriesName": "override-series", | ||
"exportDatetime": "2021-01-27T13:35:15Z", | ||
"createdDatetime": "2021-01-15T07:47:19Z", | ||
"transferInitiatedDatetime": "2021-01-15T07:47:19Z", | ||
"userid": "b2657adf-6e93-424f-b0f1-aadd26762a96", | ||
"consignmentReference": "consignmentReference-1234", | ||
"consignmentType": "standard", | ||
"includeTopLevelFolder": false, | ||
"transferringBodyName": "override-body", | ||
"files": [ | ||
{ | ||
"fileId": "7b19b272-d4d1-4d77-bf25-511dc6489d12", | ||
"fileName": "name", | ||
"fileType": "File", | ||
"fileMetadata": [ | ||
{ | ||
"name": "ClientSideOriginalFilepath", | ||
"value": "originalPath" | ||
}, | ||
{ | ||
"name": "LegalStatus", | ||
"value": "Public Record" | ||
}, | ||
{ | ||
"name": "ClientSideFileSize", | ||
"value": "1024" | ||
}, | ||
{ | ||
"name": "ClientSideLastModifiedDate", | ||
"value": "2021-01-26T17:10:58.047" | ||
}, | ||
{ | ||
"name": "RightsCopyright", | ||
"value": "Crown Copyright" | ||
}, | ||
{ | ||
"name": "HeldBy", | ||
"value": "TNA" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
.../resources/json/get_override_consignment_type_consignment_missing_antivirus_metadata.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
{ | ||
"data": { | ||
"getConsignment": { | ||
"seriesName": "override-series", | ||
"exportDatetime": "2021-01-27T13:35:15Z", | ||
"createdDatetime": "2021-01-15T07:47:19Z", | ||
"transferInitiatedDatetime": "2021-01-15T07:47:19Z", | ||
"userid": "b2657adf-6e93-424f-b0f1-aadd26762a96", | ||
"consignmentReference": "consignmentReference-1234", | ||
"consignmentType": "standard", | ||
"includeTopLevelFolder": false, | ||
"transferringBodyName": "override-body", | ||
"files": [ | ||
{ | ||
"fileId": "5e271e33-ae7e-4471-9f89-005c5d15c5a1", | ||
"fileName": "name", | ||
"fileType": "File", | ||
"fileMetadata": [ | ||
{ | ||
"name": "ClientSideOriginalFilepath", | ||
"value": "originalPath" | ||
}, | ||
{ | ||
"name": "LegalStatus", | ||
"value": "Public Record" | ||
}, | ||
{ | ||
"name": "ClientSideFileSize", | ||
"value": "1024" | ||
}, | ||
{ | ||
"name": "ClientSideLastModifiedDate", | ||
"value": "2021-01-26T17:10:58.047" | ||
}, | ||
{ | ||
"name": "RightsCopyright", | ||
"value": "Crown Copyright" | ||
}, | ||
{ | ||
"name": "HeldBy", | ||
"value": "TNA" | ||
}, | ||
{ | ||
"name": "FoiExemptionCode", | ||
"value": "open" | ||
}, | ||
{ | ||
"name": "Language", | ||
"value": "English" | ||
}, | ||
{ | ||
"name": "SHA256ClientSideChecksum", | ||
"value": "cd0aa9856147b6c5b4ff2b7dfee5da20aa38253099ef1b4a64aced233c9afe29" | ||
} | ||
], | ||
"ffidMetadata": { | ||
"method": "pronom", | ||
"softwareVersion": "6.5", | ||
"datetime": 1617704135359, | ||
"software": "Droid", | ||
"matches": [ | ||
{ | ||
"extension": null, | ||
"identificationBasis": "", | ||
"puid": null, | ||
"fileExtensionMismatch": false, | ||
"formatName": "" | ||
} | ||
], | ||
"containerSignatureFileVersion": "DROID_SignatureFile_V96.xml", | ||
"binarySignatureFileVersion": "container-signature-20200121.xml" | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
Oops, something went wrong.