public void setAnswerService(AnswerService answerService) {
this.answerService = answerService;
}
public DeleteAnswersResponseType deleteAnswers(AttributedURIType address, DeleteAnswersType parameters) {
DeleteAnswersResponseType response = new DeleteAnswersResponseType();
try {
String careUnit = parameters.getCareUnitId().getExtension();
log.debug("DeleteAnswers called for careunit:" + careUnit);
List<String> idValues = parameters.getAnswerId();
Set<Long> ids = newHashSet();
for (String idValue : idValues) {
ids.add(Long.parseLong(idValue));
}
answerService.deleteAnswersForCareUnit(careUnit, ids);
log.debug(ids.size() + " answers deleted for careunit:" + careUnit);
response.setResult(new ResultOfCall());
response.getResult().setResultCode(ResultCodeEnum.OK);
} catch (Exception e) {
log.warn("Error handling DeleteAnswer message", e);
// FIXME: Improved error handling
response.setResult(new ResultOfCall());
response.getResult().setErrorText(e.getMessage());
response.getResult().setResultCode(ResultCodeEnum.ERROR);
}
return response;
}