Package com.darkhonor.rage.model

Examples of com.darkhonor.rage.model.Instructor


        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(2, result.getSections().size());
        for (int i = 0; i < result.getSections().size(); i++)
        {
            Section section = result.getSection(i);
View Full Code Here


        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);
View Full Code Here

        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(0, result.getSections().size());

        // Verify the data in the database
        EntityManager em = testDb.getConnection();
View Full Code Here

        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);
View Full Code Here

        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);
View Full Code Here

        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);
View Full Code Here

            LOGGER.debug("(create) Looping through " + course.getInstructors().size()
                    + " instructors");
            for (Instructor instructor : course.getInstructors())
            {
                Instructor dbInstructor = null;
                if (instructor.getId() != null)
                {
                    dbInstructor = entityManager.find(Instructor.class,
                            instructor.getId());
                } else
                {
                    CriteriaQuery<Instructor> cq = cb.createQuery(Instructor.class);
                    Root<Instructor> instructorRoot = cq.from(Instructor.class);
                    cq.where(cb.and(cb.equal(instructorRoot.get("firstName"),
                            instructor.getFirstName()),
                            cb.equal(instructorRoot.get("lastName"),
                            instructor.getLastName()),
                            cb.equal(instructorRoot.get("domainAccount"),
                            instructor.getDomainAccount())));
                    TypedQuery<Instructor> instructorQuery =
                            entityManager.createQuery(cq);
                    try
                    {
                        dbInstructor = instructorQuery.getSingleResult();
                    } catch (NoResultException ex)
                    {
                        dbInstructor = null;
                    }
                }
                if (dbInstructor != null)
                {
                    LOGGER.debug("(create) Instructor " + dbInstructor.getLastName()
                            + ", " + dbInstructor.getFirstName()
                            + " exists in DB.  Adding to course");
                    LOGGER.debug("(create) Instructor ID: " + dbInstructor.getId());
                } else
                {
                    LOGGER.debug("(create) Instructor " + instructor.getLastName()
                            + ", " + instructor.getFirstName()
                            + " doesn't exist in DB.  Adding to course");
                    dbInstructor = new Instructor(instructor.getFirstName(),
                            instructor.getLastName(), instructor.getWebID());
                    dbInstructor.setDomainAccount(instructor.getDomainAccount());
                    if (instructor.getId() != null)
                    {
                        dbInstructor.setId(instructor.getId());
                    }
                    try
                    {
                        tx.begin();
                        this.entityManager.persist(dbInstructor);
                        tx.commit();
                    } catch (Exception ex)
                    {
                        LOGGER.error("(create) Exception Caught: "
                                + ex.getLocalizedMessage());
                        throw new IllegalStateException(ex.getLocalizedMessage());
                    }
                    LOGGER.debug("(create) Instructor ID: " + dbInstructor.getId());
                }
                dbCourse.addInstructor(dbInstructor);
                tx.begin();
                dbCourse = entityManager.merge(dbCourse);
                tx.commit();
                LOGGER.debug("(create) Added Instructor to Course: "
                        + dbCourse.getId());
            // Loop through Course Instructors

            LOGGER.debug("(create) Looping through " + course.getSections().size()
                    + " sections");
            for (Section section : course.getSections())
            {
                LOGGER.debug("(create) Section: " + section);
                Instructor dbInstructor = null;
                CriteriaQuery<Instructor> cq = cb.createQuery(Instructor.class);
                Root<Instructor> instructorRoot = cq.from(Instructor.class);
                cq.where(cb.and(cb.equal(instructorRoot.get("firstName"),
                        section.getInstructor().getFirstName()),
                        cb.equal(instructorRoot.get("lastName"),
                        section.getInstructor().getLastName()),
                        cb.equal(instructorRoot.get("domainAccount"),
                        section.getInstructor().getDomainAccount())));
                TypedQuery<Instructor> instructorQuery =
                        entityManager.createQuery(cq);
                try
                {
                    dbInstructor = instructorQuery.getSingleResult();
                    LOGGER.debug("(create) Instructor for Section " + section
                            + " found: " + dbInstructor.getLastName() + ", "
                            + dbInstructor.getFirstName());
                    LOGGER.debug("(create) Instructor ID: " + dbInstructor.getId());
                } catch (NoResultException ex)
                {
                    dbInstructor = null;
                    LOGGER.error("(create) Section " + section
                            + " Instructor not found in DB");
View Full Code Here

                } else
                {
                    for (Section section : course.getSections())
                    {
                        // Remove the Instructor from the Section
                        Instructor instructor = section.getInstructor();
                        instructor.removeSection(section);
                        section.removeInstructor();
                        tx.begin();
                        em.persist(section);
                        em.persist(instructor);
                        tx.commit();
View Full Code Here

            LOGGER.debug("Instructor List clicked.  Disabling Student Management Buttons");
            btnMoveSection.setEnabled(false);
            btnRemoveFromCourse.setEnabled(false);
            lstSections.setEnabled(true);
            studentListModel.removeAll();
            Instructor selectedInstructor = (Instructor) lstInstructors.getSelectedValue();
            EntityManager em = emf.createEntityManager();
            Instructor instructor = em.find(Instructor.class, selectedInstructor.getId());
            LOGGER.debug("Finding Sections for Instructor " + instructor.getDomainAccount());
            if (instructor.getSections().size() > 0)
            {
                LOGGER.debug("Found " + instructor.getSections().size() + " sections");
                slm.removeAll();
                for (int i = 0; i < instructor.getSections().size(); i++)
                {
                    slm.add(instructor.getSection(i));
                }
                LOGGER.debug("Added " + slm.getSize() + " sections to the ListModel");
            } else
            {
                LOGGER.warn("No sections found for Instructor "
                        + instructor.getDomainAccount());
            }
            em.close();
        } else
        {
            lstSections.setEnabled(false);
View Full Code Here

        if (directories.length != 0)
        {
            for (File f : directories)
            {
                Instructor newInstructor = new Instructor();
                String[] temp = f.getName().trim().split("\\.");
                newInstructor.setFirstName(temp[0]);
                newInstructor.setLastName(temp[1]);
                newInstructor.setWebID(f.getName().trim());
                newInstructor.setDomainAccount(f.getName().trim());
                output.add(newInstructor);
            }
        } else
        {
            output = null;
View Full Code Here

TOP

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

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.