-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexport-production-full-text.ps1
107 lines (96 loc) · 3.7 KB
/
export-production-full-text.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
. "$global:rootDir\Helpers\EndpointsClass.ps1"
. "$global:rootDir\Helpers\WriteInformationClass.ps1"
. "$global:rootDir\Helpers\BaseExportService.ps1"
# Your workspace ID: this is where we point to the workspace where we want to export from
[int]$workspaceId = 1022188
# Export settings parameters
# Your production set ID
[int]$productionId = 1040261
# ArtifactIds: Example: 1003668 - Extracted Text, 1003677 - Folder Name, 1003676 - Artifact ID, 1003667 - Control Number
$fulltextPrecedenceFieldsArtifactIds = '[1003668,1003677]'
$fieldArtifactIds = '[1003676,1003667]'
# Job related data
$jobId = New-Guid
[string]$applicationName = "Export-Service-Sample-Powershell"
[string]$applicationId = "Sample-Job-" + $MyInvocation.MyCommand.Name.Replace(".ps1", "")
# Export job settings
[string]$exportJobSettings =
'{
"settings": {
"ExportSourceSettings": {
"ArtifactTypeID":10,
"ExportSourceType":0,
"ExportSourceArtifactID":' + $productionId + ',
"ViewID":1,
"StartAtDocumentNumber":1
},
"ExportArtifactSettings": {
"FileNamePattern":"{identifier}",
"ExportNative":false,
"ExportPdf":false,
"ExportImages":false,
"ExportFullText":true,
"ExportMultiChoicesAsNested":false,
"FullTextExportSettings": {
"ExportFullTextAsFile":true,
"TextFileEncoding":"utf-8",
"PrecedenceFieldsArtifactIDs":' + $fulltextPrecedenceFieldsArtifactIds + '
},
"FieldArtifactIDs":' + $fieldArtifactIds + ',
"ApplyFileNamePatternToImages":false
},
"ExportOutputSettings": {
"LoadFileSettings": {
"LoadFileFormat":"CSV",
"ImageLoadFileFormat":"IPRO",
"PdfLoadFileFormat":"IPRO_FullText",
"Encoding":"utf-8",
"DelimitersSettings": {
"NestedValueDelimiter":"B",
"RecordDelimiter":"E",
"QuoteDelimiter":"D",
"NewlineDelimiter":"C",
"MultiRecordDelimiter":"A"
},
"ExportMsAccess": false
},
"VolumeSettings": {
"VolumePrefix":"VOL_FOLDER",
"VolumeStartNumber":"1",
"VolumeMaxSizeInMegabytes":100,
"VolumeDigitPadding":5
},
"SubdirectorySettings": {
"SubdirectoryStartNumber":1,
"MaxNumberOfFilesInDirectory":100,
"ImageSubdirectoryPrefix":"IMAGE_",
"NativeSubdirectoryPrefix":"NATIVE_",
"FullTextSubdirectoryPrefix":"FULLTEXT_",
"PdfSubdirectoryPrefix":"PDF_",
"SubdirectoryDigitPadding":5
},
"CreateArchive":false,
"FolderStructure":0
}
},
"applicationName":"' + $applicationName + '",
"correlationID":"' + $applicationId + '"
}'
# Create, run export job and display export job result
$global:Endpoints = [Endpoints]::new($workspaceId)
$global:WriteInformation = [WriteInformation]::new()
$global:BaseExportService = [BaseExportService]::new()
Context "Exports fulltext from production" {
Describe "Create export job" {
$global:BaseExportService.createExportJob($jobId, $exportJobSettings)
}
Describe "Start export job" {
$global:BaseExportService.startExportJob($jobId)
}
Describe "Wait for export job to be completed" {
$global:BaseExportService.waitForExportJobToBeCompleted($jobId)
}
Describe "Export job summary" {
$global:BaseExportService.exportJobResult($jobId)
}
}