Skip to content

Commit

Permalink
IJMP-1496-Jobs-Sort
Browse files Browse the repository at this point in the history
  • Loading branch information
ATsikhamirau committed Feb 6, 2024
1 parent 0152e2c commit e5e3743
Show file tree
Hide file tree
Showing 26 changed files with 1,727 additions and 1,384 deletions.
20 changes: 20 additions & 0 deletions src/main/kotlin/eu/ibagroup/formainframe/dataops/SortableQuery.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright IBA Group 2020
*/

package eu.ibagroup.formainframe.dataops

import eu.ibagroup.formainframe.dataops.sort.SortQueryKeys

/**
* Interface identifies what query is SortableQuery
*/
interface SortableQuery {
val sortKeys : List<SortQueryKeys>
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
package eu.ibagroup.formainframe.dataops

import eu.ibagroup.formainframe.config.connect.ConnectionConfigBase
import eu.ibagroup.formainframe.config.ws.JobsFilter
import eu.ibagroup.formainframe.dataops.fetch.UssQuery
import eu.ibagroup.formainframe.dataops.sort.SortQueryKeys
import eu.ibagroup.formainframe.explorer.ui.UssNode
import eu.ibagroup.formainframe.utils.UNIT_CLASS

Expand All @@ -19,27 +22,15 @@ import eu.ibagroup.formainframe.utils.UNIT_CLASS
*/
data class UnitRemoteQueryImpl<Connection: ConnectionConfigBase, R>(
override val request: R,
override val connectionConfig: Connection
) : RemoteQuery<Connection, R, Unit> {
val sortKeys = mutableListOf(SortQueryKeys.DATE, SortQueryKeys.ASCENDING)
var requester: UssNode? = null
override val connectionConfig: Connection,
) : RemoteQuery<Connection, R, Unit>, SortableQuery {
override val resultClass: Class<out Unit>
get() = UNIT_CLASS
}

/**
* Enum class represents the sorting keys which is currently enabled for particular Node
*/
enum class SortQueryKeys(private val sortType: String) {
NAME("name"),
TYPE("type"),
DATE("date"),
NONE("none"),
ASCENDING("ascending"),
DESCENDING("descending");

override fun toString(): String {
return sortType
}

override val sortKeys: List<SortQueryKeys>
get() = when(request) {
is UssQuery -> mutableListOf(SortQueryKeys.FILE_MODIFICATION_DATE, SortQueryKeys.ASCENDING)
is JobsFilter -> mutableListOf(SortQueryKeys.JOB_CREATION_DATE, SortQueryKeys.ASCENDING)
// TODO: Add sort query keys for other queries when implemented
else -> mutableListOf()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Copyright IBA Group 2020
*/
package eu.ibagroup.formainframe.dataops.sort

/**
* Enum class represents the sorting keys which is currently enabled for particular Node
*/
enum class SortQueryKeys(private val sortType: String) {
FILE_NAME("uss_file_name"),
FILE_TYPE("uss_type"),
FILE_MODIFICATION_DATE("uss_modification_date"),
JOB_NAME("Job Name"),
JOB_CREATION_DATE("Job Creation Date"),
JOB_COMPLETION_DATE("Job Completion Date"),
JOB_STATUS("Job Status"),
JOB_OWNER("Job Owner"),
JOB_ID("Job ID"),
ASCENDING("Ascending"),
DESCENDING("Descending");

override fun toString(): String {
return sortType
}
}

val typedSortKeys : List<SortQueryKeys> by lazy {
return@lazy listOf(SortQueryKeys.FILE_NAME, SortQueryKeys.FILE_TYPE, SortQueryKeys.FILE_MODIFICATION_DATE, SortQueryKeys.JOB_NAME, SortQueryKeys.JOB_ID, SortQueryKeys.JOB_OWNER, SortQueryKeys.JOB_STATUS, SortQueryKeys.JOB_CREATION_DATE, SortQueryKeys.JOB_COMPLETION_DATE)
}

val orderingSortKeys : List<SortQueryKeys> by lazy {
return@lazy listOf(SortQueryKeys.ASCENDING, SortQueryKeys.DESCENDING)
}
Loading

0 comments on commit e5e3743

Please sign in to comment.