/* Copyright 1999-2008 Acelet.org. All rights reserved. GPL v2 license */
/** @author Wei Jiang */
package com.acelet.s.workflow;
import java.io.*;
import com.jgraph.editor.JGraphEditorModel;
import com.jgraph.pad.JGraphpadFile;
public class WorkflowFile extends JGraphpadFile {
public String version = "1.0";
public String info = "";
public WorkflowFile() {
super();
}
public WorkflowFile(String filename) {
super(filename);
}
public String getInfo() {
return info;
}
public String getVersion() {
return version;
}
public void putInfo(String info) {
this.info = info;
}
public void putVersion(String version) {
this.version = version;
}
WorkflowFile readFile(String fileName) throws Exception {
FileInputStream inputStream = null;
try {
inputStream = new FileInputStream(fileName);
return (WorkflowFile) WorkflowPanel.graphEditor.getModel().readObject(inputStream);
} finally {
if (inputStream != null)
inputStream.close();
}
}
void writeFile(String fileName) throws Exception {
JGraphEditorModel model = WorkflowPanel.graphEditor.getModel();
OutputStream out = null;
try {
out = model.getOutputStream(fileName);
model.writeObject(this, out);
out.flush();
} finally {
if (out != null)
out.close();
}
}
}