Skip to content

Commit

Permalink
Fix dcm4che#2013 : Reschedule bulk tasks audit : Include number of ta…
Browse files Browse the repository at this point in the history
…sks which failed to be rescheduled in ParticipantObjectDetail
  • Loading branch information
vrindanayak committed Jun 5, 2019
1 parent 685ab18 commit 651d5bf
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class AuditInfo {
static final int PAT_VERIFICATION_STATUS = 32;
static final int PDQ_SERVICE_URI = 33;
static final int IMPAX_ENDPOINT = 34;
static final int FAILED = 35;

private final String[] fields;

Expand Down Expand Up @@ -122,7 +123,8 @@ class AuditInfo {
i.connType != null ? i.connType.name() : null,
i.patVerificationStatus != null ? i.patVerificationStatus.name() : null,
i.pdqServiceURI,
i.impaxEndpoint
i.impaxEndpoint,
String.valueOf(i.failed)
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class AuditInfoBuilder {
final Patient.VerificationStatus patVerificationStatus;
final String pdqServiceURI;
final String impaxEndpoint;
final int failed;

static class Builder {
private String callingHost;
Expand Down Expand Up @@ -126,6 +127,7 @@ static class Builder {
private Patient.VerificationStatus patVerificationStatus;
private String pdqServiceURI;
private String impaxEndpoint;
private int failed;

Builder callingHost(String val) {
callingHost = val;
Expand Down Expand Up @@ -282,6 +284,10 @@ Builder impaxEndpoint(String val) {
impaxEndpoint = val;
return this;
}
Builder failed(int val) {
failed = val;
return this;
}
AuditInfoBuilder build() {
return new AuditInfoBuilder(this);
}
Expand Down Expand Up @@ -323,6 +329,7 @@ private AuditInfoBuilder(Builder builder) {
patVerificationStatus = builder.patVerificationStatus;
pdqServiceURI = builder.pdqServiceURI;
impaxEndpoint = builder.impaxEndpoint;
failed = builder.failed;
}

private static String toPID(IDWithIssuer pidWithIssuer, ArchiveDeviceExtension arcDev) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ static AuditInfoBuilder bulkQueueMsgAuditInfo(BulkQueueMessageEvent bulkQueueMsg
.outcome(outcome(bulkQueueMsgEvent.getException()))
.filters(req.getQueryString())
.count(bulkQueueMsgEvent.getCount())
.failed(bulkQueueMsgEvent.getFailed())
.taskPOID(bulkQueueMsgEvent.getOperation().name())
.build();
}
Expand Down Expand Up @@ -139,7 +140,8 @@ private static ParticipantObjectIdentificationBuilder buildTasksPOI(AuditInfo in
AuditMessages.ParticipantObjectTypeCode.SystemObject,
null)
.detail(AuditMessages.createParticipantObjectDetail("Filters", info.getField(AuditInfo.FILTERS)),
AuditMessages.createParticipantObjectDetail("Count", info.getField(AuditInfo.COUNT)))
AuditMessages.createParticipantObjectDetail("Count", info.getField(AuditInfo.COUNT)),
AuditMessages.createParticipantObjectDetail("Failed", info.getField(AuditInfo.FAILED)))
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ private Response rescheduleValidTasks(TaskQueryParam queueTaskQueryParam, TaskQu
queueEvent.setException(e);
throw e;
} finally {
queueEvent.setFailed(failed);
bulkQueueMsgEvent.fire(queueEvent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public class BulkQueueMessageEvent {
private final HttpServletRequest request;
private final QueueMessageOperation operation;
private long count;
private int failed;
private Exception exception;

public BulkQueueMessageEvent(HttpServletRequest request, QueueMessageOperation operation) {
Expand All @@ -34,6 +35,14 @@ public void setCount(long count) {
this.count = count;
}

public int getFailed() {
return failed;
}

public void setFailed(int failed) {
this.failed = failed;
}

public Exception getException() {
return exception;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ private Response rescheduleValidMessages(TaskQueryParam queueTaskQueryParam) {
queueEvent.setException(e);
throw e;
} finally {
queueEvent.setFailed(failed);
bulkQueueMsgEvent.fire(queueEvent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ private Response rescheduleValidTasks(TaskQueryParam queueTaskQueryParam, TaskQu
queueEvent.setException(e);
throw e;
} finally {
queueEvent.setFailed(failed);
bulkQueueMsgEvent.fire(queueEvent);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ private Response rescheduleValidTasks(TaskQueryParam queueTaskQueryParam, TaskQu
queueEvent.setException(e);
throw e;
} finally {
queueEvent.setFailed(failed);
bulkQueueMsgEvent.fire(queueEvent);
}

Expand Down

0 comments on commit 651d5bf

Please sign in to comment.