@Test public void testJsonUserSearch() { formParams.clear(); formParams.put("s", ""); result = ninjaTestBrowser.makeRequest(ninjaTestServer.getBaseUrl() + "/admin/usersearch?s="); assertTrue(result.equals("[]")); assertFalse(result.contains("FreeMarker template error")); assertFalse(result.contains("<title>404 - not found</title>")); formParams.clear(); formParams.put("s", ""); result = ninjaTestBrowser.makeRequest(ninjaTestServer.getBaseUrl() + "/admin/usersearch?s=admi"); assertTrue(result.contains("admin@xcmailr.test")); assertFalse(result.contains("FreeMarker template error")); assertFalse(result.contains("<title>404 - not found</title>")); }
public Result jsonUserSearch(Context context) { List<User> userList; String searchString = context.getParameter("s", ""); userList = (searchString.equals("")) ? new ArrayList<User>() : User.findUserLike(searchString); UserFormData userData; List<UserFormData> userDatalist = new ArrayList<UserFormData>(); for (User currentUser : userList) { userData = UserFormData.prepopulate(currentUser); userDatalist.add(userData); } return Results.json().render(userDatalist); }
AdminHandler { public Result jsonUserSearch(Context context) { List<User> userList; String searchString = context.getParameter("s", ""); userList = (searchString.equals("")) ? new ArrayList<User>() : User.findUserLike(searchString); UserFormData userData; List<UserFormData> userDatalist = new ArrayList<UserFormData>(); for (User currentUser : userList) { userData = UserFormData.prepopulate(currentUser); userDatalist.add(userData); } return Results.json().render(userDatalist); } }
AdminHandler { public Result jsonUserSearch(Context context) { List<User> userList; String searchString = context.getParameter("s", ""); userList = (searchString.equals("")) ? new ArrayList<User>() : User.findUserLike(searchString); UserFormData userData; List<UserFormData> userDatalist = new ArrayList<UserFormData>(); for (User currentUser : userList) { userData = UserFormData.prepopulate(currentUser); userDatalist.add(userData); } return Results.json().render(userDatalist); }  }
AdminHandler { public Result jsonUserSearch(Context context) { List<User> userList; String searchString = context.getParameter("s", ""); userList = (searchString.equals("")) ? new ArrayList<User>() : User.findUserLike(searchString); UserFormData userData; List<UserFormData> userDatalist = new ArrayList<UserFormData>(); for (User currentUser : userList) { userData = UserFormData.prepopulate(currentUser); userDatalist.add(userData); } return Results.json().render(userDatalist); }  Result showAdmin(Context context); Result showUsers(Context context); Result showSummedTransactions(Context context); Result pagedMTX(Context context, @Param("p") int page); Result deleteMTXProcess(@PathParam("time") Integer time, Context context); Result activateUserProcess(@PathParam("id") Long userId, Context context); Result promoteUserProcess(@PathParam("id") Long userId, Context context); Result deleteUserProcess(@PathParam("id") Long deleteUserId, Context context); Result jsonUserSearch(Context context); @FilterWith(WhitelistFilter.class) Result showDomainWhitelist(Context context); @FilterWith(WhitelistFilter.class) Result callRemoveDomain(Context context, @Param("removeDomainsSelection") Long remDomainId); @FilterWith(WhitelistFilter.class) Result handleRemoveDomain(Context context, @Param("action") String action, @Param("domainId") long domainId); @FilterWith(WhitelistFilter.class) Result addDomain(Context context, @Param("domainName") String domainName); Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage,
                                      @Param("sortDailyList") String sortDailyList,
                                      @Param("sortWeeklyList") String sortWeeklyList); Result getEmailSenderTablePage(Context context, @Param("scope") String scope, @Param("page") int page,
                                          @Param("offset") int offset, @Param("limit") int limit,
                                          @Param("sort") String sort, @Param("order") String order); }
AdminHandler { public Result jsonUserSearch(Context context) { List<User> userList; String searchString = context.getParameter("s", ""); userList = (searchString.equals("")) ? new ArrayList<User>() : User.findUserLike(searchString); UserFormData userData; List<UserFormData> userDatalist = new ArrayList<UserFormData>(); for (User currentUser : userList) { userData = UserFormData.prepopulate(currentUser); userDatalist.add(userData); } return Results.json().render(userDatalist); }  Result showAdmin(Context context); Result showUsers(Context context); Result showSummedTransactions(Context context); Result pagedMTX(Context context, @Param("p") int page); Result deleteMTXProcess(@PathParam("time") Integer time, Context context); Result activateUserProcess(@PathParam("id") Long userId, Context context); Result promoteUserProcess(@PathParam("id") Long userId, Context context); Result deleteUserProcess(@PathParam("id") Long deleteUserId, Context context); Result jsonUserSearch(Context context); @FilterWith(WhitelistFilter.class) Result showDomainWhitelist(Context context); @FilterWith(WhitelistFilter.class) Result callRemoveDomain(Context context, @Param("removeDomainsSelection") Long remDomainId); @FilterWith(WhitelistFilter.class) Result handleRemoveDomain(Context context, @Param("action") String action, @Param("domainId") long domainId); @FilterWith(WhitelistFilter.class) Result addDomain(Context context, @Param("domainName") String domainName); Result showEmailStatistics(Context context, @Param("dayPage") int dayPage, @Param("weekPage") int weekPage,
                                      @Param("sortDailyList") String sortDailyList,
                                      @Param("sortWeeklyList") String sortWeeklyList); Result getEmailSenderTablePage(Context context, @Param("scope") String scope, @Param("page") int page,
                                          @Param("offset") int offset, @Param("limit") int limit,
                                          @Param("sort") String sort, @Param("order") String order);  }