public void setCustomId() { Employee e = getTestEmployee(); if (e == null) { return; } final String customId = customIdEditText.getText().toString().trim(); e.setCustomId(customId); employeeConnector.updateEmployee( e, new EmployeeConnector.EmployeeCallback<Employee>() { @Override public void onServiceSuccess(Employee result, ResultStatus status) { if (status.getStatusCode() / 100 == 2) { toast("Successfully set the test employee custom id to '" + customId + "'."); } else { toast("Unable to set the test employee custom id: " + status.getStatusMessage()); } } @Override public void onServiceFailure(ResultStatus status) { toast("Unable to set the test employee custom id: " + status.getStatusMessage()); } }); }
private void createTestEmployee() { Employee employee = null; employee = new Employee(); employee.setName(TEST_EMPLOYEE_NAME); employee.setNickname("Tester"); employee.setCustomId("test123"); employee.setEmail("*****@*****.**"); employee.setPin("123456"); employee.setRole(AccountRole.EMPLOYEE); employeeConnector.createEmployee( employee, new EmployeeConnector.EmployeeCallback<Employee>() { @Override public void onServiceSuccess(Employee result, ResultStatus status) { if (status.getStatusCode() / 100 != 2) { toast("Unable to create employee: " + status.getStatusMessage()); return; } toast("Successfully created test employee."); } @Override public void onServiceFailure(ResultStatus status) { toast("Unable to create test employee: " + status.getStatusMessage()); } }); }