Sped up parsing allowed job names

This commit is contained in:
dankito 2020-05-18 23:20:54 +02:00
parent 2401b0e85c
commit bd77a8b6f4
1 changed files with 6 additions and 2 deletions

View File

@ -257,11 +257,11 @@ open class ResponseParser @JvmOverloads constructor(
protected open fun parseAllowedJobNames(dataElementGroups: List<String>): List<String> {
return dataElementGroups.mapNotNull { parseAllowedJobName(it) }
return dataElementGroups.filterNot { it.isEmpty() }.mapNotNull { parseAllowedJobName(it) }
}
protected open fun parseAllowedJobName(dataElementGroup: String): String? {
val dataElements = getDataElements(dataElementGroup)
val dataElements = getDataElementsThatContainsNoMaskSeparators(dataElementGroup)
if (dataElements.size > 0) {
val jobName = parseString(dataElements[0])
@ -704,6 +704,10 @@ open class ResponseParser @JvmOverloads constructor(
}
protected open fun getDataElementsThatContainsNoMaskSeparators(dataElementGroup: String): List<String> {
return dataElementGroup.split(Separators.DataElementsSeparator)
}
protected open fun getDataElements(dataElementGroup: String): List<String> {
return splitIntoPartsAndUnmask(dataElementGroup, Separators.DataElementsSeparator)
}