Package org.jbpm.ui.common.model

Examples of org.jbpm.ui.common.model.ProcessDefinition


        setTitle(Messages.getString("ExportParWizardPage.page.title"));
        setDescription(Messages.getString("ExportParWizardPage.page.description"));

        this.definitionNameFileMap = new TreeMap<String, IFile>();
        for (IFile file : ProcessCache.getAllProcessDefinitionsMap().keySet()) {
            ProcessDefinition definition = ProcessCache.getProcessDefinition(file);
            if (definition != null) {
                definitionNameFileMap.put(getKey(file.getProject(), definition), file);
            }
        }
    }
View Full Code Here


        IFile adjacentFile = ProjectFinder.getCurrentFile();
        if (adjacentFile != null && adjacentFile.getParent().exists()) {
            IFile definitionFile = ProjectFinder.getProcessDefinitionFile((IFolder) adjacentFile.getParent());
            if (definitionFile != null && definitionFile.exists()) {
                ProcessDefinition currentDefinition = ProcessCache.getProcessDefinition(definitionFile);
                if (currentDefinition != null) {
                    definitionListViewer.setSelection(new StructuredSelection(getKey(definitionFile.getProject(), currentDefinition)));
                }
            }
        }
View Full Code Here

        IFile definitionFile = definitionNameFileMap.get(selectedDefinitionName);
        try {
            ProjectFinder.refreshProcessFolder(definitionFile);
        } catch (CoreException e1) {
        }
        ProcessDefinition definition = ProcessCache.getProcessDefinition(definitionFile);
        try {
            int validationResult = definition.validateDefinition(definitionFile);
            if (validationResult != 0) {
                DesignerPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ErrorLogView.ID);
                if (validationResult == 2) {
                    setErrorMessage(Messages.getString("ExportParWizardPage.page.errorsExist"));
                    return false;
                }
            }
            definition.getContentProvider().validateProcessDefinitionXML(definitionFile);

            // Add orgfunctions & mappings .xml
            File orgFile = MappingContentProvider.INSTANCE.getOrgFile();
            if (orgFile.exists()) {
                InputStream is = new FileInputStream(orgFile);
View Full Code Here

                        monitor.worked(1);
                        IFolder targetFolder = page.getTargetProcessFolder();
                        page.getSourceProcessFolder().copy(targetFolder.getFullPath(), true, monitor);
                        IFile definitionFile = ProjectFinder.getProcessDefinitionFile(targetFolder);
                        monitor.worked(1);
                        ProcessDefinition definition = ProcessCache.getProcessDefinition(definitionFile);
                        definition.setName(page.getProcessName());
                        definition.setNotation(page.getNotation());
                        WorkspaceOperations.saveProcessDefinition(definitionFile, definition);
                        monitor.done();
                    } catch (Exception e) {
                        throw new InvocationTargetException(e);
                    }
View Full Code Here

    public static ProcessDefinition updateToNextVersion(ProcessDefinition oldDefinition, IFile file) throws Exception {
        List<String> versions = getAllJpdlVersions();
        int versionIndex = versions.indexOf(oldDefinition.getJpdlVersion());
        String newVersion = versions.get(versionIndex + 1);
        JpdlModelConverter modelConverter = getModelConverter(newVersion);
        ProcessDefinition newDefinition = modelConverter.convert(oldDefinition, newVersion);
        newDefinition.setJpdlVersion(newVersion);
        Document document = newDefinition.getContentProvider().getInitialProcessDefinitionDocument(newDefinition.getName());
        newDefinition.getContentProvider().saveToXML(newDefinition, document);
        byte[] bytes = XmlUtil.writeXml(document);
        file.setContents(new ByteArrayInputStream(bytes), true, true, null);
        return newDefinition;
    }
View Full Code Here

    public static ProcessDefinition parseProcessDefinition(IFile file) throws Exception {
        // Workaround to resource out of sync
        ProjectFinder.refreshProcessFolder(file);
        Document document = XmlUtil.parseDocument(file.getContents());
        String jpdlVersion = identifyJpdlVersionByContent(document);
        ProcessDefinition definition = getContentProvider(jpdlVersion).parseXML(document);
        definition.setJpdlVersion(jpdlVersion);
        return definition;
    }
View Full Code Here

        CACHE_BY_NAME.put(definition.getName(), definition);
    }

    public static void newProcessDefinitionWasCreated(IFile file) {
        try {
            ProcessDefinition definition = JpdlVersionRegistry.parseProcessDefinition(file);
            cacheProcessDefinition(file, definition);
        } catch (Exception e) {
            DesignerLogger.logError("Parsing process definition failed: " + file.toString(), e);
        }
    }
View Full Code Here

        }
    }

    public static void processDefinitionWasDeleted(IFile file) {
        try {
            ProcessDefinition definition = CACHE_BY_FILE.remove(file);
            if (definition != null) {
                CACHE_BY_NAME.remove(definition.getName());
            }
        } catch (Exception e) {
            DesignerLogger.logError("Parsing process definition failed: " + file.toString(), e);
        }
    }
View Full Code Here

    public static Map<IFile, ProcessDefinition> getAllProcessDefinitionsMap() {
        return new HashMap<IFile, ProcessDefinition>(CACHE_BY_FILE);
    }

    public static void invalidateProcessDefinition(IFile file) {
        ProcessDefinition definition = CACHE_BY_FILE.remove(file);
        if (definition != null) {
            CACHE_BY_NAME.remove(definition.getName());
            getProcessDefinition(file);
        }
    }
View Full Code Here

    }

    public static ProcessDefinition getProcessDefinition(IFile file) {
        if (!CACHE_BY_FILE.containsKey(file)) {
            try {
                ProcessDefinition definition = JpdlVersionRegistry.parseProcessDefinition(file);
                cacheProcessDefinition(file, definition);
            } catch (Exception e) {
              throw new RuntimeException("Parsing process definition failed: " + file.toString(), e);
            }
        }
View Full Code Here

TOP

Related Classes of org.jbpm.ui.common.model.ProcessDefinition

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.