private HtmlFormInputElement getRecipient(boolean isToAdmin) { if (isToAdmin) { TextElement te = new TextElement("recipient", "SUPER_ADMIN", ""); te.setType("hidden"); te.setFormName("writemessage"); return te; } String[] users = UserManager.getAllUsers(); SelectElement se = new SelectElement(users, users, "recipient", "Получатель", ""); se.setFormName("writemessage"); return se; }
public void testTaskOperations() { try { String pr = (String) ConnectionManager.executeQuery( SELECT_GROUP, new Object[0], new StringRowHandler("id"))[0]; UserAccaunt a = UserManager.createAccaunt( "user_with_very_lon", "pass", "fio", "email", SystemGroupsManager.DEFAULT_GROUP); int init_gt = ((Integer) ConnectionManager.executeQuery( SELECT_GTASK_COUNT, new Object[] {}, new IntegerRowHandler("count(*)"))[0]) .intValue(); assertNull(GivenTasksManager.getUserTask(a)); GivenTasksManager.giveTask("1", a); int after_get_gt = ((Integer) ConnectionManager.executeQuery( SELECT_GTASK_COUNT, new Object[] {}, new IntegerRowHandler("count(*)"))[0]) .intValue(); assertTrue(init_gt + 1 == after_get_gt); Task t = GivenTasksManager.getUserTask(a); assertNotNull(t); assertTrue("1".equalsIgnoreCase(GivenTasksManager.getUserTask(a).getId() + "")); CheckedTasksManager.returnTask(a, t, 5); int after_ret_gt = ((Integer) ConnectionManager.executeQuery( SELECT_GTASK_COUNT, new Object[] {}, new IntegerRowHandler("count(*)"))[0]) .intValue(); assertTrue(init_gt + 1 == after_ret_gt); assertNull(GivenTasksManager.getUserTask(a)); UserManager.deleteAccaunt(a.getId()); } catch (SQLException e) { SystemManager.getLogger().log(getName() + ".", e); } }