Search in sources :

Example 1 with CourseEntity

use of fi.pyramus.services.entities.courses.CourseEntity in project pyramus by otavanopisto.

the class CoursesService method searchCourses.

public CourseEntitySearchResult searchCourses(@WebParam(name = "resultsPerPage") Integer resultsPerPage, @WebParam(name = "page") Integer page, @WebParam(name = "name") String name, @WebParam(name = "tags") String tags, @WebParam(name = "nameExtension") String nameExtension, @WebParam(name = "description") String description, @WebParam(name = "courseStateId") Long courseStateId, @WebParam(name = "subjectId") Long subjectId, @WebParam(name = "timeFilterMode") String timeFilterMode, @WebParam(name = "timeframeStart") Date timeframeStart, @WebParam(name = "timeframeEnd") Date timeframeEnd) {
    CourseDAO courseDAO = DAOFactory.getInstance().getCourseDAO();
    CourseStateDAO courseStateDAO = DAOFactory.getInstance().getCourseStateDAO();
    SubjectDAO subjectDAO = DAOFactory.getInstance().getSubjectDAO();
    CourseState courseState = courseStateId != null ? courseStateDAO.findById(courseStateId) : null;
    Subject subject = subjectId != null ? subjectDAO.findById(subjectId) : null;
    SearchTimeFilterMode tFilterMode = timeFilterMode != null ? SearchTimeFilterMode.valueOf(timeFilterMode) : null;
    SearchResult<Course> searchResult = courseDAO.searchCourses(resultsPerPage, page, name, tags, nameExtension, description, courseState, subject, tFilterMode, timeframeStart, timeframeEnd, true);
    return new CourseEntitySearchResult(searchResult.getPage(), searchResult.getPages(), searchResult.getTotalHitCount(), (CourseEntity[]) EntityFactoryVault.buildFromDomainObjects(searchResult.getResults()));
}
Also used : CourseStateDAO(fi.otavanopisto.pyramus.dao.courses.CourseStateDAO) SubjectDAO(fi.otavanopisto.pyramus.dao.base.SubjectDAO) CourseDAO(fi.otavanopisto.pyramus.dao.courses.CourseDAO) SearchTimeFilterMode(fi.otavanopisto.pyramus.persistence.search.SearchTimeFilterMode) CourseEntitySearchResult(fi.pyramus.services.entities.courses.CourseEntitySearchResult) CourseState(fi.otavanopisto.pyramus.domainmodel.courses.CourseState) Course(fi.otavanopisto.pyramus.domainmodel.courses.Course) Subject(fi.otavanopisto.pyramus.domainmodel.base.Subject) CourseEntity(fi.pyramus.services.entities.courses.CourseEntity)

Aggregations

SubjectDAO (fi.otavanopisto.pyramus.dao.base.SubjectDAO)1 CourseDAO (fi.otavanopisto.pyramus.dao.courses.CourseDAO)1 CourseStateDAO (fi.otavanopisto.pyramus.dao.courses.CourseStateDAO)1 Subject (fi.otavanopisto.pyramus.domainmodel.base.Subject)1 Course (fi.otavanopisto.pyramus.domainmodel.courses.Course)1 CourseState (fi.otavanopisto.pyramus.domainmodel.courses.CourseState)1 SearchTimeFilterMode (fi.otavanopisto.pyramus.persistence.search.SearchTimeFilterMode)1 CourseEntity (fi.pyramus.services.entities.courses.CourseEntity)1 CourseEntitySearchResult (fi.pyramus.services.entities.courses.CourseEntitySearchResult)1