use of com.instructure.canvasapi2.models.Student in project instructure-android by instructure.
the class UserManager method getStudentsForParentAirwolf.
public static void getStudentsForParentAirwolf(String airwolfDomain, String parentId, StatusCallback<List<Student>> callback) {
if (isTesting() || mTesting) {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(true).withDomain(airwolfDomain).withAPIVersion("").build();
UserManager_Test.getStudentsForParentAirwolf(airwolfDomain, adapter, params, parentId, callback);
} else {
RestBuilder adapter = new RestBuilder(callback);
RestParams params = new RestParams.Builder().withShouldIgnoreToken(false).withPerPageQueryParam(true).withDomain(airwolfDomain).withAPIVersion("").withForceReadFromNetwork(true).build();
UserAPI.getStudentsForParentAirwolf(adapter, params, parentId, callback);
}
}
use of com.instructure.canvasapi2.models.Student in project instructure-android by instructure.
the class UserTest method getEnrollmentsHash_Test2.
@Test
public void getEnrollmentsHash_Test2() {
Enrollment enrollment1 = new Enrollment();
enrollment1.setCourseId(1234);
enrollment1.setRole("student");
Enrollment enrollment2 = new Enrollment();
enrollment2.setCourseId(1234);
enrollment2.setRole("teacher");
List<Enrollment> enrollmentList = new ArrayList<>();
enrollmentList.add(enrollment1);
enrollmentList.add(enrollment2);
user1.setEnrollments(enrollmentList);
user1.getEnrollmentsHash();
assertEquals("teacher", user1.getEnrollmentsHash().get("1234")[1]);
}
use of com.instructure.canvasapi2.models.Student in project instructure-android by instructure.
the class UserTest method getEnrollmentsHash_Test1.
// endregion
@Test
public void getEnrollmentsHash_Test1() {
Enrollment enrollment1 = new Enrollment();
enrollment1.setCourseId(1234);
enrollment1.setRole("student");
Enrollment enrollment2 = new Enrollment();
enrollment2.setCourseId(1234);
enrollment2.setRole("teacher");
List<Enrollment> enrollmentList = new ArrayList<>();
enrollmentList.add(enrollment1);
enrollmentList.add(enrollment2);
user1.setEnrollments(enrollmentList);
user1.getEnrollmentsHash();
assertEquals("student", user1.getEnrollmentsHash().get("1234")[0]);
}
use of com.instructure.canvasapi2.models.Student in project instructure-android by instructure.
the class UserBinder method bind.
public static void bind(final Context context, final User user, final AdapterToFragmentCallback<User> adapterToFragmentCallback, final UserViewHolder holder, final int position) {
// Set student avatar
BasicUser basicUser = new BasicUser();
basicUser.setName(user.getName());
basicUser.setAvatarUrl(user.getAvatarUrl());
ProfileUtils.loadAvatarForUser(holder.studentAvatar, basicUser);
// Set student name
holder.userName.setText(user.getName());
holder.itemView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
adapterToFragmentCallback.onRowClicked(user, position);
}
});
// List enrollmentApiModel type(s)
// get a list of strings of the enrollments
// Use hashSet to prevent duplicate enrollments
HashSet<String> enrollments = new HashSet<>();
for (Enrollment enrollment : user.getEnrollments()) {
enrollments.add(enrollment.getType());
}
holder.userRole.setText(android.text.TextUtils.join(", ", enrollments));
}
use of com.instructure.canvasapi2.models.Student in project tutorials by eugenp.
the class StudentController method listStudents.
public Result listStudents() {
Set<Student> result = StudentStore.getInstance().getAllStudents();
ObjectMapper mapper = new ObjectMapper();
JsonNode jsonData = mapper.convertValue(result, JsonNode.class);
return ok(Util.createResponse(jsonData, true));
}
Aggregations