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();
}
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();
}
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;
}
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();
}
}
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);
}
}
Aggregations