Search in sources :

Example 1 with QUERY_PARAM_FILTER

use of io.jans.scim.model.scim2.Constants.QUERY_PARAM_FILTER in project jans by JanssenProject.

the class ReferenceURIInterceptor method manage.

@AroundInvoke
public Object manage(InvocationContext ctx) throws Exception {
    Object[] params = ctx.getParameters();
    Annotation[][] annotations = ctx.getMethod().getParameterAnnotations();
    for (int i = 0; i < annotations.length; i++) {
        // Iterate over annotations found at every parameter
        for (Annotation annotation : annotations[i]) {
            if (annotation instanceof QueryParam) {
                String paramName = ((QueryParam) annotation).value();
                if ((paramName.equals(QUERY_PARAM_FILTER) || paramName.equals(QUERY_PARAM_ATTRIBUTES) || paramName.equals(QUERY_PARAM_EXCLUDED_ATTRS))) {
                    log.trace("Removing '$' char (if any) from {} param", paramName);
                    params[i] = dropDollar(params[i]);
                }
            }
        }
        if (params[i] != null && params[i] instanceof SearchRequest) {
            log.trace("Removing '$' char (if any) from SearchRequest object");
            SearchRequest sr = (SearchRequest) params[i];
            sr.setAttributes(dropDollar(sr.getAttributesStr()));
            sr.setExcludedAttributes(dropDollar(sr.getExcludedAttributesStr()));
            sr.setFilter(dropDollar(sr.getFilter()));
        }
    }
    log.debug("ReferenceURIInterceptor. manage exit");
    return ctx.proceed();
}
Also used : SearchRequest(io.jans.scim.model.scim2.SearchRequest) QueryParam(javax.ws.rs.QueryParam) Annotation(java.lang.annotation.Annotation) AroundInvoke(javax.interceptor.AroundInvoke)

Aggregations

SearchRequest (io.jans.scim.model.scim2.SearchRequest)1 Annotation (java.lang.annotation.Annotation)1 AroundInvoke (javax.interceptor.AroundInvoke)1 QueryParam (javax.ws.rs.QueryParam)1