Package com.rit.dca.pubpaper.dao
Class AffiliationDAO
java.lang.Object
com.rit.dca.pubpaper.dao.AffiliationDAO
public class AffiliationDAO
extends java.lang.Object
Database Connectivity and Access
-
Field Summary
Fields Modifier and Type Field Description private UserDAO
userAccess
-
Constructor Summary
Constructors Constructor Description AffiliationDAO(UserDAO userAccess)
-
Method Summary
Modifier and Type Method Description boolean
addAffiliations(java.lang.String affiliationName)
Adds new affiliation to the databaseint
changeAffiliation(int affiliationId, java.lang.String newAffiliationName)
Change affiliation name in the databaseint
deleteAffiliation(int affiliationId)
Deletes existing affiliation from the databaseAffiliation
getAffiliation(int userId)
Gives affiliationjava.util.ArrayList<Affiliation>
getAffiliations()
Gives a list of all affiliation instancesprivate int
nextAffiliationId(MySQLDatabase connection)
Get the new affiliation id to be inserted
-
Field Details
-
Constructor Details
-
Method Details
-
getAffiliation
Gives affiliation- Parameters:
userId
- for which affiliation is required- Returns:
- affiliation name for userId provided
- Throws:
PubPaperException
-
getAffiliations
Gives a list of all affiliation instances- Returns:
- array list of all affiliation instances
- Throws:
PubPaperException
-
nextAffiliationId
Get the new affiliation id to be inserted- Parameters:
connection
- MySQLDatabase connection object- Returns:
- int new affiliation id to use
-
addAffiliations
Adds new affiliation to the database- Parameters:
affiliationName
- affiliation name to be added- Returns:
- boolean status of affiliation inserted
- Throws:
PubPaperException
-
deleteAffiliation
Deletes existing affiliation from the database- Parameters:
affiliationId
- affiliation id to be deleted- Returns:
- int rows affected on deleting affiliation
- Throws:
PubPaperException
-
changeAffiliation
public int changeAffiliation(int affiliationId, java.lang.String newAffiliationName) throws PubPaperExceptionChange affiliation name in the database- Parameters:
affiliationId
- affiliation id to be changednewAffiliationName
- affiliation name to be changed to- Returns:
- int rows affected on deleting affiliation
- Throws:
PubPaperException
-