Search in sources :

Example 16 with Graph

use of com.centurylink.mdw.designer.display.Graph in project mdw-designer by CenturyLinkCloud.

the class DesignerProxy method forceUpdateProcess.

/**
 * Relies on classic designer page to update the processVO with the reloaded
 * data.
 */
public void forceUpdateProcess(WorkflowProcess processVersion, FlowchartPage flowchartPage, boolean validate, boolean lock) throws ValidationException, DataAccessException, RemoteException {
    CodeTimer timer = new CodeTimer("forceUpdateProcess()");
    Graph graph = flowchartPage.getProcess();
    graph.save_temp_vars();
    if (validate)
        new ProcessValidator(processVersion.getProcessVO()).validate(getNodeMetaInfo());
    if (!processVersion.getProject().checkRequiredVersion(5, 5))
        flowchartPage.setProcessVersions(flowchartPage.getProcess(), // not
        !processVersion.getProject().checkRequiredVersion(5, 2));
    // sure
    // why
    // this
    // was
    // ever
    // needed
    Graph reloaded = null;
    try {
        reloaded = flowchartPage.saveProcess(graph, mainFrame, PersistType.UPDATE, 0, lock);
    } catch (ValidationException ex) {
        if (ex.getMessage() != null && ex.getMessage().contains(ORA_02292))
            throw new ValidationException(INCOMPATIBLE_INSTANCES);
        else
            throw ex;
    }
    flowchartPage.setProcess(reloaded);
    processVersion.setProcessVO(reloaded.getProcessVO());
    cacheRefresh.fireRefresh(reloaded.getProcessVO().hasDynamicJavaActivity());
    timer.stopAndLog();
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) ValidationException(com.centurylink.mdw.designer.utils.ValidationException) CodeTimer(com.centurylink.mdw.plugin.CodeTimer) ProcessValidator(com.centurylink.mdw.designer.utils.ProcessValidator)

Example 17 with Graph

use of com.centurylink.mdw.designer.display.Graph in project mdw-designer by CenturyLinkCloud.

the class DesignerProxy method createNewProcess.

public void createNewProcess(final WorkflowProcess processVersion) {
    String progressMsg = "Creating '" + processVersion.getName() + "'";
    String errorMsg = "Create Process";
    designerRunner = new DesignerRunner(progressMsg, errorMsg, project) {

        public void perform() throws ValidationException, DataAccessException, RemoteException {
            if (dataAccess.getDesignerDataModel().getNodeMetaInfo().getStartActivity() == null)
                throw new ValidationException("Please import the MDW Baseline Package corresponding to your MDW framework version.");
            Graph process = new Graph(processVersion.getName(), ProcessVisibilityConstant.PUBLIC, dataAccess.getDesignerDataModel().getNodeMetaInfo(), getIconFactory());
            process.setDescription(processVersion.getDescription());
            process.getProcessVO().setInRuleSet(processVersion.isInRuleSet());
            if (project.isFilePersist())
                process.getProcessVO().setRawFile(new File(project.getAssetDir() + "/" + processVersion.getPackage().getName() + "/" + processVersion.getName() + ".proc"));
            if (!processVersion.isInDefaultPackage())
                process.getProcessVO().setPackageName(processVersion.getPackage().getName());
            final FlowchartPage flowchartPage = FlowchartPage.newPage(mainFrame);
            flowchartPage.setProcess(process);
            saveProcess(processVersion, flowchartPage, PersistType.CREATE, 0, false, false);
            toggleProcessLock(processVersion, true);
            if (processVersion.isInRuleSet())
                dataAccess.getAllRuleSets(false).add(processVersion.getProcessVO());
            // update the process tree
            if (!processVersion.isInDefaultPackage()) {
                processVersion.getPackage().addProcess(processVersion);
                savePackage(processVersion.getPackage());
            } else {
                processVersion.getProject().getDefaultPackage().addProcess(processVersion);
            }
            // add to the mainFrame process list
            dataAccess.getDesignerDataModel().addProcess(processVersion.getProcessVO());
        }
    };
    designerRunner.run();
}
Also used : ValidationException(com.centurylink.mdw.designer.utils.ValidationException) Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) RemoteException(java.rmi.RemoteException) IFile(org.eclipse.core.resources.IFile) File(java.io.File) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) FlowchartPage(com.centurylink.mdw.designer.pages.FlowchartPage)

Example 18 with Graph

use of com.centurylink.mdw.designer.display.Graph in project mdw-designer by CenturyLinkCloud.

the class DesignerPage method loadProcess.

/**
 * Loads a process for use by Designer.
 */
public Graph loadProcess(Long processId, String server) {
    Graph process = model.findProcessGraph(processId, server);
    if (process != null)
        return process;
    ProcessVO procdef = findProcessDefinition(processId, server);
    try {
        procdef = loadProcess(procdef);
        process = new Graph(procdef, model.getNodeMetaInfo(), frame.getIconFactory());
        model.addProcessGraph(process);
    } catch (Exception ex) {
        ex.printStackTrace();
    }
    return process;
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) ProcessVO(com.centurylink.mdw.model.value.process.ProcessVO) DataAccessException(com.centurylink.mdw.common.exception.DataAccessException) RemoteException(java.rmi.RemoteException) ValidationException(com.centurylink.mdw.designer.utils.ValidationException)

Example 19 with Graph

use of com.centurylink.mdw.designer.display.Graph in project mdw-designer by CenturyLinkCloud.

the class ExportHelper method exportProcesses.

/**
 * Export multiple processes
 *
 * @param filename
 *            the file name (including path) where the document will be
 *            generated
 * @param type
 *            can be pdf, rtf and html
 * @param flowchart
 *            the designer page (for using its canvas and report errors)
 * @param graphs
 *            the list of processes to be printed.
 * @param options
 *            options for printing, from the print dialog.
 */
public void exportProcesses(String filename, String type, FlowchartPage flowchart, List<Graph> graphs) throws Exception {
    initialize(false);
    options.add(SECTION_NUMBER);
    // step 1: creation of a document-object
    Document document = new Document();
    try {
        // step 2: create PDF or RTF writer
        DocWriter writer;
        if (type.equals(RTF)) {
            writer = RtfWriter2.getInstance(document, new FileOutputStream(filename));
        } else if (type.equals(PDF)) {
            writer = PdfWriter.getInstance(document, new FileOutputStream(filename));
        } else {
            StringBuilder sb = printPrologHtml("Processes");
            Graph process;
            for (int i = 0; i < graphs.size(); i++) {
                process = graphs.get(i);
                flowchart.setProcess(process);
                this.printProcessHtml(sb, flowchart.canvas, i + 1, process, filename);
            }
            printEpilogHtml(sb, filename);
            return;
        }
        // step 3: we open the document
        document.open();
        // step 4: we add contents to the document
        document.setPageSize(PageSize.LETTER);
        Graph process;
        Chapter chapter;
        Rectangle pageSize = document.getPageSize();
        for (int i = 0; i < graphs.size(); i++) {
            process = graphs.get(i);
            process.setNodeIdType(nodeIdType);
            flowchart.setProcess(process);
            chapter = printOneProcessPdf(writer, flowchart.canvas, type, i + 1, process, filename, pageSize);
            document.add(chapter);
        }
    } finally {
        // step 5: we close the document
        document.close();
    }
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) FileOutputStream(java.io.FileOutputStream) Chapter(com.lowagie.text.Chapter) Rectangle(com.lowagie.text.Rectangle) HTMLDocument(javax.swing.text.html.HTMLDocument) Document(com.lowagie.text.Document) DocWriter(com.lowagie.text.DocWriter)

Example 20 with Graph

use of com.centurylink.mdw.designer.display.Graph in project mdw-designer by CenturyLinkCloud.

the class ExportHelper method printGraphPdf.

private void printGraphPdf(GraphCommon graph, Chapter chapter) throws Exception {
    Section section;
    String tmp;
    if (graph instanceof SubGraph) {
        SubGraph subgraph = (SubGraph) graph;
        String id = subgraph.getDisplayId(nodeIdType);
        if (id == null || id.length() == 0)
            id = subgraph.getId().toString();
        tmp = "Subprocess " + id + ": \"" + subgraph.getName().replace('\n', ' ') + "\"";
    } else {
        tmp = "Process Description";
    }
    Paragraph sTitle = new Paragraph(tmp, sectionFont);
    sTitle.setSpacingBefore(10);
    section = chapter.addSection(sTitle, options.contains(SECTION_NUMBER) ? 2 : 0);
    String summary = (graph instanceof SubGraph) ? ((SubGraph) graph).getProcessVO().getProcessDescription() : ((Graph) graph).getProcessVO().getProcessDescription();
    if (summary != null && summary.length() > 0)
        printBoldParagraphsPdf(section, summary);
    if (options.contains(DOCUMENTATION)) {
        String detail = graph.getProcessVO().getAttribute(WorkAttributeConstant.DOCUMENTATION);
        if (detail != null && detail.length() > 0) {
            printHtmlParagraphsPdf(section, detail, options.contains(SECTION_NUMBER) ? 2 : 0);
        }
    }
    if (options.contains(ATTRIBUTES) && !graph.getProcessVO().getAttributes().isEmpty() && graph instanceof SubGraph) {
        printAttributesPdf(section, graph.getProcessVO().getAttributes(), options.contains(SECTION_NUMBER) ? 2 : 0);
    }
}
Also used : Graph(com.centurylink.mdw.designer.display.Graph) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Section(com.lowagie.text.Section) SubGraph(com.centurylink.mdw.designer.display.SubGraph) Paragraph(com.lowagie.text.Paragraph)

Aggregations

Graph (com.centurylink.mdw.designer.display.Graph)31 SubGraph (com.centurylink.mdw.designer.display.SubGraph)31 Link (com.centurylink.mdw.designer.display.Link)9 Node (com.centurylink.mdw.designer.display.Node)9 ValidationException (com.centurylink.mdw.designer.utils.ValidationException)7 DataAccessException (com.centurylink.mdw.common.exception.DataAccessException)6 TextNote (com.centurylink.mdw.designer.display.TextNote)5 ProcessVO (com.centurylink.mdw.model.value.process.ProcessVO)5 RemoteException (java.rmi.RemoteException)5 ProcessInstanceVO (com.centurylink.mdw.model.value.process.ProcessInstanceVO)4 CodeTimer (com.centurylink.mdw.plugin.CodeTimer)4 FlowchartPage (com.centurylink.mdw.designer.pages.FlowchartPage)3 GraphFragment (com.centurylink.mdw.designer.display.GraphFragment)2 ProcessValidator (com.centurylink.mdw.designer.utils.ProcessValidator)2 ProcessWorker (com.centurylink.mdw.designer.utils.ProcessWorker)2 ActivityInstanceVO (com.centurylink.mdw.model.value.work.ActivityInstanceVO)2 WorkTransitionInstanceVO (com.centurylink.mdw.model.value.work.WorkTransitionInstanceVO)2 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)2 Graphics2D (java.awt.Graphics2D)2 ArrayList (java.util.ArrayList)2