Package org.joget.directory.model.service

Examples of org.joget.directory.model.service.DirectoryManager


     * @return
     */
    protected List<String> getParticipantsByRequesterHod(PackageParticipant participant, String processDefId, String processId, String requesterUsername) {
        List<String> resultList = new ArrayList<String>();
        ApplicationContext appContext = AppUtil.getApplicationContext();
        DirectoryManager directoryManager = (DirectoryManager) appContext.getBean("directoryManager");
        if (participant.getValue() != null && participant.getValue().trim().length() > 0) {
            WorkflowManager workflowManager = (WorkflowManager) appContext.getBean("workflowManager");
            requesterUsername = workflowManager.getUserByProcessIdAndActivityDefId(processDefId, processId, participant.getValue());
        }
        Collection<User> users = directoryManager.getUserHod(requesterUsername);
        for (User user : users) {
            if (user != null && user.getActive() == User.ACTIVE) {
                resultList.add(user.getUsername());
            }
        }
View Full Code Here


    }
   
    protected List<String> getParticipantsByRequesterHodIgnoreReportTo(PackageParticipant participant, String processDefId, String processId, String requesterUsername) {
        List<String> resultList = new ArrayList<String>();
        ApplicationContext appContext = AppUtil.getApplicationContext();
        DirectoryManager directoryManager = (DirectoryManager) appContext.getBean("directoryManager");
        if (participant.getValue() != null && participant.getValue().trim().length() > 0) {
            WorkflowManager workflowManager = (WorkflowManager) appContext.getBean("workflowManager");
            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

        ApplicationContext appContext = AppUtil.getApplicationContext();
        if (participant.getValue() != null && participant.getValue().trim().length() > 0) {
            WorkflowManager workflowManager = (WorkflowManager) appContext.getBean("workflowManager");
            requesterUsername = workflowManager.getUserByProcessIdAndActivityDefId(processDefId, processId, participant.getValue());
        }
        DirectoryManager directoryManager = (DirectoryManager) appContext.getBean("directoryManager");
        Collection<User> users = directoryManager.getUserSubordinate(requesterUsername);
        for (User user : users) {
            if (user != null && user.getActive() == User.ACTIVE) {
                resultList.add(user.getUsername());
            }
        }
View Full Code Here

     * @return
     */
    protected List<String> getParticipantsByRequesterDepartment(PackageParticipant participant, String processDefId, String processId, String requesterUsername) {
        List<String> resultList = new ArrayList<String>();
        ApplicationContext appContext = AppUtil.getApplicationContext();
        DirectoryManager directoryManager = (DirectoryManager) appContext.getBean("directoryManager");
        if (participant.getValue() != null && participant.getValue().trim().length() > 0) {
            WorkflowManager workflowManager = (WorkflowManager) appContext.getBean("workflowManager");
            requesterUsername = workflowManager.getUserByProcessIdAndActivityDefId(processDefId, processId, participant.getValue());
        }
        Collection<User> users = directoryManager.getUserDepartmentUser(requesterUsername);
        for (User user : users) {
            if (user != null && user.getActive() == User.ACTIVE) {
                resultList.add(user.getUsername());
            }
        }
View Full Code Here

     * @return
     */
    protected List<String> getParticipantsByDepartment(PackageParticipant participant) {
        List<String> resultList = new ArrayList<String>();
        ApplicationContext appContext = AppUtil.getApplicationContext();
        DirectoryManager directoryManager = (DirectoryManager) appContext.getBean("directoryManager");
        String departmentId = participant.getValue();
        Collection<User> users = directoryManager.getUserByDepartmentId(departmentId);
        for (User user : users) {
            if (user != null && user.getActive() == User.ACTIVE) {
                resultList.add(user.getUsername());
            }
        }
View Full Code Here

     * @return
     */
    protected List<String> getParticipantsByHod(PackageParticipant participant) {
        List<String> resultList = new ArrayList<String>();
        ApplicationContext appContext = AppUtil.getApplicationContext();
        DirectoryManager directoryManager = (DirectoryManager) appContext.getBean("directoryManager");
        String departmentId = participant.getValue();
        User user = directoryManager.getDepartmentHod(departmentId);
        if (user != null && user.getActive() == User.ACTIVE) {
            resultList.add(user.getUsername());
        }
        return resultList;
    }
View Full Code Here

     * @return
     */
    protected List<String> getParticipantsByWorkflowVariable(PackageParticipant participant, String activityId) {
        List<String> resultList = new ArrayList<String>();
        ApplicationContext appContext = AppUtil.getApplicationContext();
        DirectoryManager directoryManager = (DirectoryManager) appContext.getBean("directoryManager");
        WorkflowManager workflowManager = (WorkflowManager) appContext.getBean("workflowManager");
        String variableName = null;
        String variableType = null;
        String variableStr = participant.getValue();
        if (variableStr != null) {
            StringTokenizer st = new StringTokenizer(variableStr.replaceAll(";", ","), ",");
            if (st.hasMoreTokens()) {
                variableName = st.nextToken();
            }
            if (st.hasMoreTokens()) {
                variableType = st.nextToken();
            }
        }
        //if is workflow variable
        Collection<WorkflowVariable> varList = workflowManager.getActivityVariableList(activityId);
        for (WorkflowVariable va : varList) {
            if (va.getName() != null && va.getName().equals(variableName)) {
                String variableValue = (String) va.getVal();
                variableValue = variableValue.replace(",", ";");

                StringTokenizer valueST = new StringTokenizer(variableValue, ";");
                Collection<User> users = new ArrayList<User>();

                while (valueST.hasMoreTokens()) {
                    String value = valueST.nextToken();
                    value = value.trim();

                    if (PackageParticipant.TYPE_GROUP.equals(variableType)) {
                        Collection<User> tempUsers = directoryManager.getUserByGroupId(value);
                        users.addAll(tempUsers);
                    } else if (PackageParticipant.TYPE_USER.equals(variableType)) {
                        User user = directoryManager.getUserByUsername(value);
                        users.add(user);
                    } else if (PackageParticipant.TYPE_HOD.equals(variableType)) {
                        User user = directoryManager.getDepartmentHod(value);
                        users.add(user);
                    } else if (PackageParticipant.TYPE_DEPARTMENT.equals(variableType)) {
                        Collection<User> tempUsers = directoryManager.getUserByDepartmentId(value);
                        users.addAll(tempUsers);
                    }
                }
                for (User user : users) {
                    if (user != null && user.getActive() == User.ACTIVE) {
View Full Code Here

        try {
            User user = userCache.get(username);
            if (user == null) {
                ApplicationContext appContext = AppUtil.getApplicationContext();
                DirectoryManager directoryManager = (DirectoryManager) appContext.getBean("directoryManager");
                user = directoryManager.getUserByUsername(username);
                userCache.put(username, user);
            }

            if (user != null) {
                //convert first character to upper case
View Full Code Here

        String attributeValue = null;

        try {
            if (user == null) {
                ApplicationContext appContext = AppUtil.getApplicationContext();
                DirectoryManager directoryManager = (DirectoryManager) appContext.getBean("directoryManager");
                user = directoryManager.getUserByUsername(username);
            }
           
            if (user != null) {
                //convert first character to upper case
                char firstChar = attribute.charAt(0);
View Full Code Here

    }

    public GrantedAuthority[] getAuthorities() {
        try {
            ApplicationContext appContext = WorkflowUtil.getApplicationContext();
            DirectoryManager directoryManager = (DirectoryManager) appContext.getBean("directoryManager");
            Collection<Role> roles = directoryManager.getUserRoles(user.getUsername());
            List<GrantedAuthority> gaList = new ArrayList<GrantedAuthority>();

            if (roles != null && !roles.isEmpty()) {
                for (Role role : roles) {
                    GrantedAuthorityImpl ga = new GrantedAuthorityImpl(role.getId());
View Full Code Here

TOP

Related Classes of org.joget.directory.model.service.DirectoryManager

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.