Package org.joget.directory.model

Examples of org.joget.directory.model.Grade


    }

    public Boolean assignUserToGrade(String userId, String gradeId) {
        try {
            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


    }

    public Boolean unassignUserFromGrade(String userId, String gradeId) {
        try {
            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;
                }
            }
View Full Code Here

        }
    }

    public Boolean deleteGrade(String id) {
        try {
            Grade grade = getGrade(id);

            if (grade != null && grade.getEmployments() != null && grade.getEmployments().size() > 0) {
                for (Employment e : (Set<Employment>) grade.getEmployments()) {
                    employmentDao.unassignUserFromGrade(e.getUserId(), id);
                }
            }
            delete("Grade", grade);
            return true;
View Full Code Here

        }
    }

    public Grade getGradeByName(String name) {
        try {
            Grade grade = new Grade();
            grade.setName(name);
            List grades = findByExample("Grade", grade);

            if (grades.size() > 0) {
                return (Grade) grades.get(0);
            }
View Full Code Here

    }

    @RequestMapping("/console/directory/grade/create")
    public String consoleGradeCreate(ModelMap model, @RequestParam("orgId") String orgId) {
        model.addAttribute("organization", organizationDao.getOrganization(orgId));
        model.addAttribute("grade", new Grade());
        return "console/directory/gradeCreate";
    }
View Full Code Here

        return "console/directory/gradeCreate";
    }

    @RequestMapping("/console/directory/grade/view/(*:id)")
    public String consoleGradeView(ModelMap model, @RequestParam("id") String id) {
        Grade grade = directoryManager.getGradeById(id);
        model.addAttribute("grade", grade);

        if (grade != null && grade.getOrganization() != null) {
            Collection<Department> departments = directoryManager.getDepartmentsByOrganizationId(null, grade.getOrganization().getId(), "name", false, null, null);
            model.addAttribute("departments", departments);
        }

        model.addAttribute("isCustomDirectoryManager", DirectoryUtil.isCustomDirectoryManager());
        return "console/directory/gradeView";
View Full Code Here

                } else {
                    grade.setOrganization(organization);
                    invalid = !gradeDao.addGrade(grade);
                }
            } else {
                Grade g = gradeDao.getGrade(grade.getId());
                g.setName(grade.getName());
                g.setDescription(grade.getDescription());
                invalid = !gradeDao.updateGrade(g);
            }

            if (!errors.isEmpty()) {
                model.addAttribute("errors", errors);
View Full Code Here

    }

    @RequestMapping("/console/directory/grade/(*:id)/user/assign/view")
    public String consoleGradeUserAssign(ModelMap model, @RequestParam(value = "id") String id) {
        model.addAttribute("id", id);
        Grade grade = directoryManager.getGradeById(id);
        if (grade != null && grade.getOrganization() != null) {
            model.addAttribute("organizationId", grade.getOrganization().getId());
        }
        return "console/directory/gradeUserAssign";
    }
View Full Code Here

TOP

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

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.