Formatted project

Change-Id: I6993ddfab02e06541b4138040280a4777c719562
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/AuthenticationController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/AuthenticationController.java
index a777131..0b40e33 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/AuthenticationController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/AuthenticationController.java
@@ -54,19 +54,19 @@
  * @author margaretha
  * @last-update 01/07/2019
  * 
- * - added user authentication time in token context
- * - added api version filter
- * - changed the response media-type 
+ *              - added user authentication time in token context
+ *              - added api version filter
+ *              - changed the response media-type
  */
 @Controller
 @Path("/{version}/auth")
-@ResourceFilters({APIVersionFilter.class, PiwikFilter.class })
+@ResourceFilters({ APIVersionFilter.class, PiwikFilter.class })
 @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
 public class AuthenticationController {
 
     @Autowired
     private KustvaktResponseHandler kustvaktResponseHandler;
-    
+
     @Autowired
     private HttpAuthorizationHandler authorizationHandler;
 
@@ -74,8 +74,8 @@
 
     //todo: bootstrap function to transmit certain default configuration settings and examples (example user queries,
     // default usersettings, etc.)
-    private static Logger jlog =
-            LogManager.getLogger(AuthenticationController.class);
+    private static Logger jlog = LogManager
+            .getLogger(AuthenticationController.class);
 
     @Autowired
     private AuthenticationManager controller;
@@ -108,7 +108,6 @@
         }
     }
 
-
     // fixme: moved to user
     @GET
     @Path("status")
@@ -126,45 +125,44 @@
             throw kustvaktResponseHandler.throwit(e);
         }
     }
-    
-    // EM: testing using spring security authentication manager
-//    @Deprecated
-//    @GET
-//    @Path("ldap/token")
-//    public Response requestToken (@Context HttpHeaders headers,
-//            @Context Locale locale,
-//            @HeaderParam(ContainerRequest.USER_AGENT) String agent,
-//            @HeaderParam(ContainerRequest.HOST) String host,
-//            @HeaderParam("referer-url") String referer,
-//            @QueryParam("scope") String scopes,
-//            //   @Context WebServiceContext wsContext, // FB
-//            @Context SecurityContext securityContext) {
-//        
-//        Map<String, Object> attr = new HashMap<>();
-//        if (scopes != null && !scopes.isEmpty())
-//            attr.put(Attributes.SCOPES, scopes);
-//        attr.put(Attributes.HOST, host);
-//        attr.put(Attributes.USER_AGENT, agent);
-//        
-//        User user = new KorAPUser();
-//        user.setUsername(securityContext.getUserPrincipal().getName());
-//        controller.setAccessAndLocation(user, headers);
-//        if (DEBUG_LOG == true) System.out.printf(
-//                "Debug: /token/: location=%s, access='%s'.\n",
-//                user.locationtoString(), user.accesstoString());
-//        attr.put(Attributes.LOCATION, user.getLocation());
-//        attr.put(Attributes.CORPUS_ACCESS, user.getCorpusAccess());
-//        
-//        try {
-//            TokenContext context = controller.createTokenContext(user, attr,
-//                    TokenType.API);
-//            return Response.ok(context.toJson()).build();
-//        }
-//        catch (KustvaktException e) {
-//            throw kustvaktResponseHandler.throwit(e);
-//        }
-//    }
 
+    // EM: testing using spring security authentication manager
+    //    @Deprecated
+    //    @GET
+    //    @Path("ldap/token")
+    //    public Response requestToken (@Context HttpHeaders headers,
+    //            @Context Locale locale,
+    //            @HeaderParam(ContainerRequest.USER_AGENT) String agent,
+    //            @HeaderParam(ContainerRequest.HOST) String host,
+    //            @HeaderParam("referer-url") String referer,
+    //            @QueryParam("scope") String scopes,
+    //            //   @Context WebServiceContext wsContext, // FB
+    //            @Context SecurityContext securityContext) {
+    //        
+    //        Map<String, Object> attr = new HashMap<>();
+    //        if (scopes != null && !scopes.isEmpty())
+    //            attr.put(Attributes.SCOPES, scopes);
+    //        attr.put(Attributes.HOST, host);
+    //        attr.put(Attributes.USER_AGENT, agent);
+    //        
+    //        User user = new KorAPUser();
+    //        user.setUsername(securityContext.getUserPrincipal().getName());
+    //        controller.setAccessAndLocation(user, headers);
+    //        if (DEBUG_LOG == true) System.out.printf(
+    //                "Debug: /token/: location=%s, access='%s'.\n",
+    //                user.locationtoString(), user.accesstoString());
+    //        attr.put(Attributes.LOCATION, user.getLocation());
+    //        attr.put(Attributes.CORPUS_ACCESS, user.getCorpusAccess());
+    //        
+    //        try {
+    //            TokenContext context = controller.createTokenContext(user, attr,
+    //                    TokenType.API);
+    //            return Response.ok(context.toJson()).build();
+    //        }
+    //        catch (KustvaktException e) {
+    //            throw kustvaktResponseHandler.throwit(e);
+    //        }
+    //    }
 
     @Deprecated
     @GET
@@ -178,144 +176,144 @@
             @QueryParam("scope") String scopes,
             //   @Context WebServiceContext wsContext, // FB
             @Context SecurityContext secCtx) {
-        
+
         if (DEBUG_LOG == true) {
             String warning = "Access to API token (JWT) web service";
-            
-            List<String> auth =
-                  headers.getRequestHeader(ContainerRequest.AUTHORIZATION);
-          if (auth != null && !auth.isEmpty()) {
-              try {
-                  AuthorizationData authorizationData = authorizationHandler
-                          .parseAuthorizationHeaderValue(auth.get(0));
-                  if (authorizationData.getAuthenticationScheme()
-                          .equals(AuthenticationScheme.BASIC)) {
-                      authorizationData = authorizationHandler
-                              .parseBasicToken(authorizationData);
-                      jlog.warn(warning + " with username:"+authorizationData.getUsername());
-                  }
-              }
-              catch (KustvaktException e) {}
-          }
-          else {
-              jlog.warn(warning);
-          }
+
+            List<String> auth = headers
+                    .getRequestHeader(ContainerRequest.AUTHORIZATION);
+            if (auth != null && !auth.isEmpty()) {
+                try {
+                    AuthorizationData authorizationData = authorizationHandler
+                            .parseAuthorizationHeaderValue(auth.get(0));
+                    if (authorizationData.getAuthenticationScheme()
+                            .equals(AuthenticationScheme.BASIC)) {
+                        authorizationData = authorizationHandler
+                                .parseBasicToken(authorizationData);
+                        jlog.warn(warning + " with username:"
+                                + authorizationData.getUsername());
+                    }
+                }
+                catch (KustvaktException e) {}
+            }
+            else {
+                jlog.warn(warning);
+            }
         }
         throw kustvaktResponseHandler.throwit(new KustvaktException(
                 StatusCodes.DEPRECATED,
                 "API token is no longer supported. Please use OAuth2 procedure instead."));
     }
 
-//        List<String> auth =
-//                headers.getRequestHeader(ContainerRequest.AUTHORIZATION);
-//        if (auth == null || auth.isEmpty()) {
-//            throw kustvaktResponseHandler
-//                    .throwit(new KustvaktException(StatusCodes.MISSING_PARAMETER,
-//                            "Authorization header is missing.",
-//                            "Authorization header"));
-//        }
-//        
-//        AuthorizationData authorizationData;
-//        try {
-//            authorizationData = authorizationHandler.
-//                    parseAuthorizationHeaderValue(auth.get(0));
-//            if (authorizationData.getAuthenticationScheme().equals(AuthenticationScheme.BASIC)){
-//                authorizationData = authorizationHandler.parseBasicToken(authorizationData);
-//            }
-//            else {
-//                // EM: throw exception that auth scheme is not supported?
-//            }
-//           
-//        }
-//        catch (KustvaktException e) {
-//            throw kustvaktResponseHandler.throwit(e);
-//        }
-//
-//        if (DEBUG_LOG == true) {
-//            System.out.printf("Debug: AuthService.requestAPIToken...:\n");
-//            System.out.printf("Debug: auth.size=%d\n", auth.size());
-//            System.out.printf("auth.get(0)='%s'\n", auth.get(0));
-//            /* hide password etc. - FB
-//             if( auth.size() > 0 )
-//            	{
-//            	Iterator it = auth.iterator();
-//            	while( it.hasNext() )
-//            		System.out.printf(" header '%s'\n",  it.next());
-//            	}
-//            if( values.length > 0 )
-//            	{
-//            	for(int i=0; i< values.length; i++)
-//            		{
-//            		System.out.printf(" values[%d]='%s'\n",  i, values[i]);
-//            		}
-//            	}
-//             */
-//            MultivaluedMap<String, String> headerMap =
-//                    headers.getRequestHeaders();
-//            if (headerMap != null && headerMap.size() > 0) {
-//                Iterator<String> it = headerMap.keySet().iterator();
-//                while (it.hasNext()) {
-//                    String key = (String) it.next();
-//                    List<String> vals = headerMap.get(key);
-////                    System.out.printf("Debug: requestAPIToken: '%s' = '%s'\n",
-////                            key, vals);
-//                }
-//
-//            }
-////            System.out.printf("Debug: requestAPIToken: isSecure = %s.\n",
-////                    secCtx.isSecure() ? "yes" : "no");
-//        } // DEBUG_LOG        
-//
-//        if (authorizationData.getUsername() == null || 
-//                authorizationData.getUsername().isEmpty() || 
-//                authorizationData.getPassword()== null || 
-//                authorizationData.getPassword().isEmpty())
-//            // is actual an invalid request
-//            throw kustvaktResponseHandler.throwit(StatusCodes.REQUEST_INVALID);
-//
-//        Map<String, Object> attr = new HashMap<>();
-//        if (scopes != null && !scopes.isEmpty())
-//            attr.put(Attributes.SCOPE, scopes);
-//        attr.put(Attributes.HOST, host);
-//        attr.put(Attributes.USER_AGENT, agent);
-//
-//        TokenContext context;
-//        try {
-//            // User user = controller.authenticate(0, values[0], values[1], attr); Implementation by Hanl
-//            User user = controller.authenticate(AuthenticationMethod.LDAP,
-//                    authorizationData.getUsername(), authorizationData.getPassword(), attr); // Implementation with IdM/LDAP
-//            // Userdata data = this.controller.getUserData(user, UserDetails.class); // Implem. by Hanl
-//            // todo: is this necessary?
-//            //            attr.putAll(data.fields());
-//            
-//            // EM: add authentication time
-//            Date authenticationTime = TimeUtils.getNow().toDate();
-//            attr.put(Attributes.AUTHENTICATION_TIME, authenticationTime);
-//            // -- EM
-//            
-//            controller.setAccessAndLocation(user, headers);
-//            if (DEBUG_LOG == true) System.out.printf(
-//                    "Debug: /apiToken/: location=%s, access='%s'.\n",
-//                    user.locationtoString(), user.accesstoString());
-//            attr.put(Attributes.LOCATION, user.getLocation());
-//            attr.put(Attributes.CORPUS_ACCESS, user.getCorpusAccess());
-//            context = controller.createTokenContext(user, attr,
-//                  TokenType.API);
-////            context = controller.createTokenContext(user, attr,
-////                    Attributes.API_AUTHENTICATION);
-//        }
-//        catch (KustvaktException e) {
-//            throw kustvaktResponseHandler.throwit(e);
-//        }
-//
-//        try {
-//            return Response.ok(context.toJson()).build();
-//        }
-//        catch (KustvaktException e) {
-//            throw kustvaktResponseHandler.throwit(e);
-//        }
-//    }
-
+    //        List<String> auth =
+    //                headers.getRequestHeader(ContainerRequest.AUTHORIZATION);
+    //        if (auth == null || auth.isEmpty()) {
+    //            throw kustvaktResponseHandler
+    //                    .throwit(new KustvaktException(StatusCodes.MISSING_PARAMETER,
+    //                            "Authorization header is missing.",
+    //                            "Authorization header"));
+    //        }
+    //        
+    //        AuthorizationData authorizationData;
+    //        try {
+    //            authorizationData = authorizationHandler.
+    //                    parseAuthorizationHeaderValue(auth.get(0));
+    //            if (authorizationData.getAuthenticationScheme().equals(AuthenticationScheme.BASIC)){
+    //                authorizationData = authorizationHandler.parseBasicToken(authorizationData);
+    //            }
+    //            else {
+    //                // EM: throw exception that auth scheme is not supported?
+    //            }
+    //           
+    //        }
+    //        catch (KustvaktException e) {
+    //            throw kustvaktResponseHandler.throwit(e);
+    //        }
+    //
+    //        if (DEBUG_LOG == true) {
+    //            System.out.printf("Debug: AuthService.requestAPIToken...:\n");
+    //            System.out.printf("Debug: auth.size=%d\n", auth.size());
+    //            System.out.printf("auth.get(0)='%s'\n", auth.get(0));
+    //            /* hide password etc. - FB
+    //             if( auth.size() > 0 )
+    //            	{
+    //            	Iterator it = auth.iterator();
+    //            	while( it.hasNext() )
+    //            		System.out.printf(" header '%s'\n",  it.next());
+    //            	}
+    //            if( values.length > 0 )
+    //            	{
+    //            	for(int i=0; i< values.length; i++)
+    //            		{
+    //            		System.out.printf(" values[%d]='%s'\n",  i, values[i]);
+    //            		}
+    //            	}
+    //             */
+    //            MultivaluedMap<String, String> headerMap =
+    //                    headers.getRequestHeaders();
+    //            if (headerMap != null && headerMap.size() > 0) {
+    //                Iterator<String> it = headerMap.keySet().iterator();
+    //                while (it.hasNext()) {
+    //                    String key = (String) it.next();
+    //                    List<String> vals = headerMap.get(key);
+    ////                    System.out.printf("Debug: requestAPIToken: '%s' = '%s'\n",
+    ////                            key, vals);
+    //                }
+    //
+    //            }
+    ////            System.out.printf("Debug: requestAPIToken: isSecure = %s.\n",
+    ////                    secCtx.isSecure() ? "yes" : "no");
+    //        } // DEBUG_LOG        
+    //
+    //        if (authorizationData.getUsername() == null || 
+    //                authorizationData.getUsername().isEmpty() || 
+    //                authorizationData.getPassword()== null || 
+    //                authorizationData.getPassword().isEmpty())
+    //            // is actual an invalid request
+    //            throw kustvaktResponseHandler.throwit(StatusCodes.REQUEST_INVALID);
+    //
+    //        Map<String, Object> attr = new HashMap<>();
+    //        if (scopes != null && !scopes.isEmpty())
+    //            attr.put(Attributes.SCOPE, scopes);
+    //        attr.put(Attributes.HOST, host);
+    //        attr.put(Attributes.USER_AGENT, agent);
+    //
+    //        TokenContext context;
+    //        try {
+    //            // User user = controller.authenticate(0, values[0], values[1], attr); Implementation by Hanl
+    //            User user = controller.authenticate(AuthenticationMethod.LDAP,
+    //                    authorizationData.getUsername(), authorizationData.getPassword(), attr); // Implementation with IdM/LDAP
+    //            // Userdata data = this.controller.getUserData(user, UserDetails.class); // Implem. by Hanl
+    //            // todo: is this necessary?
+    //            //            attr.putAll(data.fields());
+    //            
+    //            // EM: add authentication time
+    //            Date authenticationTime = TimeUtils.getNow().toDate();
+    //            attr.put(Attributes.AUTHENTICATION_TIME, authenticationTime);
+    //            // -- EM
+    //            
+    //            controller.setAccessAndLocation(user, headers);
+    //            if (DEBUG_LOG == true) System.out.printf(
+    //                    "Debug: /apiToken/: location=%s, access='%s'.\n",
+    //                    user.locationtoString(), user.accesstoString());
+    //            attr.put(Attributes.LOCATION, user.getLocation());
+    //            attr.put(Attributes.CORPUS_ACCESS, user.getCorpusAccess());
+    //            context = controller.createTokenContext(user, attr,
+    //                  TokenType.API);
+    ////            context = controller.createTokenContext(user, attr,
+    ////                    Attributes.API_AUTHENTICATION);
+    //        }
+    //        catch (KustvaktException e) {
+    //            throw kustvaktResponseHandler.throwit(e);
+    //        }
+    //
+    //        try {
+    //            return Response.ok(context.toJson()).build();
+    //        }
+    //        catch (KustvaktException e) {
+    //            throw kustvaktResponseHandler.throwit(e);
+    //        }
+    //    }
 
     // todo:
     @Deprecated
@@ -336,7 +334,6 @@
         return null;
     }
 
-
     @GET
     @Path("sessionToken")
     //@ResourceFilters({HeaderFilter.class})
@@ -344,15 +341,16 @@
             @Context Locale locale,
             @HeaderParam(ContainerRequest.USER_AGENT) String agent,
             @HeaderParam(ContainerRequest.HOST) String host) {
-        List<String> auth =
-                headers.getRequestHeader(ContainerRequest.AUTHORIZATION);
+        List<String> auth = headers
+                .getRequestHeader(ContainerRequest.AUTHORIZATION);
 
         AuthorizationData authorizationData;
         try {
-            authorizationData = authorizationHandler.
-                    parseAuthorizationHeaderValue(auth.get(0));
-            authorizationData = authorizationHandler.parseBasicToken(authorizationData);
-           
+            authorizationData = authorizationHandler
+                    .parseAuthorizationHeaderValue(auth.get(0));
+            authorizationData = authorizationHandler
+                    .parseBasicToken(authorizationData);
+
         }
         catch (KustvaktException e) {
             throw kustvaktResponseHandler.throwit(e);
@@ -361,10 +359,10 @@
         // Implementation Hanl mit '|'. 16.02.17/FB
         //if (values[0].equalsIgnoreCase("null")
         //        | values[1].equalsIgnoreCase("null"))
-        if (authorizationData.getUsername() == null || 
-                authorizationData.getUsername().isEmpty() || 
-                authorizationData.getPassword()== null || 
-                authorizationData.getPassword().isEmpty())
+        if (authorizationData.getUsername() == null
+                || authorizationData.getUsername().isEmpty()
+                || authorizationData.getPassword() == null
+                || authorizationData.getPassword().isEmpty())
             // is actual an invalid request
             throw kustvaktResponseHandler.throwit(StatusCodes.INVALID_REQUEST);
 
@@ -376,11 +374,12 @@
         try {
             //EM: authentication scheme default
             User user = controller.authenticate(AuthenticationMethod.DATABASE,
-                    authorizationData.getUsername(), authorizationData.getPassword(), attr);
+                    authorizationData.getUsername(),
+                    authorizationData.getPassword(), attr);
             context = controller.createTokenContext(user, attr,
                     TokenType.SESSION);
-//            context = controller.createTokenContext(user, attr,
-//                    Attributes.SESSION_AUTHENTICATION);
+            //            context = controller.createTokenContext(user, attr,
+            //                    Attributes.SESSION_AUTHENTICATION);
             contextJson = context.toJson();
             jlog.debug(contextJson);
         }
@@ -390,7 +389,6 @@
         return Response.ok().entity(contextJson).build();
     }
 
-
     // fixme: security issues: setup shibboleth compatible authentication system
     // todo: will be purged with token authentication --> shib is client side
     @POST
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2Controller.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2Controller.java
index e8d7b10..8ab3e2a 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2Controller.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuth2Controller.java
@@ -77,7 +77,7 @@
     private OAuth2TokenService tokenService;
     @Autowired
     private OAuth2AuthorizationService authorizationService;
-    
+
     @Autowired
     private OAuth2ScopeService scopeService;
 
@@ -108,8 +108,7 @@
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
     public Response requestAuthorizationCode (
             @Context HttpServletRequest request,
-            @Context SecurityContext context, 
-            @FormParam("scope") String scope,
+            @Context SecurityContext context, @FormParam("scope") String scope,
             @FormParam("state") String state,
             @FormParam("client_id") String clientId,
             @FormParam("redirect_uri") String redirectUri,
@@ -125,27 +124,26 @@
             builder.queryParam(key, form.get(key).toArray());
         }
         requestURI = builder.build();
-       
+
         try {
             scopeService.verifyScope(tokenContext, OAuth2Scope.AUTHORIZE);
-            URI uri = authorizationService.requestAuthorizationCode(
-                    requestURI, clientId, redirectUri,
-                    scope, state, username, authTime);
+            URI uri = authorizationService.requestAuthorizationCode(requestURI,
+                    clientId, redirectUri, scope, state, username, authTime);
             return responseHandler.sendRedirect(uri);
         }
         catch (KustvaktException e) {
             e = authorizationService.checkRedirectUri(e, clientId, redirectUri);
             if (e.getRedirectUri() != null) {
-                AuthorizationErrorResponse errorResponse =
-                        authorizationService.createAuthorizationError(e, state);
+                AuthorizationErrorResponse errorResponse = authorizationService
+                        .createAuthorizationError(e, state);
                 return responseHandler.sendRedirect(errorResponse.toURI());
             }
             else {
                 throw responseHandler.throwit(e, state);
-            } 
+            }
         }
     }
-    
+
     @GET
     @Path("authorize")
     public Response requestAuthorizationCode (
@@ -163,7 +161,8 @@
 
         URI requestURI;
         try {
-            requestURI = new URI(request.getRequestURI()+"?"+request.getQueryString());
+            requestURI = new URI(
+                    request.getRequestURI() + "?" + request.getQueryString());
         }
         catch (URISyntaxException e) {
             KustvaktException ke = new KustvaktException(
@@ -171,24 +170,23 @@
                     OAuth2Error.INVALID_REQUEST_URI);
             throw responseHandler.throwit(ke, state);
         }
-        
+
         try {
             scopeService.verifyScope(tokenContext, OAuth2Scope.AUTHORIZE);
-            URI uri = authorizationService.requestAuthorizationCode(
-                    requestURI, clientId, redirectUri,
-                    scope, state, username, authTime);
+            URI uri = authorizationService.requestAuthorizationCode(requestURI,
+                    clientId, redirectUri, scope, state, username, authTime);
             return responseHandler.sendRedirect(uri);
         }
         catch (KustvaktException e) {
             e = authorizationService.checkRedirectUri(e, clientId, redirectUri);
             if (e.getRedirectUri() != null) {
-                AuthorizationErrorResponse errorResponse =
-                        authorizationService.createAuthorizationError(e, state);
+                AuthorizationErrorResponse errorResponse = authorizationService
+                        .createAuthorizationError(e, state);
                 return responseHandler.sendRedirect(errorResponse.toURI());
             }
             else {
                 throw responseHandler.throwit(e, state);
-            } 
+            }
         }
     }
 
@@ -256,7 +254,7 @@
      */
     @POST
     @Path("token")
-    @ResourceFilters({APIVersionFilter.class})
+    @ResourceFilters({ APIVersionFilter.class })
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
     public Response requestAccessToken (@Context HttpServletRequest request,
             @NotEmpty @FormParam("grant_type") String grantType,
@@ -266,62 +264,64 @@
 
         try {
             URI requestURI;
-            UriBuilder builder = UriBuilder.fromPath(
-                    request.getRequestURL().toString());
+            UriBuilder builder = UriBuilder
+                    .fromPath(request.getRequestURL().toString());
             for (String key : form.keySet()) {
                 builder.queryParam(key, form.get(key).toArray());
             }
             requestURI = builder.build();
-            
+
             try {
-                AuthorizationGrant authGrant = AuthorizationGrant.parse(form);  
-                
+                AuthorizationGrant authGrant = AuthorizationGrant.parse(form);
+
                 ClientAuthentication clientAuth = null;
                 String authorizationHeader = request.getHeader("Authorization");
-                if (authorizationHeader!=null && !authorizationHeader.isEmpty() ) {
+                if (authorizationHeader != null
+                        && !authorizationHeader.isEmpty()) {
                     clientAuth = ClientSecretBasic.parse(authorizationHeader);
                 }
                 else if (authGrant instanceof ClientCredentialsGrant) {
                     // this doesn't allow public clients
                     clientAuth = ClientSecretPost.parse(form);
                 }
-                
+
                 TokenRequest tokenRequest = null;
-                if (clientAuth!=null) {
+                if (clientAuth != null) {
                     ClientAuthenticationMethod method = clientAuth.getMethod();
-                    if (method.equals(ClientAuthenticationMethod.CLIENT_SECRET_BASIC)) {
+                    if (method.equals(
+                            ClientAuthenticationMethod.CLIENT_SECRET_BASIC)) {
                         ClientSecretBasic basic = (ClientSecretBasic) clientAuth;
                         clientSecret = basic.getClientSecret().getValue();
                         clientId = basic.getClientID().getValue();
                     }
-                    else if (method.equals(ClientAuthenticationMethod.CLIENT_SECRET_POST)) {
+                    else if (method.equals(
+                            ClientAuthenticationMethod.CLIENT_SECRET_POST)) {
                         ClientSecretPost post = (ClientSecretPost) clientAuth;
                         clientSecret = post.getClientSecret().getValue();
                         clientId = post.getClientID().getValue();
                     }
-                    
-                    tokenRequest = new TokenRequest(requestURI,
-                            clientAuth,
+
+                    tokenRequest = new TokenRequest(requestURI, clientAuth,
                             AuthorizationGrant.parse(form),
                             Scope.parse(form.getFirst("scope")));
                 }
                 else {
                     // requires ClientAuthentication for client_credentials grant
                     tokenRequest = new TokenRequest(requestURI,
-                        new ClientID(clientId),
-                        AuthorizationGrant.parse(form),
-                        Scope.parse(form.getFirst("scope")));
+                            new ClientID(clientId),
+                            AuthorizationGrant.parse(form),
+                            Scope.parse(form.getFirst("scope")));
                 }
-            
-                AccessTokenResponse r = tokenService.requestAccessToken(tokenRequest,
-                        clientId, clientSecret);
+
+                AccessTokenResponse r = tokenService.requestAccessToken(
+                        tokenRequest, clientId, clientSecret);
                 return responseHandler.createResponse(r);
             }
             catch (ParseException | IllegalArgumentException e) {
                 throw new KustvaktException(StatusCodes.INVALID_REQUEST,
-                        e.getMessage(), OAuth2Error.INVALID_REQUEST); 
+                        e.getMessage(), OAuth2Error.INVALID_REQUEST);
             }
-            
+
         }
         catch (KustvaktException e) {
             throw responseHandler.throwit(e);
@@ -348,7 +348,7 @@
      */
     @POST
     @Path("revoke")
-    @ResourceFilters({APIVersionFilter.class})
+    @ResourceFilters({ APIVersionFilter.class })
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
     public Response revokeAccessToken (@Context HttpServletRequest request,
             @FormParam("client_id") String clientId,
@@ -359,8 +359,8 @@
         try {
             ParameterChecker.checkStringValue("client_id", clientId);
             ParameterChecker.checkStringValue("token", token);
-            tokenService.revokeToken(clientId,clientSecret,token,tokenType);
-            
+            tokenService.revokeToken(clientId, clientSecret, token, tokenType);
+
             return Response.ok("SUCCESS").build();
         }
         catch (KustvaktException e) {
@@ -382,10 +382,11 @@
             ParameterChecker.checkStringValue("super_client_secret",
                     superClientSecret);
             ParameterChecker.checkStringValue("token", token);
-            
-            TokenContext tokenContext = (TokenContext) context.getUserPrincipal();
+
+            TokenContext tokenContext = (TokenContext) context
+                    .getUserPrincipal();
             String username = tokenContext.getUsername();
-            
+
             tokenService.revokeTokensViaSuperClient(username, superClientId,
                     superClientSecret, token);
             return Response.ok("SUCCESS").build();
@@ -426,7 +427,7 @@
             ParameterChecker.checkStringValue("super_client_id", superClientId);
             ParameterChecker.checkStringValue("super_client_secret",
                     superClientSecret);
-           
+
             tokenService.revokeAllClientTokensViaSuperClient(username,
                     superClientId, superClientSecret, clientId);
             return Response.ok("SUCCESS").build();
@@ -439,8 +440,7 @@
     @POST
     @Path("token/list")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    public List<OAuth2TokenDto> listUserToken (
-            @Context SecurityContext context,
+    public List<OAuth2TokenDto> listUserToken (@Context SecurityContext context,
             @FormParam("super_client_id") String superClientId,
             @FormParam("super_client_secret") String superClientSecret,
             @FormParam("client_id") String clientId, // optional
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuthClientController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuthClientController.java
index bace018..b530e19 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuthClientController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/OAuthClientController.java
@@ -94,8 +94,8 @@
     public OAuth2ClientDto registerClient (
             @Context SecurityContext securityContext,
             OAuth2ClientJson clientJson) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.REGISTER_CLIENT);
             return clientService.registerClient(clientJson,
@@ -107,7 +107,7 @@
     }
 
     /**
-     * Deregisters a client requires client owner authentication. 
+     * Deregisters a client requires client owner authentication.
      * 
      * 
      * @param securityContext
@@ -117,11 +117,10 @@
      */
     @DELETE
     @Path("deregister/{client_id}")
-    public Response deregisterClient (
-            @Context SecurityContext securityContext,
+    public Response deregisterClient (@Context SecurityContext securityContext,
             @PathParam("client_id") String clientId) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.DEREGISTER_CLIENT);
             clientService.deregisterClient(clientId, context.getUsername());
@@ -148,8 +147,8 @@
     public OAuth2ClientDto resetClientSecret (
             @Context SecurityContext securityContext,
             @FormParam("client_id") String clientId) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.RESET_CLIENT_SECRET);
             return clientService.resetSecret(clientId, context.getUsername());
@@ -159,11 +158,10 @@
         }
     }
 
-
     @POST
     @Path("{client_id}")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    @ResourceFilters({ APIVersionFilter.class})
+    @ResourceFilters({ APIVersionFilter.class })
     public OAuth2ClientInfoDto retrieveClientInfo (
             @PathParam("client_id") String clientId,
             @FormParam("super_client_id") String superClientId,
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/PluginController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/PluginController.java
index c10c4fa..0afda45 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/PluginController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/PluginController.java
@@ -62,12 +62,11 @@
             throw responseHandler.throwit(e);
         }
     }
-    
+
     @POST
     @Path("/install")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    public InstalledPluginDto installPlugin (
-            @Context SecurityContext context,
+    public InstalledPluginDto installPlugin (@Context SecurityContext context,
             @FormParam("super_client_id") String superClientId,
             @FormParam("super_client_secret") String superClientSecret,
             @FormParam("client_id") String clientId) {
@@ -80,13 +79,14 @@
                     OAuth2Scope.INSTALL_USER_CLIENT);
 
             clientService.verifySuperClient(superClientId, superClientSecret);
-            return clientService.installPlugin(superClientId,clientId, username);
+            return clientService.installPlugin(superClientId, clientId,
+                    username);
         }
         catch (KustvaktException e) {
             throw responseHandler.throwit(e);
         }
     }
-    
+
     @POST
     @Path("/installed")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@@ -109,12 +109,11 @@
             throw responseHandler.throwit(e);
         }
     }
-    
+
     @POST
     @Path("/uninstall")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    public Response uninstallPlugin (
-            @Context SecurityContext context,
+    public Response uninstallPlugin (@Context SecurityContext context,
             @FormParam("super_client_id") String superClientId,
             @FormParam("super_client_secret") String superClientSecret,
             @FormParam("client_id") String clientId) {
@@ -127,7 +126,7 @@
                     OAuth2Scope.UNINSTALL_USER_CLIENT);
 
             clientService.verifySuperClient(superClientId, superClientSecret);
-            clientService.uninstallPlugin(superClientId,clientId, username);
+            clientService.uninstallPlugin(superClientId, clientId, username);
             return Response.ok().build();
         }
         catch (KustvaktException e) {
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/QueryReferenceController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/QueryReferenceController.java
index caa059c..af9c395 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/QueryReferenceController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/QueryReferenceController.java
@@ -75,21 +75,21 @@
      * @param query
      *            a json object describing the query and its
      *            properties
-     * @return HTTP Status 201 Created when creating a new query, or 204
+     * @return HTTP Status 201 Created when creating a new query, or
+     *         204
      *         No Content when updating an existing query.
      * @throws KustvaktException
      */
     @PUT
     @Path("/~{qCreator}/{qName}")
     @Consumes(MediaType.APPLICATION_JSON + ";charset=utf-8")
-    public Response createQuery (
-        @Context SecurityContext securityContext,
-        @PathParam("qCreator") String qCreator,
-        @PathParam("qName") String qName,
-        QueryJson query) throws KustvaktException {
+    public Response createQuery (@Context SecurityContext securityContext,
+            @PathParam("qCreator") String qCreator,
+            @PathParam("qName") String qName, QueryJson query)
+            throws KustvaktException {
 
-        TokenContext context =
-            (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
 
         try {
             scopeService.verifyScope(context, OAuth2Scope.EDIT_VC);
@@ -104,7 +104,7 @@
         catch (KustvaktException e) {
             throw kustvaktResponseHandler.throwit(e);
         }
-        
+
     }
 
     /**
@@ -120,13 +120,13 @@
     @GET
     @Path("~{createdBy}/{qName}")
     @ResourceFilters({ APIVersionFilter.class, AuthenticationFilter.class,
-        DemoUserFilter.class, PiwikFilter.class })
+            DemoUserFilter.class, PiwikFilter.class })
     public QueryDto retrieveQueryByName (
             @Context SecurityContext securityContext,
             @PathParam("createdBy") String createdBy,
             @PathParam("qName") String qName) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
             return service.retrieveQueryByName(context.getUsername(), qName,
@@ -149,33 +149,32 @@
      *            query name
      * @return HTTP status 200, if successful
      */
-    
+
     @DELETE
     @Path("~{createdBy}/{qName}")
     public Response deleteQueryByName (@Context SecurityContext securityContext,
             @PathParam("createdBy") String createdBy,
             @PathParam("qName") String qName) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.DELETE_VC);
             service.deleteQueryByName(context.getUsername(), qName, createdBy,
                     QueryType.QUERY);
         }
         catch (KustvaktException e) {
-        throw kustvaktResponseHandler.throwit(e);
+            throw kustvaktResponseHandler.throwit(e);
         }
         return Response.ok().build();
     };
 
-    
     /**
      * Lists all queries available to the authenticated user.
      *
      * System-admins can list available queries for a specific user by
      * specifiying the username parameter.
      * 
-     * Normal users cannot list queries available for other users. 
+     * Normal users cannot list queries available for other users.
      * Thus, username parameter is optional
      * and must be identical to the authenticated username.
      * 
@@ -189,8 +188,8 @@
     public List<QueryDto> listAvailableQuery (
             @Context SecurityContext securityContext,
             @QueryParam("username") String username) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
             List<QueryDto> dtos = service.listAvailableQueryForUser(
@@ -201,39 +200,38 @@
             throw kustvaktResponseHandler.throwit(e);
         }
     }
-    
-//    // TODO: List all queries of a sepcific user
-//    /**
-//     * Lists all queries created by a user. This list is only
-//     * available to the owner of the queries. Users, except system-admins, 
-//     * are not allowed to list queries created by other users. 
-//     * 
-//     * Thus, the path parameter "createdBy" must be the same as the
-//     * authenticated username. 
-//     * 
-//     * @param securityContext
-//     * @return a list of queries created by the user
-//     *         in the security context.
-//     */
-//    @GET
-//    @Path("~{createdBy}")
-//    @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
-//    public List<VirtualCorpusDto> listUserVC (
-//            @PathParam("createdBy") String createdBy,
-//            @Context SecurityContext securityContext) {
-//        TokenContext context =
-//                (TokenContext) securityContext.getUserPrincipal();
-//        try {
-//            scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
-//            return service.listOwnerVC(context.getUsername(), createdBy,
-//                    QueryType.QUERY);
-//        }
-//        catch (KustvaktException e) {
-//            throw kustvaktResponseHandler.throwit(e);
-//        }
-//    }
-    
-    
+
+    //    // TODO: List all queries of a sepcific user
+    //    /**
+    //     * Lists all queries created by a user. This list is only
+    //     * available to the owner of the queries. Users, except system-admins, 
+    //     * are not allowed to list queries created by other users. 
+    //     * 
+    //     * Thus, the path parameter "createdBy" must be the same as the
+    //     * authenticated username. 
+    //     * 
+    //     * @param securityContext
+    //     * @return a list of queries created by the user
+    //     *         in the security context.
+    //     */
+    //    @GET
+    //    @Path("~{createdBy}")
+    //    @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
+    //    public List<VirtualCorpusDto> listUserVC (
+    //            @PathParam("createdBy") String createdBy,
+    //            @Context SecurityContext securityContext) {
+    //        TokenContext context =
+    //                (TokenContext) securityContext.getUserPrincipal();
+    //        try {
+    //            scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
+    //            return service.listOwnerVC(context.getUsername(), createdBy,
+    //                    QueryType.QUERY);
+    //        }
+    //        catch (KustvaktException e) {
+    //            throw kustvaktResponseHandler.throwit(e);
+    //        }
+    //    }
+
     // TODO: Some admin routes missing.
     // TODO: Some sharing routes missing
 };
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/ResourceController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/ResourceController.java
index 074b14b..986f621 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/ResourceController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/ResourceController.java
@@ -23,19 +23,19 @@
  */
 @Controller
 @Path("{version}/resource")
-@ResourceFilters({APIVersionFilter.class, PiwikFilter.class })
+@ResourceFilters({ APIVersionFilter.class, PiwikFilter.class })
 @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
 public class ResourceController {
 
     @Autowired
     private ResourceService resourceService;
 
-
-    /** Returns descriptions of all free resources stored in 
+    /**
+     * Returns descriptions of all free resources stored in
      * the database.
      * 
-     * @return a json description of all free resources stored in 
-     * the database. 
+     * @return a json description of all free resources stored in
+     *         the database.
      */
     @GET
     public List<ResourceDto> getAllResourceInfo () {
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserController.java
index 8e461f4..09de4c2 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserController.java
@@ -24,7 +24,7 @@
 @Controller
 @Path("{version}/user")
 @Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
-@ResourceFilters({ AuthenticationFilter.class, APIVersionFilter.class})
+@ResourceFilters({ AuthenticationFilter.class, APIVersionFilter.class })
 public class UserController {
 
     @Autowired
@@ -36,16 +36,15 @@
 
     @GET
     @Path("/info")
-    public JsonNode getUsername (
-        @Context SecurityContext securityContext) {
-            TokenContext context =
-                    (TokenContext) securityContext.getUserPrincipal();
-            try {
-                scopeService.verifyScope(context, OAuth2Scope.USER_INFO);
-                return userService.retrieveUserInfo(context.getUsername());
-            }
-            catch (KustvaktException e) {
-                throw kustvaktResponseHandler.throwit(e);
-            }
+    public JsonNode getUsername (@Context SecurityContext securityContext) {
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
+        try {
+            scopeService.verifyScope(context, OAuth2Scope.USER_INFO);
+            return userService.retrieveUserInfo(context.getUsername());
         }
+        catch (KustvaktException e) {
+            throw kustvaktResponseHandler.throwit(e);
+        }
+    }
 }
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupAdminController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupAdminController.java
index e5edce5..4ed6266 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupAdminController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupAdminController.java
@@ -31,7 +31,7 @@
     private KustvaktResponseHandler kustvaktResponseHandler;
     @Autowired
     private UserGroupService service;
-    
+
     /**
      * Lists user-groups for system-admin purposes. If username is
      * specified, lists user-groups of the given user, otherwise list
@@ -53,14 +53,13 @@
             @FormParam("username") String username,
             @FormParam("status") UserGroupStatus status) {
         try {
-            return service.retrieveUserGroupByStatus(username,
-                    status);
+            return service.retrieveUserGroupByStatus(username, status);
         }
         catch (KustvaktException e) {
             throw kustvaktResponseHandler.throwit(e);
         }
     }
-    
+
     /**
      * Retrieves a specific user-group. Only system admins are
      * allowed.
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
index 19c97d7..b54269a 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserGroupController.java
@@ -64,7 +64,8 @@
      * 
      * Not suitable for system-admin, instead use
      * {@link UserGroupController#
-     * getUserGroupBySystemAdmin(SecurityContext, String, UserGroupStatus)}
+     * getUserGroupBySystemAdmin(SecurityContext, String,
+     * UserGroupStatus)}
      * 
      * @param securityContext
      * @return a list of user-groups
@@ -73,8 +74,8 @@
     @GET
     public List<UserGroupDto> listUserGroups (
             @Context SecurityContext securityContext) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.USER_GROUP_INFO);
             return service.retrieveUserGroupDto(context.getUsername());
@@ -90,18 +91,20 @@
      * context.
      * 
      * @param securityContext
-     * @param groupName the name of the group            
+     * @param groupName
+     *            the name of the group
      * @return if a new group created, HTTP response status 201
      *         Created, otherwise 204 No Content.
      */
     @PUT
     @Path("@{groupName}")
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
-    public Response createUpdateUserGroup (@Context SecurityContext securityContext,
+    public Response createUpdateUserGroup (
+            @Context SecurityContext securityContext,
             @PathParam("groupName") String groupName,
             @FormParam("description") String description) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.CREATE_USER_GROUP);
             boolean groupExists = service.createUpdateUserGroup(groupName,
@@ -131,8 +134,8 @@
     @Path("@{groupName}")
     public Response deleteUserGroup (@Context SecurityContext securityContext,
             @PathParam("groupName") String groupName) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.DELETE_USER_GROUP);
             service.deleteGroup(groupName, context.getUsername());
@@ -161,8 +164,8 @@
             @Context SecurityContext securityContext,
             @PathParam("memberUsername") String memberUsername,
             @PathParam("groupName") String groupName) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.DELETE_USER_GROUP_MEMBER);
@@ -179,7 +182,7 @@
      * Invites users to join a user-group specified by the
      * groupName. Only user-group admins and system admins are
      * allowed to use this service.
-     *  
+     * 
      * The invited users are added as group members with status
      * GroupMemberStatus.PENDING.
      * 
@@ -205,8 +208,8 @@
             @Context SecurityContext securityContext,
             @PathParam("groupName") String groupName,
             @FormParam("members") String members) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.ADD_USER_GROUP_MEMBER);
@@ -239,8 +242,8 @@
             @PathParam("groupName") String groupName,
             @FormParam("memberUsername") String memberUsername,
             @FormParam("roleId") List<Integer> roleIds) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.EDIT_USER_GROUP_MEMBER_ROLE);
@@ -273,8 +276,8 @@
             @PathParam("groupName") String groupName,
             @FormParam("memberUsername") String memberUsername,
             @FormParam("roleId") List<Integer> roleIds) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.ADD_USER_GROUP_MEMBER_ROLE);
@@ -308,8 +311,8 @@
             @PathParam("groupName") String groupName,
             @FormParam("memberUsername") String memberUsername,
             @FormParam("roleId") List<Integer> roleIds) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.DELETE_USER_GROUP_MEMBER_ROLE);
@@ -335,8 +338,8 @@
     @Path("@{groupName}/subscribe")
     public Response subscribeToGroup (@Context SecurityContext securityContext,
             @PathParam("groupName") String groupName) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.ADD_USER_GROUP_MEMBER);
@@ -364,8 +367,8 @@
     public Response unsubscribeFromGroup (
             @Context SecurityContext securityContext,
             @PathParam("groupName") String groupName) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context,
                     OAuth2Scope.DELETE_USER_GROUP_MEMBER);
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserSettingController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserSettingController.java
index bf57a1e..af0199f 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/UserSettingController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/UserSettingController.java
@@ -113,7 +113,8 @@
             if (settings == null) {
                 username = tokenContext.getUsername();
                 throw new KustvaktException(StatusCodes.NO_RESOURCE_FOUND,
-                        "No default setting for username: " + username+" is found",
+                        "No default setting for username: " + username
+                                + " is found",
                         username);
             }
             return Response.ok(settings).build();
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusAdminController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusAdminController.java
index c6ffcdf..b4946fb 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusAdminController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusAdminController.java
@@ -34,20 +34,19 @@
     private KustvaktResponseHandler kustvaktResponseHandler;
     @Autowired
     private QueryService service;
-    
+
     @Autowired
     private NamedVCLoader vcLoader;
-    
+
     @POST
     @Path("load-cache")
     public Response loadAndCacheSystemVC () {
         Thread t = new Thread(vcLoader);
         t.start();
-        
+
         return Response.status(Status.OK).build();
     }
-    
-    
+
     /**
      * Lists virtual corpora by creator and type. This is a controller
      * for system admin requiring valid system admin authentication.
diff --git a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
index bd9e13c..b69b09f 100644
--- a/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
+++ b/full/src/main/java/de/ids_mannheim/korap/web/controller/VirtualCorpusController.java
@@ -81,7 +81,7 @@
      * VC name cannot be updated.
      * 
      * The VC creator must be the same as the authenticated username,
-     * except for system admins. System admins can create or update 
+     * except for system admins. System admins can create or update
      * system VC and any VC for any users.
      * 
      * 
@@ -102,10 +102,10 @@
     @Consumes(MediaType.APPLICATION_JSON + ";charset=utf-8")
     public Response createUpdateVC (@Context SecurityContext securityContext,
             @PathParam("vcCreator") String vcCreator,
-            @PathParam("vcName") String vcName,
-            QueryJson vc) throws KustvaktException {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+            @PathParam("vcName") String vcName, QueryJson vc)
+            throws KustvaktException {
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
 
         try {
             scopeService.verifyScope(context, OAuth2Scope.EDIT_VC);
@@ -120,7 +120,7 @@
         catch (KustvaktException e) {
             throw kustvaktResponseHandler.throwit(e);
         }
-        
+
     }
 
     /**
@@ -139,13 +139,12 @@
     @GET
     @Path("~{createdBy}/{vcName}")
     @ResourceFilters({ APIVersionFilter.class, AuthenticationFilter.class,
-        DemoUserFilter.class, PiwikFilter.class })
-    public QueryDto retrieveVCByName (
-            @Context SecurityContext securityContext,
+            DemoUserFilter.class, PiwikFilter.class })
+    public QueryDto retrieveVCByName (@Context SecurityContext securityContext,
             @PathParam("createdBy") String createdBy,
             @PathParam("vcName") String vcName) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
             return service.retrieveQueryByName(context.getUsername(), vcName,
@@ -162,8 +161,8 @@
             @Context SecurityContext securityContext,
             @PathParam("createdBy") String createdBy,
             @PathParam("vcName") String vcName) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
             return service.retrieveKoralQuery(context.getUsername(), vcName,
@@ -173,8 +172,9 @@
             throw kustvaktResponseHandler.throwit(e);
         }
     }
-    
-    /** Retrieves field values of a virtual corpus, e.g. corpus sigle.
+
+    /**
+     * Retrieves field values of a virtual corpus, e.g. corpus sigle.
      * 
      * This service is restricted to system admin only.
      * 
@@ -187,13 +187,12 @@
     @GET
     @Path("/field/~{createdBy}/{vcName}")
     @ResourceFilters({ APIVersionFilter.class, AdminFilter.class })
-    public JsonNode retrieveVCField (
-            @Context SecurityContext securityContext,
+    public JsonNode retrieveVCField (@Context SecurityContext securityContext,
             @PathParam("createdBy") String createdBy,
             @PathParam("vcName") String vcName,
             @QueryParam("fieldName") String fieldName) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             return service.retrieveFieldValues(context.getUsername(), vcName,
                     createdBy, QueryType.VIRTUAL_CORPUS, fieldName);
@@ -202,7 +201,7 @@
             throw kustvaktResponseHandler.throwit(e);
         }
     }
-    
+
     /**
      * Lists all virtual corpora available to the user.
      *
@@ -222,28 +221,28 @@
     public List<QueryDto> listAvailableVC (
             @Context SecurityContext securityContext,
             @QueryParam("filter-by") String filter) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
 
         try {
             scopeService.verifyScope(context, OAuth2Scope.VC_INFO);
-            if (filter !=null && !filter.isEmpty() ) {
+            if (filter != null && !filter.isEmpty()) {
                 filter = filter.toLowerCase();
                 if (filter.equals("system")) {
                     return service.listSystemQuery(QueryType.VIRTUAL_CORPUS);
                 }
                 else if (filter.equals("own")) {
                     return service.listOwnerQuery(context.getUsername(),
-                            QueryType.VIRTUAL_CORPUS);    
+                            QueryType.VIRTUAL_CORPUS);
                 }
                 else {
-                    throw new KustvaktException(StatusCodes.UNSUPPORTED_VALUE, 
+                    throw new KustvaktException(StatusCodes.UNSUPPORTED_VALUE,
                             "The given filter is unknown or not supported.");
                 }
             }
             else {
                 return service.listAvailableQueryForUser(context.getUsername(),
-                    QueryType.VIRTUAL_CORPUS);
+                        QueryType.VIRTUAL_CORPUS);
             }
         }
         catch (KustvaktException e) {
@@ -276,14 +275,13 @@
     public List<QueryDto> listUserOrSystemVC (
             @PathParam("createdBy") String createdBy,
             @Context SecurityContext securityContext) {
-        
+
         KustvaktException e = new KustvaktException(StatusCodes.DEPRECATED,
                 "This service has been deprecated. Please use Virtual Corpus List "
-                + "web-service.");
-            throw kustvaktResponseHandler.throwit(e);
+                        + "web-service.");
+        throw kustvaktResponseHandler.throwit(e);
     }
-    
-   
+
     /**
      * Only the VC owner and system admins can delete VC. VCA admins
      * can delete VC-accesses e.g. of project VC, but not the VC
@@ -301,8 +299,8 @@
     public Response deleteVCByName (@Context SecurityContext securityContext,
             @PathParam("createdBy") String createdBy,
             @PathParam("vcName") String vcName) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.DELETE_VC);
             service.deleteQueryByName(context.getUsername(), vcName, createdBy,
@@ -335,13 +333,14 @@
     @Path("~{vcCreator}/{vcName}/share/@{groupName}")
     public Response shareVC (@Context SecurityContext securityContext,
             @PathParam("vcCreator") String vcCreator,
-            @PathParam("vcName") String vcName, 
+            @PathParam("vcName") String vcName,
             @PathParam("groupName") String groupName) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.SHARE_VC);
-            service.shareQuery(context.getUsername(), vcCreator, vcName, groupName);
+            service.shareQuery(context.getUsername(), vcCreator, vcName,
+                    groupName);
         }
         catch (KustvaktException e) {
             throw kustvaktResponseHandler.throwit(e);
@@ -365,8 +364,8 @@
     public Response deleteVCAccessById (
             @Context SecurityContext securityContext,
             @PathParam("accessId") int accessId) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.DELETE_VC_ACCESS);
             service.deleteQueryAccess(accessId, context.getUsername());
@@ -391,12 +390,13 @@
     public List<QueryAccessDto> listVCAccesses (
             @Context SecurityContext securityContext,
             @QueryParam("groupName") String groupName) {
-        TokenContext context =
-                (TokenContext) securityContext.getUserPrincipal();
+        TokenContext context = (TokenContext) securityContext
+                .getUserPrincipal();
         try {
             scopeService.verifyScope(context, OAuth2Scope.VC_ACCESS_INFO);
-            if (groupName!=null && !groupName.isEmpty()){
-                return service.listQueryAccessByGroup(context.getUsername(), groupName);
+            if (groupName != null && !groupName.isEmpty()) {
+                return service.listQueryAccessByGroup(context.getUsername(),
+                        groupName);
             }
             else {
                 return service.listQueryAccessByUsername(context.getUsername());