Create Objectify Structure
Closed this issue · 1 comments
djwessel commented
Create Structure for Objectify classes. Must include User information, classes and group information, and student attendance/presentation information.
djwessel commented
Objectify should now be working. Here is an example on how to use each of the classes (other than the tutor class, but it works the same as the Student)
Course crypt = new Course("IN2001", "Cryptography", 10, 1);
ObjectifyService.ofy().save().entity(crypt).now();
Group a = new Group(crypt.getId(), "Group A");
Group b = new Group(crypt.getId(), "Group B");
Group c = new Group(crypt.getId(), "Group C");
ObjectifyService.ofy().save().entity(a).now();
ObjectifyService.ofy().save().entity(b).now();
ObjectifyService.ofy().save().entity(c).now();
List<Group> groups = ObjectifyService.ofy().load().type(Group.class).ancestor(Key.create(Course.class, crypt.getId())).list();
for (Group g : groups) {
System.out.println(g.getId());
}
Long groupId = c.getId();
Student s = new Student("email", "password");
ObjectifyService.ofy().save().entity(s).now();
System.out.println("Student: " + s.getGroups());
AttendanceRecord ar = new AttendanceRecord(groupId, s.getId());
ObjectifyService.ofy().save().entity(ar).now();