From d7037fbbce65a5aa43cf4ea66c718a06416b3e89 Mon Sep 17 00:00:00 2001 From: tomas-muller Date: Thu, 29 Oct 2015 19:30:28 +0100 Subject: [PATCH] Code Cleanup - fixed various compiler warnings - removed TODOs and FIXMEs that make no longer any sense --- .../org/unitime/commons/web/htmlgen/GeneralHtml.java | 1 - .../commons/web/htmlgen/GeneralHtmlWithJavascript.java | 1 - .../commons/web/htmlgen/GeneralTableCellSupport.java | 1 - .../commons/web/htmlgen/GeneralTableRowSupport.java | 1 - .../unitime/commons/web/htmlgen/GeneralTableSupport.java | 1 - JavaSource/org/unitime/commons/web/htmlgen/Span.java | 1 - JavaSource/org/unitime/commons/web/htmlgen/Table.java | 1 - JavaSource/org/unitime/commons/web/htmlgen/TableCell.java | 1 - .../org/unitime/commons/web/htmlgen/TableHeaderCell.java | 1 - JavaSource/org/unitime/commons/web/htmlgen/TableRow.java | 1 - .../org/unitime/commons/web/htmlgen/TestHtmlGen.java | 2 -- .../org/unitime/timetable/action/ClassesAction.java | 4 ---- .../timetable/action/CourseOfferingEditAction.java | 3 ++- JavaSource/org/unitime/timetable/action/ExamsAction.java | 4 ---- .../action/InstructionalOfferingConfigEditAction.java | 3 ++- .../action/InstructionalOfferingDetailAction.java | 3 ++- .../timetable/dataexchange/EventRelatedImports.java | 1 - .../unitime/timetable/defaults/ApplicationProperty.java | 8 -------- .../unitime/timetable/export/hql/SavedHqlExportToCSV.java | 3 ++- JavaSource/org/unitime/timetable/form/ClassEditForm.java | 6 ------ .../timetable/onlinesectioning/OnlineSectioningLog.java | 3 ++- .../timetable/test/AssignFirstAvailableTimePattern.java | 2 +- .../org/unitime/timetable/test/DegreeWorksImportTest.java | 1 - .../unitime/timetable/test/MasarykDefaultPreferences.java | 2 +- .../org/unitime/timetable/test/SpringLoginTest.java | 7 ++++--- JavaSource/org/unitime/timetable/util/CalendarUtils.java | 1 - 26 files changed, 16 insertions(+), 47 deletions(-) diff --git a/JavaSource/org/unitime/commons/web/htmlgen/GeneralHtml.java b/JavaSource/org/unitime/commons/web/htmlgen/GeneralHtml.java index 484c04999e..95f6a34386 100644 --- a/JavaSource/org/unitime/commons/web/htmlgen/GeneralHtml.java +++ b/JavaSource/org/unitime/commons/web/htmlgen/GeneralHtml.java @@ -26,7 +26,6 @@ /** * @author Stephanie Schluttenhofer * - * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public abstract class GeneralHtml { diff --git a/JavaSource/org/unitime/commons/web/htmlgen/GeneralHtmlWithJavascript.java b/JavaSource/org/unitime/commons/web/htmlgen/GeneralHtmlWithJavascript.java index 215c161a1e..a0192c9ba9 100644 --- a/JavaSource/org/unitime/commons/web/htmlgen/GeneralHtmlWithJavascript.java +++ b/JavaSource/org/unitime/commons/web/htmlgen/GeneralHtmlWithJavascript.java @@ -22,7 +22,6 @@ /** * @author Stephanie Schluttenhofer * - * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public abstract class GeneralHtmlWithJavascript extends GeneralHtml { diff --git a/JavaSource/org/unitime/commons/web/htmlgen/GeneralTableCellSupport.java b/JavaSource/org/unitime/commons/web/htmlgen/GeneralTableCellSupport.java index d51778fff4..79184ae7d2 100644 --- a/JavaSource/org/unitime/commons/web/htmlgen/GeneralTableCellSupport.java +++ b/JavaSource/org/unitime/commons/web/htmlgen/GeneralTableCellSupport.java @@ -22,7 +22,6 @@ /** * @author Stephanie Schluttenhofer * - * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public abstract class GeneralTableCellSupport extends GeneralTableRowSupport { diff --git a/JavaSource/org/unitime/commons/web/htmlgen/GeneralTableRowSupport.java b/JavaSource/org/unitime/commons/web/htmlgen/GeneralTableRowSupport.java index d69e716988..2ff8df254f 100644 --- a/JavaSource/org/unitime/commons/web/htmlgen/GeneralTableRowSupport.java +++ b/JavaSource/org/unitime/commons/web/htmlgen/GeneralTableRowSupport.java @@ -22,7 +22,6 @@ /** * @author Stephanie Schluttenhofer * - * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public abstract class GeneralTableRowSupport extends GeneralTableSupport { diff --git a/JavaSource/org/unitime/commons/web/htmlgen/GeneralTableSupport.java b/JavaSource/org/unitime/commons/web/htmlgen/GeneralTableSupport.java index 84a780f434..016b99f35b 100644 --- a/JavaSource/org/unitime/commons/web/htmlgen/GeneralTableSupport.java +++ b/JavaSource/org/unitime/commons/web/htmlgen/GeneralTableSupport.java @@ -22,7 +22,6 @@ /** * @author Stephanie Schluttenhofer * - * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public abstract class GeneralTableSupport extends GeneralHtmlWithJavascript { diff --git a/JavaSource/org/unitime/commons/web/htmlgen/Span.java b/JavaSource/org/unitime/commons/web/htmlgen/Span.java index c86f20d7a7..e49a554cd8 100644 --- a/JavaSource/org/unitime/commons/web/htmlgen/Span.java +++ b/JavaSource/org/unitime/commons/web/htmlgen/Span.java @@ -23,7 +23,6 @@ /** * @author Stephanie Schluttenhofer * - * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class Span extends GeneralHtmlWithJavascript { diff --git a/JavaSource/org/unitime/commons/web/htmlgen/Table.java b/JavaSource/org/unitime/commons/web/htmlgen/Table.java index 7d25d3b895..49173f2a53 100644 --- a/JavaSource/org/unitime/commons/web/htmlgen/Table.java +++ b/JavaSource/org/unitime/commons/web/htmlgen/Table.java @@ -24,7 +24,6 @@ /** * @author Stephanie Schluttenhofer * - * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class Table extends GeneralTableSupport { diff --git a/JavaSource/org/unitime/commons/web/htmlgen/TableCell.java b/JavaSource/org/unitime/commons/web/htmlgen/TableCell.java index b4739d431c..4d72112710 100644 --- a/JavaSource/org/unitime/commons/web/htmlgen/TableCell.java +++ b/JavaSource/org/unitime/commons/web/htmlgen/TableCell.java @@ -22,7 +22,6 @@ /** * @author Stephanie Schluttenhofer * - * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class TableCell extends GeneralTableCellSupport { diff --git a/JavaSource/org/unitime/commons/web/htmlgen/TableHeaderCell.java b/JavaSource/org/unitime/commons/web/htmlgen/TableHeaderCell.java index e4a841ebb4..e2959b72e8 100644 --- a/JavaSource/org/unitime/commons/web/htmlgen/TableHeaderCell.java +++ b/JavaSource/org/unitime/commons/web/htmlgen/TableHeaderCell.java @@ -22,7 +22,6 @@ /** * @author Stephanie Schluttenhofer * - * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class TableHeaderCell extends GeneralTableCellSupport { diff --git a/JavaSource/org/unitime/commons/web/htmlgen/TableRow.java b/JavaSource/org/unitime/commons/web/htmlgen/TableRow.java index aa9a90bf0c..b250d92ee4 100644 --- a/JavaSource/org/unitime/commons/web/htmlgen/TableRow.java +++ b/JavaSource/org/unitime/commons/web/htmlgen/TableRow.java @@ -23,7 +23,6 @@ /** * @author Stephanie Schluttenhofer * - * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class TableRow extends GeneralTableRowSupport { diff --git a/JavaSource/org/unitime/commons/web/htmlgen/TestHtmlGen.java b/JavaSource/org/unitime/commons/web/htmlgen/TestHtmlGen.java index f5d85782b4..b201638640 100644 --- a/JavaSource/org/unitime/commons/web/htmlgen/TestHtmlGen.java +++ b/JavaSource/org/unitime/commons/web/htmlgen/TestHtmlGen.java @@ -23,7 +23,6 @@ /** * @author Stephanie Schluttenhofer * - * TODO To change the template for this generated type comment go to * Window - Preferences - Java - Code Style - Code Templates */ public class TestHtmlGen { @@ -33,7 +32,6 @@ public class TestHtmlGen { */ public TestHtmlGen() { super(); - // TODO Auto-generated constructor stub } public String htmlOutput(){ diff --git a/JavaSource/org/unitime/timetable/action/ClassesAction.java b/JavaSource/org/unitime/timetable/action/ClassesAction.java index b74922de78..9a90013ffb 100644 --- a/JavaSource/org/unitime/timetable/action/ClassesAction.java +++ b/JavaSource/org/unitime/timetable/action/ClassesAction.java @@ -180,10 +180,6 @@ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServlet } } - String msg = ApplicationProperty.ClassesMessage.value(); - if (msg!=null && msg.length()>0) - request.setAttribute(Constants.REQUEST_MSSG, msg); - return mapping.findForward("show"); } diff --git a/JavaSource/org/unitime/timetable/action/CourseOfferingEditAction.java b/JavaSource/org/unitime/timetable/action/CourseOfferingEditAction.java index 2f492fcea8..c2fa0aa499 100644 --- a/JavaSource/org/unitime/timetable/action/CourseOfferingEditAction.java +++ b/JavaSource/org/unitime/timetable/action/CourseOfferingEditAction.java @@ -662,7 +662,8 @@ private void doLoad( if (co.isIsControl().booleanValue()) { // Catalog Link - String linkLookupClass = ApplicationProperty.CourseCatalogLinkProvider.value(); + @SuppressWarnings("deprecation") + String linkLookupClass = ApplicationProperty.CourseCatalogLinkProvider.value(); if (linkLookupClass!=null && linkLookupClass.trim().length()>0) { ExternalLinkLookup lookup = (ExternalLinkLookup) (Class.forName(linkLookupClass).newInstance()); Map results = lookup.getLink(io); diff --git a/JavaSource/org/unitime/timetable/action/ExamsAction.java b/JavaSource/org/unitime/timetable/action/ExamsAction.java index 70cad61efe..30a3044e6a 100644 --- a/JavaSource/org/unitime/timetable/action/ExamsAction.java +++ b/JavaSource/org/unitime/timetable/action/ExamsAction.java @@ -165,10 +165,6 @@ public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServlet } } - String msg = ApplicationProperty.ExamsMessage.value(); - if (msg!=null && msg.length()>0) - request.setAttribute(Constants.REQUEST_MSSG, msg); - LookupTables.setupExamTypes(request, null); return mapping.findForward("show"); diff --git a/JavaSource/org/unitime/timetable/action/InstructionalOfferingConfigEditAction.java b/JavaSource/org/unitime/timetable/action/InstructionalOfferingConfigEditAction.java index 1f25289038..ddf1ee7e17 100644 --- a/JavaSource/org/unitime/timetable/action/InstructionalOfferingConfigEditAction.java +++ b/JavaSource/org/unitime/timetable/action/InstructionalOfferingConfigEditAction.java @@ -443,7 +443,8 @@ private void loadDetailFromCourseOffering( frm.setConfigCount(new Integer (configs.size())); // Catalog Link - String linkLookupClass = ApplicationProperty.CourseCatalogLinkProvider.value(); + @SuppressWarnings("deprecation") + String linkLookupClass = ApplicationProperty.CourseCatalogLinkProvider.value(); if (linkLookupClass!=null && linkLookupClass.trim().length()>0) { ExternalLinkLookup lookup = (ExternalLinkLookup) (Class.forName(linkLookupClass).newInstance()); Map results = lookup.getLink(io); diff --git a/JavaSource/org/unitime/timetable/action/InstructionalOfferingDetailAction.java b/JavaSource/org/unitime/timetable/action/InstructionalOfferingDetailAction.java index a4581a8170..5ef8f833f4 100644 --- a/JavaSource/org/unitime/timetable/action/InstructionalOfferingDetailAction.java +++ b/JavaSource/org/unitime/timetable/action/InstructionalOfferingDetailAction.java @@ -427,7 +427,8 @@ private void doLoad( } // Catalog Link - String linkLookupClass = ApplicationProperty.CourseCatalogLinkProvider.value(); + @SuppressWarnings("deprecation") + String linkLookupClass = ApplicationProperty.CourseCatalogLinkProvider.value(); if (linkLookupClass!=null && linkLookupClass.trim().length()>0) { ExternalLinkLookup lookup = (ExternalLinkLookup) (Class.forName(linkLookupClass).newInstance()); Map results = lookup.getLink(io); diff --git a/JavaSource/org/unitime/timetable/dataexchange/EventRelatedImports.java b/JavaSource/org/unitime/timetable/dataexchange/EventRelatedImports.java index 2542a3f66d..2b7ef67563 100644 --- a/JavaSource/org/unitime/timetable/dataexchange/EventRelatedImports.java +++ b/JavaSource/org/unitime/timetable/dataexchange/EventRelatedImports.java @@ -57,7 +57,6 @@ public abstract class EventRelatedImports extends BaseImport { * */ public EventRelatedImports() { - // TODO Auto-generated constructor stub } protected void addNote(String note){ diff --git a/JavaSource/org/unitime/timetable/defaults/ApplicationProperty.java b/JavaSource/org/unitime/timetable/defaults/ApplicationProperty.java index d5f4c0cb84..0526a7ac20 100644 --- a/JavaSource/org/unitime/timetable/defaults/ApplicationProperty.java +++ b/JavaSource/org/unitime/timetable/defaults/ApplicationProperty.java @@ -646,14 +646,6 @@ public enum ApplicationProperty { @Description("Classes: class naming helper class (implementing ExternalClassNameHelperInterface)") ClassNamingHelper("tmtbl.class.naming.helper"), - @Description("Classes: text of a blue message on the top of the page") - @Deprecated - ClassesMessage("tmtbl.classes.message"), - - @Description("Examinations: text of a blue message on the top of the page") - @Deprecated - ExamsMessage("tmtbl.exams.message"), - @Type(Boolean.class) @DefaultValue("false") @Description("Instructional Offering Detail: make not offered stays on the detail page") diff --git a/JavaSource/org/unitime/timetable/export/hql/SavedHqlExportToCSV.java b/JavaSource/org/unitime/timetable/export/hql/SavedHqlExportToCSV.java index ccedbd3783..2f0fc403db 100644 --- a/JavaSource/org/unitime/timetable/export/hql/SavedHqlExportToCSV.java +++ b/JavaSource/org/unitime/timetable/export/hql/SavedHqlExportToCSV.java @@ -49,6 +49,7 @@ import org.unitime.timetable.model.dao.SavedHQLDAO; import org.unitime.timetable.model.dao._RootDAO; import org.unitime.timetable.security.UserContext; +import org.unitime.timetable.security.rights.Right; /** * @author Tomas Muller @@ -66,7 +67,7 @@ public String reference() { @Override public void export(ExportHelper helper) throws IOException { // Check rights - // FIXME: helper.getSessionContext().checkPermission(Right.???); + helper.getSessionContext().checkPermission(Right.HQLReports); // Retrive report String report = helper.getParameter("report"); diff --git a/JavaSource/org/unitime/timetable/form/ClassEditForm.java b/JavaSource/org/unitime/timetable/form/ClassEditForm.java index bfed726ee4..a08dec39ae 100644 --- a/JavaSource/org/unitime/timetable/form/ClassEditForm.java +++ b/JavaSource/org/unitime/timetable/form/ClassEditForm.java @@ -99,10 +99,8 @@ public class ClassEditForm extends PreferencesForm { private Integer minRoomLimit; private Boolean unlimitedEnroll; private Integer enrollment; - //TODO Reservations Bypass - to be removed later private Boolean isCrosslisted; private String accommodation; - //End Bypass // --------------------------------------------------------- Classes @@ -267,9 +265,7 @@ public void reset(ActionMapping mapping, HttpServletRequest request) { maxExpectedCapacity = null; roomRatio = null; unlimitedEnroll = null; - //TODO Reservations Bypass - to be removed later isCrosslisted = null; - // End Bypass instructors = DynamicList.getInstance(new ArrayList(), factoryInstructors); instrPctShare= DynamicList.getInstance(new ArrayList(), factoryInstructors); @@ -612,14 +608,12 @@ public void setUnlimitedEnroll(Boolean unlimitedEnroll) { this.unlimitedEnroll = unlimitedEnroll; } - //TODO Reservations Bypass - to be removed later public Boolean getIsCrosslisted() { return isCrosslisted; } public void setIsCrosslisted(Boolean isCrosslisted) { this.isCrosslisted = isCrosslisted; } - // End Bypass /** * @param date diff --git a/JavaSource/org/unitime/timetable/onlinesectioning/OnlineSectioningLog.java b/JavaSource/org/unitime/timetable/onlinesectioning/OnlineSectioningLog.java index 9a35629f3b..8ea8a5a921 100644 --- a/JavaSource/org/unitime/timetable/onlinesectioning/OnlineSectioningLog.java +++ b/JavaSource/org/unitime/timetable/onlinesectioning/OnlineSectioningLog.java @@ -3,6 +3,7 @@ package org.unitime.timetable.onlinesectioning; +@SuppressWarnings("unused") public final class OnlineSectioningLog { private OnlineSectioningLog() {} public static void registerAllExtensions( @@ -12796,7 +12797,7 @@ public org.unitime.timetable.onlinesectioning.OnlineSectioningLog.Log build() { public org.unitime.timetable.onlinesectioning.OnlineSectioningLog.Log buildPartial() { org.unitime.timetable.onlinesectioning.OnlineSectioningLog.Log result = new org.unitime.timetable.onlinesectioning.OnlineSectioningLog.Log(this); - int from_bitField0_ = bitField0_; + int from_bitField0_ = bitField0_; if (actionBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001)) { action_ = java.util.Collections.unmodifiableList(action_); diff --git a/JavaSource/org/unitime/timetable/test/AssignFirstAvailableTimePattern.java b/JavaSource/org/unitime/timetable/test/AssignFirstAvailableTimePattern.java index 31e3d72bfd..eb754c5260 100644 --- a/JavaSource/org/unitime/timetable/test/AssignFirstAvailableTimePattern.java +++ b/JavaSource/org/unitime/timetable/test/AssignFirstAvailableTimePattern.java @@ -74,7 +74,7 @@ public static void main(String[] args) { "select distinct s from SchedulingSubpart s inner join s.instrOfferingConfig.instructionalOffering.courseOfferings co where " + "co.subjectArea.department.session.uniqueId = :sessionId").setLong("sessionId", session.getUniqueId()).list()) { if (s.getTimePreferences().isEmpty()) { - List patterns = TimePattern.findByMinPerWeek(session, false, false, false, s.getMinutesPerWk(), null); + List patterns = TimePattern.findApplicable(session, false, false, false, s.getMinutesPerWk(), s.effectiveDatePattern(), s.getInstrOfferingConfig().getDurationModel(), null); if (patterns.isEmpty()) continue; TimePattern pattern = patterns.get(0); TimePref tp = new TimePref(); diff --git a/JavaSource/org/unitime/timetable/test/DegreeWorksImportTest.java b/JavaSource/org/unitime/timetable/test/DegreeWorksImportTest.java index a3217368e1..42b209a9fd 100644 --- a/JavaSource/org/unitime/timetable/test/DegreeWorksImportTest.java +++ b/JavaSource/org/unitime/timetable/test/DegreeWorksImportTest.java @@ -82,7 +82,6 @@ public static int guessEnrollmentFromLastLike(org.hibernate.Session hibSession, } public static int guessEnrollmentFromReal(org.hibernate.Session hibSession, CourseOffering co, String area, String major, String classification) { - if (true) return 0; return ((Number)hibSession.createQuery( "select count(distinct e.student) from StudentClassEnrollment e inner join e.student.academicAreaClassifications aac " + "inner join e.student.posMajors m where e.courseOffering.uniqueId = :courseId and " + diff --git a/JavaSource/org/unitime/timetable/test/MasarykDefaultPreferences.java b/JavaSource/org/unitime/timetable/test/MasarykDefaultPreferences.java index 49d63830bc..d0c1362841 100644 --- a/JavaSource/org/unitime/timetable/test/MasarykDefaultPreferences.java +++ b/JavaSource/org/unitime/timetable/test/MasarykDefaultPreferences.java @@ -284,7 +284,7 @@ else if (rg.getAbbv().equals("BĚŽ")) c.getPreferences().clear(); // Strongly preferred room TimePattern pattern = null; - patterns: for (TimePattern p: TimePattern.findByMinPerWeek(session.getUniqueId(), false, false, false, c.getSchedulingSubpart().getMinutesPerWk(), null)) { + patterns: for (TimePattern p: TimePattern.findApplicable(session.getUniqueId(), false, false, false, c.getSchedulingSubpart().getMinutesPerWk(), c.effectiveDatePattern(), c.getSchedulingSubpart().getInstrOfferingConfig().getDurationModel(), null)) { for (TimePatternDays d: p.getDays()) if (a.getDays().equals(d.getDayCode())) for (TimePatternTime t: p.getTimes()) { diff --git a/JavaSource/org/unitime/timetable/test/SpringLoginTest.java b/JavaSource/org/unitime/timetable/test/SpringLoginTest.java index 87c6092933..5be87cbe11 100644 --- a/JavaSource/org/unitime/timetable/test/SpringLoginTest.java +++ b/JavaSource/org/unitime/timetable/test/SpringLoginTest.java @@ -21,7 +21,6 @@ import org.cpsolver.ifs.util.ToolBox; -import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -51,7 +50,7 @@ public static void main(String[] args) { HibernateUtil.configureHibernate(ApplicationProperties.getProperties()); // Setup application context - ApplicationContext context = new ClassPathXmlApplicationContext("/applicationContext.xml", "/securityContext.xml"); + ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("/applicationContext.xml", "/securityContext.xml"); // Get username and password String username = System.console().readLine("[%s]", "Username:"); @@ -72,9 +71,11 @@ public static void main(String[] args) { // Print user name and his/her authorities System.out.println("User name:" + user.getName()); System.out.println("Authorities:" + user.getAuthorities()); + + context.close(); } catch (Exception e) { e.printStackTrace(); - } + } } } diff --git a/JavaSource/org/unitime/timetable/util/CalendarUtils.java b/JavaSource/org/unitime/timetable/util/CalendarUtils.java index 35534459a7..12bc3e654d 100644 --- a/JavaSource/org/unitime/timetable/util/CalendarUtils.java +++ b/JavaSource/org/unitime/timetable/util/CalendarUtils.java @@ -47,7 +47,6 @@ public static boolean isValidDate(String date, String dateFormat) { * @return null if not a valid date * Use {@link Formats.Format.parse(String)} instead. */ - @Deprecated public static Date getDate(String date, String dateFormat) { try { return Formats.getDateFormat(dateFormat).parse(date);