Skip to content

Commit

Permalink
RESTful service to update Study Access Control ID of matching Studies d…
Browse files Browse the repository at this point in the history
  • Loading branch information
vrindanayak committed Mar 29, 2019
1 parent 72276a4 commit f7955f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,30 +173,20 @@ public Response updateStudyAccessControlID(
try {
ArchiveDeviceExtension arcDev = device.getDeviceExtensionNotNull(ArchiveDeviceExtension.class);
QueryContext qCtx = queryContext(ae);
String warning = null;
int count = 0;
Response.Status status = Response.Status.ACCEPTED;
try (Query query = queryService.createQuery(qCtx)) {
query.beginTransaction();
try {
query.executeQuery(arcDev.getQueryFetchSize());
while (query.hasMoreMatches()) {
Attributes match = query.nextMatch();
StudyMgtContext ctx = studyService.createStudyMgtContextWEB(request, ae);
ctx.setStudyInstanceUID(match.getString(Tag.StudyInstanceUID));
ctx.setAccessControlID("null".equals(accessControlID) ? "*" : accessControlID);
studyService.updateAccessControlID(ctx);
count++;
}
} catch (Exception e) {
warning = e.getMessage();
status = Response.Status.INTERNAL_SERVER_ERROR;
query.executeQuery(arcDev.getQueryFetchSize());
while (query.hasMoreMatches()) {
Attributes match = query.nextMatch();
StudyMgtContext ctx = studyService.createStudyMgtContextWEB(request, ae);
ctx.setStudyInstanceUID(match.getString(Tag.StudyInstanceUID));
ctx.setAccessControlID("null".equals(accessControlID) ? "*" : accessControlID);
studyService.updateAccessControlID(ctx);
count++;
}
}
Response.ResponseBuilder builder = Response.status(status);
if (warning != null)
builder.header("Warning", warning);
return builder.entity("{\"count\":" + count + '}').build();
return Response.ok("{\"count\":" + count + '}').build();
} catch (Exception e) {
return errResponseAsTextPlain(e);
}
Expand Down
7 changes: 5 additions & 2 deletions dcm4chee-arc-ui2/src/swagger/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -8009,8 +8009,11 @@
}
],
"responses": {
"204": {
"description": "successful operation"
"200": {
"description": "Study Access Control ID successfully updated",
"schema": {
"$ref": "#/definitions/Count"
}
},
"404": {
"description": "No such Archive AE Title"
Expand Down

0 comments on commit f7955f8

Please sign in to comment.