use of fi.otavanopisto.pyramus.domainmodel.base.Language in project pyramus by otavanopisto.
the class BaseService method listLanguages.
public LanguageEntity[] listLanguages() {
LanguageDAO languageDAO = DAOFactory.getInstance().getLanguageDAO();
List<Language> languages = languageDAO.listUnarchived();
Collections.sort(languages, new StringAttributeComparator("getName"));
return (LanguageEntity[]) EntityFactoryVault.buildFromDomainObjects(languages);
}
use of fi.otavanopisto.pyramus.domainmodel.base.Language in project pyramus by otavanopisto.
the class StudentsService method addStudyProgramme.
public StudentEntity addStudyProgramme(@WebParam(name = "studentId") Long studentId, @WebParam(name = "studyProgrammeId") Long studyProgrammeId) {
// TODO Generalize to StudentDAO (also used in CopyStudentStudyProgrammeJSONRequestController)
StudentDAO studentDAO = DAOFactory.getInstance().getStudentDAO();
StudyProgrammeDAO studyProgrammeDAO = DAOFactory.getInstance().getStudyProgrammeDAO();
AddressDAO addressDAO = DAOFactory.getInstance().getAddressDAO();
ContactInfoDAO contactInfoDAO = DAOFactory.getInstance().getContactInfoDAO();
EmailDAO emailDAO = DAOFactory.getInstance().getEmailDAO();
PhoneNumberDAO phoneNumberDAO = DAOFactory.getInstance().getPhoneNumberDAO();
PersonDAO personDAO = DAOFactory.getInstance().getPersonDAO();
Student oldStudent = studentDAO.findById(studentId);
Person person = oldStudent.getPerson();
String firstName = oldStudent.getFirstName();
String lastName = oldStudent.getLastName();
String nickname = oldStudent.getNickname();
String additionalInfo = oldStudent.getAdditionalInfo();
// student.getPreviousStudies();
Double previousStudies = null;
// student.getStudyTimeEnd();
Date studyTimeEnd = null;
// student.getStudyStartDate();
Date studyStartTime = null;
// student.getStudyEndDate();
Date studyEndTime = null;
// student.getStudyEndText();
String studyEndText = null;
Language language = oldStudent.getLanguage();
Municipality municipality = oldStudent.getMunicipality();
StudentActivityType activityType = oldStudent.getActivityType();
StudentExaminationType examinationType = oldStudent.getExaminationType();
StudentEducationalLevel educationalLevel = oldStudent.getEducationalLevel();
String education = oldStudent.getEducation();
Nationality nationality = oldStudent.getNationality();
School school = oldStudent.getSchool();
StudyProgramme studyProgramme = studyProgrammeId == null ? null : studyProgrammeDAO.findById(studyProgrammeId);
// student.getStudyEndReason();
StudentStudyEndReason studyEndReason = null;
Curriculum curriculum = oldStudent.getCurriculum();
Student newStudent = studentDAO.create(person, firstName, lastName, nickname, additionalInfo, studyTimeEnd, activityType, examinationType, educationalLevel, education, nationality, municipality, language, school, studyProgramme, curriculum, previousStudies, studyStartTime, studyEndTime, studyEndReason, studyEndText, false);
// Contact info
contactInfoDAO.update(newStudent.getContactInfo(), oldStudent.getContactInfo().getAdditionalInfo());
// Default user
personDAO.updateDefaultUser(person, newStudent);
// Addresses
List<Address> addresses = oldStudent.getContactInfo().getAddresses();
for (int i = 0; i < addresses.size(); i++) {
Address add = addresses.get(i);
addressDAO.create(newStudent.getContactInfo(), add.getContactType(), add.getName(), add.getStreetAddress(), add.getPostalCode(), add.getCity(), add.getCountry(), add.getDefaultAddress());
}
// E-mail addresses
List<Email> emails = oldStudent.getContactInfo().getEmails();
for (int i = 0; i < emails.size(); i++) {
Email email = emails.get(i);
emailDAO.create(newStudent.getContactInfo(), email.getContactType(), email.getDefaultAddress(), email.getAddress());
}
// Phone numbers
List<PhoneNumber> phoneNumbers = oldStudent.getContactInfo().getPhoneNumbers();
for (int i = 0; i < phoneNumbers.size(); i++) {
PhoneNumber phoneNumber = phoneNumbers.get(i);
phoneNumberDAO.create(newStudent.getContactInfo(), phoneNumber.getContactType(), phoneNumber.getDefaultNumber(), phoneNumber.getNumber());
}
return EntityFactoryVault.buildFromDomainObject(newStudent);
}
use of fi.otavanopisto.pyramus.domainmodel.base.Language in project pyramus by otavanopisto.
the class StudentAPI method create.
public Long create(Long personId, String firstName, String lastName, String email, Long emailContactTypeId, String nickname, String additionalInfo, Date studyTimeEnd, Long activityType, Long examinationType, Long educationalLevel, String education, Long nationality, Long municipality, Long language, Long schoolId, Long studyProgrammeId, Double previousStudies, Date studyStartDate, Date studyEndDate, Long studyEndReasonId, String studyEndText, boolean lodging) throws InvalidScriptException {
StudentDAO studentDAO = DAOFactory.getInstance().getStudentDAO();
EmailDAO emailDAO = DAOFactory.getInstance().getEmailDAO();
ContactTypeDAO contactTypeDAO = DAOFactory.getInstance().getContactTypeDAO();
PersonDAO personDAO = DAOFactory.getInstance().getPersonDAO();
StudentLodgingPeriodDAO studentLodgingPeriodDAO = DAOFactory.getInstance().getStudentLodgingPeriodDAO();
UserVariableDAO userVariableDAO = DAOFactory.getInstance().getUserVariableDAO();
email = email != null ? email.trim() : null;
Person personEntity = null;
if (personId != null) {
personEntity = personDAO.findById(personId);
}
StudentActivityType activityTypeEntity = null;
if (activityType != null) {
activityTypeEntity = DAOFactory.getInstance().getStudentActivityTypeDAO().findById(activityType);
}
StudentExaminationType examinationTypeEntity = null;
if (examinationType != null) {
examinationTypeEntity = DAOFactory.getInstance().getStudentExaminationTypeDAO().findById(examinationType);
}
StudentEducationalLevel educationalLevelEntity = null;
if (educationalLevel != null) {
educationalLevelEntity = DAOFactory.getInstance().getStudentEducationalLevelDAO().findById(educationalLevel);
}
Nationality nationalityEntity = null;
if (nationality != null) {
nationalityEntity = DAOFactory.getInstance().getNationalityDAO().findById(nationality);
}
Municipality municipalityEntity = null;
if (municipality != null) {
municipalityEntity = DAOFactory.getInstance().getMunicipalityDAO().findById(municipality);
}
Language languageEntity = null;
if (language != null) {
languageEntity = DAOFactory.getInstance().getLanguageDAO().findById(language);
}
School school = null;
if (schoolId != null) {
school = DAOFactory.getInstance().getSchoolDAO().findById(schoolId);
}
StudyProgramme studyProgramme = null;
if (studyProgrammeId != null) {
studyProgramme = DAOFactory.getInstance().getStudyProgrammeDAO().findById(studyProgrammeId);
}
StudentStudyEndReason studyEndReason = null;
if (studyEndReasonId != null) {
studyEndReason = DAOFactory.getInstance().getStudentStudyEndReasonDAO().findById(studyEndReasonId);
}
firstName = StringUtils.trim(firstName);
lastName = StringUtils.trim(lastName);
nickname = StringUtils.trim(nickname);
Student student = studentDAO.create(personEntity, firstName, lastName, nickname, additionalInfo, studyTimeEnd, activityTypeEntity, examinationTypeEntity, educationalLevelEntity, education, nationalityEntity, municipalityEntity, languageEntity, school, studyProgramme, null, previousStudies, studyStartDate, studyEndDate, studyEndReason, studyEndText, false);
userVariableDAO.createDefaultValueVariables(student);
if (lodging && studyStartDate != null)
studentLodgingPeriodDAO.create(student, studyStartDate, studyEndDate);
if (personEntity.getDefaultUser() == null) {
personDAO.updateDefaultUser(personEntity, student);
}
if (StringUtils.isNotBlank(email)) {
ContactType emailContactType = contactTypeDAO.findById(emailContactTypeId);
if (emailContactType == null) {
throw new InvalidScriptException("Could not find contact type for email");
}
emailDAO.create(student.getContactInfo(), emailContactType, true, email);
}
return student.getId();
}
use of fi.otavanopisto.pyramus.domainmodel.base.Language in project pyramus by otavanopisto.
the class CreateStudentJSONRequestController method process.
public void process(JSONRequestContext requestContext) {
StudentDAO studentDAO = DAOFactory.getInstance().getStudentDAO();
PersonDAO personDAO = DAOFactory.getInstance().getPersonDAO();
StudentActivityTypeDAO activityTypeDAO = DAOFactory.getInstance().getStudentActivityTypeDAO();
StudentExaminationTypeDAO examinationTypeDAO = DAOFactory.getInstance().getStudentExaminationTypeDAO();
StudentEducationalLevelDAO educationalLevelDAO = DAOFactory.getInstance().getStudentEducationalLevelDAO();
StudentStudyEndReasonDAO studyEndReasonDAO = DAOFactory.getInstance().getStudentStudyEndReasonDAO();
UserVariableDAO userVariableDAO = DAOFactory.getInstance().getUserVariableDAO();
LanguageDAO languageDAO = DAOFactory.getInstance().getLanguageDAO();
MunicipalityDAO municipalityDAO = DAOFactory.getInstance().getMunicipalityDAO();
NationalityDAO nationalityDAO = DAOFactory.getInstance().getNationalityDAO();
SchoolDAO schoolDAO = DAOFactory.getInstance().getSchoolDAO();
StudyProgrammeDAO studyProgrammeDAO = DAOFactory.getInstance().getStudyProgrammeDAO();
AddressDAO addressDAO = DAOFactory.getInstance().getAddressDAO();
ContactInfoDAO contactInfoDAO = DAOFactory.getInstance().getContactInfoDAO();
EmailDAO emailDAO = DAOFactory.getInstance().getEmailDAO();
PhoneNumberDAO phoneNumberDAO = DAOFactory.getInstance().getPhoneNumberDAO();
TagDAO tagDAO = DAOFactory.getInstance().getTagDAO();
ContactTypeDAO contactTypeDAO = DAOFactory.getInstance().getContactTypeDAO();
CurriculumDAO curriculumDAO = DAOFactory.getInstance().getCurriculumDAO();
StudentLodgingPeriodDAO lodgingPeriodDAO = DAOFactory.getInstance().getStudentLodgingPeriodDAO();
StaffMemberDAO staffMemberDAO = DAOFactory.getInstance().getStaffMemberDAO();
User loggedUser = staffMemberDAO.findById(requestContext.getLoggedUserId());
Long personId = requestContext.getLong("personId");
int emailCount2 = requestContext.getInteger("emailTable.rowCount");
for (int i = 0; i < emailCount2; i++) {
String colPrefix = "emailTable." + i;
String email = StringUtils.trim(requestContext.getString(colPrefix + ".email"));
if (StringUtils.isNotBlank(email)) {
ContactType contactType = contactTypeDAO.findById(requestContext.getLong(colPrefix + ".contactTypeId"));
if (!UserUtils.isAllowedEmail(email, contactType, personId)) {
throw new RuntimeException(Messages.getInstance().getText(requestContext.getRequest().getLocale(), "generic.errors.emailInUse"));
}
}
}
Date birthday = requestContext.getDate("birthday");
String ssecId = requestContext.getString("ssecId");
Sex sex = (Sex) requestContext.getEnum("gender", Sex.class);
String basicInfo = requestContext.getString("basicInfo");
Boolean secureInfo = requestContext.getBoolean("secureInfo");
String firstName = StringUtils.trim(requestContext.getString("firstName"));
String lastName = StringUtils.trim(requestContext.getString("lastName"));
String nickname = StringUtils.trim(requestContext.getString("nickname"));
String additionalInfo = requestContext.getString("additionalInfo");
String otherContactInfo = requestContext.getString("otherContactInfo");
String education = requestContext.getString("education");
Double previousStudies = requestContext.getDouble("previousStudies");
Date studyTimeEnd = requestContext.getDate("studyTimeEnd");
Date studyStartTime = requestContext.getDate("studyStartDate");
Date studyEndTime = requestContext.getDate("studyEndDate");
String studyEndText = requestContext.getString("studyEndText");
String tagsText = requestContext.getString("tags");
Set<Tag> tagEntities = new HashSet<>();
if (!StringUtils.isBlank(tagsText)) {
List<String> tags = Arrays.asList(tagsText.split("[\\ ,]"));
for (String tag : tags) {
if (!StringUtils.isBlank(tag)) {
Tag tagEntity = tagDAO.findByText(tag.trim());
if (tagEntity == null)
tagEntity = tagDAO.create(tag);
tagEntities.add(tagEntity);
}
}
}
Long entityId = requestContext.getLong("language");
Language language = entityId == null ? null : languageDAO.findById(entityId);
entityId = requestContext.getLong("municipality");
Municipality municipality = entityId == null ? null : municipalityDAO.findById(entityId);
entityId = requestContext.getLong("activityType");
StudentActivityType activityType = entityId == null ? null : activityTypeDAO.findById(entityId);
entityId = requestContext.getLong("examinationType");
StudentExaminationType examinationType = entityId == null ? null : examinationTypeDAO.findById(entityId);
entityId = requestContext.getLong("educationalLevel");
StudentEducationalLevel educationalLevel = entityId == null ? null : educationalLevelDAO.findById(entityId);
entityId = requestContext.getLong("nationality");
Nationality nationality = entityId == null ? null : nationalityDAO.findById(entityId);
entityId = requestContext.getLong("school");
School school = entityId != null && entityId > 0 ? schoolDAO.findById(entityId) : null;
entityId = requestContext.getLong("studyProgramme");
StudyProgramme studyProgramme = entityId != null && entityId > 0 ? studyProgrammeDAO.findById(entityId) : null;
if (!UserUtils.canAccessOrganization(loggedUser, studyProgramme.getOrganization())) {
throw new SmvcRuntimeException(PyramusStatusCode.UNAUTHORIZED, "Invalid studyprogramme.");
}
entityId = requestContext.getLong("studyEndReason");
StudentStudyEndReason studyEndReason = entityId == null ? null : studyEndReasonDAO.findById(entityId);
entityId = requestContext.getLong("curriculum");
Curriculum curriculum = entityId == null ? null : curriculumDAO.findById(entityId);
Person person = personId != null ? personDAO.findById(personId) : null;
Person personBySSN = personDAO.findBySSN(ssecId);
if (person == null) {
if (personBySSN == null) {
person = personDAO.create(birthday, ssecId, sex, basicInfo, secureInfo);
} else {
personDAO.update(personBySSN, birthday, ssecId, sex, basicInfo, secureInfo);
person = personBySSN;
}
} else {
personDAO.update(person, birthday, ssecId, sex, basicInfo, secureInfo);
}
Student student = studentDAO.create(person, firstName, lastName, nickname, additionalInfo, studyTimeEnd, activityType, examinationType, educationalLevel, education, nationality, municipality, language, school, studyProgramme, curriculum, previousStudies, studyStartTime, studyEndTime, studyEndReason, studyEndText, false);
// Lodging periods
Integer lodgingPeriodsCount = requestContext.getInteger("lodgingPeriodsTable.rowCount");
if (lodgingPeriodsCount != null) {
for (int i = 0; i < lodgingPeriodsCount; i++) {
String colPrefix = "lodgingPeriodsTable." + i;
Date begin = requestContext.getDate(colPrefix + ".begin");
Date end = requestContext.getDate(colPrefix + ".end");
lodgingPeriodDAO.create(student, begin, end);
}
}
// Tags
studentDAO.setStudentTags(student, tagEntities);
if (person.getDefaultUser() == null) {
personDAO.updateDefaultUser(person, student);
}
// Contact info
contactInfoDAO.update(student.getContactInfo(), otherContactInfo);
// Addresses
int addressCount = requestContext.getInteger("addressTable.rowCount");
for (int i = 0; i < addressCount; i++) {
String colPrefix = "addressTable." + i;
Boolean defaultAddress = requestContext.getBoolean(colPrefix + ".defaultAddress");
ContactType contactType = contactTypeDAO.findById(requestContext.getLong(colPrefix + ".contactTypeId"));
String name = requestContext.getString(colPrefix + ".name");
String street = requestContext.getString(colPrefix + ".street");
String postal = requestContext.getString(colPrefix + ".postal");
String city = requestContext.getString(colPrefix + ".city");
String country = requestContext.getString(colPrefix + ".country");
boolean hasAddress = name != null || street != null || postal != null || city != null || country != null;
if (hasAddress) {
addressDAO.create(student.getContactInfo(), contactType, name, street, postal, city, country, defaultAddress);
}
}
// Email addresses
int emailCount = requestContext.getInteger("emailTable.rowCount");
for (int i = 0; i < emailCount; i++) {
String colPrefix = "emailTable." + i;
Boolean defaultAddress = requestContext.getBoolean(colPrefix + ".defaultAddress");
ContactType contactType = contactTypeDAO.findById(requestContext.getLong(colPrefix + ".contactTypeId"));
String email = StringUtils.trim(requestContext.getString(colPrefix + ".email"));
if (StringUtils.isNotBlank(email)) {
emailDAO.create(student.getContactInfo(), contactType, defaultAddress, email);
}
}
// Phone numbers
int phoneCount = requestContext.getInteger("phoneTable.rowCount");
for (int i = 0; i < phoneCount; i++) {
String colPrefix = "phoneTable." + i;
Boolean defaultNumber = requestContext.getBoolean(colPrefix + ".defaultNumber");
ContactType contactType = contactTypeDAO.findById(requestContext.getLong(colPrefix + ".contactTypeId"));
String number = requestContext.getString(colPrefix + ".phone");
if (number != null) {
phoneNumberDAO.create(student.getContactInfo(), contactType, defaultNumber, number);
}
}
// Student variables, create the defaults first and modify if modified
userVariableDAO.createDefaultValueVariables(student);
Integer variableCount = requestContext.getInteger("variablesTable.rowCount");
if (variableCount != null) {
for (int i = 0; i < variableCount; i++) {
String colPrefix = "variablesTable." + i;
Long edited = requestContext.getLong(colPrefix + ".edited");
if (Objects.equals(new Long(1), edited)) {
String variableKey = requestContext.getRequest().getParameter(colPrefix + ".key");
String variableValue = requestContext.getRequest().getParameter(colPrefix + ".value");
userVariableDAO.setUserVariable(student, variableKey, variableValue);
}
}
}
// Contact information of a student won't be reflected to Person
// used when searching students, so a manual re-index is needed
personDAO.forceReindex(student.getPerson());
String redirectURL = requestContext.getRequest().getContextPath() + "/students/editstudent.page?person=" + student.getPerson().getId();
String refererAnchor = requestContext.getRefererAnchor();
if (!StringUtils.isBlank(refererAnchor)) {
redirectURL += "#" + refererAnchor;
}
requestContext.setRedirectURL(redirectURL);
}
use of fi.otavanopisto.pyramus.domainmodel.base.Language in project pyramus by otavanopisto.
the class SearchStudentsJSONRequestContoller method process.
public void process(JSONRequestContext jsonRequestContext) {
StudentDAO studentDAO = DAOFactory.getInstance().getStudentDAO();
PersonDAO personDAO = DAOFactory.getInstance().getPersonDAO();
LanguageDAO languageDAO = DAOFactory.getInstance().getLanguageDAO();
MunicipalityDAO municipalityDAO = DAOFactory.getInstance().getMunicipalityDAO();
NationalityDAO nationalityDAO = DAOFactory.getInstance().getNationalityDAO();
StudyProgrammeDAO studyProgrammeDAO = DAOFactory.getInstance().getStudyProgrammeDAO();
StaffMemberDAO staffMemberDAO = DAOFactory.getInstance().getStaffMemberDAO();
StaffMember loggedUser = staffMemberDAO.findById(jsonRequestContext.getLoggedUserId());
Organization organization = UserUtils.canAccessAllOrganizations(loggedUser) ? null : loggedUser.getOrganization();
Integer resultsPerPage = NumberUtils.createInteger(jsonRequestContext.getRequest().getParameter("maxResults"));
if (resultsPerPage == null) {
resultsPerPage = 10;
}
Integer page = NumberUtils.createInteger(jsonRequestContext.getRequest().getParameter("page"));
if (page == null) {
page = 0;
}
SearchResult<Person> searchResult;
if ("advanced".equals(jsonRequestContext.getRequest().getParameter("activeTab"))) {
String firstName = jsonRequestContext.getString("firstname");
String nickname = jsonRequestContext.getString("nickname");
String lastName = jsonRequestContext.getString("lastname");
String tags = jsonRequestContext.getString("tags");
if (!StringUtils.isBlank(tags))
tags = tags.replace(',', ' ');
String education = jsonRequestContext.getString("education");
String email = jsonRequestContext.getString("email");
Sex sex = (Sex) jsonRequestContext.getEnum("sex", Sex.class);
String ssn = jsonRequestContext.getString("ssn");
String addressCity = jsonRequestContext.getString("addressCity");
String addressCountry = jsonRequestContext.getString("addressCountry");
String addressPostalCode = jsonRequestContext.getString("addressPostalCode");
String addressStreetAddress = jsonRequestContext.getString("addressStreetAddress");
String phone = jsonRequestContext.getString("phone");
String title = jsonRequestContext.getString("title");
PersonFilter personFilter = (PersonFilter) jsonRequestContext.getEnum("studentFilter", PersonFilter.class);
Language language = null;
Long languageId = jsonRequestContext.getLong("language");
if (languageId != null) {
language = languageDAO.findById(languageId);
}
Nationality nationality = null;
Long nationalityId = jsonRequestContext.getLong("nationality");
if (nationalityId != null) {
nationality = nationalityDAO.findById(nationalityId);
}
Municipality municipality = null;
Long municipalityId = jsonRequestContext.getLong("municipality");
if (municipalityId != null) {
municipality = municipalityDAO.findById(municipalityId);
}
StudyProgramme studyProgramme = null;
Long studyProgrammeId = jsonRequestContext.getLong("studyProgramme");
if (studyProgrammeId != null) {
studyProgramme = studyProgrammeDAO.findById(studyProgrammeId);
}
searchResult = personDAO.searchPersons(resultsPerPage, page, firstName, lastName, nickname, tags, education, email, sex, ssn, addressCity, addressCountry, addressPostalCode, addressStreetAddress, phone, studyProgramme, language, nationality, municipality, title, personFilter, organization);
} else if ("active".equals(jsonRequestContext.getRequest().getParameter("activeTab"))) {
String query = jsonRequestContext.getRequest().getParameter("activesQuery");
searchResult = personDAO.searchPersonsBasic(resultsPerPage, page, query, PersonFilter.ACTIVE_STUDENTS, organization);
} else {
String query = jsonRequestContext.getRequest().getParameter("query");
searchResult = personDAO.searchPersonsBasic(resultsPerPage, page, query, PersonFilter.ALL, organization);
}
List<Map<String, Object>> results = new ArrayList<>();
List<Person> persons = searchResult.getResults();
for (Person person : persons) {
List<Student> studentList2 = studentDAO.listByPerson(person);
StaffMember staffMember = staffMemberDAO.findByPerson(person);
if (!studentList2.isEmpty() || staffMember != null) {
String activeStudyProgrammes = "";
String inactiveStudyProgrammes = "";
for (Student student1 : studentList2) {
if (student1.getStudyProgramme() != null && UserUtils.canAccessOrganization(loggedUser, student1.getOrganization())) {
if (!student1.getHasFinishedStudies()) {
if (activeStudyProgrammes.length() == 0)
activeStudyProgrammes = student1.getStudyProgramme().getName();
else
activeStudyProgrammes += ", " + student1.getStudyProgramme().getName();
} else {
if (inactiveStudyProgrammes.length() == 0)
inactiveStudyProgrammes = student1.getStudyProgramme().getName();
else
inactiveStudyProgrammes += ", " + student1.getStudyProgramme().getName();
}
}
}
String firstName = "";
String lastName = "";
Boolean archived = Boolean.FALSE;
Long id = null;
if (person.getLatestStudent() != null) {
firstName = person.getLatestStudent().getFirstName();
lastName = person.getLatestStudent().getLastName();
archived = person.getLatestStudent().getArchived();
id = person.getLatestStudent().getId();
} else {
if (staffMember != null) {
firstName = staffMember.getFirstName();
lastName = staffMember.getLastName();
}
}
Map<String, Object> info = new HashMap<>();
info.put("personId", person.getId());
info.put("id", id);
info.put("firstName", firstName);
info.put("lastName", lastName);
info.put("archived", archived);
info.put("activeStudyProgrammes", activeStudyProgrammes);
info.put("inactiveStudyProgrammes", inactiveStudyProgrammes);
info.put("active", person.getActive());
results.add(info);
}
}
String statusMessage;
Locale locale = jsonRequestContext.getRequest().getLocale();
if (searchResult.getTotalHitCount() > 0) {
statusMessage = Messages.getInstance().getText(locale, "students.searchStudents.searchStatus", new Object[] { searchResult.getFirstResult() + 1, searchResult.getLastResult() + 1, searchResult.getTotalHitCount() });
} else {
statusMessage = Messages.getInstance().getText(locale, "students.searchStudents.searchStatusNoMatches");
}
jsonRequestContext.addResponseParameter("results", results);
jsonRequestContext.addResponseParameter("statusMessage", statusMessage);
jsonRequestContext.addResponseParameter("pages", searchResult.getPages());
jsonRequestContext.addResponseParameter("page", searchResult.getPage());
}
Aggregations