Search in sources :

Example 6 with EducationType

use of fi.otavanopisto.pyramus.domainmodel.base.EducationType in project pyramus by otavanopisto.

the class BaseService method createEducationType.

public EducationTypeEntity createEducationType(@WebParam(name = "name") String name, @WebParam(name = "code") String code) {
    EducationTypeDAO educationTypeDAO = DAOFactory.getInstance().getEducationTypeDAO();
    EducationType educationType = educationTypeDAO.create(name, code);
    validateEntity(educationType);
    return EntityFactoryVault.buildFromDomainObject(educationType);
}
Also used : EducationType(fi.otavanopisto.pyramus.domainmodel.base.EducationType) EducationTypeDAO(fi.otavanopisto.pyramus.dao.base.EducationTypeDAO)

Example 7 with EducationType

use of fi.otavanopisto.pyramus.domainmodel.base.EducationType in project pyramus by otavanopisto.

the class BaseService method listEducationSubtypesByEducationType.

public EducationSubtypeEntity[] listEducationSubtypesByEducationType(@WebParam(name = "educationTypeId") Long educationTypeId) {
    EducationTypeDAO educationTypeDAO = DAOFactory.getInstance().getEducationTypeDAO();
    EducationSubtypeDAO educationSubtypeDAO = DAOFactory.getInstance().getEducationSubtypeDAO();
    EducationType educationType = educationTypeDAO.findById(educationTypeId);
    List<EducationSubtype> educationSubtypes = educationSubtypeDAO.listByEducationType(educationType);
    Collections.sort(educationSubtypes, new StringAttributeComparator("getName"));
    return (EducationSubtypeEntity[]) EntityFactoryVault.buildFromDomainObjects(educationSubtypes);
}
Also used : EducationType(fi.otavanopisto.pyramus.domainmodel.base.EducationType) EducationSubtype(fi.otavanopisto.pyramus.domainmodel.base.EducationSubtype) StringAttributeComparator(fi.otavanopisto.pyramus.util.StringAttributeComparator) EducationTypeDAO(fi.otavanopisto.pyramus.dao.base.EducationTypeDAO) EducationSubtypeDAO(fi.otavanopisto.pyramus.dao.base.EducationSubtypeDAO)

Example 8 with EducationType

use of fi.otavanopisto.pyramus.domainmodel.base.EducationType in project pyramus by otavanopisto.

the class EducationTypeEntityFactory method buildFromDomainObject.

public EducationTypeEntity buildFromDomainObject(Object domainObject) {
    if (domainObject == null)
        return null;
    EducationType educationType = (EducationType) domainObject;
    List<EducationSubtype> educationSubtypes = DAOFactory.getInstance().getEducationSubtypeDAO().listByEducationType(educationType);
    EducationSubtypeEntity[] subtypes = (EducationSubtypeEntity[]) EntityFactoryVault.buildFromDomainObjects(educationSubtypes);
    return new EducationTypeEntity(educationType.getId(), educationType.getName(), educationType.getCode(), subtypes, educationType.getArchived());
}
Also used : EducationType(fi.otavanopisto.pyramus.domainmodel.base.EducationType) EducationSubtype(fi.otavanopisto.pyramus.domainmodel.base.EducationSubtype)

Example 9 with EducationType

use of fi.otavanopisto.pyramus.domainmodel.base.EducationType in project pyramus by otavanopisto.

the class EducationTypesViewController method process.

/**
 * Processes the page request by including the corresponding JSP page to the response.
 *
 * @param pageRequestContext Page request context
 */
public void process(PageRequestContext pageRequestContext) {
    EducationTypeDAO educationTypeDAO = DAOFactory.getInstance().getEducationTypeDAO();
    List<EducationType> educationTypes = educationTypeDAO.listUnarchived();
    Collections.sort(educationTypes, new StringAttributeComparator("getName"));
    String jsonEducationTypes = new JSONArrayExtractor("name", "code", "id").extractString(educationTypes);
    this.setJsDataVariable(pageRequestContext, "educationTypes", jsonEducationTypes);
    pageRequestContext.setIncludeJSP("/templates/settings/educationtypes.jsp");
}
Also used : EducationType(fi.otavanopisto.pyramus.domainmodel.base.EducationType) StringAttributeComparator(fi.otavanopisto.pyramus.util.StringAttributeComparator) EducationTypeDAO(fi.otavanopisto.pyramus.dao.base.EducationTypeDAO) JSONArrayExtractor(fi.otavanopisto.pyramus.util.JSONArrayExtractor)

Example 10 with EducationType

use of fi.otavanopisto.pyramus.domainmodel.base.EducationType in project pyramus by otavanopisto.

the class StudyProgrammeCategoriesViewController method process.

/**
 * Processes the page request by including the corresponding JSP page to the response.
 *
 * @param pageRequestContext Page request context
 */
public void process(PageRequestContext pageRequestContext) {
    StudyProgrammeCategoryDAO studyProgrammeCategoryDAO = DAOFactory.getInstance().getStudyProgrammeCategoryDAO();
    EducationTypeDAO educationTypeDAO = DAOFactory.getInstance().getEducationTypeDAO();
    List<EducationType> educationTypes = educationTypeDAO.listUnarchived();
    Collections.sort(educationTypes, new StringAttributeComparator("getName"));
    List<StudyProgrammeCategory> studyProgrammeCategories = studyProgrammeCategoryDAO.listUnarchived();
    JSONArray jsonStudyProgrammeCategories = new JSONArrayExtractor("name", "id").extract(studyProgrammeCategories);
    for (int i = 0; i < jsonStudyProgrammeCategories.size(); i++) {
        JSONObject jsonStudyProgrammeCategory = jsonStudyProgrammeCategories.getJSONObject(i);
        if (studyProgrammeCategories.get(i).getEducationType() != null) {
            jsonStudyProgrammeCategory.put("educationTypeId", studyProgrammeCategories.get(i).getEducationType().getId());
        }
    }
    String jsonEducationTypes = new JSONArrayExtractor("name", "id").extractString(educationTypes);
    this.setJsDataVariable(pageRequestContext, "studyProgrammeCategories", jsonStudyProgrammeCategories.toString());
    this.setJsDataVariable(pageRequestContext, "educationTypes", jsonEducationTypes);
    pageRequestContext.setIncludeJSP("/templates/settings/studyprogrammecategories.jsp");
}
Also used : EducationType(fi.otavanopisto.pyramus.domainmodel.base.EducationType) JSONObject(net.sf.json.JSONObject) StudyProgrammeCategory(fi.otavanopisto.pyramus.domainmodel.base.StudyProgrammeCategory) StudyProgrammeCategoryDAO(fi.otavanopisto.pyramus.dao.base.StudyProgrammeCategoryDAO) StringAttributeComparator(fi.otavanopisto.pyramus.util.StringAttributeComparator) JSONArray(net.sf.json.JSONArray) EducationTypeDAO(fi.otavanopisto.pyramus.dao.base.EducationTypeDAO) JSONArrayExtractor(fi.otavanopisto.pyramus.util.JSONArrayExtractor)

Aggregations

EducationType (fi.otavanopisto.pyramus.domainmodel.base.EducationType)66 EducationTypeDAO (fi.otavanopisto.pyramus.dao.base.EducationTypeDAO)42 EducationSubtype (fi.otavanopisto.pyramus.domainmodel.base.EducationSubtype)24 Subject (fi.otavanopisto.pyramus.domainmodel.base.Subject)23 SubjectDAO (fi.otavanopisto.pyramus.dao.base.SubjectDAO)20 EducationSubtypeDAO (fi.otavanopisto.pyramus.dao.base.EducationSubtypeDAO)17 HashMap (java.util.HashMap)17 StringAttributeComparator (fi.otavanopisto.pyramus.util.StringAttributeComparator)16 RESTPermit (fi.otavanopisto.pyramus.rest.annotation.RESTPermit)13 Date (java.util.Date)13 Path (javax.ws.rs.Path)13 List (java.util.List)12 Curriculum (fi.otavanopisto.pyramus.domainmodel.base.Curriculum)11 CurriculumDAO (fi.otavanopisto.pyramus.dao.base.CurriculumDAO)10 CourseEducationType (fi.otavanopisto.pyramus.domainmodel.base.CourseEducationType)10 Course (fi.otavanopisto.pyramus.domainmodel.courses.Course)10 EducationalTimeUnit (fi.otavanopisto.pyramus.domainmodel.base.EducationalTimeUnit)9 Map (java.util.Map)9 EducationalTimeUnitDAO (fi.otavanopisto.pyramus.dao.base.EducationalTimeUnitDAO)8 CourseDescriptionCategoryDAO (fi.otavanopisto.pyramus.dao.courses.CourseDescriptionCategoryDAO)8