Package com.rit.dca.pubpaper.dao
Class PaperDAO
java.lang.Object
com.rit.dca.pubpaper.dao.PaperDAO
public class PaperDAO
extends java.lang.Object
Database Connectivity and Access
-
Field Summary
Fields Modifier and Type Field Description private UserDAO
userAccess
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description int
deletePaper(int paperId)
Delete a paper using paperId from the database (only ADMIN)int
deleteUserPaper(int submitterId)
Delete a user's paper from the database (only ADMIN)Paper
getPaper(int paperId)
Gives a paper's instance for paperId providedjava.util.ArrayList<Paper>
getPapers(int userId)
Gives a list of paper instancesprivate int
nextPaperId(MySQLDatabase connection)
Get the new paper id to be insertedPaper
setPaper(java.util.HashMap<java.lang.String,java.lang.Object> paperDetails)
Creates a new paper or updates an existing paper and sets the information for it
-
Field Details
-
Constructor Details
-
Method Details
-
getPapers
Gives a list of paper instances- Parameters:
userId
- for which papers are required- Returns:
- array list of papers for userId provided
- Throws:
PubPaperException
-
getPaper
Gives a paper's instance for paperId provided- Parameters:
paperId
- - id for which paper information is required- Returns:
- paper's instance
- Throws:
PubPaperException
-
nextPaperId
Get the new paper id to be inserted- Parameters:
connection
- MySQLDatababase connection object- Returns:
- int new paper id to use
-
setPaper
public Paper setPaper(java.util.HashMap<java.lang.String,java.lang.Object> paperDetails) throws PubPaperExceptionCreates a new paper or updates an existing paper and sets the information for it- Parameters:
paperDetails
- key value pairs containing paper information- Returns:
- Paper instance for created / updated paper
- Throws:
PubPaperException
-
deleteUserPaper
Delete a user's paper from the database (only ADMIN)- Parameters:
submitterId
- to be deleted from the database- Returns:
- int number of rows affected
- Throws:
PubPaperException
-
deletePaper
Delete a paper using paperId from the database (only ADMIN)- Parameters:
paperId
- paperid of the paper to be deleted from the database- Returns:
- int number of rows affected
- Throws:
PubPaperException
-