Package org.joget.apps.app.model

Examples of org.joget.apps.app.model.AuditTrail


    }

    public Object execute(Map properties) {
        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) {
View Full Code Here


    }

    public Object execute(Map properties) {
        Object result = null;
        try {
            final AuditTrail auditTrail = (AuditTrail) properties.get("auditTrail");

            if (validation(auditTrail)) {
                WorkflowManager workflowManager = (WorkflowManager) AppUtil.getApplicationContext().getBean("workflowManager");
                WorkflowProcess process = null;
                WorkflowProcess trackProcess = null;
                WorkflowActivity activity = null;
                WorkflowActivity trackActivity = null;

                if (auditTrail.getMethod().startsWith("process")) {
                    process = workflowManager.getRunningProcessById(auditTrail.getMessage());
                    trackProcess = workflowManager.getRunningProcessInfo(auditTrail.getMessage());
                } else {
                    activity = workflowManager.getActivityById(auditTrail.getMessage());
                    trackActivity = workflowManager.getRunningActivityInfo(auditTrail.getMessage());
                    process = workflowManager.getRunningProcessById(activity.getProcessId());
                    trackProcess = workflowManager.getRunningProcessInfo(activity.getProcessId());
                }

                final WorkflowProcess wfProcess = process;
                final WorkflowProcess wfTrackProcess = trackProcess;
                final WorkflowActivity wfActivity = activity;
                final WorkflowActivity wfTrackActivity = trackActivity;

                new Thread(new Runnable() {

                    public void run() {
                        String method = auditTrail.getMethod();
                        String appId = auditTrail.getAppId();
                        String appVersion = auditTrail.getAppVersion();

                        if (method.startsWith("process")) {
                            updateProcessData(wfProcess, wfTrackProcess, appId, appVersion);
                        } else {
                            updateActivityData(wfActivity, wfTrackActivity, wfProcess, wfTrackProcess, appId, appVersion);
View Full Code Here

    private PluginManager pluginManager;
    @Autowired
    private AuditTrailDao auditTrailDao;

    public void addAuditTrail(String clazz, String method, String message) {
        AuditTrail auditTrail = new AuditTrail();
        auditTrail.setUsername(workflowUserManager.getCurrentUsername());
        auditTrail.setClazz(clazz);
        auditTrail.setMethod(method);
        auditTrail.setMessage(message);
        auditTrail.setTimestamp(new Date());

        AppDefinition appDef = AppUtil.getCurrentAppDefinition();
        if (appDef != null) {
            auditTrail.setAppId(appDef.getId());
            auditTrail.setAppVersion(appDef.getVersion().toString());
        }

        auditTrailDao.addAuditTrail(auditTrail);
        executePlugin(auditTrail);
    }
View Full Code Here

    public void addAuditTrail(AuditTrail auditTrail) {
        super.save(ENTITY_NAME, auditTrail);
    }

    public AuditTrail getAuditTrailByUsername(String username) {
        AuditTrail auditTrail = new AuditTrail();
        auditTrail.setUsername(username);
        return (AuditTrail) super.findByExample(ENTITY_NAME, auditTrail);
    }
View Full Code Here

TOP

Related Classes of org.joget.apps.app.model.AuditTrail

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.