Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
de42449c
Commit
de42449c
authored
7 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-3111: implement taxonomy order by for items
parent
3646f05e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/modules/qpool/manager/QItemQueriesDAO.java
+21
-11
21 additions, 11 deletions
.../java/org/olat/modules/qpool/manager/QItemQueriesDAO.java
with
21 additions
and
11 deletions
src/main/java/org/olat/modules/qpool/manager/QItemQueriesDAO.java
+
21
−
11
View file @
de42449c
...
@@ -127,7 +127,7 @@ public class QItemQueriesDAO {
...
@@ -127,7 +127,7 @@ public class QItemQueriesDAO {
}
}
if
(
orderBy
!=
null
&&
orderBy
.
length
>
0
&&
orderBy
[
0
]
!=
null
&&
!
OrderBy
.
marks
.
name
().
equals
(
orderBy
[
0
].
getKey
()))
{
if
(
orderBy
!=
null
&&
orderBy
.
length
>
0
&&
orderBy
[
0
]
!=
null
&&
!
OrderBy
.
marks
.
name
().
equals
(
orderBy
[
0
].
getKey
()))
{
appendOrderBy
(
sb
,
"item"
,
orderBy
);
appendOrderBy
(
sb
,
"item"
,
"taxonomyLevel"
,
orderBy
);
}
}
TypedQuery
<
Object
[]>
query
=
dbInstance
.
getCurrentEntityManager
()
TypedQuery
<
Object
[]>
query
=
dbInstance
.
getCurrentEntityManager
()
...
@@ -210,7 +210,7 @@ public class QItemQueriesDAO {
...
@@ -210,7 +210,7 @@ public class QItemQueriesDAO {
if
(
StringHelper
.
containsNonWhitespace
(
format
))
{
if
(
StringHelper
.
containsNonWhitespace
(
format
))
{
sb
.
append
(
" and item.format=:format"
);
sb
.
append
(
" and item.format=:format"
);
}
}
appendOrderBy
(
sb
,
"item"
,
orderBy
);
appendOrderBy
(
sb
,
"item"
,
"taxonomyLevel"
,
orderBy
);
TypedQuery
<
Object
[]>
query
=
dbInstance
.
getCurrentEntityManager
()
TypedQuery
<
Object
[]>
query
=
dbInstance
.
getCurrentEntityManager
()
.
createQuery
(
sb
.
toString
(),
Object
[].
class
)
.
createQuery
(
sb
.
toString
(),
Object
[].
class
)
...
@@ -306,7 +306,7 @@ public class QItemQueriesDAO {
...
@@ -306,7 +306,7 @@ public class QItemQueriesDAO {
if
(
StringHelper
.
containsNonWhitespace
(
params
.
getFormat
()))
{
if
(
StringHelper
.
containsNonWhitespace
(
params
.
getFormat
()))
{
sb
.
append
(
" and item.format=:format"
);
sb
.
append
(
" and item.format=:format"
);
}
}
appendOrderBy
(
sb
,
"item"
,
orderBy
);
appendOrderBy
(
sb
,
"item"
,
"taxonomyLevel"
,
orderBy
);
TypedQuery
<
Object
[]>
query
=
dbInstance
.
getCurrentEntityManager
()
TypedQuery
<
Object
[]>
query
=
dbInstance
.
getCurrentEntityManager
()
.
createQuery
(
sb
.
toString
(),
Object
[].
class
)
.
createQuery
(
sb
.
toString
(),
Object
[].
class
)
...
@@ -380,7 +380,7 @@ public class QItemQueriesDAO {
...
@@ -380,7 +380,7 @@ public class QItemQueriesDAO {
if
(
StringHelper
.
containsNonWhitespace
(
format
))
{
if
(
StringHelper
.
containsNonWhitespace
(
format
))
{
sb
.
append
(
" and item.format=:format"
);
sb
.
append
(
" and item.format=:format"
);
}
}
appendOrderBy
(
sb
,
"item"
,
orderBy
);
appendOrderBy
(
sb
,
"item"
,
"taxonomyLevel"
,
orderBy
);
TypedQuery
<
Object
[]>
query
=
dbInstance
.
getCurrentEntityManager
()
TypedQuery
<
Object
[]>
query
=
dbInstance
.
getCurrentEntityManager
()
.
createQuery
(
sb
.
toString
(),
Object
[].
class
)
.
createQuery
(
sb
.
toString
(),
Object
[].
class
)
...
@@ -456,7 +456,7 @@ public class QItemQueriesDAO {
...
@@ -456,7 +456,7 @@ public class QItemQueriesDAO {
if
(
StringHelper
.
containsNonWhitespace
(
params
.
getFormat
()))
{
if
(
StringHelper
.
containsNonWhitespace
(
params
.
getFormat
()))
{
sb
.
append
(
" and item.format=:format"
);
sb
.
append
(
" and item.format=:format"
);
}
}
appendOrderBy
(
sb
,
"item"
,
orderBy
);
appendOrderBy
(
sb
,
"item"
,
"taxonomyLevel"
,
orderBy
);
TypedQuery
<
Object
[]>
query
=
dbInstance
.
getCurrentEntityManager
()
TypedQuery
<
Object
[]>
query
=
dbInstance
.
getCurrentEntityManager
()
.
createQuery
(
sb
.
toString
(),
Object
[].
class
)
.
createQuery
(
sb
.
toString
(),
Object
[].
class
)
...
@@ -623,7 +623,7 @@ public class QItemQueriesDAO {
...
@@ -623,7 +623,7 @@ public class QItemQueriesDAO {
}
}
if
(
orderBy
!=
null
&&
orderBy
.
length
>
0
&&
orderBy
[
0
]
!=
null
&&
!
OrderBy
.
marks
.
name
().
equals
(
orderBy
[
0
].
getKey
()))
{
if
(
orderBy
!=
null
&&
orderBy
.
length
>
0
&&
orderBy
[
0
]
!=
null
&&
!
OrderBy
.
marks
.
name
().
equals
(
orderBy
[
0
].
getKey
()))
{
appendOrderBy
(
sb
,
"item"
,
orderBy
);
appendOrderBy
(
sb
,
"item"
,
"taxonomyLevel"
,
orderBy
);
}
}
TypedQuery
<
Object
[]>
query
=
dbInstance
.
getCurrentEntityManager
()
TypedQuery
<
Object
[]>
query
=
dbInstance
.
getCurrentEntityManager
()
...
@@ -710,14 +710,14 @@ public class QItemQueriesDAO {
...
@@ -710,14 +710,14 @@ public class QItemQueriesDAO {
}
}
}
}
private
void
appendOrderBy
(
StringBuilder
sb
,
String
d
bRef
,
SortKey
...
orderBy
)
{
private
void
appendOrderBy
(
StringBuilder
sb
,
String
itemDbRef
,
String
taxonomyD
bRef
,
SortKey
...
orderBy
)
{
if
(
orderBy
!=
null
&&
orderBy
.
length
>
0
&&
orderBy
[
0
]
!=
null
)
{
if
(
orderBy
!=
null
&&
orderBy
.
length
>
0
&&
orderBy
[
0
]
!=
null
)
{
String
sortKey
=
orderBy
[
0
].
getKey
();
String
sortKey
=
orderBy
[
0
].
getKey
();
boolean
asc
=
orderBy
[
0
].
isAsc
();
boolean
asc
=
orderBy
[
0
].
isAsc
();
sb
.
append
(
" order by "
);
sb
.
append
(
" order by "
);
switch
(
sortKey
)
{
switch
(
sortKey
)
{
case
"itemType"
:
case
"itemType"
:
sb
.
append
(
d
bRef
).
append
(
".type.type "
);
sb
.
append
(
itemD
bRef
).
append
(
".type.type "
);
appendAsc
(
sb
,
asc
);
appendAsc
(
sb
,
asc
);
break
;
break
;
case
"marks"
:
case
"marks"
:
...
@@ -732,12 +732,22 @@ public class QItemQueriesDAO {
...
@@ -732,12 +732,22 @@ public class QItemQueriesDAO {
case
"keywords"
:
case
"keywords"
:
case
"coverage"
:
case
"coverage"
:
case
"additionalInformations"
:
case
"additionalInformations"
:
sb
.
append
(
"lower("
).
append
(
d
bRef
).
append
(
"."
).
append
(
sortKey
).
append
(
")"
);
sb
.
append
(
"lower("
).
append
(
itemD
bRef
).
append
(
"."
).
append
(
sortKey
).
append
(
")"
);
appendAsc
(
sb
,
asc
);
appendAsc
(
sb
,
asc
);
sb
.
append
(
" nulls last"
);
sb
.
append
(
" nulls last"
);
break
;
break
;
case
"taxonomyLevel"
:
sb
.
append
(
"lower("
).
append
(
taxonomyDbRef
).
append
(
".displayName)"
);
appendAsc
(
sb
,
asc
);
sb
.
append
(
" nulls last"
);
break
;
case
"taxonomyPath"
:
sb
.
append
(
"lower("
).
append
(
taxonomyDbRef
).
append
(
".materializedPathIdentifiers)"
);
appendAsc
(
sb
,
asc
);
sb
.
append
(
" nulls last"
);
break
;
default
:
default
:
sb
.
append
(
d
bRef
).
append
(
"."
).
append
(
sortKey
);
sb
.
append
(
itemD
bRef
).
append
(
"."
).
append
(
sortKey
);
appendAsc
(
sb
,
asc
);
appendAsc
(
sb
,
asc
);
sb
.
append
(
" nulls last"
);
sb
.
append
(
" nulls last"
);
break
;
break
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment