use of org.sonatype.siesta.Resource in project concord by walmartlabs.
the class ProcessResource method listAttachments.
/**
* Lists process attachments.
*
* @param instanceId
* @return
*/
@GET
@ApiOperation(value = "List attachments", responseContainer = "list", response = String.class)
@javax.ws.rs.Path("/{id}/attachment")
@Produces(MediaType.APPLICATION_JSON)
@WithTimer
public List<String> listAttachments(@ApiParam @PathParam("id") UUID instanceId) {
ProcessEntry processEntry = processManager.assertProcess(instanceId);
assertProcessAccess(processEntry, "attachments");
PartialProcessKey processKey = new ProcessKey(processEntry.instanceId(), processEntry.createdAt());
String resource = Constants.Files.JOB_ATTACHMENTS_DIR_NAME + "/";
List<String> l = stateManager.list(processKey, resource);
return l.stream().map(s -> s.substring(resource.length())).collect(Collectors.toList());
}
Aggregations