use of fi.otavanopisto.muikku.plugins.workspace.model.WorkspaceMaterialAudioFieldAnswerClip in project muikku by otavanopisto.
the class WorkspaceAudioFieldIOHandler method retrieve.
@Override
public String retrieve(WorkspaceMaterialField field, WorkspaceMaterialReply reply) throws WorkspaceFieldIOException {
List<Clip> result = new ArrayList<>();
WorkspaceMaterialAudioFieldAnswer fieldAnswer = workspaceMaterialFieldAnswerController.findWorkspaceMaterialAudioFieldAnswerByFieldAndReply(field, reply);
if (fieldAnswer != null) {
List<WorkspaceMaterialAudioFieldAnswerClip> answerClips = workspaceMaterialFieldAnswerController.listWorkspaceMaterialAudioFieldAnswerClipsByFieldAnswer(fieldAnswer);
for (WorkspaceMaterialAudioFieldAnswerClip answerClip : answerClips) {
result.add(new Clip(answerClip.getClipId(), answerClip.getFileName(), answerClip.getContentType()));
}
}
try {
return new ObjectMapper().writeValueAsString(result);
} catch (IOException e) {
throw new WorkspaceFieldIOException("Could not marshal audio audio response", e);
}
}
Aggregations