Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
adapt
ace
Commits
34f9c264
Commit
34f9c264
authored
Feb 27, 2017
by
Michael Ritter
Browse files
Add query parameter for auditing corrupt files only
parent
01f82774
Changes
1
Show whitespace changes
Inline
Side-by-side
ace-am/src/main/java/edu/umiacs/ace/rest/CollectionManagement.java
View file @
34f9c264
...
...
@@ -22,11 +22,13 @@ import javax.persistence.EntityTransaction;
import
javax.persistence.Query
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.ws.rs.Consumes
;
import
javax.ws.rs.DefaultValue
;
import
javax.ws.rs.GET
;
import
javax.ws.rs.POST
;
import
javax.ws.rs.Path
;
import
javax.ws.rs.PathParam
;
import
javax.ws.rs.Produces
;
import
javax.ws.rs.QueryParam
;
import
javax.ws.rs.core.Context
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
...
...
@@ -70,7 +72,8 @@ public class CollectionManagement {
@POST
@Path
(
"audit/{id}"
)
public
Response
startAudit
(
@PathParam
(
"id"
)
long
id
)
{
public
Response
startAudit
(
@PathParam
(
"id"
)
long
id
,
@DefaultValue
(
"false"
)
@QueryParam
(
"corrupt"
)
String
corrupt
)
{
boolean
auditCorrupt
=
Boolean
.
getBoolean
(
corrupt
);
EntityManager
em
=
PersistUtil
.
getEntityManager
();
Collection
c
=
em
.
find
(
Collection
.
class
,
id
);
if
(
c
==
null
)
{
...
...
@@ -84,6 +87,13 @@ public class CollectionManagement {
// We use a null item so that the entire collection gets audited
MonitoredItem
[]
item
=
null
;
if
(
auditCorrupt
)
{
// todo: might be able to put this in some type of service class
Query
query
=
em
.
createNamedQuery
(
"MonitoredItem.listLocalErrors"
);
query
.
setParameter
(
"coll"
,
c
);
List
<
MonitoredItem
>
resList
=
query
.
getResultList
();
item
=
resList
.
toArray
(
new
MonitoredItem
[
resList
.
size
()]);
}
AuditThreadFactory
.
createThread
(
c
,
driver
,
true
,
item
);
return
Response
.
ok
().
build
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment