Search in sources :

Example 1 with BackDoorLogic

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;
}
Also used : BackDoorLogic(teammates.logic.backdoor.BackDoorLogic) FeedbackResponseCommentAttributes(teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes) DataBundle(teammates.common.datatransfer.DataBundle) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Aggregations

DataBundle (teammates.common.datatransfer.DataBundle)1 FeedbackResponseCommentAttributes (teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes)1 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)1 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)1 BackDoorLogic (teammates.logic.backdoor.BackDoorLogic)1