Class PaperSubjectDAO

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

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

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

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

    Modifier and Type Method Description
    int addPaperSubject​(int paperId, int[] subjectIds)
    Add a new paper subject to the database (submitter or ADMIN)
    int deletePaperSubjects​(int paperId)
    Delete a paper subject from the database (only ADMIN)
    int deleteSinglePaperSubject​(int paperId, int subjectId)
    Delete a single paper subject from the database (only ADMIN)
    int deleteSubjectPapers​(int subjectId)
    Delete a subject's paper from the database (only ADMIN)
    java.util.ArrayList<Subject> getPaperSubjects​(int paperId)
    Gives a list of subject instances for paper id
    int updatePaperSubject​(int paperId, int subjectId)
    Update a paper subject in the database (submitter or 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

    • getPaperSubjects

      public java.util.ArrayList<Subject> getPaperSubjects​(int paperId) throws PubPaperException
      Gives a list of subject instances for paper id
      Parameters:
      paperId - for which subjects are required
      Returns:
      array list of subjects for paperId provided
      Throws:
      PubPaperException
    • addPaperSubject

      public int addPaperSubject​(int paperId, int[] subjectIds) throws PubPaperException
      Add a new paper subject to the database (submitter or ADMIN)
      Parameters:
      paperId - paperId to be added to the database
      subjectIds - subjectIds to be paired with paper id to insert
      Returns:
      int number of rows affected
      Throws:
      PubPaperException
    • updatePaperSubject

      public int updatePaperSubject​(int paperId, int subjectId) throws PubPaperException
      Update a paper subject in the database (submitter or ADMIN)
      Parameters:
      paperId - paperId to be update in the database
      subjectId - subjectId to be to be replaced with in the database
      Returns:
      int number of rows affected
      Throws:
      PubPaperException
    • deletePaperSubjects

      public int deletePaperSubjects​(int paperId) throws PubPaperException
      Delete a paper subject 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
    • deleteSubjectPapers

      public int deleteSubjectPapers​(int subjectId) throws PubPaperException
      Delete a subject's paper from the database (only ADMIN)
      Parameters:
      subjectId - subjectId of the subject to be deleted from the database
      Returns:
      int number of rows affected
      Throws:
      PubPaperException
    • deleteSinglePaperSubject

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