Skip to content

Commit

Permalink
Merge pull request #48 from MatiasComercio/jersey
Browse files Browse the repository at this point in the history
Jersey
  • Loading branch information
gibarsin committed Jan 19, 2017
2 parents a0947b2 + b4c15d0 commit 9e8325e
Show file tree
Hide file tree
Showing 63 changed files with 3,186 additions and 2,578 deletions.
46 changes: 24 additions & 22 deletions interfaces/src/main/java/ar/edu/itba/paw/interfaces/CourseDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ public interface CourseDao {

/**
* Update a course
* @param id Id of the old course
* @param courseId Id of the old course
* @param course Modified course
* @return The result code of the insertion
*/
boolean update(int id, Course course);
boolean update(String courseId, Course course);

/**
* Get the course identified by an ID
Expand All @@ -30,14 +30,19 @@ public interface CourseDao {
*/
Course getById(int id);


/**
* Gets the desired course by the course's ID code
* @param courseID the course's ID code
* @return the course if it exists; null otherwise.
*/
Course getByCourseID(String courseID);

/**
* Gets the desired course by the identifier with the inscribed students
* @param id the id of the course
* @param courseId the id of the course
* @return the course created, with a list of the inscribed students
*/
Course getCourseStudents(int id);
Course getCourseStudents(String courseId);

/**
* Get all the courses in the storage
Expand All @@ -55,21 +60,18 @@ public interface CourseDao {

/**
* Attempts to delete the course with the given id
* @param id of the course to delete
* @return OK if the course was deleted;
* COURSE_EXISTS_INSCRIPTION if there are inscriptions in that course;
* COURSE_EXISTS_GRADE if there grades tied to the course;
* INVALID_INPUT_PARAMETERS if the ID is invalid;
* ERROR_UNKNOWN else;
* @param courseId of the course to delete
* @return true if the course was deleted;
* false in other case;
*/
boolean deleteCourse(int id);
boolean deleteCourse(String courseId);

/**
* @param courseId The id of the course.
* @return List of correlatives for the given course (i.d. The courses that are requiered to enroll a student in the
* given course)
*/
List<Integer> getCorrelatives(int courseId);
List<String> getCorrelatives(String courseId);

/**
* Check if a correlativity loop is formed
Expand All @@ -79,7 +81,7 @@ public interface CourseDao {
* @return The boolean value indicating if the correlativity loop
* is generated.
*/
boolean checkCorrelativityLoop(int id, int correlativeId);
boolean checkCorrelativityLoop(String id, String correlativeId);

/**
* Persist a correlativity
Expand All @@ -88,41 +90,41 @@ public interface CourseDao {
* @param correlativeId The id of the course correlative course
* @return The insertion result.
*/
boolean addCorrelativity(int id, int correlativeId);
boolean addCorrelativity(String id, String correlativeId);

/**
* Check whether a course exists or not
* @param id The id of the course;
* @return The boolean indicating if the course exists
*/
boolean courseExists(int id);
boolean courseExists(String id);

/**
* @param courseId The id of the course.
* @return The boolean indicating if the given course has any enrolled students.
*/
boolean inscriptionExists(int courseId);
boolean inscriptionExists(String courseId);

/**
* @param courseId The id of the course.
* @return The boolean indicating whether there are any students with grades of the given course.
*/
boolean gradeExists(int courseId);
boolean gradeExists(String courseId);

/**
* @param courseId The id of the course.
* @return List of correlatives for the given course (i.d. The courses that require this course to enroll a student in the
* given course)
*/
List<Integer> getUpperCorrelatives(int courseId);
List<String> getUpperCorrelatives(String courseId);

/**
*
* @param courseId The id of the course.
* @param correlativeId The id of the correlative for the given course.
* @return OK if no errors were found, UNKNOWN_ERROR otherwise.
*/
boolean deleteCorrelative(int courseId, int correlativeId);
boolean deleteCorrelative(String courseId, String correlativeId);

/**
* Get the number of semesters.
Expand All @@ -136,7 +138,7 @@ public interface CourseDao {
* @return List of correlatives for the given course (i.d. The courses that are required to enroll a student in the
* given course)
*/
List<Course> getCorrelativeCourses(int courseId);
List<Course> getCorrelativeCourses(String courseId);

/**
* Get the total credits of the plan.
Expand All @@ -146,7 +148,7 @@ public interface CourseDao {

/* +++ xtest */
/* +++ xdocument */
Course getStudentsThatPassedCourse(int id);
Course getStudentsThatPassedCourse(String id);


/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ public interface CourseService {

/**
* Update a course
* @param id Id the previous course.
* @param courseId Id the previous course.
* @param course Modified course.
* @return The result code of the insertion.
*/
boolean update(int id, Course course);
boolean update(String courseId, Course course);

/**
* Get all the current available courses
Expand All @@ -38,12 +38,19 @@ public interface CourseService {
*/
Course getById(int id);

/**
* Gets the desired course by the course's ID code
* @param courseID the course's ID code
* @return the course if it exists; null otherwise.
*/
Course getByCourseID(String courseID);

/**
* Gets the desired course by the identifier with the inscribed students
* @param id the id of the course
* @return the course created, with a list of the inscribed students
*/
Course getCourseStudents(int id);
Course getCourseStudents(String id);

/**
* Gets the courses that comply with the list of filters
Expand All @@ -56,14 +63,10 @@ public interface CourseService {
/**
* Attempts to delete the course with the given id
* @param id of the course to delete
* @return OK if the course was deleted;
* ERROR_ID_OUT_OF_BOUNDS if the id is not within the required limits;
* COURSE_EXISTS_INSCRIPTION if there are inscriptions in that course;
* COURSE_EXISTS_GRADE if there grades tied to the course;
* INVALID_INPUT_PARAMETERS if the ID is invalid;
* ERROR_UNKNOWN else;
* @return true if the course was deleted;
* false in other case;
*/
boolean deleteCourse(int id);
boolean deleteCourse(String id);

/**
* Gets the desired course by the identifier with the inscribed students,
Expand All @@ -72,47 +75,47 @@ public interface CourseService {
* @param studentFilter the filter to be applied to the student
* @return the list of students enrolled in the given course
*/
List<Student> getCourseStudents(int id, StudentFilter studentFilter);
List<Student> getCourseStudents(String id, StudentFilter studentFilter);

/**
* @param courseId The id of the course.
* @return The id's of correlatives for the given course (i.d. The courses that are requiered to enroll a student in the
* given course)
*/
List<Integer> getCorrelatives(int courseId);
List<String> getCorrelatives(String courseId);

/**
* Make the course corresponding to the correlativeId necessary
* to take the course corresponding to the id. Checks that no correlativity
* loop is generated.
*
* @param id The id of the course to which a correlative course is going to be added
* @param courseId The id of the course to which a correlative course is going to be added
* @param correlativeId The id of the correlative course
* @return The result indicating if the action could be done.
*/
boolean addCorrelative(int id, int correlativeId);
boolean addCorrelative(String courseId, String correlativeId);

/**
* @param courseId The id of the course.
* @return List of correlatives for the given course (i.d. The courses that require this course to enroll a student in the
* given course)
*/
List<Integer> getUpperCorrelatives(int courseId);
List<String> getUpperCorrelatives(String courseId);

/**
*
* @param courseId The id of the course.
* @param correlativeId The id of the correlative for the given course.
* @return OK if no errors were found, UNKNOWN_ERROR otherwise.
*/
boolean deleteCorrelative(int courseId, int correlativeId);
boolean deleteCorrelative(String courseId, String correlativeId);

/**
*
* @param courseId Given the id of a course, delete all the correlative
* @return The result code of the operation
*/
boolean deleteCourseCorrelatives(int courseId);
boolean deleteCourseCorrelatives(String courseId);

/**
* Get the number of semesters.
Expand All @@ -126,14 +129,14 @@ public interface CourseService {
* @param courseFilter The course's filter. If null, no filter is applied.
* @return A list of correlatives courses to the given course, with the filter applied.
*/
List<Course> getCorrelativesByFilter(int courseId, CourseFilter courseFilter);
List<Course> getCorrelativesByFilter(String courseId, CourseFilter courseFilter);

/**
*
* @param courseId The id of the course
* @return A list of the courses that are available to be added as correlatives for the given course
*/
List<Course> getAvailableAddCorrelatives(int courseId, CourseFilter courseFilter);
List<Course> getAvailableAddCorrelatives(String courseId, CourseFilter courseFilter);

/**
* Get the total credits of the plan.
Expand All @@ -143,7 +146,7 @@ public interface CourseService {

/* +++xtest */
/* +++xdocument */
Course getStudentsThatPassedCourse(int id, StudentFilter studentFilter);
Course getStudentsThatPassedCourse(String courseId, StudentFilter studentFilter);

/**
* Get the open final inscriptions corresponding to a course.
Expand Down
25 changes: 12 additions & 13 deletions interfaces/src/main/java/ar/edu/itba/paw/interfaces/StudentDao.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package ar.edu.itba.paw.interfaces;

import ar.edu.itba.paw.models.Course;
import ar.edu.itba.paw.models.FinalGrade;
import ar.edu.itba.paw.models.FinalInscription;
import ar.edu.itba.paw.models.Grade;
import ar.edu.itba.paw.models.Procedure;
import ar.edu.itba.paw.models.*;
import ar.edu.itba.paw.models.users.Student;
import ar.edu.itba.paw.shared.StudentFilter;

Expand Down Expand Up @@ -79,14 +75,18 @@ public interface StudentDao {
*/
boolean deleteStudent(int docket);

/**
*
* @param address The new address to be persisted
*/
void editAddress(Address address);

/**
* Add the grade for a given student and course;
* @param grade which contains the student docket, the course id and the grade
* @return OK if the grade was added;
* INVALID_INPUT_PARAMETERS if one or more parameters are invalid;
* ERROR_UNKNOWN else;
* @return the created grade's id
*/
boolean addGrade(Grade grade);
int addGrade(Grade grade);

/**
* Add the final grade for a given student and course;
Expand All @@ -112,16 +112,15 @@ public interface StudentDao {
* @param courseId The course id
* @return a Result object containing information of the operation carried out
*/
boolean enroll(int studentDocket, int courseId);
boolean enroll(int studentDocket, String courseId);

/**
* Unenrolls the student with the given docket of the course with the specified id.
*
* @param studentDocket The student's docket
* @param courseId The course id
* @return a Result object containing information of the operation carried out
*/
boolean unenroll(int studentDocket, int courseId);
void unenroll(int studentDocket, int courseId);

/**
* Gets the collection of courses the student already approved.
Expand Down Expand Up @@ -158,7 +157,7 @@ public interface StudentDao {

/* +++xtest */
/* +++xdocument */
List<Student> getStudentsPassed(int id);
List<Student> getStudentsPassed(String courseId);

/**
*
Expand Down
Loading

0 comments on commit 9e8325e

Please sign in to comment.