Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
MrThanasiz committed Jun 12, 2019
2 parents 461c91a + 817a6c2 commit 1ef269a
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 33 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ Please contact [MrThanasiz](https://github.com/MrThanasiz)/[Novvator](https://gi

## Versioning

For the versions available, see the [tags on this repository](https://github.com/your/project/tags).
For the versions available, check the [Releases tab on the repository](https://github.com/MrThanasiz/UoM-Erasmus-Helper/releases).

## Authors

* **Athanasios Stefanidis** - *InputDataFrame / Score / Tips / UniversitySelectFrame* - [MrThanasiz](https://github.com/MrThanasiz/)
* **Konstantinos Petridis** - *LogRegCheck / Secretariat / SecretariatFrame* - [Romputer](https://github.com/Romputer)
* **Athanasios Stefanidis** - *InputDataFrame / Score / Tips / UniversitySelectFrame / ValidationCheck* - [MrThanasiz](https://github.com/MrThanasiz/)
* **Konstantinos Petridis** - *LogRegCheck / Secretariat / SecretariatFrame / Student* - [Romputer](https://github.com/Romputer)
* **Stamatis Sellas** - *Department / MainFrame / University* - [Novvator](https://github.com/Novvator)
* **Stefanos Fokianos** - *CentralRegistry / CreateFile / HomeFrame / RegisterFrame* - [Stef-Fokianos](https://github.com/Stef-fokianos)

Expand Down
56 changes: 27 additions & 29 deletions src/CentralRegistry.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public class CentralRegistry

private static ArrayList<Student> students;

public static boolean initializedList = false;
private static boolean initializedList = false;


@SuppressWarnings("unchecked")
Expand Down Expand Up @@ -41,6 +41,28 @@ public static void desirializeUsers(){
c.printStackTrace();
}
}

public static void serializeUsers() {

String filename = "student.ser";

// Serialization
try{
//Saving of student in a file
FileOutputStream file = new FileOutputStream(filename);
ObjectOutputStream out = new ObjectOutputStream(file);

// Method for serialization of Student s
out.writeObject(students);

out.close();
file.close();

// System.out.println("Serialization worked");
}catch(IOException ex) {
System.out.println("IOException is caught");
}
}

public static Student registerNewUser() {

Expand All @@ -53,34 +75,6 @@ public static Student registerNewUser() {

return s.get(s.indexOf(stud));
}



public static void serializeUsers() {

String filename = "student.ser";

// Serialization
try{
//Saving of student in a file
FileOutputStream file = new FileOutputStream(filename);
ObjectOutputStream out = new ObjectOutputStream(file);

// Method for serialization of Student s
out.writeObject(students);

out.close();
file.close();

// System.out.println("Serialization worked");
}catch(IOException ex) {

System.out.println("IOException is caught");
}



}

public static ArrayList<Student> getStudents(){

Expand Down Expand Up @@ -158,6 +152,10 @@ public static ArrayList<Department> getDepartments(){
return departmentsList;
}

public static boolean initializedList() {
return initializedList;
}

public static void assignStudsToDeps() {
for(Student student: students) {
for(int i = 0; i < departmentsList.size(); i++)
Expand Down
2 changes: 1 addition & 1 deletion src/LogRegCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ public class LogRegCheck {
public static Student checkUsername(String aUsername) {

//We need a initializedList variable in Central Registry
if ( !CentralRegistry.initializedList )
if ( !CentralRegistry.initializedList() )
return null;

for(Student student: CentralRegistry.getStudents())
Expand Down

0 comments on commit 1ef269a

Please sign in to comment.