Search in sources :

Example 1 with WorkflowService

use of org.apache.syncope.common.rest.api.service.WorkflowService in project syncope by apache.

the class WorkflowRestClient method getDiagram.

public byte[] getDiagram(final String key) {
    WorkflowService service = getService(WorkflowService.class);
    WebClient.client(service).accept(RESTHeaders.MEDIATYPE_IMAGE_PNG);
    Response response = service.exportDiagram(AnyTypeKind.USER.name(), key);
    byte[] diagram;
    try {
        diagram = IOUtils.readBytesFromStream((InputStream) response.getEntity());
    } catch (Exception e) {
        LOG.error("Could not get workflow diagram", e);
        diagram = new byte[0];
    }
    return diagram;
}
Also used : Response(javax.ws.rs.core.Response) WorkflowService(org.apache.syncope.common.rest.api.service.WorkflowService) InputStream(java.io.InputStream)

Aggregations

InputStream (java.io.InputStream)1 Response (javax.ws.rs.core.Response)1 WorkflowService (org.apache.syncope.common.rest.api.service.WorkflowService)1