0% found this document useful (0 votes)
7 views10 pages

2

Uploaded by

kingbalaji81
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views10 pages

2

Uploaded by

kingbalaji81
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

2.

Develop a Java Project on Dissertation with Database*

Developing a Java-based project on "Dissertation with Database" typically involves


creating a system that manages dissertation data for students, researchers, and faculty
members. The database would store information such as dissertation titles, authors,
supervisors, research topics, and status. The Java application would interact with this
database to allow for CRUD (Create, Read, Update, Delete) operations on the dissertation
records.

### Key Features of the Dissertation Management System


1. **User Authentication and Role Management:**
- Different users, such as students, faculty, and administrators, will have access to
different functionalities.

2. **Dissertation Management:**
- Users can add, update, and view dissertation details (e.g., title, author, supervisor,
abstract, research topic, etc.).

3. **Search and Filter:**


- Users can search for dissertations by title, author, supervisor, and other parameters.

4. **Status Tracking:**
- The system can track the status of a dissertation (e.g., under review, completed, in-
progress).

5. **Database Integration:**
- All dissertation data will be stored in a relational database (e.g., MySQL, PostgreSQL,
SQLite).

### Technologies Used


1. **Java**: Core programming language.
2. **JDBC (Java Database Connectivity)**: For interacting with the database.
3. **MySQL** (or any other relational DB): For storing the dissertation-related data.
4. **Swing** or **JavaFX**: For building the GUI (Graphical User Interface).
5. **Maven/Gradle**: Build tools for managing dependencies.
6. **JDBC** for Database connection.

---

### 1. **Database Design**

#### Tables:
1. **Users**: Stores information about students, faculty, and administrators.
- `user_id` (INT, Primary Key)
- `username` (VARCHAR)
- `password` (VARCHAR)
- `role` (VARCHAR) [student, faculty, admin]

2. **Dissertations**: Stores the dissertation details.


- `dissertation_id` (INT, Primary Key)
- `title` (VARCHAR)
- `abstract` (TEXT)
- `author_id` (INT, Foreign Key referencing `Users.user_id`)
- `supervisor_id` (INT, Foreign Key referencing `Users.user_id`)
- `research_topic` (VARCHAR)
- `status` (VARCHAR) [under review, completed, in-progress]

3. **Reviews**: Stores review details for each dissertation.


- `review_id` (INT, Primary Key)
- `dissertation_id` (INT, Foreign Key referencing `Dissertations.dissertation_id`)
- `reviewer_id` (INT, Foreign Key referencing `Users.user_id`)
- `review_text` (TEXT)
- `rating` (INT)

4. **Dissertation_Status_History**: Stores changes in the dissertation status over time.


- `status_id` (INT, Primary Key)
- `dissertation_id` (INT, Foreign Key referencing `Dissertations.dissertation_id`)
- `status` (VARCHAR)
- `updated_on` (DATE)

### 2. **Database Setup (MySQL)**

1. **Create a Database**:
```sql
CREATE DATABASE dissertation_management;
USE dissertation_management;
```

2. **Create Tables**:
```sql
CREATE TABLE Users (
user_id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(50) NOT NULL,
password VARCHAR(50) NOT NULL,
role VARCHAR(20) NOT NULL
);

CREATE TABLE Dissertations (


dissertation_id INT AUTO_INCREMENT PRIMARY KEY,
title VARCHAR(100) NOT NULL,
abstract TEXT,
author_id INT,
supervisor_id INT,
research_topic VARCHAR(100),
status VARCHAR(50),
FOREIGN KEY (author_id) REFERENCES Users(user_id),
FOREIGN KEY (supervisor_id) REFERENCES Users(user_id)
);

CREATE TABLE Reviews (


review_id INT AUTO_INCREMENT PRIMARY KEY,
dissertation_id INT,
reviewer_id INT,
review_text TEXT,
rating INT,
FOREIGN KEY (dissertation_id) REFERENCES Dissertations(dissertation_id),
FOREIGN KEY (reviewer_id) REFERENCES Users(user_id)
);

CREATE TABLE Dissertation_Status_History (


status_id INT AUTO_INCREMENT PRIMARY KEY,
dissertation_id INT,
status VARCHAR(50),
updated_on DATE,
FOREIGN KEY (dissertation_id) REFERENCES Dissertations(dissertation_id)
);
```

### 3. **Java Classes & Project Structure**


#### **Project Structure**:
```
dissertation-management-system
├── src
│ ├── model
│ │ ├── Dissertation.java
│ │ ├── User.java
│ │ ├── Review.java
│ │ └── DissertationStatusHistory.java
│ ├── dao
│ │ ├── DissertationDAO.java
│ │ ├── UserDAO.java
│ │ ├── ReviewDAO.java
│ │ └── DissertationStatusHistoryDAO.java
│ ├── gui
│ │ └── MainGUI.java
│ └── utils
│ └── DatabaseConnection.java
├── resources
│ └── database.properties
└── pom.xml (Maven)
```

#### **Java Classes:**

1. **User.java**:
```java
public class User {
private int userId;
private String username;
private String password;
private String role;

// Constructor, Getters, Setters, toString()


}
```

2. **Dissertation.java**:
```java
public class Dissertation {
private int dissertationId;
private String title;
private String abstractText;
private User author;
private User supervisor;
private String researchTopic;
private String status;

// Constructor, Getters, Setters, toString()


}
```

3. **Review.java**:
```java
public class Review {
private int reviewId;
private Dissertation dissertation;
private User reviewer;
private String reviewText;
private int rating;

// Constructor, Getters, Setters, toString()


}
```

4. **DissertationStatusHistory.java**:
```java
public class DissertationStatusHistory {
private int statusId;
private Dissertation dissertation;
private String status;
private Date updatedOn;

// Constructor, Getters, Setters, toString()


}
```

### 4. **DAO (Data Access Object)**

For interacting with the database, create DAO classes for each entity:

1. **DatabaseConnection.java** (Utility for connecting to MySQL Database):


```java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DatabaseConnection {
private static final String DB_URL =
"jdbc:mysql://localhost:3306/dissertation_management";
private static final String DB_USERNAME = "root";
private static final String DB_PASSWORD = "";

public static Connection getConnection() throws SQLException {


try {
return DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);
} catch (SQLException e) {
throw new SQLException("Database connection failed", e);
}
}
}
```

2. **DissertationDAO.java**:
```java
import java.sql.*;

public class DissertationDAO {


public boolean addDissertation(Dissertation dissertation) {
String query = "INSERT INTO Dissertations (title, abstract, author_id, supervisor_id,
research_topic, status) VALUES (?, ?, ?, ?, ?, ?)";
try (Connection conn = DatabaseConnection.getConnection();
PreparedStatement stmt = conn.prepareStatement(query)) {
stmt.setString(1, dissertation.getTitle());
stmt.setString(2, dissertation.getAbstractText());
stmt.setInt(3, dissertation.getAuthor().getUserId());
stmt.setInt(4, dissertation.getSupervisor().getUserId());
stmt.setString(5, dissertation.getResearchTopic());
stmt.setString(6, dissertation.getStatus());
int rowsAffected = stmt.executeUpdate();
return rowsAffected > 0;
} catch (SQLException e) {
e.printStackTrace();
return false;
}
}

public Dissertation getDissertationById(int dissertationId) {


String query = "SELECT * FROM Dissertations WHERE dissertation_id = ?";
try (Connection conn = DatabaseConnection.getConnection();
PreparedStatement stmt = conn.prepareStatement(query)) {
stmt.setInt(1, dissertationId);
ResultSet rs = stmt.executeQuery();
if (rs.next()) {
Dissertation dissertation = new Dissertation();
dissertation.setDissertationId(rs.getInt("dissertation_id"));
dissertation.setTitle(rs.getString("title"));
dissertation.setAbstractText(rs.getString("abstract"));
// Map other fields...
return dissertation;
}
} catch (SQLException e) {
e.printStackTrace();
}
return null;
}
}
```

### 5. **GUI (MainGUI.java)**

You can use Swing or JavaFX to create a basic graphical interface to interact with the
system. For simplicity, let's assume you're using Swing.

```java
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class MainGUI {


private JFrame frame;
private JTextField titleField;
private JTextArea abstractTextArea;
private JButton addButton;

public MainGUI() {
frame = new JFrame("Dissertation Management System");
frame.setSize(400, 400);
frame.setDefaultClose

You might also like