Skip to content

Commit

Permalink
Code Cleanup
Browse files Browse the repository at this point in the history
- fixed various compiler warnings
- removed TODOs and FIXMEs that make no longer any sense
  • Loading branch information
tomas-muller committed Oct 29, 2015
1 parent 6e56115 commit d7037fb
Show file tree
Hide file tree
Showing 26 changed files with 16 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion JavaSource/org/unitime/commons/web/htmlgen/Span.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion JavaSource/org/unitime/commons/web/htmlgen/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion JavaSource/org/unitime/commons/web/htmlgen/TableCell.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion JavaSource/org/unitime/commons/web/htmlgen/TableRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions JavaSource/org/unitime/commons/web/htmlgen/TestHtmlGen.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -33,7 +32,6 @@ public class TestHtmlGen {
*/
public TestHtmlGen() {
super();
// TODO Auto-generated constructor stub
}

public String htmlOutput(){
Expand Down
4 changes: 0 additions & 4 deletions JavaSource/org/unitime/timetable/action/ClassesAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 0 additions & 4 deletions JavaSource/org/unitime/timetable/action/ExamsAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public abstract class EventRelatedImports extends BaseImport {
*
*/
public EventRelatedImports() {
// TODO Auto-generated constructor stub
}

protected void addNote(String note){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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");
Expand Down
6 changes: 0 additions & 6 deletions JavaSource/org/unitime/timetable/form/ClassEditForm.java
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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<TimePattern> patterns = TimePattern.findByMinPerWeek(session, false, false, false, s.getMinutesPerWk(), null);
List<TimePattern> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down
7 changes: 4 additions & 3 deletions JavaSource/org/unitime/timetable/test/SpringLoginTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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:");
Expand All @@ -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();
}
}
}

}
1 change: 0 additions & 1 deletion JavaSource/org/unitime/timetable/util/CalendarUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d7037fb

Please sign in to comment.