Package com.darkhonor.rage.model

Examples of com.darkhonor.rage.model.Student


        for (File f : directories)
        {
            if (f.getName().matches("C\\d\\d(\\p{Alpha})+\\.(\\p{Alpha})+\\.*(\\p{Alpha})*"))
            {
                Student student = new Student();
                student.setWebID(f.getName().trim());
                student.setClassYear(Integer.parseInt(f.getName().trim().substring(1, 3)) + yearOffset);
                String[] temp = f.getName().trim().substring(3).split("\\.");
                student.setFirstName(temp[0]);
                student.setLastName(temp[1]);
                output.add(student);
            }
        }
        return output;
    }
View Full Code Here


     */
    protected Course createTestCourse()
    {
        Course course = new Course("CS110");
        // Create 2 Sections, 2 Students per Section, and 2 Instructors
        Student student1 = new Student("John", "Doe", "C13John.Doe",
                new Integer(2013));
        Student student2 = new Student("Mary", "Johnson", "C13Mary.Johnson",
                new Integer(2013));
        Student student3 = new Student("Bob", "Reimer", "C13Robert.Reimer",
                new Integer(2013));
        Student student4 = new Student("Andrew", "Callow", "C13Andrew.Callow",
                new Integer(2013));
        Section section1 = new Section("M1A");
        Section section2 = new Section("M2B");
        Instructor instructor1 = new Instructor("David", "Roberts", "David.Roberts");
        instructor1.setDomainAccount(instructor1.getWebID());
        Instructor instructor2 = new Instructor("Sarah", "O'Reilly", "Sarah.OReilly");
        instructor2.setDomainAccount(instructor2.getWebID());

        // 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);

        // 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
        section1.setCourse(course);
        section2.setCourse(course);
        course.addSection(section1);
View Full Code Here

    {
        Course course = new Course(name);

        // Create 2 Sections, 2 Students in 1 section, 3 in the other,
        // and 2 Instructors
        Student student1 = new Student("John", "Doe", "C11John.Doe",
                new Integer(2011));
        Student student2 = new Student("Mary", "Johnson", "C11Mary.Johnson",
                new Integer(2011));
        Student student3 = new Student("Bob", "Reimer", "C13Robert.Reimer",
                new Integer(2013));
        Student student4 = new Student("Andrew", "Callow", "C13Andrew.Callow",
                new Integer(2013));
        Student student5 = new Student("Kerry", "Beevers", "C11Kerry.Beevers",
                new Integer(2011));
        Section section1 = new Section("M2A");
        Section section2 = new Section("T1A");
        Instructor instructor1 = new Instructor("David", "Roberts", "David.Roberts");
        instructor1.setDomainAccount(instructor1.getWebID());

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

        // Add Instructor to Course
        course.addInstructor(instructor1);

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

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

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

                    LOGGER.debug("Header information correct");
                    for (int i = 1; i < totalRows; i++)
                    {
                        LOGGER.debug("Parsing Student Row #" + i);
                        XSSFRow studentRow = studentSheet.getRow(i);
                        Student student = new Student();
                        student.setWebID(studentRow.getCell(2).getStringCellValue());
                        LOGGER.debug("Student Web ID: " + student.getWebID());
                        student.setFirstName(studentRow.getCell(3).getStringCellValue());
                        LOGGER.debug("Student First Name: " + student.getFirstName());
                        student.setLastName(studentRow.getCell(4).getStringCellValue());
                        LOGGER.debug("Student Last Name: " + student.getLastName());
                        Double tempClassYear = new Double(studentRow.getCell(0).getNumericCellValue());
                        LOGGER.debug("Class Year (Temp): " + tempClassYear);

                        student.setClassYear(new Integer(tempClassYear.intValue()));
                        LOGGER.debug("Student Class Year: " + student.getClassYear());

                        /**
                         * The assumption is that all Course Sections will be
                         * identified prior to loading students.
                         */
                        Section importedSection = new Section();
                        importedSection.setName(studentRow.getCell(5).getStringCellValue());
                        importedSection.setCourse(course);

                        int sectionIndex = sections.indexOf(importedSection);

                        int studentIndex = students.indexOf(student);
                        if (studentIndex > -1)
                        {
                            LOGGER.debug("Student is in the system");
                            students.get(studentIndex).addSection(sections.get(sectionIndex));
                            sections.get(sectionIndex).addStudent(students.get(studentIndex));
                            LOGGER.debug("Added Student to section "
                                    + sections.get(sectionIndex));
                        } else
                        {
                            LOGGER.debug("Student is not in the system");
                            LOGGER.debug("Section (from Spreadsheet): " + importedSection);
                            LOGGER.debug("Section (from Database): "
                                    + sections.get(sectionIndex));
                            student.addSection(sections.get(sectionIndex));
                            sections.get(sectionIndex).addStudent(student);
                            LOGGER.debug("Added Student to section "
                                    + sections.get(sectionIndex));
                            students.add(student);
                            LOGGER.debug("Added Student to list");
                        }
                        LOGGER.debug(student.getFirstName() + " "
                                + student.getLastName() + " is in Section "
                                + sections.get(sectionIndex).getName() + " with Login "
                                + student.getWebID());
                    }
                }
            } catch (NumberFormatException ex)
            {
                LOGGER.error("Invalid Number Format: " + ex.getLocalizedMessage());
View Full Code Here

                {
                    LOGGER.debug("(create) Querying for Student: " + student.getWebID()
                            + ", " + student.getFirstName() + ", "
                            + student.getLastName() + " (" + student.getClassYear()
                            + ")");
                    Student dbStudent = null;
                    CriteriaQuery<Student> cqStudent = cb.createQuery(Student.class);
                    Root<Student> studentRoot = cqStudent.from(Student.class);
                    cqStudent.where(cb.and(
                            cb.equal(studentRoot.get("webID"), student.getWebID()),
                            cb.equal(studentRoot.get("firstName"),
                            student.getFirstName()),
                            cb.equal(studentRoot.get("lastName"),
                            student.getLastName()),
                            cb.equal(studentRoot.get("classYear"),
                            student.getClassYear())));
                    TypedQuery<Student> studentQuery =
                            entityManager.createQuery(cqStudent);

                    try
                    {
                        dbStudent = studentQuery.getSingleResult();
                        LOGGER.debug("(create) Student " + dbStudent.getLastName()
                                + ", " + dbStudent.getFirstName() + " ("
                                + dbStudent.getClassYear() + ") does exist in DB.  "
                                + "Adding to Section " + dbSection);
                        LOGGER.debug("(create) Student ID: " + dbStudent.getId());
                    } // Student in Database
                    catch (NoResultException ex)
                    {
                        LOGGER.debug("(create) Student " + student.getLastName()
                                + ", " + student.getFirstName() + " ("
                                + student.getClassYear() + ") doesn't exist in DB.  "
                                + "Adding to Section " + dbSection);
                        dbStudent = new Student(student.getFirstName(),
                                student.getLastName(), student.getWebID(),
                                student.getClassYear());
                        if (student.getId() != null)
                        {
                            dbStudent.setId(student.getId());
                        }
                        tx.begin();
                        entityManager.persist(dbStudent);
                        tx.commit();
                        LOGGER.debug("(create) Student ID: " + dbStudent.getId());
                    } // Student not in Database
                    dbSection.addStudent(dbStudent);
                    tx.begin();
                    dbSection = entityManager.merge(dbSection);
                    tx.commit();
View Full Code Here

                    + selectedSection.getName());
            Section section = sectionDAO.find(selectedSection.getId());
            LOGGER.debug("Found " + section.getStudents().size() + " Students");
            LOGGER.debug("Adding list of Students in Section "
                    + section.getName() + " to ComboBox");
            studentComboBoxModel.add(new Student(" ", "000 - All Students", "All.Students",
                    new Integer(2010)));
            int count = 0;
            for (int i = 0; i < section.getStudents().size(); i++)
            {
                studentComboBoxModel.add(section.getStudent(i));
View Full Code Here

            String path = this.buildBasePath();

            Instructor selectedInstructor = null;
            Section selectedSection = null;
            Student selectedStudent = null;
            if (cboInstructor.getSelectedIndex() != -1)
            {
                selectedInstructor = (Instructor) cboInstructor.getSelectedItem();
            }
            if (cboSection.getSelectedIndex() != -1)
            {
                selectedSection = (Section) cboSection.getSelectedItem();
            }
            if (cboStudent.getSelectedIndex() != -1)
            {
                selectedStudent = (Student) cboStudent.getSelectedItem();
            }

//            // Derive the grading path from the selected comboboxes
//            String path = node.get("RootDir", "");
//            path = path.concat(File.separator);
//            path = path.concat(selectedCourse.getName());
//            path = path.concat(File.separator);
//            path = path.concat(selectedAssignment.getAssignment());

            /**
             * Get the selected Instructor and Section objects.  If either is
             * not selected, getSelectedIndex will return -1 and the object will
             * stay null.
             */
//            Instructor selectedInstructor = null;
//            Section selectedSection = null;
//            if (cboInstructor.getSelectedIndex() != -1)
//            {
//                selectedInstructor = (Instructor) cboInstructor.getSelectedItem();
//            }
//            if (cboSection.getSelectedIndex() != -1)
//            {
//                selectedSection = (Section) cboSection.getSelectedItem();
//            }
//
//            // Add the Instructor if one is selected
//            if (cboInstructor.getSelectedIndex() > 0)
//            {
//                path = path.concat(File.separator);
//
//                //InstructorDAO instructorDAO = new InstructorDAO(emf.createEntityManager());
//                //instructor = instructorDAO.find(selectedInstructor.getId());
//                path = path.concat(selectedInstructor.getWebID());
//
//                // Add the section if one is selected
//                if (cboSection.getSelectedIndex() > 0)
//                {
//                    //SectionDAO sectionDAO = new SectionDAO(emf.createEntityManager());
//                    //section = sectionDAO.find(selectedSection.getId());
//
//                    path = path.concat(File.separator);
//                    path = path.concat(selectedSection.getName());
//
//                    // Add the Student if one is selected
//                    if (cboStudent.getSelectedIndex() > 0)
//                    {
//                        path = path.concat(File.separator);
//                        name = cboStudent.getSelectedItem().toString().split(",");
//                        query = em.createQuery("SELECT p FROM Person p WHERE "
//                                + "p.firstName = :fname AND p.lastName = :lname");
//                        query.setParameter("fname", name[1].trim());
//                        query.setParameter("lname", name[0].trim());
//                        student = (Student) query.getSingleResult();
//                        path = path.concat(student.getWebID());
//                    }
//                }
//            }
            // Build the thread environment regardless of whether doing student or
            ProcessBuilder launcher = new ProcessBuilder();
            Map<String, String> environment = launcher.environment();
            launcher.redirectErrorStream(true);
            File outputFile = null;
            SectionReport sectionReport = null;
            Date dateStamp = new Date();
            String dateStampString = String.format("%tY%tm%td%tH%tM", dateStamp);

            /**
             * Grade All Instructors.  Section and Student are not selected
             */
            if ((cboAssignment.getSelectedIndex() >= 0)
                    && (cboInstructor.getSelectedIndex() == 0)
                    && (cboSection.getSelectedIndex() < 0)
                    && (cboStudent.getSelectedIndex() < 0))
            {
                LOGGER.debug("Grading All Instructors.  Section and Student are "
                        + "not selected");
                for (Instructor insIter : course.getInstructors())
                {
                    String tempPath = new String();
                    tempPath = path.concat(File.separator);
                    tempPath = tempPath.concat(insIter.getWebID());
                    for (Section sectionIter : insIter.getSections())
                    {
                        sectionReport = new SectionReport(course.getName(),
                                insIter, sectionIter.getName(),
                                selectedAssignment.getAssignment());
                        try
                        {
                            outputFile = new File(tempPath + File.separator
                                    + sectionIter.getName() + File.separator
                                    + sectionIter.getName() + dateStampString + ".html");
                            LOGGER.debug("Output File: " + outputFile.getCanonicalPath());
                            outputFile.createNewFile();
                        } catch (IOException ex)
                        {
                            LOGGER.error("ERROR: IOException caught.");
                            LOGGER.error(ex.getLocalizedMessage());
                        }
                        /**
                         * If a section is selected and there are multiple versions,
                         * pull the right one for the gevent variable...can we
                         * search the list and return the right one?
                         */
                        if (multVersions)
                        {
                            /**
                             * If there are multiple versions of the GradedEvent,
                             * pull only the one for this section
                             */
                            gevent = RageLib.getGradedEventFromSectionName(gevents,
                                    sectionIter.getName());
                        }
                        // No else needed since if there are no multiple versions,
                        // gevent is already set above

                        for (Student studentIter : sectionIter.getStudents())
                        {
                            StudentReport studentReport = new StudentReport(studentIter,
                                    sectionIter);
                            String newPath = new String();
                            newPath = tempPath.concat(File.separator);
                            newPath = newPath.concat(sectionIter.getName());
                            newPath = newPath.concat(File.separator);
                            newPath = newPath.concat(studentIter.getWebID());
                            LOGGER.debug("Path to grade: " + newPath);
                            statusMessageLabel.setText("Grading: "
                                    + studentIter.getLastName()
                                    + ", " + studentIter.getFirstName());
                            LOGGER.info("Grading: " + studentIter.getLastName()
                                    + ", " + studentIter.getFirstName());
                            try
                            {
                                File directory = new File(newPath);
                                LOGGER.debug("Grading path: " + directory.getCanonicalPath());
                                launcher.directory(directory);
                                Runnable r = new GraderThread(node, launcher, directory,
                                        gevent, studentReport, type);
                                grader_thread = new Thread(r);
                                grader_thread.start();
                                while (grader_thread.isAlive())
                                {
                                }
                                // After grader is complete, add StudentReport to
                                // SectionReport
                                sectionReport.addStudentReport(studentReport);
                            } catch (IOException ex)
                            {
                                LOGGER.error("IO Exception: " + ex.getLocalizedMessage());
                            }
                        }
                        sectionReport.sortStudentReports();
                        RageLib.printSectionReport(outputFile, sectionReport);
                    }
                }
            } /**
             * Grade a single instructor, but All Sections is selected
             */
            else if ((cboInstructor.getSelectedIndex() > 0)
                    && (cboSection.getSelectedIndex() == 0)
                    && (cboStudent.getSelectedIndex() < 0))
            {
                LOGGER.debug("Grading all sections for Instructor "
                        + selectedInstructor.getLastName() + ", "
                        + selectedInstructor.getFirstName());

                // Pull the Instructor from the Data Source to be able to grab Sections
                InstructorDAO instructorDAO = new InstructorDAO(emf.createEntityManager());
                Instructor instructor = instructorDAO.find(selectedInstructor.getId());
                for (Section sectionIter : instructor.getSections())
                {
                    sectionReport = new SectionReport(course.getName(),
                            instructor, sectionIter.getName(),
                            selectedAssignment.getAssignment());
                    try
                    {
                        outputFile = new File(path + File.separator
                                + sectionIter.getName() + File.separator
                                + sectionIter.getName() + dateStampString + ".html");
                        LOGGER.debug("Output File: " + outputFile.getCanonicalPath());
                        outputFile.createNewFile();
                    } catch (IOException ex)
                    {
                        LOGGER.error("IOException caught: "
                                + ex.getLocalizedMessage());
                    }
                    /**
                     * If a section is selected and there are multiple versions,
                     * pull the right one for the gevent variable...can we
                     * search the list and return the right one?
                     */
                    if (multVersions)
                    {
                        /**
                         * If there are multiple versions of the GradedEvent,
                         * pull only the one for this section
                         */
                        gevent = RageLib.getGradedEventFromSectionName(gevents,
                                sectionIter.getName());
                    }
                    // No else needed since if there are no multiple versions,
                    // gevent is already set above

                    for (Student studentIter : sectionIter.getStudents())
                    {
//                        StudentReport studentReport = new StudentReport(studentIter);
                        StudentReport studentReport = new StudentReport(studentIter,
                                sectionIter);
                        String newPath = new String();
                        newPath = path.concat(File.separator);
                        newPath = newPath.concat(sectionIter.getName());
                        newPath = newPath.concat(File.separator);
                        newPath = newPath.concat(studentIter.getWebID());
                        LOGGER.debug("Path to grade: " + newPath);
                        statusMessageLabel.setText("Grading: " + studentIter.getLastName()
                                + ", " + studentIter.getFirstName());
                        LOGGER.info("Grading: " + studentIter.getLastName()
                                + ", " + studentIter.getFirstName());
                        File directory = new File(newPath);
                        launcher.directory(directory);
                        Runnable r = new GraderThread(node, launcher, directory,
                                gevent, studentReport, type);
                        grader_thread = new Thread(r);
                        grader_thread.start();
                        while (grader_thread.isAlive())
                        {
                        }
                        sectionReport.addStudentReport(studentReport);
                    }
                    sectionReport.sortStudentReports();
                    RageLib.printSectionReport(outputFile, sectionReport);
                }
                // Close the connection to the Data Source
                instructorDAO.closeConnection();
            } /**
             * Grade all students in a single section
             */
            else if ((cboStudent.getSelectedIndex() == 0)
                    && (cboSection.getSelectedIndex() > 0))
            {
                LOGGER.debug("Grading all students in section "
                        + selectedSection.getName());

                // Pull the Section from the Data Source to get the full list of
                // Students
                SectionDAO sectionDAO = new SectionDAO(emf.createEntityManager());
                Section section = sectionDAO.find(selectedSection.getId());
                sectionReport = new SectionReport(course.getName(), selectedInstructor,
                        section.getName(), selectedAssignment.getAssignment());
                try
                {
                    outputFile = new File(path + File.separator
                            + selectedSection.getName() + dateStampString + ".html");
                    LOGGER.debug("Output File: " + outputFile.getCanonicalPath());
                    outputFile.createNewFile();
                    /**
                     * If a section is selected and there are multiple versions,
                     * pull the right one for the gevent variable...can we
                     * search the list and return the right one?
                     */
                    if (multVersions)
                    {
                        /**
                         * If there are multiple versions of the GradedEvent,
                         * pull only the one for this section
                         */
                        gevent = RageLib.getGradedEventFromSectionName(gevents,
                                selectedSection.getName());
                    }
                    // No else needed since if there are no multiple versions,
                    // gevent is already set above

                } catch (FileNotFoundException ex)
                {
                    // Do nothing...the file should be created if it's not there
                } catch (IOException ex)
                {
                    LOGGER.error("ERROR: IOException caught.");
                    LOGGER.error(ex.getLocalizedMessage());
                }
                for (Student studentIter : section.getStudents())
                {
                    StudentReport studentReport = new StudentReport(studentIter, section);
//                    StudentReport studentReport = new StudentReport(studentIter);
                    String newPath = new String();
                    newPath = path.concat(File.separator);
                    newPath = newPath.concat(studentIter.getWebID());
                    LOGGER.debug("Path to grade: " + newPath);
                    statusMessageLabel.setText("Grading: " + studentIter.getLastName()
                            + ", " + studentIter.getFirstName());
                    LOGGER.info("Grading: " + studentIter.getLastName() + ", "
                            + studentIter.getFirstName());
                    File directory = new File(newPath);
                    launcher.directory(directory);
                    Runnable r = new GraderThread(node, launcher, directory, gevent,
                            studentReport, type);
                    grader_thread = new Thread(r);
                    grader_thread.start();

                    while (grader_thread.isAlive())
                    {
                    }
                    sectionReport.addStudentReport(studentReport);
                }
                sectionReport.sortStudentReports();
                RageLib.printSectionReport(outputFile, sectionReport);

                // Close the connection to the Data Source
                sectionDAO.closeConnection();
            } /**
             * Just grade a single student
             */
            else
            {
                LOGGER.debug("Grading a single Student:" + selectedStudent.getWebID());
                LOGGER.debug("Path to grade: " + path);
                File directory = null;
                try
                {
                    directory = new File(path);
                    LOGGER.debug("Creating Output File");
                    outputFile = new File(directory.getParent()
                            + File.separator + selectedStudent.getWebID()
                            + dateStampString + ".html");
                    LOGGER.debug("Output File: " + outputFile.getCanonicalPath());
                    outputFile.createNewFile();
                    /**
                     * If a section is selected and there are multiple versions,
                     * pull the right one for the gevent variable...can we
                     * search the list and return the right one?
                     */
                    if (multVersions)
                    {
                        /**
                         * If there are multiple versions of the GradedEvent,
                         * pull only the one for this section
                         */
                        gevent = RageLib.getGradedEventFromSectionName(gevents,
                                selectedSection.getName());
                    }
                    // No else needed since if there are no multiple versions,
                    // gevent is already set above
                } catch (FileNotFoundException ex)
                {
                    // Do nothing...the file should be created if it's not there
                } catch (IOException ex)
                {
                    LOGGER.error("IOException caught.");
                    LOGGER.error(ex.getLocalizedMessage());
                } catch (NullPointerException ex)
                {
                    LOGGER.error("Null Pointer Exception: " + ex.getLocalizedMessage());
                } catch (Exception ex)
                {
                    LOGGER.error("Exception caught: " + ex.getLocalizedMessage());
                }
                LOGGER.info("Grading: " + selectedStudent.getLastName() + ", "
                        + selectedStudent.getFirstName());
                try
                {
                    LOGGER.debug("Grading Directory: " + directory.getCanonicalPath());
                    launcher.directory(directory);
                    StudentReport studentReport = new StudentReport(selectedStudent,
View Full Code Here

            LOGGER.debug("Unzipping assignments");
            EntityManager em = emf.createEntityManager();
            // TODO: Remove Query once StudentDAO is finished.  All others clear
            Query query;
            String[] name;
            Student student = null;
            Course course;
            Instructor instructor = null;
            Section section = null;
            int counter = 0;
            File rootDir;
            File[] files;

            CourseDAO courseDAO = new CourseDAO(emf.createEntityManager());
           
            Course selectedCourse = (Course) cboCourse.getSelectedItem();
            //course = em.find(Course.class, selectedCourse.getId());
            course = courseDAO.find(selectedCourse.getId());
            //query = em.createQuery("SELECT c FROM Course c WHERE c.name = :name");
            //query.setParameter("name", cboCourse.getSelectedItem().toString().trim());
            //course = (Course)query.getSingleResult();

//            query = em.createQuery("SELECT g FROM GradedEvent g WHERE g.course = " +
//                 ":course AND g.term = :term AND g.assignment = :assignment");
//            query.setParameter("course", course);
//            query.setParameter("term", node.get("Term", ""));
//            query.setParameter("assignment", cboAssignment.getSelectedItem()
//                .toString().trim());
//            List<GradedEvent> gevents = query.getResultList();
//           
//            // We don't care about versions...only what the event is so we can find
//            // the right directory
//            gevent = gevents.get(0);   // Get the first one

            // Derive the grading path from the selected comboboxes
            //String path = buildBasePath(instructor, section, student);
            String path = node.get("RootDir", "");
            path = path.concat(File.separator);
            path = path.concat(course.getName());
            path = path.concat(File.separator);
            path = path.concat((String) cboAssignment.getSelectedItem());

            Instructor selectedInstructor = null;
            Section selectedSection = null;
            if (cboInstructor.getSelectedIndex() != -1)
            {
                selectedInstructor = (Instructor) cboInstructor.getSelectedItem();
            }
            if (cboSection.getSelectedIndex() != -1)
            {
                selectedSection = (Section) cboSection.getSelectedItem();
            }
            // Add the Instructor if one is selected
            if (cboInstructor.getSelectedIndex() > 0)
            {
                path = path.concat(File.separator);
                //name = cboInstructor.getSelectedItem().toString().split(",");
                // Pull Instructor webid from database
                //query = em.createQuery("SELECT p FROM Person p WHERE p.firstName " +
                //        "= :fname AND p.lastName = :lname");
                //query.setParameter("fname", name[1].trim());
                //query.setParameter("lname", name[0].trim());
                // Don't need to check for non-existent since cboInstructor was populated
                // from the database...have bigger problems if instructor is not there now
                //ins = (Instructor)query.getSingleResult();
                InstructorDAO instructorDAO = new InstructorDAO(emf.createEntityManager());
                instructor = instructorDAO.find(selectedInstructor.getId());
                //instructor = em.find(Instructor.class, selectedInstructor.getId());
                path = path.concat(instructor.getWebID());

                // Add the section if one is selected
                if (cboSection.getSelectedIndex() > 0)
                {
                    SectionDAO sectionDAO = new SectionDAO(emf.createEntityManager());
                    section = sectionDAO.find(selectedSection.getId());
                    //section = em.find(Section.class, selectedSection.getId());
                    //for (Section s : instructor.getSections())
                    //{
                    //    if (s.getName().equals(cboSection.getSelectedItem()))
                    //    {
                    //        sect = s;
                    //    }
                    //}
                    path = path.concat(File.separator);
                    path = path.concat(section.getName());

                    // Add the Student if one is selected
                    if (cboStudent.getSelectedIndex() > 0)
                    {
                        path = path.concat(File.separator);
                        name = cboStudent.getSelectedItem().toString().split(",");
                        query = em.createQuery("SELECT p FROM Person p WHERE "
                                + "p.firstName = :fname AND p.lastName = :lname");
                        query.setParameter("fname", name[1].trim());
                        query.setParameter("lname", name[0].trim());
                        student = (Student) query.getSingleResult();
                        path = path.concat(student.getWebID());
                    }
                    sectionDAO.closeConnection();
                }
                instructorDAO.closeConnection();
            }
View Full Code Here

                    // Add the Student if one is selected
                    if (cboStudent.getSelectedIndex() > 0)
                    {
                        path = path.concat(File.separator);
                        Student selectedStudent = (Student) cboStudent.getSelectedItem();
                        LOGGER.debug("Student Selected: " + selectedStudent.getLastName()
                                + ", " + selectedStudent.getFirstName());
                        path = path.concat(selectedStudent.getWebID());
                    }
                }
            }
            LOGGER.debug("Path: " + path);
            return path;
View Full Code Here

TOP

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

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.