Package com.darkhonor.rage.model

Examples of com.darkhonor.rage.model.Section


        assertEquals("Sarah.OReilly", ins2.getDomainAccount());
        assertNotNull(result.getSections());
        assertEquals(2, result.getSections().size());
        for (int i = 0; i < result.getSections().size(); i++)
        {
            Section section = result.getSection(i);
            System.out.println("- Section: " + section + ", Id: " + section.getId());
        }
        assertTrue(result.getSection(0).getName().equals("M3A") ||
                result.getSection(0).getName().equals("M2B"));
        assertTrue(result.getSection(1).getName().equals("M3A") ||
                result.getSection(1).getName().equals("M2B"));
View Full Code Here


    public void testUpdateSectionRemoved()
    {
        System.out.println("update - Section Removed");
        Course course = createExistingCourse();

        Section removedSect = new Section("M2B");
        removedSect.setId(new Long(2L));
        removedSect.setCourse(course);
        course.removeSection(removedSect);

        assertTrue(instance.isOpen());
        Course result = instance.update(course);
        assertEquals(new Long(1L), result.getId());
        assertEquals("CS110", result.getName());
        assertNull(result.getCourseDirector());
        assertNotNull(result.getInstructors());
        assertEquals(2, result.getInstructors().size());
        Instructor ins1 = result.getInstructor(0);
        assertEquals("David.Roberts", ins1.getDomainAccount());
        Instructor ins2 = result.getInstructor(1);
        assertEquals("Sarah.OReilly", ins2.getDomainAccount());
        assertNotNull(result.getSections());
        assertEquals(1, result.getSections().size());
        for (int i = 0; i < result.getSections().size(); i++)
        {
            Section section = result.getSection(i);
            System.out.println("- Section: " + section + ", Id: " + section.getId());
        }
        Section sec1 = result.getSection(0);
        assertEquals("M1A", sec1.getName());

        // Verify the data in the database
        EntityManager em = testDb.getConnection();
        CriteriaBuilder cb = em.getCriteriaBuilder();
        CriteriaQuery<Section> cqSection = cb.createQuery(Section.class);
View Full Code Here

                new Integer(2013));
        student3.setId(new Long(12L));
        Student student4 = new Student("Jason", "Borough", "C14Jason.Borough",
                new Integer(2013));
        student4.setId(new Long(13L));
        Section section1 = new Section("M3A");
        section1.setId(new Long(10L));
        Section section2 = new Section("T2B");
        section2.setId(new Long(11L));
        Instructor instructor1 = new Instructor("Sam", "Pierce", "Sam.Pierce");
        instructor1.setDomainAccount(instructor1.getWebID());
        instructor1.setId(new Long(14L));
        Instructor instructor2 = new Instructor("Jenny", "Conners", "Jenny.Conners");
        instructor2.setDomainAccount(instructor2.getWebID());
        instructor2.setId(new Long(15L));

        // Set the Instructors for Sections 1 & 2
        section1.setInstructor(instructor1);
        section2.setInstructor(instructor2);
        section1.setCourse(course);
        section2.setCourse(course);

        // Add Instructors to Course
        course.addInstructor(instructor1);
        course.addInstructor(instructor2);

        // Add Students 1 & 2 to Section 1
        section1.addStudent(student1);
        student1.addSection(section1);
        section1.addStudent(student2);
        student2.addSection(section1);

        // Add Students 3 & 4 to Section 2
        section2.addStudent(student3);
        student3.addSection(section2);
        section2.addStudent(student4);
        student4.addSection(section2);

        // Add Sections 1 & 2 to Course
        course.addSection(section1);
        course.addSection(section2);
View Full Code Here

                new Integer(2013));
        student3.setId(new Long(12L));
        Student student4 = new Student("Jason", "Borough", "C14Jason.Borough",
                new Integer(2013));
        student4.setId(new Long(13L));
        Section section1 = new Section("M3A");
        section1.setId(new Long(10L));
        Section section2 = new Section("T2B");
        section2.setId(new Long(11L));
        Instructor instructor1 = new Instructor("Sam", "Pierce", "Sam.Pierce");
        instructor1.setDomainAccount(instructor1.getWebID());
        instructor1.setId(new Long(14L));
        Instructor instructor2 = new Instructor("Jenny", "Conners", "Jenny.Conners");
        instructor2.setDomainAccount(instructor2.getWebID());
        instructor2.setId(new Long(15L));

        // Set the Instructors for Sections 1 & 2
        section1.setInstructor(instructor1);
        section2.setInstructor(instructor2);
        section1.setCourse(course);
        section2.setCourse(course);

        // Add Instructors to Course
        course.addInstructor(instructor1);
        course.addInstructor(instructor2);

        // Add Students 1 & 2 to Section 1
        section1.addStudent(student1);
        student1.addSection(section1);
        section1.addStudent(student2);
        student2.addSection(section1);

        // Add Students 3 & 4 to Section 2
        section2.addStudent(student3);
        student3.addSection(section2);
        section2.addStudent(student4);
        student4.addSection(section2);

        // Add Sections 1 & 2 to Course
        course.addSection(section1);
        course.addSection(section2);
View Full Code Here

        student3.setId(new Long(3L));
        Student student4 = new Student("Andrew", "Callow", "C13Andrew.Callow",
                new Integer(2013));
        student4.setId(new Long(4L));

        Section section1 = new Section("M1A");
        section1.setId(new Long(1L));
        Section section2 = new Section("M2B");
        section2.setId(new Long(2L));
        section1.setCourse(course);
        section2.setCourse(course);

        Instructor instructor1 = new Instructor("David", "Roberts", "David.Roberts");
        instructor1.setId(new Long(5L));
        Instructor instructor2 = new Instructor("Sarah", "O'Reilly", "Sarah.OReilly");
        instructor2.setId(new Long(6L));

        // Set the Instructors for Sections 1 & 2
        section1.setInstructor(instructor1);
        section2.setInstructor(instructor2);

        // Add Instructors to Course
        course.addInstructor(instructor1);
        course.addInstructor(instructor2);

        // Add Students 1 & 2 to Section 1
        section1.addStudent(student1);
        student1.addSection(section1);
        section1.addStudent(student2);
        student2.addSection(section1);

        course.addSection(section1);
        course.addSection(section2);

        // Add Students 3 & 4 to Section 2
        section2.addStudent(student3);
        student3.addSection(section2);
        section2.addStudent(student4);
        student4.addSection(section2);

        return course;
    }
View Full Code Here

            JCourseManagementApp.getApplication().show(selectSectionDialog);

            if (selectSectionDialog.getReturnStatus() == SelectSectionDialog.RET_OK)
            {
                LOGGER.debug("Dialog returned Ok. Getting section from Database");
                Section section = em.find(Section.class, selectSectionDialog.getSection().getId());
                LOGGER.debug("New Section: " + section.getName());
                Section selectedSection = (Section) lstSections.getSelectedValue();
                Section oldSection = em.find(Section.class, selectedSection.getId());
                LOGGER.debug("Old Section: " + oldSection.getName());
                Student selectedStudent = (Student) lstStudents.getSelectedValue();
                Student student = em.find(Student.class, selectedStudent.getId());
                LOGGER.debug("Removing from old Section: " + oldSection);
                try
                {
                    student.removeFromSection(oldSection);
                } catch (NullPointerException ex)
                {
                    LOGGER.error("NullPointException: " + ex.getLocalizedMessage());
                } catch (IllegalArgumentException ex)
                {
                    LOGGER.error("IllegalArgumentException: " + ex.getLocalizedMessage());
                }

                LOGGER.debug("Adding to new Section: " + section);
                student.addSection(section);
                oldSection.removeStudent(student);
                section.addStudent(student);
                EntityTransaction tx = em.getTransaction();
                try
                {
                    tx.begin();
View Full Code Here

                // Clear the student enrollment from the course
                LOGGER.debug("Removing student enrollment");
                List<Section> sections = course.getSections();
                for (int i = 0; i < sections.size(); i++)
                {
                    Section section = sections.get(i);
                    section.clearStudents();
                    course.removeSection(section);
                    tx.begin();
                    em.merge(section);
                    em.remove(section);
                    tx.commit();
View Full Code Here

    {
        if (lstStudents.getSelectedIndex() >= 0)
        {
            LOGGER.info("Removing selected Student from Course");
            Student selectedStudent = (Student) lstStudents.getSelectedValue();
            Section selectedSection = (Section) lstSections.getSelectedValue();
            EntityManager em = emf.createEntityManager();
            Student student = em.find(Student.class, selectedStudent.getId());
            Section section = em.find(Section.class, selectedSection.getId());
            LOGGER.info("Removing " + student.getLastName() + ", "
                    + student.getFirstName() + " (" + student.getClassYear()
                    + ") from Section " + section.getName());
            student.removeFromSection(section);
            section.removeStudent(student);
            EntityTransaction tx = em.getTransaction();
            tx.begin();
            em.merge(section);
            em.merge(student);
            tx.commit();
View Full Code Here

        {
            LOGGER.debug("Section selected");
            lstStudents.setEnabled(true);
            btnRemoveFromCourse.setEnabled(false);
            btnMoveSection.setEnabled(false);
            Section selectedSection = (Section) lstSections.getSelectedValue();
            EntityManager em = emf.createEntityManager();
            LOGGER.debug("Loading selected section from database");
            Section section = em.find(Section.class, selectedSection.getId());
            LOGGER.debug("Clearing Student List Model");
            studentListModel.removeAll();
            LOGGER.debug("Adding all students to Student List Model");
            for (Student student : section.getStudents())
            {
                studentListModel.add(student);
            }
            studentListModel.sort();
            lstStudents.setSelectedIndex(-1);
View Full Code Here

        for (File f : directories)
        {
            // Ignore the Instructor section in each directory
            if (!f.getName().equalsIgnoreCase("INS"))
            {
                Section newSection = new Section();
                newSection.setName(f.getName());
                output.add(newSection);
            }
        }
        return output;
    }
View Full Code Here

TOP

Related Classes of com.darkhonor.rage.model.Section

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.