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 database
    int changeAffiliation​(int affiliationId, java.lang.String newAffiliationName)
    Change affiliation name in the database
    int deleteAffiliation​(int affiliationId)
    Deletes existing affiliation from the database
    Affiliation getAffiliation​(int userId)
    Gives affiliation
    java.util.ArrayList<Affiliation> getAffiliations()
    Gives a list of all affiliation instances
    private int nextAffiliationId​(MySQLDatabase connection)
    Get the new affiliation id to be inserted

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

  • Method Details

    • getAffiliation

      public Affiliation getAffiliation​(int userId) throws PubPaperException
      Gives affiliation
      Parameters:
      userId - for which affiliation is required
      Returns:
      affiliation name for userId provided
      Throws:
      PubPaperException
    • getAffiliations

      public java.util.ArrayList<Affiliation> getAffiliations() throws PubPaperException
      Gives a list of all affiliation instances
      Returns:
      array list of all affiliation instances
      Throws:
      PubPaperException
    • nextAffiliationId

      private int nextAffiliationId​(MySQLDatabase connection)
      Get the new affiliation id to be inserted
      Parameters:
      connection - MySQLDatabase connection object
      Returns:
      int new affiliation id to use
    • addAffiliations

      public boolean addAffiliations​(java.lang.String affiliationName) throws PubPaperException
      Adds new affiliation to the database
      Parameters:
      affiliationName - affiliation name to be added
      Returns:
      boolean status of affiliation inserted
      Throws:
      PubPaperException
    • deleteAffiliation

      public int deleteAffiliation​(int affiliationId) throws PubPaperException
      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 PubPaperException
      Change affiliation name in the database
      Parameters:
      affiliationId - affiliation id to be changed
      newAffiliationName - affiliation name to be changed to
      Returns:
      int rows affected on deleting affiliation
      Throws:
      PubPaperException