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);
}
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);
}
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());
}
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");
}
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");
}
Aggregations