Skip to content

Commit

Permalink
Core Java Classes
Browse files Browse the repository at this point in the history
Login-- Dataabse manager class
  • Loading branch information
anushkab authored Nov 2, 2017
1 parent d551835 commit c91e749
Show file tree
Hide file tree
Showing 9 changed files with 734 additions and 0 deletions.
68 changes: 68 additions & 0 deletions src/Admin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;

public class Admin extends Member{

public Admin(College thisCollege, List<Room> myBookings, String name, String email, String password) {
super(thisCollege, myBookings, name, email, password);
// TODO Auto-generated constructor stub
}
private void book_room(Room r) {
this.MyBookings.add(r);

}
private void respond_Req(Request req) {

req.setStatus(true);

}

@Override
public void ViewRooms() {
// TODO Auto-generated method stub

}

@Override
public void Cancel_Bookings() {
// TODO Auto-generated method stub

}

@Override
public void Display_Page() {
// TODO Auto-generated method stub

}

public void serialize(Admin s1) throws IOException {

ObjectOutputStream out = null;
try {
out = new ObjectOutputStream (new FileOutputStream("Admin/"+s1.Name+".txt"));
out.writeObject(s1);
}
finally
{
out.close();
}
}
public static Admin deserialize(String u) throws IOException, ClassNotFoundException {ObjectInputStream in = null;
try {
String fo="Admin/"+u;
in = new ObjectInputStream ( new FileInputStream(fo));
Admin s1 = (Admin) in.readObject();
return s1;

} finally {
in.close();
}
}



}
75 changes: 75 additions & 0 deletions src/College.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;
import java.util.Map;

public class College {

private List<Member> MemberList;
private List<Admin> adminList;
private List<Member> FacultyList;
private List<Member> RequestList;
private Map<Course,Room> Room_Courses;
public List<Member> getMemberList() {
return MemberList;
}
public void setMemberList(List<Member> memberList) {
MemberList = memberList;
}
public List<Admin> getAdminList() {
return adminList;
}
public void setAdminList(List<Admin> adminList) {
this.adminList = adminList;
}
public List<Member> getFacultyList() {
return FacultyList;
}
public void setFacultyList(List<Member> facultyList) {
FacultyList = facultyList;
}
public List<Member> getRequestList() {
return RequestList;
}
public void setRequestList(List<Member> requestList) {
RequestList = requestList;
}
public Map<Course, Room> getRoom_Courses() {
return Room_Courses;
}
public void setRoom_Courses(Map<Course, Room> room_Courses) {
Room_Courses = room_Courses;
}



public void serialize(College s1) throws IOException {

ObjectOutputStream out = null;
try {
out = new ObjectOutputStream (new FileOutputStream("College/"+s1.hashCode()+".txt"));
out.writeObject(s1);
}
finally
{
out.close();
}
}
public static College deserialize() throws IOException, ClassNotFoundException {ObjectInputStream in = null;
try {
String fo="College.txt";
in = new ObjectInputStream ( new FileInputStream(fo));
College s1 = (College) in.readObject();
return s1;

} finally {
in.close();
}
}



}
91 changes: 91 additions & 0 deletions src/Course.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;

public class Course {
public Room room_allocated;
public String TimeStamp;
public int audience;
public List<String> postconditions;
public List<String> preconditions;
public boolean findkeyword(String tomatch)
{
for(String find : preconditions)
{
if(find.equals(tomatch))
{
return true;
}
}
for(String find : postconditions)
{
if(find.equals(tomatch))
{
return true;
}
}
return false;
}

public void serialize(Course s1) throws IOException {

ObjectOutputStream out = null;
try {
out = new ObjectOutputStream (new FileOutputStream("Course/"+s1.getRoom_allocated()+".txt"));
out.writeObject(s1);
}
finally
{
out.close();
}
}
public static Course deserialize(String u) throws IOException, ClassNotFoundException {ObjectInputStream in = null;
try {
String fo="Course/"+u;
in = new ObjectInputStream ( new FileInputStream(fo));
Course s1 = (Course) in.readObject();
return s1;

} finally {
in.close();
}
}




public Room getRoom_allocated() {
return room_allocated;
}
public void setRoom_allocated(Room room_allocated) {
this.room_allocated = room_allocated;
}
public String getTimeStamp() {
return TimeStamp;
}
public void setTimeStamp(String timeStamp) {
TimeStamp = timeStamp;
}
public int getAudience() {
return audience;
}
public void setAudience(int audience) {
this.audience = audience;
}
public List<String> getPostconditions() {
return postconditions;
}
public void setPostconditions(List<String> postconditions) {
this.postconditions = postconditions;
}
public List<String> getPreconditions() {
return preconditions;
}
public void setPreconditions(List<String> preconditions) {
this.preconditions = preconditions;
}

}
59 changes: 59 additions & 0 deletions src/Faculty.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.List;

public class Faculty extends Member {
public Faculty(College thisCollege, List<Room> myBookings, String email, String password) {
super(thisCollege, myBookings, email, password, password);
// TODO Auto-generated constructor stub
}
private void book_room(Room r) {
this.MyBookings.add(r);

}
@Override
public void ViewRooms() {
// TODO Auto-generated method stub

}

@Override
public void Cancel_Bookings() {
// TODO Auto-generated method stub

}

@Override
public void Display_Page() {
// TODO Auto-generated method stub

}
public void serialize(Faculty s1) throws IOException {

ObjectOutputStream out = null;
try {
out = new ObjectOutputStream (new FileOutputStream("Faculty/"+s1.Name+".txt"));
out.writeObject(s1);
}
finally
{
out.close();
}
}
public static Faculty deserialize(String u) throws IOException, ClassNotFoundException {ObjectInputStream in = null;
try {
String fo="Faculty/"+u;
in = new ObjectInputStream ( new FileInputStream(fo));
Faculty s1 = (Faculty) in.readObject();
return s1;

} finally {
in.close();
}
}


}
Loading

0 comments on commit c91e749

Please sign in to comment.