Added skeleton classes for defining TA teams.

This commit is contained in:
Andrew Lalis 2018-08-28 20:27:41 +02:00
parent 5c3ddc6e29
commit ef14733fa8
6 changed files with 46 additions and 10 deletions

View File

@ -0,0 +1,9 @@
package nl.andrewlalis.model;
public abstract class DatabaseObject {
public abstract DatabaseObject retrieve();
public abstract boolean store();
}

View File

@ -0,0 +1,13 @@
package nl.andrewlalis.ui.control.command.executables;
import nl.andrewlalis.git_api.GithubManager;
public class DefineTaTeams extends GithubExecutable {
@Override
protected boolean executeWithManager(GithubManager manager, String[] args) {
return false;
}
}

View File

@ -35,6 +35,9 @@ public class ReadStudentsFileToDB implements Executable {
String filename = args[0]; String filename = args[0];
int teamSize = Integer.parseUnsignedInt(args[1]); int teamSize = Integer.parseUnsignedInt(args[1]);
List<StudentTeam> teams = FileUtils.getStudentTeamsFromCSV(filename, teamSize); List<StudentTeam> teams = FileUtils.getStudentTeamsFromCSV(filename, teamSize);
if (teams == null) {
return false;
}
return this.db.storeStudentTeams(teams); return this.db.storeStudentTeams(teams);
} }
} }

View File

@ -0,0 +1,18 @@
package nl.andrewlalis.ui.control.listeners;
import nl.andrewlalis.ui.control.command.CommandExecutor;
import nl.andrewlalis.ui.view.InitializerApp;
import java.awt.event.ActionEvent;
public class DefineTaTeamsListener extends ExecutableListener {
public DefineTaTeamsListener(CommandExecutor executor, InitializerApp app) {
super(executor, app);
}
@Override
public void actionPerformed(ActionEvent actionEvent) {
}
}

View File

@ -35,9 +35,6 @@ public class InitializerApp extends JFrame {
private JTextField organizationField = new JTextField(); private JTextField organizationField = new JTextField();
private JTextField accessTokenField = new JTextField(); private JTextField accessTokenField = new JTextField();
private JTextField assignmentsRepoField = new JTextField();
private JTextField teachingAssistantsField = new JTextField();
private JTextField studentRepoField = new JTextField();
/** /**
* The executor responsible for performing meaningful actions. * The executor responsible for performing meaningful actions.
@ -103,12 +100,6 @@ public class InitializerApp extends JFrame {
this.organizationField.setText("InitializerTesting"); this.organizationField.setText("InitializerTesting");
infoInputPanel.add(generateTextFieldPanel("Access Token", this.accessTokenField)); infoInputPanel.add(generateTextFieldPanel("Access Token", this.accessTokenField));
this.accessTokenField.setText("haha get your own"); this.accessTokenField.setText("haha get your own");
infoInputPanel.add(generateTextFieldPanel("Assignments Repo Name", this.assignmentsRepoField));
this.assignmentsRepoField.setText("assignments_2018");
infoInputPanel.add(generateTextFieldPanel("TA-All Team Name", this.teachingAssistantsField));
this.teachingAssistantsField.setText("teaching-assistants");
infoInputPanel.add(generateTextFieldPanel("Student Repo Prefix", this.studentRepoField));
this.studentRepoField.setText("advoop_2018");
githubManagerPanel.add(infoInputPanel, BorderLayout.NORTH); githubManagerPanel.add(infoInputPanel, BorderLayout.NORTH);
@ -128,6 +119,9 @@ public class InitializerApp extends JFrame {
generateAssignmentsRepoButton.addActionListener(new GenerateAssignmentsRepoListener(this.executor, this)); generateAssignmentsRepoButton.addActionListener(new GenerateAssignmentsRepoListener(this.executor, this));
commonActionsPanel.add(generateAssignmentsRepoButton); commonActionsPanel.add(generateAssignmentsRepoButton);
JButton defineTaTeamsButton = new JButton("Define TA Teams");
commonActionsPanel.add(defineTaTeamsButton);
githubManagerPanel.add(commonActionsPanel, BorderLayout.CENTER); githubManagerPanel.add(commonActionsPanel, BorderLayout.CENTER);
return githubManagerPanel; return githubManagerPanel;

View File

@ -54,7 +54,6 @@ public class FileUtils {
return studentTeams; return studentTeams;
} catch (IOException | ArrayIndexOutOfBoundsException e) { } catch (IOException | ArrayIndexOutOfBoundsException e) {
logger.severe("Unable to generate studentTeams from CSV file, exiting. " + e.getMessage()); logger.severe("Unable to generate studentTeams from CSV file, exiting. " + e.getMessage());
System.exit(1);
return null; return null;
} }
} }