Class PaperAuthorDAO

java.lang.Object
com.rit.dca.pubpaper.dao.PaperAuthorDAO

public class PaperAuthorDAO
extends java.lang.Object
Database Connectivity and Access
  • Field Summary

    Fields 
    Modifier and Type Field Description
    private UserDAO userAccess  
  • Constructor Summary

    Constructors 
    Constructor Description
    PaperAuthorDAO​(UserDAO userAccess)  
  • Method Summary

    Modifier and Type Method Description
    int addPaperAuthor​(int paperId, int userId, int displayOrder)
    Adds new paper author in the database (submitter and ADMIN)
    int deleteAuthorPapers​(int userId)
    Delete an author's paper from the database (only ADMIN)
    int deletePaperAuthors​(int paperId)
    Delete a paper author from the database (only ADMIN)
    int deleteSinglePaperAuthor​(int paperId, int userId)
    Delete a single paper author from the database (only ADMIN)
    java.util.ArrayList<java.lang.Integer> getAuthorPapers​(int userId)
    Gives a list of paper ids for user id provided
    int getDisplayOrder​(int paperId, int userId)
    Gives the display order for a combination of paper and user ids
    java.util.ArrayList<java.lang.Integer> getPaperAuthors​(int paperId)
    Gives a list of author ids for a paper id ordered according to displayOrder
    int updatePaperAuthor​(int paperId, int userId, int displayOrder)
    Updates existing paper author in the database (submitter and ADMIN)

    Methods inherited from class java.lang.Object

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

  • Constructor Details

  • Method Details

    • getPaperAuthors

      public java.util.ArrayList<java.lang.Integer> getPaperAuthors​(int paperId) throws PubPaperException
      Gives a list of author ids for a paper id ordered according to displayOrder
      Parameters:
      paperId - for which paper authors are required
      Returns:
      array list of author ids for paperId provided
      Throws:
      PubPaperException
    • getAuthorPapers

      public java.util.ArrayList<java.lang.Integer> getAuthorPapers​(int userId) throws PubPaperException
      Gives a list of paper ids for user id provided
      Parameters:
      userId - for which papers are required
      Returns:
      array list of paper ids for userId provided
      Throws:
      PubPaperException
    • getDisplayOrder

      public int getDisplayOrder​(int paperId, int userId) throws PubPaperException
      Gives the display order for a combination of paper and user ids
      Parameters:
      paperId - paperId to be searched
      userId - userId to be searched
      Returns:
      int displayOrder of the combination
      Throws:
      PubPaperException
    • addPaperAuthor

      public int addPaperAuthor​(int paperId, int userId, int displayOrder) throws PubPaperException
      Adds new paper author in the database (submitter and ADMIN)
      Parameters:
      paperId - paperId to be added
      userId - userId to be added
      displayOrder - displayOrder to be added
      Returns:
      int number of rows affected
      Throws:
      PubPaperException
    • updatePaperAuthor

      public int updatePaperAuthor​(int paperId, int userId, int displayOrder) throws PubPaperException
      Updates existing paper author in the database (submitter and ADMIN)
      Parameters:
      paperId - paperId to be updated
      userId - userId to be updated
      displayOrder - displayOrder to be updated
      Returns:
      int number of rows affected
      Throws:
      PubPaperException
    • deletePaperAuthors

      public int deletePaperAuthors​(int paperId) throws PubPaperException
      Delete a paper author from the database (only ADMIN)
      Parameters:
      paperId - paperId of the paper author to be deleted from the database
      Returns:
      int number of rows affected
      Throws:
      PubPaperException
    • deleteAuthorPapers

      public int deleteAuthorPapers​(int userId) throws PubPaperException
      Delete an author's paper from the database (only ADMIN)
      Parameters:
      userId - userId of the author to be deleted from the database
      Returns:
      int number of rows affected
      Throws:
      PubPaperException
    • deleteSinglePaperAuthor

      public int deleteSinglePaperAuthor​(int paperId, int userId) throws PubPaperException
      Delete a single paper author from the database (only ADMIN)
      Parameters:
      paperId - paperId of the paper to be deleted from the database
      userId - userId of the user to be deleted from the database
      Returns:
      int number of rows affected
      Throws:
      PubPaperException