Search in sources :

Example 11 with PersonDAO

use of fi.otavanopisto.pyramus.dao.base.PersonDAO in project pyramus by otavanopisto.

the class CopyStudentStudyProgrammeJSONRequestController method process.

public void process(JSONRequestContext requestContext) {
    StudentDAO studentDAO = DAOFactory.getInstance().getStudentDAO();
    AddressDAO addressDAO = DAOFactory.getInstance().getAddressDAO();
    ContactInfoDAO contactInfoDAO = DAOFactory.getInstance().getContactInfoDAO();
    EmailDAO emailDAO = DAOFactory.getInstance().getEmailDAO();
    PhoneNumberDAO phoneNumberDAO = DAOFactory.getInstance().getPhoneNumberDAO();
    CreditLinkDAO creditLinkDAO = DAOFactory.getInstance().getCreditLinkDAO();
    CourseAssessmentDAO courseAssessmentDAO = DAOFactory.getInstance().getCourseAssessmentDAO();
    TransferCreditDAO transferCreditDAO = DAOFactory.getInstance().getTransferCreditDAO();
    StaffMemberDAO userDAO = DAOFactory.getInstance().getStaffMemberDAO();
    PersonDAO personDAO = DAOFactory.getInstance().getPersonDAO();
    StudyProgrammeDAO studyProgrammeDAO = DAOFactory.getInstance().getStudyProgrammeDAO();
    UserVariableDAO userVariableDAO = DAOFactory.getInstance().getUserVariableDAO();
    Long studentId = requestContext.getLong("studentId");
    Student oldStudent = studentDAO.findById(studentId);
    StaffMember loggedUser = userDAO.findById(requestContext.getLoggedUserId());
    if (!UserUtils.canAccessOrganization(loggedUser, oldStudent.getOrganization())) {
        throw new SmvcRuntimeException(PyramusStatusCode.UNAUTHORIZED, "Cannot access specified student");
    }
    Long newStudyProgrammeId = requestContext.getLong("newStudyProgrammeId");
    StudyProgramme newStudyProgramme = studyProgrammeDAO.findById(newStudyProgrammeId);
    if (newStudyProgramme == null) {
        throw new SmvcRuntimeException(PyramusStatusCode.UNDEFINED, "New Study Programme not defined");
    }
    if (!UserUtils.canAccessOrganization(loggedUser, newStudyProgramme.getOrganization())) {
        throw new SmvcRuntimeException(PyramusStatusCode.UNAUTHORIZED, "Cannot access specified study programme");
    }
    Boolean linkCredits = requestContext.getBoolean("linkCredits");
    Boolean setAsDefaultUser = requestContext.getBoolean("setAsDefaultUser");
    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();
    // oldStudent.getStudyProgramme();
    StudyProgramme studyProgramme = newStudyProgramme;
    // 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);
    // Variables are not copied, but the default values are applied
    userVariableDAO.createDefaultValueVariables(newStudent);
    // Contact info
    contactInfoDAO.update(newStudent.getContactInfo(), oldStudent.getContactInfo().getAdditionalInfo());
    if (person.getDefaultUser() == null || Boolean.TRUE.equals(setAsDefaultUser)) {
        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());
    }
    // Email 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());
    }
    if (linkCredits) {
        List<CourseAssessment> assessments = courseAssessmentDAO.listByStudent(oldStudent);
        for (CourseAssessment assessment : assessments) {
            creditLinkDAO.create(assessment, newStudent, loggedUser);
        }
        List<TransferCredit> transferCredits = transferCreditDAO.listByStudent(oldStudent);
        for (TransferCredit transferCredit : transferCredits) {
            creditLinkDAO.create(transferCredit, newStudent, loggedUser);
        }
        List<CreditLink> creditLinks = creditLinkDAO.listByStudent(oldStudent);
        for (CreditLink creditLink : creditLinks) {
            creditLinkDAO.create(creditLink.getCredit(), newStudent, loggedUser);
        }
    }
    String redirectURL = requestContext.getRequest().getContextPath() + "/students/editstudent.page?student=" + newStudent.getPerson().getId();
    String refererAnchor = requestContext.getRefererAnchor();
    if (!StringUtils.isBlank(refererAnchor))
        redirectURL += "#" + refererAnchor;
    requestContext.setRedirectURL(redirectURL);
}
Also used : PhoneNumberDAO(fi.otavanopisto.pyramus.dao.base.PhoneNumberDAO) Email(fi.otavanopisto.pyramus.domainmodel.base.Email) StudyProgramme(fi.otavanopisto.pyramus.domainmodel.base.StudyProgramme) Address(fi.otavanopisto.pyramus.domainmodel.base.Address) StudentStudyEndReason(fi.otavanopisto.pyramus.domainmodel.students.StudentStudyEndReason) SmvcRuntimeException(fi.internetix.smvc.SmvcRuntimeException) StaffMember(fi.otavanopisto.pyramus.domainmodel.users.StaffMember) StudentEducationalLevel(fi.otavanopisto.pyramus.domainmodel.students.StudentEducationalLevel) EmailDAO(fi.otavanopisto.pyramus.dao.base.EmailDAO) PersonDAO(fi.otavanopisto.pyramus.dao.base.PersonDAO) School(fi.otavanopisto.pyramus.domainmodel.base.School) StaffMemberDAO(fi.otavanopisto.pyramus.dao.users.StaffMemberDAO) TransferCreditDAO(fi.otavanopisto.pyramus.dao.grading.TransferCreditDAO) Language(fi.otavanopisto.pyramus.domainmodel.base.Language) UserVariableDAO(fi.otavanopisto.pyramus.dao.users.UserVariableDAO) CreditLink(fi.otavanopisto.pyramus.domainmodel.grading.CreditLink) AddressDAO(fi.otavanopisto.pyramus.dao.base.AddressDAO) Municipality(fi.otavanopisto.pyramus.domainmodel.base.Municipality) CourseAssessmentDAO(fi.otavanopisto.pyramus.dao.grading.CourseAssessmentDAO) StudentExaminationType(fi.otavanopisto.pyramus.domainmodel.students.StudentExaminationType) Student(fi.otavanopisto.pyramus.domainmodel.students.Student) CreditLinkDAO(fi.otavanopisto.pyramus.dao.grading.CreditLinkDAO) StudyProgrammeDAO(fi.otavanopisto.pyramus.dao.base.StudyProgrammeDAO) Date(java.util.Date) Nationality(fi.otavanopisto.pyramus.domainmodel.base.Nationality) CourseAssessment(fi.otavanopisto.pyramus.domainmodel.grading.CourseAssessment) StudentDAO(fi.otavanopisto.pyramus.dao.students.StudentDAO) ContactInfoDAO(fi.otavanopisto.pyramus.dao.base.ContactInfoDAO) StudentActivityType(fi.otavanopisto.pyramus.domainmodel.students.StudentActivityType) Curriculum(fi.otavanopisto.pyramus.domainmodel.base.Curriculum) PhoneNumber(fi.otavanopisto.pyramus.domainmodel.base.PhoneNumber) TransferCredit(fi.otavanopisto.pyramus.domainmodel.grading.TransferCredit) Person(fi.otavanopisto.pyramus.domainmodel.base.Person)

Example 12 with PersonDAO

use of fi.otavanopisto.pyramus.dao.base.PersonDAO in project pyramus by otavanopisto.

the class InvalidateKoskiStudyPermitJSONRequestController method process.

public void process(JSONRequestContext requestContext) {
    PersonDAO personDAO = DAOFactory.getInstance().getPersonDAO();
    Long personId = requestContext.getLong("personId");
    Person person = personDAO.findById(personId);
    String oid = requestContext.getString("oid");
    KoskiClient client = CDI.current().select(KoskiClient.class).get();
    try {
        client.invalidateStudyOid(person, oid);
    } catch (Exception e) {
        logger.log(Level.SEVERE, "Invalidation failed", e);
        requestContext.addMessage(Severity.ERROR, Messages.getInstance().getText(requestContext.getRequest().getLocale(), "students.invalidateKoskiOID.errorMessage", new String[] { e.getMessage() }));
    }
}
Also used : PersonDAO(fi.otavanopisto.pyramus.dao.base.PersonDAO) KoskiClient(fi.otavanopisto.pyramus.koski.KoskiClient) Person(fi.otavanopisto.pyramus.domainmodel.base.Person)

Example 13 with PersonDAO

use of fi.otavanopisto.pyramus.dao.base.PersonDAO in project pyramus by otavanopisto.

the class ListKoskiPersonVariablesJSONRequestController method process.

public void process(JSONRequestContext requestContext) {
    try {
        PersonDAO personDAO = DAOFactory.getInstance().getPersonDAO();
        StudentDAO studentDAO = DAOFactory.getInstance().getStudentDAO();
        PersonVariableDAO personVariableDAO = DAOFactory.getInstance().getPersonVariableDAO();
        UserVariableDAO userVariableDAO = DAOFactory.getInstance().getUserVariableDAO();
        Long personId = requestContext.getLong("personId");
        if (personId == null) {
            logger.log(Level.WARNING, "Unable to load log entries due to missing personId.");
            requestContext.getResponse().sendError(HttpServletResponse.SC_BAD_REQUEST);
            return;
        }
        Person person = personDAO.findById(personId);
        String personOid = personVariableDAO.findByPersonAndKey(person, KoskiConsts.VariableNames.KOSKI_HENKILO_OID);
        KoskiSettings koskiSettings = CDI.current().select(KoskiSettings.class).get();
        KoskiController koskiController = CDI.current().select(KoskiController.class).get();
        List<Map<String, Object>> studentVariables = new ArrayList<>();
        List<Student> students = studentDAO.listByPerson(person);
        students.sort((a, b) -> Comparator.nullsFirst(Date::compareTo).reversed().compare(a.getStudyStartDate(), b.getStudyStartDate()));
        for (Student student : students) {
            KoskiStudyProgrammeHandler handlerType = koskiSettings.getStudyProgrammeHandlerType(student.getStudyProgramme().getId());
            KoskiStudentHandler handler = handlerType != null ? koskiController.getStudentHandler(handlerType) : null;
            if (handler != null) {
                String studentIdentifier = KoskiConsts.getStudentIdentifier(handlerType, student.getId());
                Set<KoskiStudentId> oids = handler.listOids(student);
                KoskiStudentId koskiId = oids.stream().filter(oid -> StringUtils.equals(oid.getStudentIdentifier(), studentIdentifier)).findFirst().orElse(null);
                Map<String, Object> studentInfo = new HashMap<>();
                studentInfo.put("studentId", student.getId());
                studentInfo.put("studyProgrammeName", student.getStudyProgramme().getName());
                studentInfo.put("oid", koskiId != null ? koskiId.getOid() : null);
                studentInfo.put("linkedOid", userVariableDAO.findByUserAndKey(student, KoskiConsts.VariableNames.KOSKI_LINKED_STUDYPERMISSION_ID));
                studentInfo.put("studyStartDate", student.getStudyStartDate().getTime());
                studentVariables.add(studentInfo);
            }
        }
        requestContext.addResponseParameter("personOID", personOid);
        requestContext.addResponseParameter("studentVariables", studentVariables);
    } catch (Exception e) {
        logger.log(Level.SEVERE, "Error loading person variables", e);
    }
}
Also used : KoskiStudyProgrammeHandler(fi.otavanopisto.pyramus.koski.KoskiStudyProgrammeHandler) KoskiController(fi.otavanopisto.pyramus.koski.KoskiController) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) Student(fi.otavanopisto.pyramus.domainmodel.students.Student) KoskiStudentId(fi.otavanopisto.pyramus.koski.KoskiStudentId) StudentDAO(fi.otavanopisto.pyramus.dao.students.StudentDAO) KoskiStudentHandler(fi.otavanopisto.pyramus.koski.KoskiStudentHandler) PersonDAO(fi.otavanopisto.pyramus.dao.base.PersonDAO) PersonVariableDAO(fi.otavanopisto.pyramus.dao.users.PersonVariableDAO) UserVariableDAO(fi.otavanopisto.pyramus.dao.users.UserVariableDAO) KoskiSettings(fi.otavanopisto.pyramus.koski.KoskiSettings) Person(fi.otavanopisto.pyramus.domainmodel.base.Person) HashMap(java.util.HashMap) Map(java.util.Map)

Example 14 with PersonDAO

use of fi.otavanopisto.pyramus.dao.base.PersonDAO in project pyramus by otavanopisto.

the class ApplicationUtils method resolvePerson.

public static Person resolvePerson(Application application) throws DuplicatePersonException {
    EmailDAO emailDAO = DAOFactory.getInstance().getEmailDAO();
    PersonDAO personDAO = DAOFactory.getInstance().getPersonDAO();
    UserDAO userDAO = DAOFactory.getInstance().getUserDAO();
    JSONObject applicationData = JSONObject.fromObject(application.getFormData());
    // Person by social security number
    Map<Long, Person> existingPersons = new HashMap<Long, Person>();
    String ssn = constructSSN(getFormValue(applicationData, "field-birthday"), getFormValue(applicationData, "field-ssn-end"));
    if (StringUtils.isNotBlank(ssn)) {
        List<Person> persons = personDAO.listBySSNUppercase(ssn);
        for (Person person : persons) {
            existingPersons.put(person.getId(), person);
        }
        // SSN with "wrong" delimiter
        char[] ssnChars = ssn.toCharArray();
        ssnChars[6] = ssnChars[6] == 'A' ? '-' : 'A';
        ssn = ssnChars.toString();
        persons = personDAO.listBySSNUppercase(ssn);
        for (Person person : persons) {
            existingPersons.put(person.getId(), person);
        }
    }
    // Person by email address
    String emailAddress = StringUtils.lowerCase(StringUtils.trim(application.getEmail()));
    List<Email> emails = emailDAO.listByAddressLowercase(emailAddress);
    for (Email email : emails) {
        if (email.getContactType() == null || Boolean.FALSE.equals(email.getContactType().getNonUnique())) {
            User user = userDAO.findByContactInfo(email.getContactInfo());
            if (user != null) {
                Person person = user.getPerson();
                if (person != null) {
                    existingPersons.put(person.getId(), person);
                }
            }
        }
    }
    if (existingPersons.size() > 1) {
        throw new DuplicatePersonException("Käyttäjätiedot täsmäävät useampaan olemassa olevaan käyttäjätiliin");
    } else if (existingPersons.isEmpty()) {
        return null;
    } else {
        Person person = existingPersons.values().iterator().next();
        if (person.getDefaultUser() != null) {
            StaffMemberDAO staffMemberDAO = DAOFactory.getInstance().getStaffMemberDAO();
            StaffMember staffMember = staffMemberDAO.findById(person.getDefaultUser().getId());
            if (staffMember != null) {
                throw new DuplicatePersonException("Käyttäjätiedot viittaavat henkilökunnan jäseneen");
            }
        }
        return person;
    }
}
Also used : Email(fi.otavanopisto.pyramus.domainmodel.base.Email) User(fi.otavanopisto.pyramus.domainmodel.users.User) HashMap(java.util.HashMap) StaffMember(fi.otavanopisto.pyramus.domainmodel.users.StaffMember) EmailDAO(fi.otavanopisto.pyramus.dao.base.EmailDAO) PersonDAO(fi.otavanopisto.pyramus.dao.base.PersonDAO) StaffMemberDAO(fi.otavanopisto.pyramus.dao.users.StaffMemberDAO) UserDAO(fi.otavanopisto.pyramus.dao.users.UserDAO) JSONObject(net.sf.json.JSONObject) Person(fi.otavanopisto.pyramus.domainmodel.base.Person)

Example 15 with PersonDAO

use of fi.otavanopisto.pyramus.dao.base.PersonDAO in project pyramus by otavanopisto.

the class CreateUserJSONRequestController method process.

/**
 * Processes the request to create a new user. Simply gathers the fields submitted from the
 * web page and adds the user to the database.
 *
 * @param requestContext The JSON request context
 */
public void process(JSONRequestContext requestContext) {
    StaffMemberDAO userDAO = DAOFactory.getInstance().getStaffMemberDAO();
    AddressDAO addressDAO = DAOFactory.getInstance().getAddressDAO();
    EmailDAO emailDAO = DAOFactory.getInstance().getEmailDAO();
    PhoneNumberDAO phoneNumberDAO = DAOFactory.getInstance().getPhoneNumberDAO();
    TagDAO tagDAO = DAOFactory.getInstance().getTagDAO();
    ContactTypeDAO contactTypeDAO = DAOFactory.getInstance().getContactTypeDAO();
    PersonDAO personDAO = DAOFactory.getInstance().getPersonDAO();
    UserIdentificationDAO userIdentificationDAO = DAOFactory.getInstance().getUserIdentificationDAO();
    OrganizationDAO organizationDAO = DAOFactory.getInstance().getOrganizationDAO();
    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"));
            }
        }
    }
    // Fields from the web page
    String firstName = requestContext.getString("firstName");
    String lastName = requestContext.getString("lastName");
    String title = requestContext.getString("title");
    Role role = Role.getRole(requestContext.getInteger("role"));
    String tagsText = requestContext.getString("tags");
    String username = requestContext.getString("username");
    String password = requestContext.getString("password1");
    String password2 = requestContext.getString("password2");
    Long organizationId = requestContext.getLong("organizationId");
    User loggedUser = userDAO.findById(requestContext.getLoggedUserId());
    Organization organization = organizationId != null ? organizationDAO.findById(organizationId) : null;
    if (!UserUtils.canAccessOrganization(loggedUser, organization)) {
        throw new SmvcRuntimeException(PyramusStatusCode.UNAUTHORIZED, "Invalid organization.");
    }
    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);
            }
        }
    }
    // User
    Person person = personId != null ? personDAO.findById(personId) : personDAO.create(null, null, null, null, Boolean.FALSE);
    StaffMember user = userDAO.create(organization, firstName, lastName, role, person, false);
    if (title != null)
        userDAO.updateTitle(user, title);
    if (person.getDefaultUser() == null) {
        personDAO.updateDefaultUser(person, user);
    }
    if (AuthenticationProviderVault.getInstance().hasInternalStrategies()) {
        boolean usernameBlank = StringUtils.isBlank(username);
        boolean passwordBlank = StringUtils.isBlank(password);
        // TODO: Support multiple internal authentication sources
        if (!usernameBlank) {
            // #921: Check username
            InternalAuthDAO internalAuthDAO = DAOFactory.getInstance().getInternalAuthDAO();
            InternalAuth internalAuth = internalAuthDAO.findByUsername(username);
            if (internalAuth != null) {
                throw new RuntimeException(Messages.getInstance().getText(requestContext.getRequest().getLocale(), "generic.errors.usernameInUse"));
            }
            InternalAuthenticationProvider internalAuthenticationProvider = AuthenticationProviderVault.getInstance().getInternalAuthenticationProviders().get(0);
            if (!passwordBlank) {
                if (!password.equals(password2))
                    throw new SmvcRuntimeException(PyramusStatusCode.PASSWORD_MISMATCH, "Passwords don't match");
            }
            String externalId = internalAuthenticationProvider.createCredentials(username, password);
            userIdentificationDAO.create(person, internalAuthenticationProvider.getName(), externalId);
        }
    }
    // Tags
    userDAO.updateTags(user, tagEntities);
    // 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(user.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(user.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(user.getContactInfo(), contactType, defaultNumber, number);
        }
    }
    // Redirect to the Edit User view
    requestContext.setRedirectURL(requestContext.getRequest().getContextPath() + "/users/edituser.page?userId=" + user.getId());
}
Also used : PhoneNumberDAO(fi.otavanopisto.pyramus.dao.base.PhoneNumberDAO) ContactType(fi.otavanopisto.pyramus.domainmodel.base.ContactType) User(fi.otavanopisto.pyramus.domainmodel.users.User) Organization(fi.otavanopisto.pyramus.domainmodel.base.Organization) SmvcRuntimeException(fi.internetix.smvc.SmvcRuntimeException) StaffMember(fi.otavanopisto.pyramus.domainmodel.users.StaffMember) EmailDAO(fi.otavanopisto.pyramus.dao.base.EmailDAO) PersonDAO(fi.otavanopisto.pyramus.dao.base.PersonDAO) StaffMemberDAO(fi.otavanopisto.pyramus.dao.users.StaffMemberDAO) SmvcRuntimeException(fi.internetix.smvc.SmvcRuntimeException) InternalAuthenticationProvider(fi.otavanopisto.pyramus.plugin.auth.InternalAuthenticationProvider) ContactTypeDAO(fi.otavanopisto.pyramus.dao.base.ContactTypeDAO) InternalAuth(fi.otavanopisto.pyramus.domainmodel.users.InternalAuth) OrganizationDAO(fi.otavanopisto.pyramus.dao.base.OrganizationDAO) AddressDAO(fi.otavanopisto.pyramus.dao.base.AddressDAO) UserIdentificationDAO(fi.otavanopisto.pyramus.dao.users.UserIdentificationDAO) HashSet(java.util.HashSet) TagDAO(fi.otavanopisto.pyramus.dao.base.TagDAO) UserRole(fi.otavanopisto.pyramus.framework.UserRole) Role(fi.otavanopisto.pyramus.domainmodel.users.Role) InternalAuthDAO(fi.otavanopisto.pyramus.dao.users.InternalAuthDAO) Tag(fi.otavanopisto.pyramus.domainmodel.base.Tag) Person(fi.otavanopisto.pyramus.domainmodel.base.Person)

Aggregations

PersonDAO (fi.otavanopisto.pyramus.dao.base.PersonDAO)47 Person (fi.otavanopisto.pyramus.domainmodel.base.Person)42 Student (fi.otavanopisto.pyramus.domainmodel.students.Student)25 StudentDAO (fi.otavanopisto.pyramus.dao.students.StudentDAO)21 StaffMemberDAO (fi.otavanopisto.pyramus.dao.users.StaffMemberDAO)17 StaffMember (fi.otavanopisto.pyramus.domainmodel.users.StaffMember)14 User (fi.otavanopisto.pyramus.domainmodel.users.User)14 HashMap (java.util.HashMap)12 EmailDAO (fi.otavanopisto.pyramus.dao.base.EmailDAO)11 ContactTypeDAO (fi.otavanopisto.pyramus.dao.base.ContactTypeDAO)10 UserVariableDAO (fi.otavanopisto.pyramus.dao.users.UserVariableDAO)10 ContactType (fi.otavanopisto.pyramus.domainmodel.base.ContactType)10 StudyProgramme (fi.otavanopisto.pyramus.domainmodel.base.StudyProgramme)10 UserDAO (fi.otavanopisto.pyramus.dao.users.UserDAO)9 Language (fi.otavanopisto.pyramus.domainmodel.base.Language)9 Municipality (fi.otavanopisto.pyramus.domainmodel.base.Municipality)9 Nationality (fi.otavanopisto.pyramus.domainmodel.base.Nationality)9 School (fi.otavanopisto.pyramus.domainmodel.base.School)9 PhoneNumberDAO (fi.otavanopisto.pyramus.dao.base.PhoneNumberDAO)8 StudyProgrammeDAO (fi.otavanopisto.pyramus.dao.base.StudyProgrammeDAO)8