Source:
public static void mongoGetAllExperimentsAsInstructor(final Authenticator authenticator, final DB dbs, final String userId, final String problemId, final String sessionInfo, final MultiConnectionManager internalConnections, final ByteString review) throws DatabaseAccessException, AuthenticationException { final DBObject problem = new DBRef(dbs, COURSE_PROBLEM_COLLECTION, new ObjectId(problemId)).fetch(); if (problem == null) { throw new DatabaseAccessException("Problem was not found with the following ID " + problemId); } final ArrayList adminList = (ArrayList<Object>) problem.get(ADMIN); final ArrayList modList = (ArrayList<Object>) problem.get(MOD); boolean isAdmin = false, isMod = false; isAdmin = authenticator.checkAuthentication(userId, adminList); isMod = authenticator.checkAuthentication(userId, modList); if (!isAdmin && !isMod) { throw new AuthenticationException(AuthenticationException.INVALID_PERMISSION); } final Request.Builder requestBuilder = Request.newBuilder(); requestBuilder.setSessionInfo(sessionInfo); requestBuilder.setRequestType(MessageType.DATA_REQUEST); final ItemRequest.Builder build = ItemRequest.newBuilder(); build.setQuery(ItemQuery.EXPERIMENT); final DBRef myDbRef = new DBRef(dbs, EXPERIMENT_COLLECTION, new ObjectId(problemId)); final DBObject corsor = myDbRef.fetch(); for (String key : corsor.keySet()) { if (SELF_ID.equals(key)) { continue; } final Object experimentId = corsor.get(key); if (experimentId == null || experimentId instanceof ObjectId) { continue; } final String sketchId = corsor.get(key).toString(); LOG.info("SketchId: ", sketchId); build.addItemId(sketchId); } build.setAdvanceQuery(review); final DataRequest.Builder data = DataRequest.newBuilder(); data.addItems(build); requestBuilder.setOtherData(data.build().toByteString()); LOG.info("Sending command: ", requestBuilder.build()); try { internalConnections.send(requestBuilder.build(), null, SubmissionClientWebSocket.class); } catch (ConnectionException e) { LOG.info("Exception: {}", e); } }

Target:
public static void mongoGetAllExperimentsAsInstructor(final Authenticator authenticator, final DB dbs, final String userId, final String problemId, final String sessionInfo, final MultiConnectionManager internalConnections, final ByteString review) throws DatabaseAccessException, AuthenticationException { final DBObject problem = new DBRef(dbs, COURSE_PROBLEM_COLLECTION, new ObjectId(problemId)).fetch(); if (problem == null) { throw new DatabaseAccessException("Problem was not found with the following ID " + problemId); } final ArrayList adminList = (ArrayList<Object>) problem.get(ADMIN); final ArrayList modList = (ArrayList<Object>) problem.get(MOD); boolean isAdmin = false, isMod = false; isAdmin = authenticator.checkAuthentication(userId, adminList); isMod = authenticator.checkAuthentication(userId, modList); if (!isAdmin && !isMod) { throw new AuthenticationException(AuthenticationException.INVALID_PERMISSION); } final Request.Builder requestBuilder = Request.newBuilder(); requestBuilder.setSessionInfo(sessionInfo); requestBuilder.setRequestType(MessageType.DATA_REQUEST); final ItemRequest.Builder build = ItemRequest.newBuilder(); build.setQuery(ItemQuery.EXPERIMENT); final DBRef myDbRef = new DBRef(dbs, EXPERIMENT_COLLECTION, new ObjectId(problemId)); final DBObject corsor = myDbRef.fetch(); for (String key : corsor.keySet()) { if (SELF_ID.equals(key)) { continue; } final Object experimentId = corsor.get(key); if (experimentId == null || experimentId instanceof ObjectId) { continue; } final String sketchId = corsor.get(key).toString(); LOG.info("SketchId: {}", sketchId); build.addItemId(sketchId); } build.setAdvanceQuery(review); final DataRequest.Builder data = DataRequest.newBuilder(); data.addItems(build); requestBuilder.setOtherData(data.build().toByteString()); LOG.info("Sending command: {}", requestBuilder.build()); try { internalConnections.send(requestBuilder.build(), null, SubmissionClientWebSocket.class); } catch (ConnectionException e) { LOG.error(LoggingConstants.EXCEPTION_MESSAGE, e); } }