@@ -5,8 +5,9 @@ import com.indico.IndicoClient
55import com.indico.exceptions.IndicoMutationException
66import com.indico.graphql.WorkflowSubmissionGraphQL
77import com.indico.graphql.inputs.FileInput
8+ import com.indico.graphql.enums.SubmissionResultVersion as GraphQlResultVersion
9+ import com.indico.type.SubmissionResultVersion
810import org.apache.logging.log4j.LogManager
9- import org.json.JSONArray
1011import java.io.IOException
1112import java.util.*
1213
@@ -15,6 +16,7 @@ class WorkflowSubmission(private val client: IndicoClient) : Mutation<List<Int?>
1516 private var id = 0
1617 private var duplicationId: UUID ? = null
1718 private var streams: Map <String , ByteArray >? = null
19+ private var resultFileVersion: SubmissionResultVersion ? = null
1820 private val logger = LogManager .getLogger(javaClass)
1921
2022 /* *
@@ -58,12 +60,16 @@ class WorkflowSubmission(private val client: IndicoClient) : Mutation<List<Int?>
5860 return this
5961 }
6062
63+ fun resultFileVersion (version : SubmissionResultVersion ? ): WorkflowSubmission {
64+ resultFileVersion = version
65+ return this
66+ }
67+
6168 /* *
6269 * Executes request and returns Submissions
6370 * @return Integer List
6471 */
6572 override fun execute (): List <Int ?>? {
66- var fileMetadata: JSONArray
6773 val files: MutableList <FileInput > = ArrayList <FileInput >()
6874 try {
6975 if (this .files != null ) {
@@ -78,10 +84,18 @@ class WorkflowSubmission(private val client: IndicoClient) : Mutation<List<Int?>
7884 if (duplicationId == null ) {
7985 duplicationId = UUID .randomUUID()
8086 }
87+
88+ val resultVersion =
89+ if (resultFileVersion != null )
90+ OptionalInput .Defined (GraphQlResultVersion .valueOf(resultFileVersion.toString()))
91+ else OptionalInput .Undefined
92+
8193 return try {
8294 val call = WorkflowSubmissionGraphQL (
8395 WorkflowSubmissionGraphQL .Variables (
84- files = files, workflowId = id, duplicationId = OptionalInput .Defined (duplicationId.toString())))
96+ files = files, workflowId = id, duplicationId = OptionalInput .Defined (duplicationId.toString()),
97+ resultVersion = resultVersion
98+ ))
8599 val response = client.execute(call)
86100 handleErrors(response)
87101 val workflowSubmission = response.data!! .workflowSubmission!!
@@ -95,4 +109,4 @@ class WorkflowSubmission(private val client: IndicoClient) : Mutation<List<Int?>
95109 throw IndicoMutationException (" Call to submit submission failed" , ex)
96110 }
97111 }
98- }
112+ }
0 commit comments