Package org.joget.directory.model

Examples of org.joget.directory.model.Employment


            User user = userDao.getUserById(userId);
            Department department = departmentDao.getDepartment(departmentId);

            //get only 1st employment
            if (user != null && user.getEmployments() != null && user.getEmployments().size() > 0 && department != null) {
                Employment employment = (Employment) user.getEmployments().iterator().next();
                if (department.getId().equals(employment.getDepartmentId())) {
                    if (employment.getHods() != null && !employment.getHods().isEmpty() && employment.getDepartment() != null) {
                        Department orgDepartment = employment.getDepartment();
                        orgDepartment.setHod(null);
                        departmentDao.updateDepartment(orgDepartment);
                    }
                   
                    employment.setDepartmentId(null);
                    employment.getHods().clear();
                    saveOrUpdate("Employment", employment);
                    return true;
                }
            }
        } catch (Exception e) {
View Full Code Here


            User user = userDao.getUserById(userId);
            Grade grade = gradeDao.getGrade(gradeId);

            //get only 1st employment
            if (user != null && user.getEmployments() != null && user.getEmployments().size() > 0 && grade != null) {
                Employment employment = (Employment) user.getEmployments().iterator().next();
                if (!grade.getId().equals(employment.getGradeId())) {
                    employment.setGradeId(grade.getId());
                    saveOrUpdate("Employment", employment);
                }
                return true;
            }
        } catch (Exception e) {
View Full Code Here

            User user = userDao.getUserById(userId);
            Grade grade = gradeDao.getGrade(gradeId);

            //get only 1st employment
            if (user != null && user.getEmployments() != null && user.getEmployments().size() > 0 && grade != null) {
                Employment employment = (Employment) user.getEmployments().iterator().next();
                if (grade.getId().equals(employment.getGradeId())) {
                    employment.setGradeId(null);
                    saveOrUpdate("Employment", employment);
                    return true;
                }
            }
        } catch (Exception e) {
View Full Code Here

    public Boolean updateUserEmploymentInfo(String username, Employment info) {
        try {
            User user = getUser(username);
            if (user != null) {
                if (user.getEmployments() != null && user.getEmployments().size() > 0) {
                    Employment employment = (Employment) user.getEmployments().iterator().next();
                    info.setId(employment.getId());
                    getEmploymentDao().updateEmployment(info);
                } else {
                    user.getEmployments().add(info);
                    saveOrUpdate("User", user);
                }
View Full Code Here

    public User getHodByDepartmentId(String departmentId) {
        try {
            if (departmentId != null) {
                Department department = departmentDao.getDepartment(departmentId);
                if (department != null && department.getHod() != null) {
                    Employment employment = department.getHod();
                    if (employment.getUser() != null) {
                        return getUserById(employment.getUserId());
                    }
                }
            }
        } catch (Exception e) {
            LogUtil.error(UserDaoImpl.class.getName(), e, "Get Hod By Department Id Error!");
View Full Code Here

        userDao.addUser(user);
    }

    protected void addEmployment(String username, String departmentId, String organizationId) {
        LogUtil.info(getClass().getName(), "addEmployment");
        Employment employment = new Employment();
        employment.setUserId(username);
        employment.setEmployeeCode(username);
        employment.setDepartmentId(departmentId);
        employmentDao.updateEmployment(employment);
    }
View Full Code Here

    @Override
    public boolean isAuthorize() {
        User user = getCurrentUser();

        if (user != null && user.getEmployments() != null && user.getEmployments().size() > 0) {
            Employment e = (Employment) user.getEmployments().iterator().next();

            StringTokenizer strToken = new StringTokenizer(getPropertyString("allowedDeptIds"), ";");
            while (strToken.hasMoreTokens()) {
                String deptId = (String) strToken.nextElement();
                if (deptId.equals(e.getDepartmentId())) {
                    return true;
                }
            }
        }
View Full Code Here

    @Override
    public boolean isAuthorize() {
        User user = getCurrentUser();

        if (user != null && user.getEmployments() != null && user.getEmployments().size() > 0) {
            Employment e = (Employment) user.getEmployments().iterator().next();

            StringTokenizer strToken = new StringTokenizer(getPropertyString("allowedOrgIds"), ";");
            while (strToken.hasMoreTokens()) {
                String orgId = (String) strToken.nextElement();
                if (orgId.equals(e.getOrganizationId())) {
                    return true;
                }
            }
        }
View Full Code Here

            requesterUsername = workflowManager.getUserByProcessIdAndActivityDefId(processDefId, processId, participant.getValue());
        }
       
        User requester = directoryManager.getUserByUsername(requesterUsername);
        if (requester != null && requester.getEmployments() != null && !requester.getEmployments().isEmpty()) {
            Employment employment = (Employment) requester.getEmployments().iterator().next();
            if (employment != null && employment.getDepartment() != null) {
                Department dept = employment.getDepartment();
                User hod = directoryManager.getDepartmentHod(dept.getId());
               
                if (hod != null) {
                    resultList.add(hod.getUsername());
                }
View Full Code Here

        model.addAttribute("user", user);

        if (user != null) {
            //get only 1st employment
            if (user.getEmployments() != null && user.getEmployments().size() > 0) {
                Employment employment = (Employment) user.getEmployments().iterator().next();
                model.addAttribute("employment", directoryManager.getEmployment(employment.getId()));
            }

            //get roles
            String roles = "";
            if (user.getRoles() != null && user.getRoles().size() > 0) {
View Full Code Here

TOP

Related Classes of org.joget.directory.model.Employment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.