Search in sources :

Example 1 with EndpointType

use of org.kie.server.remote.rest.common.marker.KieServerEndpoint.EndpointType in project droolsjbpm-integration by kiegroup.

the class ReadOnlySwaggerDecoration method decorateOperation.

@Override
public void decorateOperation(Operation operation, Method method, Iterator<SwaggerExtension> chain) {
    if (method.isAnnotationPresent(GET.class)) {
        operation.setVendorExtension(SWAGGER_EXTENSION_READ_ONLY, Boolean.TRUE);
        if (chain.hasNext()) {
            chain.next().decorateOperation(operation, method, chain);
        }
        return;
    }
    KieServerEndpoint api = method.getAnnotation(KieServerEndpoint.class);
    if (api == null) {
        api = method.getDeclaringClass().getAnnotation(KieServerEndpoint.class);
    }
    if (api != null) {
        List<EndpointType> current = new ArrayList<>(asList(api.categories()));
        current.retainAll(valid);
        if (!current.isEmpty()) {
            operation.setVendorExtension(SWAGGER_EXTENSION_READ_ONLY, Boolean.TRUE);
        }
    }
    if (chain.hasNext()) {
        chain.next().decorateOperation(operation, method, chain);
    }
}
Also used : KieServerEndpoint(org.kie.server.remote.rest.common.marker.KieServerEndpoint) EndpointType(org.kie.server.remote.rest.common.marker.KieServerEndpoint.EndpointType) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 KieServerEndpoint (org.kie.server.remote.rest.common.marker.KieServerEndpoint)1 EndpointType (org.kie.server.remote.rest.common.marker.KieServerEndpoint.EndpointType)1