Search in sources :

Example 1 with WorkflowDefinitionFormat

use of org.apache.syncope.core.workflow.api.WorkflowDefinitionFormat in project syncope by apache.

the class WorkflowServiceImpl method set.

@Override
public void set(final String anyType, final String key, final String definition) {
    WorkflowDefinitionFormat format = messageContext.getHttpHeaders().getMediaType().equals(MediaType.APPLICATION_JSON_TYPE) ? WorkflowDefinitionFormat.JSON : WorkflowDefinitionFormat.XML;
    logic.importDefinition(anyType, key, format, definition);
}
Also used : WorkflowDefinitionFormat(org.apache.syncope.core.workflow.api.WorkflowDefinitionFormat)

Example 2 with WorkflowDefinitionFormat

use of org.apache.syncope.core.workflow.api.WorkflowDefinitionFormat in project syncope by apache.

the class WorkflowServiceImpl method get.

@Override
public Response get(final String anyType, final String key) {
    WorkflowDefinitionFormat format = messageContext.getHttpHeaders().getAcceptableMediaTypes().contains(MediaType.APPLICATION_JSON_TYPE) ? WorkflowDefinitionFormat.JSON : WorkflowDefinitionFormat.XML;
    StreamingOutput sout = (os) -> logic.exportDefinition(anyType, key, format, os);
    return Response.ok(sout).type(format == WorkflowDefinitionFormat.JSON ? MediaType.APPLICATION_JSON_TYPE : MediaType.APPLICATION_XHTML_XML_TYPE).build();
}
Also used : List(java.util.List) MediaType(javax.ws.rs.core.MediaType) Response(javax.ws.rs.core.Response) WorkflowDefinitionTO(org.apache.syncope.common.lib.to.WorkflowDefinitionTO) WorkflowDefinitionFormat(org.apache.syncope.core.workflow.api.WorkflowDefinitionFormat) Service(org.springframework.stereotype.Service) Autowired(org.springframework.beans.factory.annotation.Autowired) StreamingOutput(javax.ws.rs.core.StreamingOutput) RESTHeaders(org.apache.syncope.common.rest.api.RESTHeaders) WorkflowService(org.apache.syncope.common.rest.api.service.WorkflowService) WorkflowLogic(org.apache.syncope.core.logic.WorkflowLogic) StreamingOutput(javax.ws.rs.core.StreamingOutput) WorkflowDefinitionFormat(org.apache.syncope.core.workflow.api.WorkflowDefinitionFormat)

Aggregations

WorkflowDefinitionFormat (org.apache.syncope.core.workflow.api.WorkflowDefinitionFormat)2 List (java.util.List)1 MediaType (javax.ws.rs.core.MediaType)1 Response (javax.ws.rs.core.Response)1 StreamingOutput (javax.ws.rs.core.StreamingOutput)1 WorkflowDefinitionTO (org.apache.syncope.common.lib.to.WorkflowDefinitionTO)1 RESTHeaders (org.apache.syncope.common.rest.api.RESTHeaders)1 WorkflowService (org.apache.syncope.common.rest.api.service.WorkflowService)1 WorkflowLogic (org.apache.syncope.core.logic.WorkflowLogic)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Service (org.springframework.stereotype.Service)1