Package org.joget.apps.app.model

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


   
    @Override
    public boolean executeTool(WorkflowAssignment assignment) {
        ApplicationContext appContext = AppUtil.getApplicationContext();
        PluginManager pluginManager = (PluginManager) appContext.getBean("pluginManager");
        AppDefinition appDef = null;
       
        if (assignment != null) {
            WorkflowManager workflowManager = (WorkflowManager) appContext.getBean("workflowManager");
            PackageDefinitionDao packageDefinitionDao = (PackageDefinitionDao) appContext.getBean("packageDefinitionDao");
           
            String processDefId = assignment.getProcessDefId();
            WorkflowProcess process = workflowManager.getProcess(processDefId);
            if (process != null) {
                String packageId = process.getPackageId();
                Long packageVersion = Long.parseLong(process.getVersion());
                PackageDefinition packageDef = packageDefinitionDao.loadPackageDefinition(packageId, packageVersion);
                if (packageDef != null) {
                    appDef = packageDef.getAppDefinition();
                }
            }
        }

        if (appDef != null && appDef.getPackageDefinition() != null) {
            PackageDefinition packageDef = appDef.getPackageDefinition();
            String processDefId = WorkflowUtil.getProcessDefIdWithoutVersion(assignment.getProcessDefId());
            PackageActivityPlugin activityPluginMeta = packageDef.getPackageActivityPlugin(processDefId, assignment.getActivityDefId());

            Plugin plugin = null;
View Full Code Here


           
            if (packageDef != null) {
                PackageParticipant participant = packageDef.getPackageParticipant(procDefId, participantId);

                //Set app definition   
                AppDefinition appDef = packageDef.getAppDefinition();
                AppUtil.setCurrentAppDefinition(appDef);

                //if process start white list and app is not publish
                if (WorkflowUtil.PROCESS_START_WHITE_LIST.equals(participantId) && !appDef.isPublished()) {
                    resultList = getParticipantsByAdminUser();
                } else if (WorkflowUtil.PROCESS_START_WHITE_LIST.equals(participantId) && appDef.isPublished() && participant == null) {
                    resultList = getParticipantsByCurrentUser();
                } else if (participant != null) {
                    if (PackageParticipant.TYPE_USER.equals(participant.getType())) {
                        resultList = getParticipantsByUsers(participant);
                    } else if (PackageParticipant.TYPE_GROUP.equals(participant.getType())) {
View Full Code Here

        WorkflowManager workflowManager = (WorkflowManager) appContext.getBean("workflowManager");
        PluginManager pluginManager = (PluginManager) appContext.getBean("pluginManager");
        String properties = participant.getPluginProperties();
        String participantId = participant.getParticipantId();
        try {
            AppDefinition appDef = AppUtil.getCurrentAppDefinition();
            ParticipantPlugin plugin = (ParticipantPlugin) pluginManager.getPlugin(participant.getValue());
            Map propertyMap = AppPluginUtil.getDefaultProperties((Plugin)plugin, properties, appDef);
            propertyMap.put("pluginManager", pluginManager);
            WorkflowActivity activity = workflowManager.getActivityById(activityId);
            propertyMap.put("workflowActivity", activity);
View Full Code Here

        Collection<Plugin> pluginList = pluginManager.list(DeadlinePlugin.class);
        for (Plugin plugin : pluginList) {
            DeadlinePlugin p = (DeadlinePlugin) plugin;
            try {
                AppDefinition appDef = null;

                //get package definition by process id
                WorkflowProcess process = workflowManager.getRunningProcessById(processId);

                if (process != null) {
View Full Code Here

    public String getPublishedPackageVersion(String packageId) {
        //appID same with packageId
        AppService appService = (AppService) AppUtil.getApplicationContext().getBean("appService");
        Long version = appService.getPublishedVersion(packageId);
       
        AppDefinition appDef = appService.getAppDefinition(packageId, version.toString());
        PackageDefinition packageDef = appDef.getPackageDefinition();
       
        if (packageDef != null && packageDef.getVersion() != null) {
            return packageDef.getVersion().toString();
        }
        return null;
View Full Code Here

    public String getDescription() {
        return "";
    }

    public String getPropertyOptions() {
        AppDefinition appDef = AppUtil.getCurrentAppDefinition();
        String appId = appDef.getId();
        String appVersion = appDef.getVersion().toString();
        Object[] arguments = new Object[]{appId, appVersion};
        String json = AppUtil.readPluginResource(getClass().getName(), "/properties/userview/dataListMenu.json", arguments, true, "message/userview/dataListMenu");
        return json;
    }
View Full Code Here

        ApplicationContext ac = AppUtil.getApplicationContext();
        AppService appService = (AppService) ac.getBean("appService");
        DataListService dataListService = (DataListService) ac.getBean("dataListService");
        DatalistDefinitionDao datalistDefinitionDao = (DatalistDefinitionDao) ac.getBean("datalistDefinitionDao");
        String id = getPropertyString("datalistId");
        AppDefinition appDef = appService.getAppDefinition(getRequestParameterString("appId"), getRequestParameterString("appVersion"));
        DatalistDefinition datalistDefinition = datalistDefinitionDao.loadById(id, appDef);
        DataList dataList = dataListService.fromJson(datalistDefinition.getJson());
       
        if (getPropertyString(Userview.USERVIEW_KEY_NAME) != null && getPropertyString(Userview.USERVIEW_KEY_NAME).trim().length() > 0) {
            dataList.addBinderProperty(Userview.USERVIEW_KEY_NAME, getPropertyString(Userview.USERVIEW_KEY_NAME));
View Full Code Here

        if (formData != null) {
            try {
                value = FormUtil.getElementPropertyValue(this, formData);
                if (!(value != null && value.trim().length() > 0)) {
                    String envVariable = getPropertyString("envVariable");
                    AppDefinition appDef = AppUtil.getCurrentAppDefinition();
                    ApplicationContext appContext = AppUtil.getApplicationContext();
                    EnvironmentVariableDao environmentVariableDao = (EnvironmentVariableDao) appContext.getBean("environmentVariableDao");
                    EnvironmentVariable env = environmentVariableDao.loadById(envVariable, appDef);

                    int count = 0;

                    if (env != null && env.getValue() != null && env.getValue().trim().length() > 0) {
                        count = Integer.parseInt(env.getValue());
                    }
                    count += 1;

                    String format = getPropertyString("format");
                    value = format;
                    Matcher m = Pattern.compile("(\\?+)").matcher(format);
                    if (m.find()) {
                        String pattern = m.group(1);
                        String formater = pattern.replaceAll("\\?", "0");
                        pattern = pattern.replaceAll("\\?", "\\\\?");

                        DecimalFormat myFormatter = new DecimalFormat(formater);
                        String runningNumber = myFormatter.format(count);
                        value = value.replaceAll(pattern, runningNumber);
                    }

                    if (env == null) {
                        env = new EnvironmentVariable();
                        env.setAppDefinition(appDef);
                        env.setAppId(appDef.getId());
                        env.setAppVersion(appDef.getVersion());
                        env.setId(envVariable);
                        env.setRemarks("Used for plugin: " + getName());
                        env.setValue(Integer.toString(count));
                        environmentVariableDao.add(env);
                    } else {
View Full Code Here

public class EnvironmentVariableHashVariable extends DefaultHashVariablePlugin {

    @Override
    public String processHashVariable(String variableKey) {
        AppDefinition appDef = (AppDefinition) getProperty("appDefinition");
        if (appDef != null) {
            ApplicationContext appContext = AppUtil.getApplicationContext();
            EnvironmentVariableDao environmentVariableDao = (EnvironmentVariableDao) appContext.getBean("environmentVariableDao");
            EnvironmentVariable env = environmentVariableDao.loadById(variableKey, appDef);
            if (env != null) {
View Full Code Here

public class AppMessageHashVariable extends DefaultHashVariablePlugin {

    @Override
    public String processHashVariable(String variableKey) {
        AppDefinition appDef = (AppDefinition) getProperty("appDefinition");
        if (appDef != null) {
            ApplicationContext appContext = AppUtil.getApplicationContext();
            MessageDao messageDao = (MessageDao) appContext.getBean("messageDao");
            Message message = messageDao.loadByMessageKey(variableKey, AppUtil.getAppLocale(), appDef);
            if (message != null) {
View Full Code Here

TOP

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

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.