|
From: Wolfgang W. <wo...@us...> - 2008-07-14 10:47:29
|
Update of /cvsroot/cobricks/cobricks2/src/org/cobricks/course In directory sc8-pr-cvs4.sourceforge.net:/tmp/cvs-serv16761/src/org/cobricks/course Modified Files: CourseLecturer.java CourseManager.java CourseManagerImpl.java CourseModule.java CoursePresenter.java CourseServlet.java Log Message: Index: CoursePresenter.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CoursePresenter.java,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- CoursePresenter.java 23 Jan 2007 21:35:09 -0000 1.35 +++ CoursePresenter.java 14 Jul 2008 10:47:23 -0000 1.36 @@ -279,6 +279,34 @@ return null; } + /** + * New method for course module lecturers (woerndl, 05.06.08) + */ + public List getLecturersForCourseModule(String cmid) + { + try { + return courseManager. + getLecturersForCourseModule(Integer.parseInt(cmid.trim())); + } catch(Exception e ){ + logger.error(LogUtil.ex("Failed getting lecturers for course.", e)); + } + return null; + } + + /** + * New method for course module lecturers (woerndl, 20.06.08) + */ + public List getPrerequisitesForCourseModule(String cmid) + { + try { + return courseManager. + getPrerequisitesForCourseModule(cmid); + } catch(Exception e ){ + logger.error(LogUtil.ex("Failed getting prerequisites for course.", e)); + } + return null; + } + public CourseRoom getCourseRoom(String crid) { try { return courseManager.getRoom(Integer.parseInt(crid.trim())); Index: CourseServlet.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseServlet.java,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- CourseServlet.java 20 May 2008 14:07:34 -0000 1.32 +++ CourseServlet.java 14 Jul 2008 10:47:23 -0000 1.33 @@ -503,12 +503,14 @@ */ protected Map getCourseModuleRequestParameters(PortalRequest prequest) { + int cmid = 0; + Map attrs = new HashMap(); String tmps = prequest.getRequestParameter("cmid"); if (tmps != null) { try { - int tmpi = Integer.parseInt(tmps); - attrs.put("cmid", new Integer(tmpi)); + cmid = Integer.parseInt(tmps); + attrs.put("cmid", new Integer(cmid)); } catch (Exception e) { } } attrs.put("cmsid", prequest.getRequestParameter("cmsid")); @@ -548,6 +550,25 @@ attrs.put("cmaddxml", prequest. getRequestParameter("cmaddxml")); attrs.put("cmcycle", prequest.getRequestParameter("cmcycle")); + + attrs.put("cmniveau", prequest.getRequestParameter("cmniveau")); + attrs.put("cmworkload1", prequest.getRequestParameter("cmworkload1")); + attrs.put("cmworkload2", prequest.getRequestParameter("cmworkload2")); + attrs.put("cmpruefungsart", prequest.getRequestParameter("cmpruefungsart")); + attrs.put("cmpruefungsdauer", prequest.getRequestParameter("cmpruefungsdauer")); + attrs.put("cmhausaufgaben", prequest.getRequestParameter("cmhausaufgaben")); + attrs.put("cmhausarbeit", prequest.getRequestParameter("cmhausarbeit")); + attrs.put("cmvortrag", prequest.getRequestParameter("cmvortrag")); + attrs.put("cmgespraech", prequest.getRequestParameter("cmgespraech")); + attrs.put("cmwdhauchfolgesem", prequest.getRequestParameter("cmwdhauchfolgesem")); + attrs.put("cmwdhauchsemende", prequest.getRequestParameter("cmwdhauchsemende")); + attrs.put("cmmedia", prequest.getRequestParameter("cmmedia")); + attrs.put("cmliterature", prequest.getRequestParameter("cmliterature")); + attrs.put("cmsubjectarea", prequest.getRequestParameter("cmsubjectarea")); + attrs.put("cmareadipl", prequest.getRequestParameter("cmareadipl")); + attrs.put("cmprereqcomment", prequest.getRequestParameter("cmprereqcomment")); + attrs.put("cmprereqcomment_en", prequest.getRequestParameter("cmprereqcomment_en")); + tmps = prequest.getRequestParameter("cmhidden"); if (tmps != null) { try { @@ -606,6 +627,20 @@ attrs.put("cmprogcnt", new Integer(maxcnt)); } } + + // Course Module Prerequisites TODO + for(int i=1; i<=maxcnt; i++ ) + { + tmps = prequest.getRequestParameter("cmprrequ"+i); + if (tmps != null) { + try { + int tmpi = Integer.parseInt(tmps); + attrs.put("cmprrequ"+i, new Integer(tmpi)); + } catch (Exception e) { } + } + + attrs.put("cmprlevel"+i, prequest.getRequestParameter("cmprlevel"+i)); + } for(int i=1; i<=maxcnt; i++ ){ tmps = prequest.getRequestParameter("cpid"+i); @@ -671,6 +706,37 @@ } } + // Collecting LecturerIds for Course Lecturers Relation (woerndl, 05.06.08) + tmps = prequest.getRequestParameter("lecturerid"); + if (tmps != null) { + try { + attrs.put("newlecturerid", tmps); + } catch (Exception e) { } + } + tmps = prequest.getRequestParameter("lecturername"); + if (tmps != null) { + try { + attrs.put("newlecturername", tmps); + } catch (Exception e) { } + } + + // Used only by updateCourseModule + if(cmid > 0){ + List lecturers = courseManager.getLecturersForCourseModule(cmid); + List lecturersNew = new ArrayList(); + Iterator iter = lecturers.iterator(); + while (iter.hasNext()) { + CourseLecturer element = (CourseLecturer) iter.next(); + tmps = prequest. + getRequestParameter("lecturer"+element.getId()); + logger.debug("lecturer : "+tmps+" : "+element.getId()); + if (tmps != null && tmps.equalsIgnoreCase("true")) { + lecturersNew.add(new Integer(element.getId())); + } + } + if(lecturersNew.size() > 0) attrs.put("lecturers", lecturersNew); + } + return attrs; } Index: CourseManager.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseManager.java,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- CourseManager.java 22 Dec 2006 11:07:20 -0000 1.37 +++ CourseManager.java 14 Jul 2008 10:47:23 -0000 1.38 @@ -223,6 +223,14 @@ public List getCourseModuleSubProgramRel(CourseModule cm) throws CobricksException; + // New course modules from prerequisites (20.06.08) + public List getCourseModulePrerequisites(int cmid) + throws CobricksException; + public List getCourseModulePrerequisites(CourseModule cm) + throws CobricksException; + public List getPrerequisitesForCourseModule(String cmid) + throws CobricksException; + /** * This method is used to get a room out of the backend structure. * In case caching is activated, at first a lookup in the cache is performed. @@ -546,6 +554,14 @@ * @param cid * @return */ + + public List getLecturersForCourseModule(int cmid); + + /** + * @param cid + * @return + */ + public String getGroupForCourse(int cid); /** @@ -563,9 +579,14 @@ */ public void addLecturerToCourse(int lid, int cid, User user) throws CobricksException; + + public void addLecturerToCourseModule(int lid, int cmid, User user) + throws CobricksException; public void deleteLecturersFromCourse(int cid, User user); + public void deleteLecturersFromCourseModule(int cmid, User user); + public CourseProgram getProgramForLabel(String cplabel); public void addProgramToModule(Map attrs); Index: CourseManagerImpl.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseManagerImpl.java,v retrieving revision 1.72 retrieving revision 1.73 diff -u -d -r1.72 -r1.73 --- CourseManagerImpl.java 20 May 2008 14:07:34 -0000 1.72 +++ CourseManagerImpl.java 14 Jul 2008 10:47:23 -0000 1.73 @@ -908,6 +908,25 @@ // add new attributes sqlAttrs.put("cmimport", new Integer(0)); + copyAttr("cmniveau", attrs, sqlAttrs); + copyAttr("cmworkload1", attrs, sqlAttrs); + copyAttr("cmworkload2", attrs, sqlAttrs); + copyAttr("cmpruefungsart", attrs, sqlAttrs); + copyAttr("cmpruefungsdauer", attrs, sqlAttrs); + copyAttr("cmhausaufgaben", attrs, sqlAttrs); + copyAttr("cmhausarbeit", attrs, sqlAttrs); + copyAttr("cmvortrag", attrs, sqlAttrs); + copyAttr("cmgespraech", attrs, sqlAttrs); + copyAttr("cmwdhauchfolgesem", attrs, sqlAttrs); + copyAttr("cmwdhauchsemende", attrs, sqlAttrs); + copyAttr("cmmedia", attrs, sqlAttrs); + copyAttr("cmliterature", attrs, sqlAttrs); + copyAttr("cmsubjectarea", attrs, sqlAttrs); + copyAttr("cmareadipl", attrs, sqlAttrs); + copyAttr("cmprereqcomment", attrs, sqlAttrs); + copyAttr("cmprereqcomment_en", attrs, sqlAttrs); + + int maxcnt = 6; if((Integer)attrs.get("cmprogcnt") != null) { try{ @@ -964,6 +983,81 @@ dbAccess.sqlInsert("course_subprogrel", sqlAttrs2); } } + + // Course module prerequisites from db table (woerndl, 20.06.08) + int cmprid = cmid; + dbAccess.sqlDelete("course_modprerequ", "cmprid = "+cmprid); + for(int i=1; i<=4; i++ ) + { + Map sqlAttrs2 = new HashMap(); + + if( attrs.get("cmprrequ"+i) != null && + attrs.get("cmprrequ"+i).toString() != "") + { + sqlAttrs2.put("cmprid", new Integer(cmprid)); + + Object o = attrs.get("cmprrequ"+i); + if (o != null) sqlAttrs2.put("cmprrequ", o); + + o = attrs.get("cmprlevel"+i); + if (o != null) sqlAttrs2.put("cmprlevel", o); + + dbAccess.sqlInsert("course_modprerequ", sqlAttrs2); + } + } + + // Adding new lecturer to course module (woerndl, 05.06.08) + // deleting all course to lecturers relations + deleteLecturersFromCourseModule(cmid,user); + // Updating course to lecturers relations + try + { + List tmpL = (List) attrs.get("lecturers"); + if(tmpL != null) + { + Iterator iter = tmpL.iterator(); + Integer element = null; + while( iter.hasNext()) + { + element = (Integer) iter.next(); + if(element != null) + { + addLecturerToCourseModule(element.intValue(),cmid,user); + } + } + } + } + catch(Exception ex) + { + logger.error("Failed updating course to lecturers relations.", ex); + } + + try + { + if(attrs.containsKey("newlecturerid")) + { + String tmps = (String) attrs.get("newlecturerid"); + try + { + int lid = Integer.parseInt(tmps); + addLecturerToCourseModule(lid, cmid, user); + } catch (Exception e) { } + } + if(attrs.containsKey("newlecturername")) + { + String lname = (String) attrs.get("newlecturername"); + int lid = getLecturerIdByName(lname); + if (lid > 0) + { + addLecturerToCourseModule(lid, cmid, user); + } + } + } + catch(Exception ex) + { + logger.error("Failed adding course module to lecturer relation.", ex); + } + } catch (Exception e) { logger.error("Failed inserting course module.", e); @@ -981,6 +1075,8 @@ public void updateCourseModule(int cmid, Map attrs, User user) throws CobricksException { + logger.debug("Entering updateCourseModule ..."); + // copy attributes Map sqlAttrs = new HashMap(); copyAttr("cmname", attrs, sqlAttrs); @@ -1010,7 +1106,25 @@ copyAttr("cmhours_lec", attrs, sqlAttrs); copyAttr("cmhours_ex", attrs, sqlAttrs); copyAttr("cmhours_sem", attrs, sqlAttrs); - copyAttr("cmhours_lab", attrs, sqlAttrs); + copyAttr("cmhours_lab", attrs, sqlAttrs); + + copyAttr("cmniveau", attrs, sqlAttrs); + copyAttr("cmworkload1", attrs, sqlAttrs); + copyAttr("cmworkload2", attrs, sqlAttrs); + copyAttr("cmpruefungsart", attrs, sqlAttrs); + copyAttr("cmpruefungsdauer", attrs, sqlAttrs); + copyAttr("cmhausaufgaben", attrs, sqlAttrs); + copyAttr("cmhausarbeit", attrs, sqlAttrs); + copyAttr("cmvortrag", attrs, sqlAttrs); + copyAttr("cmgespraech", attrs, sqlAttrs); + copyAttr("cmwdhauchfolgesem", attrs, sqlAttrs); + copyAttr("cmwdhauchsemende", attrs, sqlAttrs); + copyAttr("cmmedia", attrs, sqlAttrs); + copyAttr("cmliterature", attrs, sqlAttrs); + copyAttr("cmsubjectarea", attrs, sqlAttrs); + copyAttr("cmareadipl", attrs, sqlAttrs); + copyAttr("cmprereqcomment", attrs, sqlAttrs); + copyAttr("cmprereqcomment_en", attrs, sqlAttrs); int maxcnt = 6; if((Integer)attrs.get("cmprogcnt") != null) { @@ -1025,14 +1139,17 @@ } catch(Exception ex) {} } - try { + try + { dbAccess.sqlUpdate("course_module", sqlAttrs, cmid); // Removes all the relation before adding the new relation dbAccess.sqlDelete("course_progrel", "cmid = "+cmid); - for(int i=1; i<=maxcnt; i++ ){ + for(int i=1; i<=maxcnt; i++ ) + { Map sqlAttrs2 = new HashMap(); - if( attrs.get("cpid"+i) != null && attrs.get("cpid"+i).toString() != "") { + if( attrs.get("cpid"+i) != null && attrs.get("cpid"+i).toString() != "") + { sqlAttrs2.put("cmid", new Integer(cmid)); Object o = attrs.get("cpid"+i); if (o != null) sqlAttrs2.put("cpid", o); @@ -1052,10 +1169,12 @@ // Removes all the relation before adding the new relation dbAccess.sqlDelete("course_subprogrel", "cmid = "+cmid); - for(int i=1; i<=maxcnt2; i++ ){ + for(int i=1; i<=maxcnt2; i++ ) + { Map sqlAttrs2 = new HashMap(); if( attrs.get("cspid"+i) != null && - attrs.get("cspid"+i).toString() != "") { + attrs.get("cspid"+i).toString() != "") + { sqlAttrs2.put("cmid", new Integer(cmid)); Object o = attrs.get("cspid"+i); if (o != null) sqlAttrs2.put("cspid", o); @@ -1068,14 +1187,98 @@ dbAccess.sqlInsert("course_subprogrel", sqlAttrs2); } } + + logger.debug("updateCourseModule - 1 -"); + // Course module prerequisites from db table (woerndl, 20.06.08) + int cmprid = cmid; + dbAccess.sqlDelete("course_modprerequ", "cmprid = "+cmprid); + for(int i=1; i<=4; i++ ) + { + logger.debug("updateCourseModule - 2 -"); + Map sqlAttrs2 = new HashMap(); + + logger.debug("attrs = " + attrs); + if( attrs.get("cmprrequ"+i) != null && + attrs.get("cmprrequ"+i).toString() != "") + { + sqlAttrs2.put("cmprid", new Integer(cmprid)); + + Object o = attrs.get("cmprrequ"+i); + if (o != null) sqlAttrs2.put("cmprrequ", o); + + o = attrs.get("cmprlevel"+i); + if (o != null) sqlAttrs2.put("cmprlevel", o); + + dbAccess.sqlInsert("course_modprerequ", sqlAttrs2); + + logger.debug("updateCourseModule - 3 -"); + } + } + + // Adding new lecturer to course module (woerndl, 05.06.08) + // deleting all course to lecturers realations + deleteLecturersFromCourseModule(cmid,user); + // Updating course to lecturers relations + try + { + List tmpL = (List) attrs.get("lecturers"); + if(tmpL != null) + { + Iterator iter = tmpL.iterator(); + Integer element = null; + while( iter.hasNext()) + { + element = (Integer) iter.next(); + if(element != null) + { + addLecturerToCourseModule(element.intValue(),cmid,user); + } + } + } + } + catch(Exception ex) + { + logger.error("Failed updating course to lecturers relations.", ex); + } - } catch (Exception e) { + try + { + if(attrs.containsKey("newlecturerid")) + { + String tmps = (String) attrs.get("newlecturerid"); + try + { + int lid = Integer.parseInt(tmps); + addLecturerToCourseModule(lid, cmid, user); + } catch (Exception e) { } + } + if(attrs.containsKey("newlecturername")) + { + String lname = (String) attrs.get("newlecturername"); + int lid = getLecturerIdByName(lname); + if (lid > 0) + { + addLecturerToCourseModule(lid, cmid, user); + } + } + } + catch(Exception ex) + { + logger.error("Failed adding course module to lecturer relation.", ex); + } + + } + catch (Exception e) + { logger.error("Failed updating course module.", e); } // update cache courseModuleCache.remove(new Integer(cmid)); courseModuleCache.put(new Integer(cmid), getCourseModule(cmid)); + + logger.debug("Leaving updateCourseModule ..."); + } /** @@ -1106,6 +1309,12 @@ dbAccess.sqlDelete("course_progrel", "cmid = "+cmid); dbAccess.sqlDelete("course_subprogrel", "cmid = "+cmid); + dbAccess.sqlDelete("course_lecturermod", "cmid = "+cmid); + + // Remove all prerequisites (woerndl, 20.06.08) + int cmprid = cmid; + dbAccess.sqlDelete("course_modprerequ", "cmprid = "+cmprid); + // update cache courseModuleCache.remove(new Integer(cmid)); } catch (Exception e) { @@ -1735,7 +1944,59 @@ return result; } - + // Course module prerequisites from db table (woerndl, 20.06.08) + public List getCourseModulePrerequisites(int cmid) + throws CobricksException + { + List result = new ArrayList(); + int cmprid = cmid; + String sql = "select * from course_modprerequ where cmprid = "+cmprid+";"; + List sqlList = dbAccess.sqlQuery(sql); + ListIterator i = sqlList.listIterator(); + logger.info("Returns CourseModulePreRequsuites"); + while (i.hasNext()) { + Map m = (Map)i.next(); + CourseModulePrerequisuites cmpr = new CourseModulePrerequisuites(); + cmpr.loadFromMap(m, this); + result.add(cmpr); + } + return result; + } + + // Course module prerequisites from db table (woerndl, 20.06.08) + public List getCourseModulePrerequisites(CourseModule cm) + throws CobricksException + { + logger.debug("Entering getCourseModulePrerequisites ..."); + int cmprid = cm.getId(); + List result = new ArrayList(); + String sql = "select * from course_modprerequ where cmprid = "+cmprid+";"; + List sqlList = dbAccess.sqlQuery(sql); + ListIterator i = sqlList.listIterator(); + logger.info("Returns CourseModulePreRequisuites"); + while (i.hasNext()) + { + logger.debug("Entering CourseModulePreRequisuites loop ... "); + Map m = (Map)i.next(); + CourseModulePrerequisuites cmpr = new CourseModulePrerequisuites(); + cmpr.loadFromMap(m, this, cm); + result.add(cmpr); + logger.debug("getCourseModulePrerequisites: cmpr = " + cmpr.getModuleId()); + } + return result; + } + + // Course module prerequisites from db table (woerndl, 20.06.08) + public List getPrerequisitesForCourseModule(String cmid) + throws CobricksException + { + logger.debug("getPrerequisitesForCourseModule("+cmid+")"); + int cmidint = Integer.valueOf(cmid).intValue(); + List result=getCourseModulePrerequisites(cmidint); + return result; + } + + /** * @see org.cobricks.course.CourseManager#getCourseModuleSubProgramRel(int) */ @@ -2032,6 +2293,22 @@ } /** + * @see org.cobricks.course.CourseManager#deleteLecturerToCourse(int, int, org.cobricks.user.User) + */ + public void deleteLecturersFromCourseModule(int cmid, User user) + { + try { + logger.debug("deleteLecturersFromCourseModule("+cmid+","+user+")"); + String sql = "delete from course_lecturermod " + +"where cmid = "+Integer.toString(cmid); + dbAccess.sqlExecute(sql); + } catch (Exception e) { + logger.error("Failed deleting lecturer from course module: "+e.toString()); + } + } + + + /** * @see org.cobricks.course.CourseManager#insertLecturerToCourse(int, int, org.cobricks.user.User) */ public void addLecturerToCourse(int lid, int cid, User user) @@ -2053,6 +2330,30 @@ "to course : "+e.toString()); } } + + /** + * @see org.cobricks.course.CourseManager#insertLecturerToCourse(int, int, org.cobricks.user.User) + */ + public void addLecturerToCourseModule(int lid, int cmid, User user) + throws CobricksException { + try { + logger.debug("addLecturerToCourseModule("+lid+","+cmid+")"); + String sql = "DELETE FROM course_lecturermod " + +"WHERE cmid = "+Integer.toString(cmid)+" " + + "AND lid = "+Integer.toString(lid); + + dbAccess.sqlExecute(sql); + + sql = "INSERT INTO course_lecturermod " + +"(lid,cmid) VALUES ("+Integer.toString(lid)+ + ","+Integer.toString(cmid)+")"; + dbAccess.sqlExecute(sql); + } catch (Exception e) { + logger.error("Failed inserting lecturer " + + "to course module : "+e.toString()); + } + } + /** * @see org.cobricks.course.CourseManager#getCoursesForLecturer(int) @@ -2109,7 +2410,35 @@ } return result; } - + + /** + * @see org.cobricks.course.CourseManager#getLecturersForCourse(int) + */ + public List getLecturersForCourseModule(int cmid) + { + logger.debug("getLecturersForCourseModule("+cmid+")"); + String sql = "select course_lecturer.lid " + +"from course_lecturer, course_lecturermod " + +"where cmid = "+cmid+" and " + +"course_lecturer.lid = course_lecturermod.lid " + +"order by course_lecturer.ltyp desc, llastname"; + List sqlresult = dbAccess.sqlQuery(sql); + List result = new ArrayList(); + Iterator i = sqlresult.listIterator(); + while (i.hasNext()) { + Map m = (Map)i.next(); + Integer lid = (Integer)m.get("lid"); + if (lid != null) { + try { + CourseLecturer l = getLecturer(lid.intValue()); + result.add(l); + } catch (Exception e) { + logger.error("Failed getting lecturer ...", e); + } + } + } + return result; + } /** * @see org.cobricks.course.CourseManager#getGroupForCourse(int) Index: CourseLecturer.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseLecturer.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- CourseLecturer.java 15 Dec 2006 23:06:32 -0000 1.11 +++ CourseLecturer.java 14 Jul 2008 10:47:23 -0000 1.12 @@ -13,6 +13,7 @@ import java.util.Map; +import java.text.*; import org.apache.log4j.Logger; @@ -58,6 +59,12 @@ { return lid; } + + public String getId3() + { + DecimalFormat df = new DecimalFormat ( "000" ); + return df.format(lid); + } public String getName() { Index: CourseModule.java =================================================================== RCS file: /cvsroot/cobricks/cobricks2/src/org/cobricks/course/CourseModule.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- CourseModule.java 21 Mar 2007 08:25:38 -0000 1.7 +++ CourseModule.java 14 Jul 2008 10:47:23 -0000 1.8 @@ -37,6 +37,7 @@ int cmid; List cmprogramrel; List cmsprogramrel; + List cmprereq; // Prerequisities in separate db table (woerndl) Map attrs; @@ -258,6 +259,129 @@ if (i == null) return 0; return i.intValue(); } + + // New + public String getNiveau() + { + return (String)attrs.get("cmniveau"); + } + + public String getWorkload1() + { + return (String)attrs.get("cmworkload1"); + } + + public String getWorkload2() + { + return (String)attrs.get("cmworkload2"); + } + + public int getWorkload3() + { + return (getHours() * 14); + } + + public Float getWorkload4() + { + try { + Object o = attrs.get("cmectscredits"); + if (o == null) return null; + if (!(o instanceof Float)) { + try { + o = new Float(o.toString()); + } catch (Exception e) { + logger.error("cmectscredits not valid: "+o.toString()); + return null; + } + } + float f = (int) ((java.lang.Float)o).floatValue(); + f = f * (float)30; + return new Float(f); + } catch (Exception e) { + logger.error(LogUtil.ex("exception", e)); + } + return new Float(0.0); + } + + public String getPruefungsart() + { + return (String)attrs.get("cmpruefungsart"); + } + + public String getPruefungsdauer() + { + return (String)attrs.get("cmpruefungsdauer"); + } + + public String getHausaufgaben() + { + return (String)attrs.get("cmhausaufgaben"); + } + + public String getHausarbeit() + { + return (String)attrs.get("cmhausarbeit"); + } + + public String getVortrag() + { + return (String)attrs.get("cmvortrag"); + } + + public String getGespraech() + { + return (String)attrs.get("cmgespraech"); + } + + public String getWdhauchfolgesem() + { + return (String)attrs.get("cmwdhauchfolgesem"); + } + + public String getWdhauchsemende() + { + return (String)attrs.get("cmwdhauchsemende"); + } + + public String getMedia() + { + return (String)attrs.get("cmmedia"); + } + + public String getLiterature() + { + return (String)attrs.get("cmliterature"); + } + + public String getSubjectarea() + { + return (String)attrs.get("cmsubjectarea"); + } + + + public String getAreadipl() + { + return (String)attrs.get("cmareadipl"); + } + + public String getPrereqcomment(String lang) + { + if (lang.equals("en")) + return (String)attrs.get("cmprereqcomment_en"); + return (String)attrs.get("cmprereqcomment"); + } + + public String getPrereqcomment_de() + { + return (String)attrs.get("cmprereqcomment"); + } + + public String getPrereqcomment_en() + { + return (String)attrs.get("cmprereqcomment_en"); + } + + /** * @return Returns the cmprogramrel. @@ -275,12 +399,20 @@ return cmsprogramrel; } + public List getPreRequisites() + { + logger.debug("getPreRequisites"); + logger.debug("cmprereq = " + cmprereq.toString()); + return cmprereq; + } + /** * Load course attributes from a Map object - e.g. one retrieved * from a database */ public void loadFromMap(Map map, CourseManager courseManager) { + logger.debug("CourseModule.loadFromMap 1"); Integer tmpi = (Integer)map.get("cmid"); if (tmpi == null) { logger.error("cmid attribute is null - this should not happen"); @@ -288,18 +420,27 @@ } cmid = tmpi.intValue(); attrs = new HashMap(map); + logger.debug("CourseModule.loadFromMap 2"); try { cmprogramrel = courseManager.getCourseModuleProgramRel(this); } catch (Exception e) { logger.error(LogUtil.ex("Failed loading course template.", e)); } + logger.debug("CourseModule.loadFromMap 3"); try { cmsprogramrel = courseManager.getCourseModuleSubProgramRel(this); } catch (Exception e) { logger.error(LogUtil.ex("Failed loading course template.", e)); } + logger.debug("CourseModule.loadFromMap 4"); + try { + cmprereq = + courseManager.getCourseModulePrerequisites(this); + } catch (Exception e) { + logger.error(LogUtil.ex("Failed loading course template.", e)); + } } } |