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
e7fa041f
Commit
e7fa041f
authored
4 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-4768: use the method in DAO to calculate revisions size
parent
995f092d
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/restapi/system/VFSStatsWebService.java
+4
-12
4 additions, 12 deletions
...main/java/org/olat/restapi/system/VFSStatsWebService.java
with
4 additions
and
12 deletions
src/main/java/org/olat/restapi/system/VFSStatsWebService.java
+
4
−
12
View file @
e7fa041f
...
...
@@ -19,8 +19,6 @@
*/
package
org.olat.restapi.system
;
import
java.util.List
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.Produces
;
import
javax.ws.rs.core.MediaType
;
...
...
@@ -28,6 +26,7 @@ import javax.ws.rs.core.Response;
import
org.olat.core.CoreSpringFactory
;
import
org.olat.core.commons.persistence.DB
;
import
org.olat.core.commons.services.vfs.manager.VFSRevisionDAO
;
import
org.olat.restapi.system.vo.VFSStatsVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -42,6 +41,8 @@ public class VFSStatsWebService {
@Autowired
private
DB
dbInstance
;
@Autowired
private
VFSRevisionDAO
vfsRevisionDAO
;
public
VFSStatsWebService
()
{
CoreSpringFactory
.
autowireObject
(
this
);
...
...
@@ -50,19 +51,10 @@ public class VFSStatsWebService {
@GET
@Produces
({
MediaType
.
APPLICATION_XML
,
MediaType
.
APPLICATION_JSON
})
public
Response
getRevisionSizeXML
()
{
StringBuilder
sb
=
new
StringBuilder
(
256
);
sb
.
append
(
"select SUM(size) from vfsrevision"
);
List
<
Long
>
revisionsSize
=
dbInstance
.
getCurrentEntityManager
()
.
createQuery
(
sb
.
toString
(),
Long
.
class
)
.
getResultList
();
Long
size
=
revisionsSize
==
null
||
revisionsSize
.
isEmpty
()
?
Long
.
valueOf
(
0
)
:
revisionsSize
.
get
(
0
);
long
size
=
vfsRevisionDAO
.
calculateRevisionsSize
();
dbInstance
.
commitAndCloseSession
();
VFSStatsVO
vo
=
new
VFSStatsVO
(
size
);
return
Response
.
ok
(
vo
).
build
();
}
}
\ No newline at end of file
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