Package org.joget.workflow.model.service

Examples of org.joget.workflow.model.service.WorkflowUserManager


   
    protected void adminRoleFilter(User user) {
        ApplicationContext ac = DirectoryUtil.getApplicationContext();
       
        if (ac != null) {
            WorkflowUserManager workflowUserManager = (WorkflowUserManager) DirectoryUtil.getApplicationContext().getBean("workflowUserManager");
            if (workflowUserManager != null && !(workflowUserManager.isCurrentUserInRole(WorkflowUserManager.ROLE_ADMIN) || workflowUserManager.isSystemUser())){
                Role adminRole = roleDao.getRole(WorkflowUserManager.ROLE_ADMIN);
                if (user.getRoles() != null && user.getRoles().contains(adminRole)) {
                    user.getRoles().remove(adminRole);
                    Role userRole = roleDao.getRole("ROLE_USER");
                    if (userRole != null && !user.getRoles().contains(userRole)) {
View Full Code Here


                // get assignments
                WorkflowManager workflowManager = (WorkflowManager) WorkflowUtil.getApplicationContext().getBean("workflowManager");
                PagedList<WorkflowAssignment> assignmentList = workflowManager.getAssignmentPendingAndAcceptedList(packageId, processDefId, null, param.getSort(), param.getDesc(), param.getStart(), param.getSize());

                DirectoryManager directoryManager = (DirectoryManager) AppUtil.getApplicationContext().getBean("directoryManager");
                WorkflowUserManager workflowUserManager = (WorkflowUserManager) AppUtil.getApplicationContext().getBean("workflowUserManager");
                User user = directoryManager.getUserByUsername(workflowUserManager.getCurrentUsername());
                String gmt = "";
                if (user != null) {
                    gmt = user.getTimeZone();
                }
                String format = AppUtil.getAppDateFormat();
View Full Code Here

        Object result = null;
        try {
            final AuditTrail auditTrail = (AuditTrail) properties.get("auditTrail");
            final PluginManager pluginManager = (PluginManager) properties.get("pluginManager");
            final WorkflowManager workflowManager = (WorkflowManager) pluginManager.getBean("workflowManager");
            final WorkflowUserManager workflowUserManager = (WorkflowUserManager) pluginManager.getBean("workflowUserManager");
            final DirectoryManager directoryManager = (DirectoryManager) pluginManager.getBean("directoryManager");

            final String base = (String) properties.get("base");
            final String smtpHost = (String) properties.get("host");
            final String smtpPort = (String) properties.get("port");
            final String smtpUsername = (String) properties.get("username");
            final String smtpPassword = (String) properties.get("password");
            final String security = (String) properties.get("security");

            final String from = (String) properties.get("from");
            final String cc = (String) properties.get("cc");

            final String subject = (String) properties.get("subject");
            final String emailMessage = (String) properties.get("emailMessage");
           
            final String url = (String) properties.get("url");
            final String urlName = (String) properties.get("urlName");
            final String parameterName = (String) properties.get("parameterName");
            final String passoverMethod = (String) properties.get("passoverMethod");
            final String exclusion = (String) properties.get("exclusion");
            final String isHtml = (String) properties.get("isHtml");
            Map<String, String> replaceMap = null;
            if ("true".equalsIgnoreCase(isHtml)) {
                replaceMap = new HashMap<String, String>();
                replaceMap.put("\\n", "<br/>");
            }
            final Map<String, String> replace = replaceMap;
                   
            String appId = auditTrail.getAppId();
            String appVersion = auditTrail.getAppVersion();
            AppService appService = (AppService) AppUtil.getApplicationContext().getBean("appService");
            final AppDefinition appDef = appService.getAppDefinition(appId, appVersion);

            if (smtpHost == null || smtpHost.trim().length() == 0) {
                return null;
            }

            if (auditTrail != null && (auditTrail.getMethod().equals("createAssignments") || auditTrail.getMethod().equals("getDefaultAssignments") || auditTrail.getMethod().equals("assignmentReassign") || auditTrail.getMethod().equals("assignmentForceComplete"))) {
                final String profile = DynamicDataSourceManager.getCurrentProfile();
                new Thread(new Runnable() {

                    public void run() {
                        ThreadSessionUtil.initSession();
                        try {
                            HostManager.setCurrentProfile(profile);
                            List<String> userList = new ArrayList<String>();
                            String activityInstanceId = auditTrail.getMessage();
                           
                            int maxAttempt = 5;
                            int numOfAttempt = 0;
                            WorkflowActivity wfActivity = null;
                            while (userList != null && userList.isEmpty() && numOfAttempt < maxAttempt) {
                                //LogUtil.info(getClass().getName(), "Attempting to get resource ids....");
                                Thread.sleep(4000);
                                wfActivity = workflowManager.getActivityById(activityInstanceId);
                                userList = workflowManager.getAssignmentResourceIds(wfActivity.getProcessDefId(), wfActivity.getProcessId(), activityInstanceId);
                                numOfAttempt++;
                            }

                            Collection<String> exclusionIds = new ArrayList<String>();
                            if (exclusion != null && !exclusion.isEmpty()) {
                                exclusionIds.addAll(Arrays.asList(exclusion.split(";")));
                            }
                           
                            if (!exclusionIds.contains(WorkflowUtil.getProcessDefIdWithoutVersion(wfActivity.getProcessDefId()) + "-" + wfActivity.getActivityDefId())) {
                                LogUtil.info(UserNotificationAuditTrail.class.getName(), "Users to notify: " + userList);
                                if (userList != null) {
                                    for (String username : userList) {
                                        workflowUserManager.setCurrentThreadUser(username);
                                        WorkflowAssignment wfAssignment = workflowManager.getAssignment(activityInstanceId);
                                       
                                        Collection<String> addresses = AppUtil.getEmailList(null, username, null, null);
                                       
                                        if (addresses != null && addresses.size() > 0) {
View Full Code Here

            UserviewPermission permission = (UserviewPermission) pluginManager.getPlugin(permissionMap.get("className").toString());
            if (permission != null) {
                permission.setProperties((Map) permissionMap.get("properties"));
                permission.setRequestParameters(formData.getRequestParams());
               
                WorkflowUserManager workflowUserManager = (WorkflowUserManager) AppUtil.getApplicationContext().getBean("workflowUserManager");
                ExtDirectoryManager directoryManager = (ExtDirectoryManager) AppUtil.getApplicationContext().getBean("directoryManager");
                User user = directoryManager.getUserByUsername(workflowUserManager.getCurrentUsername());
                permission.setCurrentUser(user);
               
                isAuthorize = permission.isAuthorize();
            }
        }
View Full Code Here

        SetupManager setupManager = (SetupManager) appContext.getBean("setupManager");
        return setupManager.getSettingValue(propertyName);
    }

    public static String getCurrentUsername() {
        WorkflowUserManager workflowUserManager = (WorkflowUserManager) appContext.getBean("workflowUserManager");
        String username = workflowUserManager.getCurrentUsername();
        return username;
    }
View Full Code Here

            return username;
        }
    }

    public static boolean isCurrentUserInRole(String role) {
        WorkflowUserManager workflowUserManager = (WorkflowUserManager) appContext.getBean("workflowUserManager");
        boolean result = workflowUserManager.isCurrentUserInRole(role);
        return result;
    }
View Full Code Here

        boolean result = workflowUserManager.isCurrentUserInRole(role);
        return result;
    }

    public static boolean isCurrentUserAnonymous() {
        WorkflowUserManager workflowUserManager = (WorkflowUserManager) appContext.getBean("workflowUserManager");
        boolean result = workflowUserManager.isCurrentUserAnonymous();
        return result;
    }
View Full Code Here

    private User user = null;
   
    @Override
    public String processHashVariable(String variableKey) {
        ApplicationContext appContext = AppUtil.getApplicationContext();
        WorkflowUserManager workflowUserManager = (WorkflowUserManager) appContext.getBean("workflowUserManager");

        String username = workflowUserManager.getCurrentUsername();
        String attribute = variableKey;

        if (WorkflowUserManager.ROLE_ANONYMOUS.equals(username)) {
            return "";
        }
View Full Code Here

     * Retrieve the participants based on current user (Including anonymous)
     * @return
     */
    protected List<String> getParticipantsByCurrentUser() {
        List<String> resultList = new ArrayList<String>();
        WorkflowUserManager workflowUserManager = (WorkflowUserManager) AppUtil.getApplicationContext().getBean("workflowUserManager");
        resultList.add(workflowUserManager.getCurrentUsername());
        return resultList;
    }
View Full Code Here

     * Retrieve the participants based on logged in user
     * @return
     */
    protected List<String> getParticipantsByLoggedInUser() {
        List<String> resultList = new ArrayList<String>();
        WorkflowUserManager workflowUserManager = (WorkflowUserManager) AppUtil.getApplicationContext().getBean("workflowUserManager");
        if (!workflowUserManager.isCurrentUserAnonymous()) {
            resultList.add(workflowUserManager.getCurrentUsername());
        }
        return resultList;
    }
View Full Code Here

TOP

Related Classes of org.joget.workflow.model.service.WorkflowUserManager

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.