Skip to content

Commit 53eb65c

Browse files
committed
HibernateSearchMeta.getSearchFields adds now additionalSearchFields of dao.
1 parent f1e14a3 commit 53eb65c

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

projectforge-business/src/main/kotlin/org/projectforge/framework/persistence/api/impl/HibernateSearchMeta.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,21 @@ private val log = KotlinLogging.logger {}
3232
object HibernateSearchMeta {
3333
private val classInfos = mutableMapOf<Class<*>, HibernateSearchClassInfo>()
3434

35+
/**
36+
* Used by Wicket list pages to show the search fields in tooltips.
37+
*/
3538
fun getSearchFields(dao: IDao<*>): Array<String>? {
3639
if (dao !is BaseDao) return null
37-
return ensureClassInfo(dao).allFieldNames
40+
val additionalFields = dao.additionalSearchFields
41+
return if (additionalFields.isNullOrEmpty()) {
42+
ensureClassInfo(dao).allFieldNames
43+
} else {
44+
// merge and sort
45+
(ensureClassInfo(dao).allFieldNames + additionalFields)
46+
.distinct()
47+
.sorted()
48+
.toTypedArray()
49+
}
3850
}
3951

4052
fun getClassInfo(baseDO: Class<*>): HibernateSearchClassInfo {

0 commit comments

Comments
 (0)