use of teammates.logic.backdoor.BackDoorLogic in project teammates by TEAMMATES.
the class AdminInstructorAccountAddAction method importDemoData.
/**
* Imports Demo course to new instructor.
* @param pageData data from AdminHomePageData
* @return the ID of Demo course
*/
private String importDemoData(AdminHomePageData pageData) throws InvalidParametersException, EntityDoesNotExistException {
String courseId = generateDemoCourseId(pageData.instructorEmail);
String jsonString = Templates.populateTemplate(Templates.INSTRUCTOR_SAMPLE_DATA, // replace email
"teammates.demo.instructor@demo.course", pageData.instructorEmail, // replace name
"Demo_Instructor", pageData.instructorName, // replace course
"demo.course", courseId);
DataBundle data = JsonUtils.fromJson(jsonString, DataBundle.class);
BackDoorLogic backDoorLogic = new BackDoorLogic();
backDoorLogic.persistDataBundle(data);
List<FeedbackResponseCommentAttributes> frComments = logic.getFeedbackResponseCommentForGiver(courseId, pageData.instructorEmail);
List<StudentAttributes> students = logic.getStudentsForCourse(courseId);
List<InstructorAttributes> instructors = logic.getInstructorsForCourse(courseId);
logic.putFeedbackResponseCommentDocuments(frComments);
logic.putStudentDocuments(students);
logic.putInstructorDocuments(instructors);
return courseId;
}
Aggregations